googleapis / python-aiplatform

A Python SDK for Vertex AI, a fully managed, end-to-end platform for data science and machine learning.
Apache License 2.0
579 stars 321 forks source link

Unable to use Gemini stable model for caching in vertexai preview #4009

Open aminecs opened 6 days ago

aminecs commented 6 days ago

Hi team,

I am trying to use context caching in Gemini through vertexai, however, when trying to create the content to cache, it fails as it can't find the stable model.

I can see that context caching has been moved back to public preview (#3935) so it should be accessible.

Environment details

Steps to reproduce

from vertexai.preview import caching
cache = caching.CachedContent.create(
    model_name='publishers/google/models/gemini-1.5-pro-001',
    system_instruction=(
        'random'
    ),
    contents=[prompt],
    ttl=datetime.timedelta(minutes=5),
)

Stack trace

400 Model ****/*****/locations/europe-west1/publishers/google/models/gemini-1.5-pro-001 is not supported for caching. Please use the stable models that are enabled for caching.
ZhenyiQ commented 5 days ago

Thanks @aminecs for reporting this! I was able to reproduce it and I'm contacting the service team.

Mojashi commented 4 days ago

The situation seems different between the two models and regions.

aminecs commented 3 days ago

@Mojashi Unfortunately I am unable to use other regions. Due to specific requirements, I need to keep the requests within Europe.

Please keep me posted if you have updates @ZhenyiQ