From c2fc10f29c1007bb378637394b3bc6bc64ccd359 Mon Sep 17 00:00:00 2001 From: budisteanualexandra Date: Fri, 28 Nov 2025 13:29:19 +0200 Subject: [PATCH] docs: fix Image.from_file() to use keyword-only param --- README.md | 2 +- docs/_sources/index.rst.txt | 2 +- google/genai/models.py | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2059f352d..0c2373a6f 100644 --- a/README.md +++ b/README.md @@ -1302,7 +1302,7 @@ video.show() from google.genai import types # Read local image (uses mimetypes.guess_type to infer mime type) -image = types.Image.from_file("local/path/file.png") +image = types.Image.from_file(location="local/path/file.png") # Create operation operation = client.models.generate_videos( diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt index 81d079a0b..ee0434b82 100644 --- a/docs/_sources/index.rst.txt +++ b/docs/_sources/index.rst.txt @@ -1398,7 +1398,7 @@ Generate Videos (Image to Video) from google.genai import types # Read local image (uses mimetypes.guess_type to infer mime type) - image = types.Image.from_file("local/path/file.png") + image = types.Image.from_file(location="local/path/file.png") # Create operation operation = client.models.generate_videos( diff --git a/google/genai/models.py b/google/genai/models.py index 9c53499a7..047741924 100644 --- a/google/genai/models.py +++ b/google/genai/models.py @@ -4444,7 +4444,7 @@ def recontext_image( virtual_try_on_response = client.models.recontext_image( model="virtual-try-on-preview-08-04", source=types.RecontextImageSource( - person_image=types.Image.from_file(IMAGE1_FILE_PATH), + person_image=types.Image.from_file(location=IMAGE1_FILE_PATH), product_images=[types.ProductImage.from_file(IMAGE2_FILE_PATH)], ), config=types.RecontextImageConfig( @@ -4530,7 +4530,7 @@ def segment_image( response = client.models.segment_image( model="image-segmentation-001", source=types.SegmentImageSource( - image=types.Image.from_file(IMAGE_FILE_PATH), + image=types.Image.from_file(location=IMAGE_FILE_PATH), ), ) @@ -5537,7 +5537,7 @@ def edit_image( raw_ref_image = RawReferenceImage( reference_id=1, - reference_image=types.Image.from_file(IMAGE_FILE_PATH), + reference_image=types.Image.from_file(location=IMAGE_FILE_PATH), ) mask_ref_image = MaskReferenceImage( @@ -5592,7 +5592,7 @@ def upscale_image( IMAGE_FILE_PATH="my-image.png" response=client.models.upscale_image( model='imagen-3.0-generate-001', - image=types.Image.from_file(IMAGE_FILE_PATH), + image=types.Image.from_file(location=IMAGE_FILE_PATH), upscale_factor='x2', ) response.generated_images[0].image.show() @@ -6288,7 +6288,7 @@ async def recontext_image( virtual_try_on_response = client.models.recontext_image( model="virtual-try-on-preview-08-04", source=types.RecontextImageSource( - person_image=types.Image.from_file(IMAGE1_FILE_PATH), + person_image=types.Image.from_file(location=IMAGE1_FILE_PATH), product_images=[types.ProductImage.from_file(IMAGE2_FILE_PATH)], ), config=types.RecontextImageConfig( @@ -6374,7 +6374,7 @@ async def segment_image( response = client.models.segment_image( model="image-segmentation-001", source=types.SegmentImageSource( - image=types.Image.from_file(IMAGE_FILE_PATH), + image=types.Image.from_file(location=IMAGE_FILE_PATH), ), config=types.SegmentImageConfig( mode=types.SegmentMode.foreground, @@ -7321,7 +7321,7 @@ async def edit_image( raw_ref_image = RawReferenceImage( reference_id=1, - reference_image=types.Image.from_file(IMAGE_FILE_PATH), + reference_image=types.Image.from_file(location=IMAGE_FILE_PATH), ) mask_ref_image = MaskReferenceImage( @@ -7483,7 +7483,7 @@ async def upscale_image( IMAGE_FILE_PATH="my-image.png" response = await client.aio.models.upscale_image( model='imagen-3.0-generate-001', - image=types.Image.from_file(IMAGE_FILE_PATH), + image=types.Image.from_file(location=IMAGE_FILE_PATH), upscale_factor='x2', ) response.generated_images[0].image.show()