-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
base: main
Are you sure you want to change the base?
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 68.49% 68.68% +0.19%
==========================================
Files 156 157 +1
Lines 10061 10137 +76
==========================================
+ Hits 6891 6963 +72
- Misses 3170 3174 +4
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
86ae223
to
652333d
Compare
652333d
to
7addcf4
Compare
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Caching Wrapper\n", |
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.
This section should come after the streaming and Azure Open AI subsections.
I think for the example we can show how to use diskcache
as that's what most people will be using.
To add diskcache for building the doc we will need to include it in the doc dependencies in the core's pyproject.toml
file.
|
||
First initialize (for eg) a Redis store: | ||
|
||
```python |
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.
Use:
.. code-bloc:: python
For the Python code. We will need to add redis
and diskcache
to the doc dependencies to build the doc, as we type check all the code blocks included in the API docs.
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