[X] I added a very descriptive title to this issue.
[X] I searched the LangChain documentation with the integrated search.
[X] I used the GitHub search to find a similar question and didn't find it.
[X] I am sure that this is a bug in LangChain rather than my code.
[X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
from langchain.globals import set_llm_cache
from langchain_google_vertexai import ChatVertexAI
from langchain_community.cache import SQLiteCache
import sqlite3
!rm llm_cache.db
set_llm_cache(SQLiteCache("./llm_cache.db"))
llm = ChatVertexAI(
model_name="gemini-1.0-pro",
)
llm.invoke("This is a drill")
llm.invoke("This is a drill")
con = sqlite3.connect("llm_cache.db")
cur = con.cursor()
cur.execute("SELECT * FROM full_llm_cache")
rows = cur.fetchall()
print(len(rows))
Error Message and Stack Trace (if applicable)
No response
Description
When invoking the cache for Gemini models, it does not cache as expected. If we run the aforementoned example (provided you have a google account with VertexAI access), the expected number of rows is 1, but it returns 2. It turns out that the "model string" is being modified internally. Check the below output when running
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
No response
Description
When invoking the cache for Gemini models, it does not cache as expected. If we run the aforementoned example (provided you have a google account with VertexAI access), the expected number of rows is 1, but it returns 2. It turns out that the "model string" is being modified internally. Check the below output when running
System Info
platform: macOs Sonoma 14.5 Apple M2 python version: 3.11