Skip to content

fix(types): accept a sequence of suggested prompts in assistant context - #1382

Merged
zimeg merged 1 commit into
ai-appsfrom
zimeg-fix-set-suggested-prompts-sequence
Oct 3, 2025
Merged

fix(types): accept a sequence of suggested prompts in assistant context#1382
zimeg merged 1 commit into
ai-appsfrom
zimeg-fix-set-suggested-prompts-sequence

Conversation

@zimeg

@zimegzimeg commented Oct 3, 2025

Copy link
Copy Markdown
Member

Summary

This PR accepts a sequence of suggested prompts in the assistant context. Fixes an issue where mypy complained about invalid types:

listeners/assistant/assistant.py:50: error: Argument "prompts" to "__call__" of "SetSuggestedPrompts" has incompatible type "list[dict[str, str]]"; expected "list[str | dict[str, str]]" [arg-type]
listeners/assistant/assistant.py:50: note: "list" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
listeners/assistant/assistant.py:50: note: Consider using "Sequence" instead, which is covariant

https://github.com/slack-samples/bolt-python-assistant-template/blob/ec9fb79117fb52bf3ccf0238d242af11ee50807f/listeners/assistant/assistant.py#L51

Testing

This error should vanish when using this build without changing app functionalities!

$ mypy --python-executable=.venv/bin/python app.py

Category

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

@zimegzimeg self-assigned this Oct 3, 2025
@zimegzimeg added bug Something isn't working area:async area:sync tests labels Oct 3, 2025
@zimegzimeg changed the title fix: accept a sequence of suggested prompts in assistant contextfix(types): accept a sequence of suggested prompts in assistant contextOct 3, 2025
@codecov

codecovBot commented Oct 3, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (ai-apps@23a4731). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@ Coverage Diff @@## ai-apps #1382 +/- ##
==========================================
Coverage ? 91.03% ==========================================
Files ? 222 Lines ? 7514 Branches ? 0 ==========================================
Hits ? 6840 Misses ? 674 Partials ? 0 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@WilliamBergaminWilliamBergamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 💯

Praise the testing 🚀

@mwbrooksmwbrooks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Really good catch @zimeg! Thanks for going above & beyond with fixing this issue after finding it 🙇🏻

🧪 :chef-kiss: on the tests!

@zimeg

zimeg commented Oct 3, 2025

Copy link
Copy Markdown
MemberAuthor

@WilliamBergamin@mwbrooks Thanks! I'm finding python to have pleasant typings with these checks optional. Hoping to bring similar changes in the future too! 👾

@zimeg
zimeg merged commit aaabe50 into ai-appsOct 3, 2025
14 checks passed
@zimeg
zimeg deleted the zimeg-fix-set-suggested-prompts-sequence branch October 3, 2025 17:26
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@zimeg@mwbrooks@WilliamBergamin