-
Notifications
You must be signed in to change notification settings - Fork 850
feat: accept chunks as arguments to chat.{start,append,stop}Stream methods #1806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat-ai-apps-thinking-steps
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat-ai-apps-thinking-steps #1806 +/- ##
===============================================================
- Coverage 83.91% 83.90% -0.01%
===============================================================
Files 115 116 +1
Lines 13080 13168 +88
===============================================================
+ Hits 10976 11049 +73
- Misses 2104 2119 +15 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! except does the helper function not have to change the way it updates the buffer now that we can use chunks instead of markdown?
zimeg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👾 Leaving a few updates from the future! These are refactors made in a "stacked" branch. Please do let me know if rebasing is preferred though-
| class URLSource(JsonObject): | ||
| type = "url" | ||
|
|
||
| @property | ||
| def attributes(self) -> Set[str]: | ||
| return super().attributes.union( | ||
| { | ||
| "url", | ||
| "text", | ||
| "icon_url", | ||
| } | ||
| ) | ||
|
|
||
| def __init__( | ||
| self, | ||
| *, | ||
| url: str, | ||
| text: str, | ||
| icon_url: Optional[str] = None, | ||
| **others: Dict, | ||
| ): | ||
| show_unknown_key_warning(self, others) | ||
| self._url = url | ||
| self._text = text | ||
| self._icon_url = icon_url | ||
|
|
||
| def to_dict(self) -> Dict[str, Any]: | ||
| self.validate_json() | ||
| json: Dict[str, Union[str, Dict]] = { | ||
| "type": self.type, | ||
| "url": self._url, | ||
| "text": self._text, | ||
| } | ||
| if self._icon_url: | ||
| json["icon_url"] = self._icon_url | ||
| return json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧮 note: It's also changed from "URL" to "Url" to match similar elements!
| if sources is not None: | ||
| self.sources = [] | ||
| for src in sources: | ||
| if isinstance(src, Dict): | ||
| self.sources.append(src) | ||
| elif isinstance(src, URLSource): | ||
| self.sources.append(src.to_dict()) | ||
| else: | ||
| raise SlackObjectFormationError(f"Unsupported type for source in task update chunk: {type(src)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🪓 note: This is simplified alongside the changes of #1819 as well!
Summary
This PR introduces the
chunksargument to the following methods:Testing
The following code snippet might be interesting to experiment with:
Category
/docs(Documents)tests/integration_tests(Automated tests for this library)Notes
Requirements
python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.shafter making the changes.