Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Error when use context caching with gemini-1.5-flash-001

I am getting the following error when using context caching following vertextai's tutorials:

 InternalServerError: 500 Model gemini-1.5-flash-001 does not support cached content.

Please see the code snippets enclosed.

Name: google-cloud-aiplatform
Version: 1.57.0

SCR-20240702-juan.pngimage.png

Appreciate any help.

1 2 1,013
2 REPLIES 2

Yeah same issue here, seems to be a totally random restriction they've placed on the Vertex AI version of gemini-1.5-flash but not the Google AI Studio version. See the difference in listed model support between 

https://cloud.google.com/vertex-ai/generative-ai/docs/context-cache/context-cache-overview#supported... and https://ai.google.dev/gemini-api/docs/caching?lang=python. What a pain, I just migrated a whole lot of my stuff over to Vertex AI because I thought it was the better supported version for larger scale. Guess not.

Thanks! I noticed as well. What a drag... I though vertax AI is supposed to be for enterprise use, thus had less restrictions. Google PM strikes again...