Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

srjoglekar246
Copy link
Contributor

@srjoglekar246 srjoglekar246 commented Jan 7, 2025

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

@srjoglekar246 srjoglekar246 requested review from ekzhu and Copilot January 7, 2025 18:48

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
@srjoglekar246
Copy link
Contributor Author

@ekzhu do we need any documentation changes? I suppose API Reference gets updated automatically?

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 96.29630% with 3 lines in your changes missing coverage. Please review.

Project coverage is 68.58%. Comparing base (a427b38) to head (652333d).

Files with missing lines Patch % Lines
...ages/autogen-core/src/autogen_core/_cache_store.py 66.66% 2 Missing ⚠️
...ges/autogen-core/src/autogen_core/models/_cache.py 98.38% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4924       +/-   ##
===========================================
+ Coverage   55.71%   68.58%   +12.87%     
===========================================
  Files          68      158       +90     
  Lines        5781    10152     +4371     
===========================================
+ Hits         3221     6963     +3742     
- Misses       2560     3189      +629     
Flag Coverage Δ
unittests 68.58% <96.29%> (+12.87%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Collaborator

@ekzhu ekzhu left a comment

Choose a reason for hiding this comment

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

@srjoglekar246
Copy link
Contributor Author

@ekzhu added docs as you mentioned :-)

@srjoglekar246 srjoglekar246 requested a review from ekzhu January 8, 2025 20:34
Copy link
Member

@jackgerrits jackgerrits left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ChatCompletionClient to support request caching
3 participants