Open thiswillbeyourgithub opened 2 months ago
Re-opened after reading a bit more carefully. @thiswillbeyourgithub if you're sharing a minimal example in the future, it's much better to share the example itself, and then any utility code to identify more cases. the utility code uses a bunch of functionality (e.g., exec
) -- that made this look like spam on a first read
I'm writing a minimal example right now
Hi @thiswillbeyourgithub, thanks!
I confirmed locally already, so we're all set :)
from langchain_anthropic import ChatAnthropic
from langchain_core.caches import InMemoryCache
cache = InMemoryCache()
model = ChatAnthropic(cache=InMemoryCache(), model_name='hello')
model._get_llm_string()
Alright, sorry for the extensive reproduction but at first I showed this on ChatOpenAI then noticed that the issue was so extensive (affecting at least 7 chat models) and is not only related to cache but sometimes to other attributes as well for example for Anthropic as you saw.
So my original code is a bit awkward but allows to quickly see a lower bound of what attributes of which model is posing problem
Issue is here:
Likely affected by any other helper objects (e.g., client)
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
No response
Description
Being affected by this bug in my DocToolsLLM project I ended up, instead of ChatLiteLLM for all models, using directly ChatOpenAI if the model asked is by openai anyway.
The other day I noticed that my SQLiteCcache was getting systematically ignored only by ChatOpenAI and ended up figuring out the culprit :
_get_llm_string()
<langchain_community.cache.SQLiteCache object at SOME_ADRESS>
To help you fix this ASAP I coded an loop that checks over all chat models and tells you what instance is causing the issue.
System Info
python -m langchain_core.sys_info
System Information
Package Information
Packages not installed (Not Necessarily a Problem)
The following packages were not found: