Skip to content

Commit e7bebb6

Browse files
committed
feat(genai): Update caching to use v1 version
1 parent d406fb8 commit e7bebb6

5 files changed

Lines changed: 5 additions & 8 deletions

File tree

genai/content_cache/contentcache_create_with_txt_gcs_pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def create_content_cache() -> str:
1818
from google import genai
1919
from google.genai.types import Content, CreateCachedContentConfig, HttpOptions, Part
2020

21-
client = genai.Client(http_options=HttpOptions(api_version="v1beta1"))
21+
client = genai.Client(http_options=HttpOptions(api_version="v1"))
2222

2323
system_instruction = """
2424
You are an expert researcher. You always stick to the facts in the sources provided, and never make up new facts.

genai/content_cache/contentcache_delete.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
def delete_context_caches(cache_name: str) -> str:
1717
# [START googlegenaisdk_contentcache_delete]
1818
from google import genai
19-
from google.genai.types import HttpOptions
20-
21-
client = genai.Client(http_options=HttpOptions(api_version="v1beta1"))
2219

20+
client = genai.Client()
2321
# Delete content cache using name
2422
# E.g cache_name = 'projects/111111111111/locations/us-central1/cachedContents/1111111111111111111'
2523
client.caches.delete(name=cache_name)

genai/content_cache/contentcache_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def list_context_caches() -> str:
1818
from google import genai
1919
from google.genai.types import HttpOptions
2020

21-
client = genai.Client(http_options=HttpOptions(api_version="v1beta1"))
21+
client = genai.Client(http_options=HttpOptions(api_version="v1"))
2222

2323
content_cache_list = client.caches.list()
2424

genai/content_cache/contentcache_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def update_content_cache(cache_name: str) -> str:
2222
from google import genai
2323
from google.genai.types import HttpOptions, UpdateCachedContentConfig
2424

25-
client = genai.Client(http_options=HttpOptions(api_version="v1beta1"))
25+
client = genai.Client(http_options=HttpOptions(api_version="v1"))
2626

2727
# Get content cache by name
2828
# cache_name = "projects/111111111111/locations/us-central1/cachedContents/1111111111111111111"

genai/content_cache/contentcache_use_with_txt.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ def generate_content(cache_name: str) -> str:
1818
from google import genai
1919
from google.genai.types import GenerateContentConfig, HttpOptions
2020

21-
client = genai.Client(http_options=HttpOptions(api_version="v1beta1"))
22-
21+
client = genai.Client(http_options=HttpOptions(api_version="v1"))
2322
# Use content cache to generate text response
2423
# E.g cache_name = 'projects/111111111111/locations/us-central1/cachedContents/1111111111111111111'
2524
response = client.models.generate_content(

0 commit comments

Comments
 (0)