#is a context cache created with gemini 1
1 messages · Page 1 of 1 (latest)
I didn't get any errors when passing in the cache but was curious if it was actually doing anything or if it was just being ignored
can you share the code? i assume the later model name is just being ignored
It was something like this
cache = client.caches.create(
model="gemini-flash-1.5-001",
config=types.CreateCachedContentConfig(
display_name='sherlock jr movie', # used to identify the cache
system_instruction=(
'You are an expert video analyzer, and your job is to answer '
'the user\'s query based on the video file you have access to.'
),
contents=[video_file],
ttl="300s",
)
)
# Construct a GenerativeModel which uses the created cache.
response = client.models.generate_content(
model = "gemini-flash-2.0-001",
contents= (
'Introduce different characters in the movie by describing '
'their personality, looks, and names. Also list the timestamps '
'they were introduced for the first time.'),
config=types.GenerateContentConfig(cached_content=cache.name)
)