-
Notifications
You must be signed in to change notification settings - Fork 16k
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 caching support to BaseChatModel #1644
Comments
Here is a suboptimal workaround that I came across: https://gist.github.com/BlackHC/49a37aaa6e9f3e31928596ce477897ad Note that it only works for |
Working on it - will be done today or tomorrow |
Amazing! Any news on this? @UmerHA |
Yes: I'm working on it (https://github.com/UmerHA/langchain/tree/1644-BaseChatModel-Caching), but it got delayed as I had to fix another PR first. |
# Add caching to BaseChatModel Fixes #1644 (Sidenote: While testing, I noticed we have multiple implementations of Fake LLMs, used for testing. I consolidated them.) ## Who can review? Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested: Models - @hwchase17 - @agola11 Twitter: [@UmerHAdil](https://twitter.com/@UmerHAdil) | Discord: RicChilligerDude#7589 --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
@UmerHA |
@gururise Hey, the lc team adapted the pr and now it doesn't, but it was a conscious decision from their pov. I assume the reasoning is that some caches only make sense with single-message inputs. GPTCache would be one of them. |
Could you please elaborate a bit on that? Why won't caching make sense for a chat model? |
Thanks for the merge! I have been looking into The reason seems to be, that it is not intended for use with ChatGenerations. There are ValueErrors in the code making statements along those lines. The limitation is fine, I will subclass and override. However I wanted to come back to the PR as the intended ValueError is never thrown. ChatGeneration is a subclass of Generation and therefor not hitting:
|
Looks like
BaseLLM
supports caching (vialangchain.llm_cache
), butBaseChatModel
does not.The text was updated successfully, but these errors were encountered: