langchain
langchain copied to clipboard
"from langchain.cache import SQLiteCache" not working after migrating from OpenAI to ChatOpenAI
Hey,
I'm trying to get the cache to work after swapping the following code:
from langchain.llm import OpenAI
to
from langchain.chat_models import ChatOpenAI
And using the new object in the code. But it's not working. I haven't modified my caching code:
from langchain.cache import SQLiteCache
langchain.llm_cache = SQLiteCache(database_path="../dbs/langchain.db")
I updated the code because I saw some warnings that OpenAI was deprecated.
Same issue here
Same here
Deprication note is because you use chat model like gpt-3.5-turbo with BaseModel instead of text model like text-davinci-003.
This issue is dulpicate of #1644, comments there have workaround of caching ChatModel
Hi, @GeiserX! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.
Based on my understanding, you were experiencing issues with the cache after migrating from OpenAI to ChatOpenAI in your code. Other users, including ChasakisD and tho-nguyen-amili, have reported experiencing the same issue. Erliz suggests that the issue is a result of using the wrong model type and provides a workaround in the comments of issue #1644.
Before we close this issue, we wanted to check if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.
Thank you for your understanding and contribution to the LangChain community!