Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't cache just the system prompt TypeError: value must not be empty #4706

Open
DreamGenX opened this issue Nov 25, 2024 · 0 comments
Open
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.

Comments

@DreamGenX
Copy link

Caching just the system prompt is not supported. This would be extremely useful.

import vertexai
import datetime

from vertexai.generative_models import Part
from vertexai.preview import caching

vertexai.init(project=PROJECT_ID, location="us-central1")

system_instruction = """
You are an expert researcher. You always stick to the facts in the sources provided, and never make up new facts.
Now look at these research papers, and answer the following questions.
"""

cached_content = caching.CachedContent.create(
    model_name="gemini-1.5-pro-002",
    system_instruction=system_instruction * 2000,
    # contents=[],
    ttl=datetime.timedelta(minutes=1),
    display_name="example-cache",
)

This results in:

TypeError: value must not be empty

Version info:

Name: google-cloud-aiplatform
Version: 1.71.1
Summary: Vertex AI API client library
Home-page: https://github.com/googleapis/python-aiplatform
Author: Google LLC
Author-email: [email protected]
License: Apache 2.0
Location: xxx
Requires: docstring-parser, google-api-core, google-auth, google-cloud-bigquery, google-cloud-resource-manager, google-cloud-storage, packaging, proto-plus, protobuf, pydantic, shapely
Required-by: vertexai
@product-auto-label product-auto-label bot added the api: vertex-ai Issues related to the googleapis/python-aiplatform API. label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.
Projects
None yet
Development

No branches or pull requests

1 participant