Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def generate_content(output_uri: str) -> str:
print(f"Job name: {job.name}")
print(f"Job state: {job.state}")
# Example response:
# Job name: projects/%PROJECT_ID%/locations/us-central1/batchPredictionJobs/9876453210000000000
# Job name: projects/.../locations/.../batchPredictionJobs/9876453210000000000
# Job state: JOB_STATE_PENDING

# See the documentation: https://googleapis.github.io/python-genai/genai.html#genai.types.BatchJob
Expand Down
2 changes: 1 addition & 1 deletion genai/batch_prediction/batchpredict_with_bq.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def generate_content(output_uri: str) -> str:
print(f"Job name: {job.name}")
print(f"Job state: {job.state}")
# Example response:
# Job name: projects/%PROJECT_ID%/locations/us-central1/batchPredictionJobs/9876453210000000000
# Job name: projects/.../locations/.../batchPredictionJobs/9876453210000000000
# Job state: JOB_STATE_PENDING

# See the documentation: https://googleapis.github.io/python-genai/genai.html#genai.types.BatchJob
Expand Down
2 changes: 1 addition & 1 deletion genai/batch_prediction/batchpredict_with_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def generate_content(output_uri: str) -> str:
print(f"Job name: {job.name}")
print(f"Job state: {job.state}")
# Example response:
# Job name: projects/%PROJECT_ID%/locations/us-central1/batchPredictionJobs/9876453210000000000
# Job name: projects/.../locations/.../batchPredictionJobs/9876453210000000000
# Job state: JOB_STATE_PENDING

# See the documentation: https://googleapis.github.io/python-genai/genai.html#genai.types.BatchJob
Expand Down
2 changes: 1 addition & 1 deletion genai/batch_prediction/get_batch_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_batch_job(batch_job_name: str) -> types.BatchJob:
client = genai.Client(http_options=HttpOptions(api_version="v1"))

# Get the batch job
# Eg. batch_job_name = "projects/123456789012/locations/us-central1/batchPredictionJobs/1234567890123456789"
# Eg. batch_job_name = "projects/123456789012/locations/.../batchPredictionJobs/1234567890123456789"
batch_job = client.batches.get(name=batch_job_name)

print(f"Job state: {batch_job.state}")
Expand Down
2 changes: 1 addition & 1 deletion genai/batch_prediction/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/bounding_box/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-genai==1.27.0
google-genai==1.41.0
pillow==11.1.0
4 changes: 2 additions & 2 deletions genai/content_cache/contentcache_create_with_txt_gcs_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def create_content_cache() -> str:
contents=contents,
system_instruction=system_instruction,
# (Optional) For enhanced security, the content cache can be encrypted using a Cloud KMS key
# kms_key_name = "projects/.../locations/us-central1/keyRings/.../cryptoKeys/..."
# kms_key_name = "projects/.../locations/.../keyRings/.../cryptoKeys/..."
display_name="example-cache",
ttl="86400s",
),
Expand All @@ -56,7 +56,7 @@ def create_content_cache() -> str:
print(content_cache.name)
print(content_cache.usage_metadata)
# Example response:
# projects/111111111111/locations/us-central1/cachedContents/1111111111111111111
# projects/111111111111/locations/.../cachedContents/1111111111111111111
# CachedContentUsageMetadata(audio_duration_seconds=None, image_count=167,
# text_count=153, total_token_count=43130, video_duration_seconds=None)
# [END googlegenaisdk_contentcache_create_with_txt_gcs_pdf]
Expand Down
4 changes: 2 additions & 2 deletions genai/content_cache/contentcache_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ def delete_context_caches(cache_name: str) -> str:

client = genai.Client()
# Delete content cache using name
# E.g cache_name = 'projects/111111111111/locations/us-central1/cachedContents/1111111111111111111'
# E.g cache_name = 'projects/111111111111/locations/.../cachedContents/1111111111111111111'
client.caches.delete(name=cache_name)
print("Deleted Cache", cache_name)
# Example response
# Deleted Cache projects/111111111111/locations/us-central1/cachedContents/1111111111111111111
# Deleted Cache projects/111111111111/locations/.../cachedContents/1111111111111111111
# [END googlegenaisdk_contentcache_delete]
return cache_name

Expand Down
4 changes: 2 additions & 2 deletions genai/content_cache/contentcache_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def list_context_caches() -> str:
print(f"Expires at: {content_cache.expire_time}")

# Example response:
# * Cache `projects/111111111111/locations/us-central1/cachedContents/1111111111111111111` for
# model `projects/111111111111/locations/us-central1/publishers/google/models/gemini-XXX-pro-XXX`
# * Cache `projects/111111111111/locations/.../cachedContents/1111111111111111111` for
# model `projects/111111111111/locations/.../publishers/google/models/gemini-XXX-pro-XXX`
# * Last updated at: 2025-02-13 14:46:42.620490+00:00
# * CachedContentUsageMetadata(audio_duration_seconds=None, image_count=167, text_count=153, total_token_count=43130, video_duration_seconds=None)
# ...
Expand Down
2 changes: 1 addition & 1 deletion genai/content_cache/contentcache_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def update_content_cache(cache_name: str) -> str:
client = genai.Client(http_options=HttpOptions(api_version="v1"))

# Get content cache by name
# cache_name = "projects/111111111111/locations/us-central1/cachedContents/1111111111111111111"
# cache_name = "projects/.../locations/.../cachedContents/1111111111111111111"
content_cache = client.caches.get(name=cache_name)
print("Expire time", content_cache.expire_time)
# Example response
Expand Down
2 changes: 1 addition & 1 deletion genai/content_cache/contentcache_use_with_txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def generate_content(cache_name: str) -> str:

client = genai.Client(http_options=HttpOptions(api_version="v1"))
# Use content cache to generate text response
# E.g cache_name = 'projects/111111111111/locations/us-central1/cachedContents/1111111111111111111'
# E.g cache_name = 'projects/.../locations/.../cachedContents/1111111111111111111'
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Summarize the pdfs",
Expand Down
2 changes: 1 addition & 1 deletion genai/content_cache/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/controlled_generation/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/count_tokens/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/embeddings/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/express_mode/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/image_generation/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
google-genai==1.29.0
google-genai==1.41.0
pillow==11.1.0
Binary file removed genai/live/hello_gemini_are_you_there.wav
Binary file not shown.
2 changes: 1 addition & 1 deletion genai/live/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
google-genai==1.28.0
google-genai==1.41.0
scipy==1.16.1
websockets==15.0.1
numpy==1.26.4
Expand Down
2 changes: 1 addition & 1 deletion genai/model_optimizer/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.20.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/provisioned_throughput/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/safety/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/template_folder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/text_generation/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/thinking/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/tools/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
google-genai==1.27.0
google-genai==1.41.0
# PIl is required for tools_code_execution_with_txt_img.py
pillow==11.1.0
2 changes: 1 addition & 1 deletion genai/tuning/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.30.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion genai/video_generation/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.27.0
google-genai==1.41.0
2 changes: 1 addition & 1 deletion model_garden/anthropic/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-genai==1.7.0
google-genai==1.41.0