-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add ChatCompletionCache along with AbstractStore for caching completions #4924
Conversation
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.
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Files not reviewed (1)
- python/packages/autogen-core/src/autogen_core/store/abstract_store_base.py: Evaluated as low risk
@ekzhu do we need any documentation changes? I suppose API Reference gets updated automatically? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4924 +/- ##
==========================================
- Coverage 72.92% 69.69% -3.24%
==========================================
Files 115 168 +53
Lines 6785 10605 +3820
==========================================
+ Hits 4948 7391 +2443
- Misses 1837 3214 +1377
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
python/packages/autogen-core/src/autogen_core/store/abstract_store_base.py
Outdated
Show resolved
Hide resolved
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.
Aside from API documentation. We can discuss the cache in the following places:
f6f398b
to
86ae223
Compare
@ekzhu added docs as you mentioned :-) |
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.
I think we should spend some more time to see if the interface can be improved. Especially if this is going into core
652333d
to
7addcf4
Compare
python/packages/autogen-core/docs/src/user-guide/core-user-guide/framework/model-clients.ipynb
Outdated
Show resolved
Hide resolved
97e8d66
to
3556990
Compare
@jackgerrits @ekzhu I am not sure if a simple protocol for duc-typing will work in all cases, unless we (or the user) implements a a wrapper around (say) redis. For eg with the latest change I get this error:
|
@jackgerrits could this be resolved by making the input types more flexible? Also do we need the For now we may not be able to get 100% type match as we are approximate duck typing. It is not going to pass the type check for all classes. We can ignore this typing issue for now -- add "type: ignore" to the example line and let's get this PR in. Fix this in a follow up work to add redis wrapper. |
In that case the current impl should just work. Will let @jackgerrits chime in. Otherwise I can also add diskcache & redis builtin implementations. |
Sorry I haven't had time to look at this. Would like to get the patch release out first then we can merge as eric said. I'd love if we can get the types to behave nicely but I understand its a bit tricky when interfacing with external libs. I do think that using a thin redis wrapper is the best thing to do here as it gives us some flexibility about dealing with issues |
In that case @ekzhu should we merge this, and I can send a followup for the redis wrapper? |
As jack said let's wait until the patch fix for user input is released on Monday. Then we'll merge this. |
python/packages/autogen-agentchat/tests/test_magentic_one_group_chat.py
Outdated
Show resolved
Hide resolved
python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/tutorial/models.ipynb
Outdated
Show resolved
Hide resolved
We can merge this for 0.4.2 once the doc fixes are completed. |
557b2f1
to
ffc14ef
Compare
@ekzhu @jackgerrits PTAL. I added specific implementations of |
ffc14ef
to
eb343cd
Compare
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
66b04f2
to
5850e18
Compare
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.
The casts should be removable right?
92af6f6
to
89c73fe
Compare
Jack has approved per our discussion
Why are these changes needed?
Add a caching wrapper to ChatCompletionClient, that can use any store with get/set methods for storage.
Related issue number
Closes #4752
Checks