google-genai 1.31.0__py3-none-any.whl → 1.32.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- google/genai/_base_transformers.py +26 -0
- google/genai/_local_tokenizer_loader.py +223 -0
- google/genai/_operations_converters.py +307 -0
- google/genai/_transformers.py +0 -10
- google/genai/caches.py +14 -2
- google/genai/files.py +10 -2
- google/genai/local_tokenizer.py +362 -0
- google/genai/models.py +144 -17
- google/genai/tunings.py +134 -0
- google/genai/types.py +251 -82
- google/genai/version.py +1 -1
- {google_genai-1.31.0.dist-info → google_genai-1.32.0.dist-info}/METADATA +6 -6
- {google_genai-1.31.0.dist-info → google_genai-1.32.0.dist-info}/RECORD +16 -12
- {google_genai-1.31.0.dist-info → google_genai-1.32.0.dist-info}/WHEEL +0 -0
- {google_genai-1.31.0.dist-info → google_genai-1.32.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.31.0.dist-info → google_genai-1.32.0.dist-info}/top_level.txt +0 -0
google/genai/types.py
CHANGED
@@ -19,6 +19,7 @@ from abc import ABC, abstractmethod
|
|
19
19
|
import datetime
|
20
20
|
from enum import Enum, EnumMeta
|
21
21
|
import inspect
|
22
|
+
import io
|
22
23
|
import json
|
23
24
|
import logging
|
24
25
|
import sys
|
@@ -29,6 +30,11 @@ import pydantic
|
|
29
30
|
from pydantic import ConfigDict, Field, PrivateAttr, model_validator
|
30
31
|
from typing_extensions import Self, TypedDict
|
31
32
|
from . import _common
|
33
|
+
from ._operations_converters import (
|
34
|
+
_GenerateVideosOperation_from_mldev,
|
35
|
+
_GenerateVideosOperation_from_vertex,
|
36
|
+
)
|
37
|
+
|
32
38
|
|
33
39
|
if sys.version_info >= (3, 10):
|
34
40
|
# Supports both Union[t1, t2] and t1 | t2
|
@@ -496,6 +502,8 @@ class FunctionCallingConfigMode(_common.CaseInSensitiveEnum):
|
|
496
502
|
"""Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations"."""
|
497
503
|
NONE = 'NONE'
|
498
504
|
"""Model will not predict any function calls. Model behavior is same as when not passing any function declarations."""
|
505
|
+
VALIDATED = 'VALIDATED'
|
506
|
+
"""Model decides to predict either a function call or a natural language response, but will validate function calls with constrained decoding. If "allowed_function_names" are set, the predicted function call will be limited to any one of "allowed_function_names", else the predicted function call will be any one of the provided "function_declarations"."""
|
499
507
|
|
500
508
|
|
501
509
|
class SafetyFilterLevel(_common.CaseInSensitiveEnum):
|
@@ -590,6 +598,18 @@ class SegmentMode(_common.CaseInSensitiveEnum):
|
|
590
598
|
INTERACTIVE = 'INTERACTIVE'
|
591
599
|
|
592
600
|
|
601
|
+
class VideoGenerationReferenceType(_common.CaseInSensitiveEnum):
|
602
|
+
"""Enum for the reference type of a video generation reference image."""
|
603
|
+
|
604
|
+
ASSET = 'ASSET'
|
605
|
+
"""A reference image that provides assets to the generated video,
|
606
|
+
such as the scene, an object, a character, etc."""
|
607
|
+
STYLE = 'STYLE'
|
608
|
+
"""A reference image that provides aesthetics including colors,
|
609
|
+
lighting, texture, etc., to be used as the style of the generated video,
|
610
|
+
such as 'anime', 'photography', 'origami', etc."""
|
611
|
+
|
612
|
+
|
593
613
|
class VideoCompressionQuality(_common.CaseInSensitiveEnum):
|
594
614
|
"""Enum that controls the compression quality of the generated videos."""
|
595
615
|
|
@@ -804,6 +824,21 @@ class Blob(_common.BaseModel):
|
|
804
824
|
description="""Required. The IANA standard MIME type of the source data.""",
|
805
825
|
)
|
806
826
|
|
827
|
+
def as_image(self) -> Optional['PIL_Image']:
|
828
|
+
"""Returns the Blob as a PIL Image, or None if the Blob is not an image."""
|
829
|
+
if (
|
830
|
+
not self.data
|
831
|
+
or not self.mime_type
|
832
|
+
or not self.mime_type.startswith('image/')
|
833
|
+
):
|
834
|
+
return None
|
835
|
+
if not _is_pillow_image_imported:
|
836
|
+
raise ImportError(
|
837
|
+
'The PIL module is not available. Please install the Pillow'
|
838
|
+
' package. `pip install pillow`'
|
839
|
+
)
|
840
|
+
return PIL.Image.open(io.BytesIO(self.data))
|
841
|
+
|
807
842
|
|
808
843
|
class BlobDict(TypedDict, total=False):
|
809
844
|
"""Content blob."""
|
@@ -1063,6 +1098,12 @@ class Part(_common.BaseModel):
|
|
1063
1098
|
default=None, description="""Optional. Text part (can be code)."""
|
1064
1099
|
)
|
1065
1100
|
|
1101
|
+
def as_image(self) -> Optional['PIL_Image']:
|
1102
|
+
"""Returns the part as a PIL Image, or None if the part is not an image."""
|
1103
|
+
if not self.inline_data:
|
1104
|
+
return None
|
1105
|
+
return self.inline_data.as_image()
|
1106
|
+
|
1066
1107
|
@classmethod
|
1067
1108
|
def from_uri(
|
1068
1109
|
cls, *, file_uri: str, mime_type: Optional[str] = None
|
@@ -5446,6 +5487,23 @@ class GenerateContentResponse(_common.BaseModel):
|
|
5446
5487
|
# part.text == '' is different from part.text is None
|
5447
5488
|
return text if any_text_part_text else None
|
5448
5489
|
|
5490
|
+
@property
|
5491
|
+
def parts(self) -> Optional[list[Part]]:
|
5492
|
+
"""Returns the content-parts in the response."""
|
5493
|
+
if (
|
5494
|
+
not self.candidates
|
5495
|
+
or self.candidates[0].content is None
|
5496
|
+
or self.candidates[0].content.parts is None
|
5497
|
+
):
|
5498
|
+
return None
|
5499
|
+
if len(self.candidates) > 1:
|
5500
|
+
logger.warning(
|
5501
|
+
'Warning: there are multiple candidates in the response, returning'
|
5502
|
+
' parts from the first one.'
|
5503
|
+
)
|
5504
|
+
|
5505
|
+
return self.candidates[0].content.parts
|
5506
|
+
|
5449
5507
|
@property
|
5450
5508
|
def text(self) -> Optional[str]:
|
5451
5509
|
"""Returns the concatenation of all text parts in the response."""
|
@@ -6854,6 +6912,10 @@ class _UpscaleImageAPIConfig(_common.BaseModel):
|
|
6854
6912
|
http_options: Optional[HttpOptions] = Field(
|
6855
6913
|
default=None, description="""Used to override HTTP request options."""
|
6856
6914
|
)
|
6915
|
+
output_gcs_uri: Optional[str] = Field(
|
6916
|
+
default=None,
|
6917
|
+
description="""Cloud Storage URI used to store the generated images.""",
|
6918
|
+
)
|
6857
6919
|
include_rai_reason: Optional[bool] = Field(
|
6858
6920
|
default=None,
|
6859
6921
|
description="""Whether to include a reason for filtered-out images in the
|
@@ -6895,6 +6957,9 @@ class _UpscaleImageAPIConfigDict(TypedDict, total=False):
|
|
6895
6957
|
http_options: Optional[HttpOptionsDict]
|
6896
6958
|
"""Used to override HTTP request options."""
|
6897
6959
|
|
6960
|
+
output_gcs_uri: Optional[str]
|
6961
|
+
"""Cloud Storage URI used to store the generated images."""
|
6962
|
+
|
6898
6963
|
include_rai_reason: Optional[bool]
|
6899
6964
|
"""Whether to include a reason for filtered-out images in the
|
6900
6965
|
response."""
|
@@ -7078,6 +7143,10 @@ class RecontextImageConfig(_common.BaseModel):
|
|
7078
7143
|
description="""Whether allow to generate person images, and restrict to specific
|
7079
7144
|
ages.""",
|
7080
7145
|
)
|
7146
|
+
add_watermark: Optional[bool] = Field(
|
7147
|
+
default=None,
|
7148
|
+
description="""Whether to add a SynthID watermark to the generated images.""",
|
7149
|
+
)
|
7081
7150
|
output_mime_type: Optional[str] = Field(
|
7082
7151
|
default=None, description="""MIME type of the generated image."""
|
7083
7152
|
)
|
@@ -7117,6 +7186,9 @@ class RecontextImageConfigDict(TypedDict, total=False):
|
|
7117
7186
|
"""Whether allow to generate person images, and restrict to specific
|
7118
7187
|
ages."""
|
7119
7188
|
|
7189
|
+
add_watermark: Optional[bool]
|
7190
|
+
"""Whether to add a SynthID watermark to the generated images."""
|
7191
|
+
|
7120
7192
|
output_mime_type: Optional[str]
|
7121
7193
|
"""MIME type of the generated image."""
|
7122
7194
|
|
@@ -7828,12 +7900,15 @@ _DeleteModelParametersOrDict = Union[
|
|
7828
7900
|
|
7829
7901
|
class DeleteModelResponse(_common.BaseModel):
|
7830
7902
|
|
7831
|
-
|
7903
|
+
sdk_http_response: Optional[HttpResponse] = Field(
|
7904
|
+
default=None, description="""Used to retain the full HTTP response."""
|
7905
|
+
)
|
7832
7906
|
|
7833
7907
|
|
7834
7908
|
class DeleteModelResponseDict(TypedDict, total=False):
|
7835
7909
|
|
7836
|
-
|
7910
|
+
sdk_http_response: Optional[HttpResponseDict]
|
7911
|
+
"""Used to retain the full HTTP response."""
|
7837
7912
|
|
7838
7913
|
|
7839
7914
|
DeleteModelResponseOrDict = Union[DeleteModelResponse, DeleteModelResponseDict]
|
@@ -8198,7 +8273,7 @@ class TokensInfo(_common.BaseModel):
|
|
8198
8273
|
|
8199
8274
|
role: Optional[str] = Field(
|
8200
8275
|
default=None,
|
8201
|
-
description="""Optional
|
8276
|
+
description="""Optional fields for the role from the corresponding Content.""",
|
8202
8277
|
)
|
8203
8278
|
token_ids: Optional[list[int]] = Field(
|
8204
8279
|
default=None, description="""A list of token ids from the input."""
|
@@ -8212,7 +8287,7 @@ class TokensInfoDict(TypedDict, total=False):
|
|
8212
8287
|
"""Tokens info with a list of tokens and the corresponding list of token ids."""
|
8213
8288
|
|
8214
8289
|
role: Optional[str]
|
8215
|
-
"""Optional
|
8290
|
+
"""Optional fields for the role from the corresponding Content."""
|
8216
8291
|
|
8217
8292
|
token_ids: Optional[list[int]]
|
8218
8293
|
"""A list of token ids from the input."""
|
@@ -8354,6 +8429,47 @@ class VideoDict(TypedDict, total=False):
|
|
8354
8429
|
VideoOrDict = Union[Video, VideoDict]
|
8355
8430
|
|
8356
8431
|
|
8432
|
+
class GenerateVideosSource(_common.BaseModel):
|
8433
|
+
"""A set of source input(s) for video generation."""
|
8434
|
+
|
8435
|
+
prompt: Optional[str] = Field(
|
8436
|
+
default=None,
|
8437
|
+
description="""The text prompt for generating the videos.
|
8438
|
+
Optional if image or video is provided.""",
|
8439
|
+
)
|
8440
|
+
image: Optional[Image] = Field(
|
8441
|
+
default=None,
|
8442
|
+
description="""The input image for generating the videos.
|
8443
|
+
Optional if prompt or video is provided.""",
|
8444
|
+
)
|
8445
|
+
video: Optional[Video] = Field(
|
8446
|
+
default=None,
|
8447
|
+
description="""The input video for video extension use cases.
|
8448
|
+
Optional if prompt or image is provided.""",
|
8449
|
+
)
|
8450
|
+
|
8451
|
+
|
8452
|
+
class GenerateVideosSourceDict(TypedDict, total=False):
|
8453
|
+
"""A set of source input(s) for video generation."""
|
8454
|
+
|
8455
|
+
prompt: Optional[str]
|
8456
|
+
"""The text prompt for generating the videos.
|
8457
|
+
Optional if image or video is provided."""
|
8458
|
+
|
8459
|
+
image: Optional[ImageDict]
|
8460
|
+
"""The input image for generating the videos.
|
8461
|
+
Optional if prompt or video is provided."""
|
8462
|
+
|
8463
|
+
video: Optional[VideoDict]
|
8464
|
+
"""The input video for video extension use cases.
|
8465
|
+
Optional if prompt or image is provided."""
|
8466
|
+
|
8467
|
+
|
8468
|
+
GenerateVideosSourceOrDict = Union[
|
8469
|
+
GenerateVideosSource, GenerateVideosSourceDict
|
8470
|
+
]
|
8471
|
+
|
8472
|
+
|
8357
8473
|
class VideoGenerationReferenceImage(_common.BaseModel):
|
8358
8474
|
"""A reference image for video generation."""
|
8359
8475
|
|
@@ -8362,11 +8478,10 @@ class VideoGenerationReferenceImage(_common.BaseModel):
|
|
8362
8478
|
description="""The reference image.
|
8363
8479
|
""",
|
8364
8480
|
)
|
8365
|
-
reference_type: Optional[
|
8481
|
+
reference_type: Optional[VideoGenerationReferenceType] = Field(
|
8366
8482
|
default=None,
|
8367
8483
|
description="""The type of the reference image, which defines how the reference
|
8368
|
-
image will be used to generate the video.
|
8369
|
-
or 'style'.""",
|
8484
|
+
image will be used to generate the video.""",
|
8370
8485
|
)
|
8371
8486
|
|
8372
8487
|
|
@@ -8377,10 +8492,9 @@ class VideoGenerationReferenceImageDict(TypedDict, total=False):
|
|
8377
8492
|
"""The reference image.
|
8378
8493
|
"""
|
8379
8494
|
|
8380
|
-
reference_type: Optional[
|
8495
|
+
reference_type: Optional[VideoGenerationReferenceType]
|
8381
8496
|
"""The type of the reference image, which defines how the reference
|
8382
|
-
image will be used to generate the video.
|
8383
|
-
or 'style'."""
|
8497
|
+
image will be used to generate the video."""
|
8384
8498
|
|
8385
8499
|
|
8386
8500
|
VideoGenerationReferenceImageOrDict = Union[
|
@@ -8540,6 +8654,10 @@ class _GenerateVideosParameters(_common.BaseModel):
|
|
8540
8654
|
description="""The input video for video extension use cases.
|
8541
8655
|
Optional if prompt or image is provided.""",
|
8542
8656
|
)
|
8657
|
+
source: Optional[GenerateVideosSource] = Field(
|
8658
|
+
default=None,
|
8659
|
+
description="""A set of source input(s) for video generation.""",
|
8660
|
+
)
|
8543
8661
|
config: Optional[GenerateVideosConfig] = Field(
|
8544
8662
|
default=None, description="""Configuration for generating videos."""
|
8545
8663
|
)
|
@@ -8563,6 +8681,9 @@ class _GenerateVideosParametersDict(TypedDict, total=False):
|
|
8563
8681
|
"""The input video for video extension use cases.
|
8564
8682
|
Optional if prompt or image is provided."""
|
8565
8683
|
|
8684
|
+
source: Optional[GenerateVideosSourceDict]
|
8685
|
+
"""A set of source input(s) for video generation."""
|
8686
|
+
|
8566
8687
|
config: Optional[GenerateVideosConfigDict]
|
8567
8688
|
"""Configuration for generating videos."""
|
8568
8689
|
|
@@ -8605,6 +8726,24 @@ class GenerateVideosResponse(_common.BaseModel):
|
|
8605
8726
|
)
|
8606
8727
|
|
8607
8728
|
|
8729
|
+
class GenerateVideosResponseDict(TypedDict, total=False):
|
8730
|
+
"""Response with generated videos."""
|
8731
|
+
|
8732
|
+
generated_videos: Optional[list[GeneratedVideoDict]]
|
8733
|
+
"""List of the generated videos"""
|
8734
|
+
|
8735
|
+
rai_media_filtered_count: Optional[int]
|
8736
|
+
"""Returns if any videos were filtered due to RAI policies."""
|
8737
|
+
|
8738
|
+
rai_media_filtered_reasons: Optional[list[str]]
|
8739
|
+
"""Returns rai failure reasons if any."""
|
8740
|
+
|
8741
|
+
|
8742
|
+
GenerateVideosResponseOrDict = Union[
|
8743
|
+
GenerateVideosResponse, GenerateVideosResponseDict
|
8744
|
+
]
|
8745
|
+
|
8746
|
+
|
8608
8747
|
class Operation(ABC):
|
8609
8748
|
"""A long-running operation."""
|
8610
8749
|
|
@@ -8640,7 +8779,6 @@ class GenerateVideosOperation(_common.BaseModel, Operation):
|
|
8640
8779
|
response: Optional[GenerateVideosResponse] = Field(
|
8641
8780
|
default=None, description="""The generated videos."""
|
8642
8781
|
)
|
8643
|
-
|
8644
8782
|
result: Optional[GenerateVideosResponse] = Field(
|
8645
8783
|
default=None, description="""The generated videos."""
|
8646
8784
|
)
|
@@ -8650,76 +8788,12 @@ class GenerateVideosOperation(_common.BaseModel, Operation):
|
|
8650
8788
|
cls, api_response: Any, is_vertex_ai: bool = False
|
8651
8789
|
) -> Self:
|
8652
8790
|
"""Instantiates a GenerateVideosOperation from an API response."""
|
8653
|
-
new_operation = cls()
|
8654
|
-
new_operation.name = api_response.get('name', None)
|
8655
|
-
new_operation.metadata = api_response.get('metadata', None)
|
8656
|
-
new_operation.done = api_response.get('done', None)
|
8657
|
-
new_operation.error = api_response.get('error', None)
|
8658
|
-
|
8659
8791
|
if is_vertex_ai:
|
8660
|
-
|
8661
|
-
new_operation.response = GenerateVideosResponse(
|
8662
|
-
generated_videos=[
|
8663
|
-
GeneratedVideo(
|
8664
|
-
video=Video(
|
8665
|
-
uri=video.get('gcsUri', None),
|
8666
|
-
video_bytes=video.get('bytesBase64Encoded', None),
|
8667
|
-
mime_type=video.get('mimeType', None),
|
8668
|
-
)
|
8669
|
-
)
|
8670
|
-
for video in api_response.get('response', {}).get('videos', [])
|
8671
|
-
],
|
8672
|
-
rai_media_filtered_count=api_response.get('response', {}).get(
|
8673
|
-
'raiMediaFilteredCount', None
|
8674
|
-
),
|
8675
|
-
rai_media_filtered_reasons=api_response.get('response', {}).get(
|
8676
|
-
'raiMediaFilteredReasons', None
|
8677
|
-
),
|
8678
|
-
)
|
8792
|
+
response_dict = _GenerateVideosOperation_from_vertex(api_response)
|
8679
8793
|
else:
|
8680
|
-
|
8681
|
-
new_operation.response = GenerateVideosResponse(
|
8682
|
-
generated_videos=[
|
8683
|
-
GeneratedVideo(
|
8684
|
-
video=Video(
|
8685
|
-
uri=video.get('video', {}).get('uri', None),
|
8686
|
-
video_bytes=video.get('video', {}).get(
|
8687
|
-
'encodedVideo', None
|
8688
|
-
),
|
8689
|
-
mime_type=video.get('encoding', None),
|
8690
|
-
)
|
8691
|
-
)
|
8692
|
-
for video in api_response.get('response', {})
|
8693
|
-
.get('generateVideoResponse', {})
|
8694
|
-
.get('generatedSamples', [])
|
8695
|
-
],
|
8696
|
-
rai_media_filtered_count=api_response.get('response', {})
|
8697
|
-
.get('generateVideoResponse', {})
|
8698
|
-
.get('raiMediaFilteredCount', None),
|
8699
|
-
rai_media_filtered_reasons=api_response.get('response', {})
|
8700
|
-
.get('generateVideoResponse', {})
|
8701
|
-
.get('raiMediaFilteredReasons', None),
|
8702
|
-
)
|
8703
|
-
new_operation.result = new_operation.response
|
8704
|
-
return new_operation
|
8705
|
-
|
8706
|
-
|
8707
|
-
class GenerateVideosResponseDict(TypedDict, total=False):
|
8708
|
-
"""Response with generated videos."""
|
8709
|
-
|
8710
|
-
generated_videos: Optional[list[GeneratedVideoDict]]
|
8711
|
-
"""List of the generated videos"""
|
8712
|
-
|
8713
|
-
rai_media_filtered_count: Optional[int]
|
8714
|
-
"""Returns if any videos were filtered due to RAI policies."""
|
8715
|
-
|
8716
|
-
rai_media_filtered_reasons: Optional[list[str]]
|
8717
|
-
"""Returns rai failure reasons if any."""
|
8794
|
+
response_dict = _GenerateVideosOperation_from_mldev(api_response)
|
8718
8795
|
|
8719
|
-
|
8720
|
-
GenerateVideosResponseOrDict = Union[
|
8721
|
-
GenerateVideosResponse, GenerateVideosResponseDict
|
8722
|
-
]
|
8796
|
+
return cls._from_response(response=response_dict, kwargs={})
|
8723
8797
|
|
8724
8798
|
|
8725
8799
|
class GetTuningJobConfig(_common.BaseModel):
|
@@ -10193,6 +10267,52 @@ ListTuningJobsResponseOrDict = Union[
|
|
10193
10267
|
]
|
10194
10268
|
|
10195
10269
|
|
10270
|
+
class CancelTuningJobConfig(_common.BaseModel):
|
10271
|
+
"""Optional parameters for tunings.cancel method."""
|
10272
|
+
|
10273
|
+
http_options: Optional[HttpOptions] = Field(
|
10274
|
+
default=None, description="""Used to override HTTP request options."""
|
10275
|
+
)
|
10276
|
+
|
10277
|
+
|
10278
|
+
class CancelTuningJobConfigDict(TypedDict, total=False):
|
10279
|
+
"""Optional parameters for tunings.cancel method."""
|
10280
|
+
|
10281
|
+
http_options: Optional[HttpOptionsDict]
|
10282
|
+
"""Used to override HTTP request options."""
|
10283
|
+
|
10284
|
+
|
10285
|
+
CancelTuningJobConfigOrDict = Union[
|
10286
|
+
CancelTuningJobConfig, CancelTuningJobConfigDict
|
10287
|
+
]
|
10288
|
+
|
10289
|
+
|
10290
|
+
class _CancelTuningJobParameters(_common.BaseModel):
|
10291
|
+
"""Parameters for the cancel method."""
|
10292
|
+
|
10293
|
+
name: Optional[str] = Field(
|
10294
|
+
default=None, description="""The resource name of the tuning job."""
|
10295
|
+
)
|
10296
|
+
config: Optional[CancelTuningJobConfig] = Field(
|
10297
|
+
default=None, description="""Optional parameters for the request."""
|
10298
|
+
)
|
10299
|
+
|
10300
|
+
|
10301
|
+
class _CancelTuningJobParametersDict(TypedDict, total=False):
|
10302
|
+
"""Parameters for the cancel method."""
|
10303
|
+
|
10304
|
+
name: Optional[str]
|
10305
|
+
"""The resource name of the tuning job."""
|
10306
|
+
|
10307
|
+
config: Optional[CancelTuningJobConfigDict]
|
10308
|
+
"""Optional parameters for the request."""
|
10309
|
+
|
10310
|
+
|
10311
|
+
_CancelTuningJobParametersOrDict = Union[
|
10312
|
+
_CancelTuningJobParameters, _CancelTuningJobParametersDict
|
10313
|
+
]
|
10314
|
+
|
10315
|
+
|
10196
10316
|
class TuningExample(_common.BaseModel):
|
10197
10317
|
|
10198
10318
|
text_input: Optional[str] = Field(
|
@@ -10797,13 +10917,16 @@ _DeleteCachedContentParametersOrDict = Union[
|
|
10797
10917
|
class DeleteCachedContentResponse(_common.BaseModel):
|
10798
10918
|
"""Empty response for caches.delete method."""
|
10799
10919
|
|
10800
|
-
|
10920
|
+
sdk_http_response: Optional[HttpResponse] = Field(
|
10921
|
+
default=None, description="""Used to retain the full HTTP response."""
|
10922
|
+
)
|
10801
10923
|
|
10802
10924
|
|
10803
10925
|
class DeleteCachedContentResponseDict(TypedDict, total=False):
|
10804
10926
|
"""Empty response for caches.delete method."""
|
10805
10927
|
|
10806
|
-
|
10928
|
+
sdk_http_response: Optional[HttpResponseDict]
|
10929
|
+
"""Used to retain the full HTTP response."""
|
10807
10930
|
|
10808
10931
|
|
10809
10932
|
DeleteCachedContentResponseOrDict = Union[
|
@@ -11208,13 +11331,16 @@ _DeleteFileParametersOrDict = Union[
|
|
11208
11331
|
class DeleteFileResponse(_common.BaseModel):
|
11209
11332
|
"""Response for the delete file method."""
|
11210
11333
|
|
11211
|
-
|
11334
|
+
sdk_http_response: Optional[HttpResponse] = Field(
|
11335
|
+
default=None, description="""Used to retain the full HTTP response."""
|
11336
|
+
)
|
11212
11337
|
|
11213
11338
|
|
11214
11339
|
class DeleteFileResponseDict(TypedDict, total=False):
|
11215
11340
|
"""Response for the delete file method."""
|
11216
11341
|
|
11217
|
-
|
11342
|
+
sdk_http_response: Optional[HttpResponseDict]
|
11343
|
+
"""Used to retain the full HTTP response."""
|
11218
11344
|
|
11219
11345
|
|
11220
11346
|
DeleteFileResponseOrDict = Union[DeleteFileResponse, DeleteFileResponseDict]
|
@@ -12281,6 +12407,10 @@ class UpscaleImageConfig(_common.BaseModel):
|
|
12281
12407
|
http_options: Optional[HttpOptions] = Field(
|
12282
12408
|
default=None, description="""Used to override HTTP request options."""
|
12283
12409
|
)
|
12410
|
+
output_gcs_uri: Optional[str] = Field(
|
12411
|
+
default=None,
|
12412
|
+
description="""Cloud Storage URI used to store the generated images.""",
|
12413
|
+
)
|
12284
12414
|
include_rai_reason: Optional[bool] = Field(
|
12285
12415
|
default=None,
|
12286
12416
|
description="""Whether to include a reason for filtered-out images in the
|
@@ -12321,6 +12451,9 @@ class UpscaleImageConfigDict(TypedDict, total=False):
|
|
12321
12451
|
http_options: Optional[HttpOptionsDict]
|
12322
12452
|
"""Used to override HTTP request options."""
|
12323
12453
|
|
12454
|
+
output_gcs_uri: Optional[str]
|
12455
|
+
"""Cloud Storage URI used to store the generated images."""
|
12456
|
+
|
12324
12457
|
include_rai_reason: Optional[bool]
|
12325
12458
|
"""Whether to include a reason for filtered-out images in the
|
12326
12459
|
response."""
|
@@ -14737,6 +14870,42 @@ CreateAuthTokenParametersOrDict = Union[
|
|
14737
14870
|
]
|
14738
14871
|
|
14739
14872
|
|
14873
|
+
class CountTokensResult(_common.BaseModel):
|
14874
|
+
"""Local tokenizer count tokens result."""
|
14875
|
+
|
14876
|
+
total_tokens: Optional[int] = Field(
|
14877
|
+
default=None, description="""The total number of tokens."""
|
14878
|
+
)
|
14879
|
+
|
14880
|
+
|
14881
|
+
class CountTokensResultDict(TypedDict, total=False):
|
14882
|
+
"""Local tokenizer count tokens result."""
|
14883
|
+
|
14884
|
+
total_tokens: Optional[int]
|
14885
|
+
"""The total number of tokens."""
|
14886
|
+
|
14887
|
+
|
14888
|
+
CountTokensResultOrDict = Union[CountTokensResult, CountTokensResultDict]
|
14889
|
+
|
14890
|
+
|
14891
|
+
class ComputeTokensResult(_common.BaseModel):
|
14892
|
+
"""Local tokenizer compute tokens result."""
|
14893
|
+
|
14894
|
+
tokens_info: Optional[list[TokensInfo]] = Field(
|
14895
|
+
default=None, description="""Lists of tokens info from the input."""
|
14896
|
+
)
|
14897
|
+
|
14898
|
+
|
14899
|
+
class ComputeTokensResultDict(TypedDict, total=False):
|
14900
|
+
"""Local tokenizer compute tokens result."""
|
14901
|
+
|
14902
|
+
tokens_info: Optional[list[TokensInfoDict]]
|
14903
|
+
"""Lists of tokens info from the input."""
|
14904
|
+
|
14905
|
+
|
14906
|
+
ComputeTokensResultOrDict = Union[ComputeTokensResult, ComputeTokensResultDict]
|
14907
|
+
|
14908
|
+
|
14740
14909
|
class CreateTuningJobParameters(_common.BaseModel):
|
14741
14910
|
"""Supervised fine-tuning job creation parameters - optional fields."""
|
14742
14911
|
|
google/genai/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: google-genai
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.32.0
|
4
4
|
Summary: GenAI Python SDK
|
5
5
|
Author-email: Google LLC <googleapis-packages@google.com>
|
6
6
|
License: Apache-2.0
|
@@ -183,7 +183,7 @@ Then, you can pass it through the following way:
|
|
183
183
|
|
184
184
|
http_options = types.HttpOptions(
|
185
185
|
client_args={'proxy': 'socks5://user:pass@host:port'},
|
186
|
-
async_client_args={'proxy': 'socks5://user:pass@host:port'}
|
186
|
+
async_client_args={'proxy': 'socks5://user:pass@host:port'},
|
187
187
|
)
|
188
188
|
|
189
189
|
client=Client(..., http_options=http_options)
|
@@ -388,7 +388,7 @@ The SDK converts all non function call parts into a content with a `user` role.
|
|
388
388
|
[
|
389
389
|
types.UserContent(parts=[
|
390
390
|
types.Part.from_uri(
|
391
|
-
|
391
|
+
file_uri: 'gs://generativeai-downloads/images/scones.jpg',
|
392
392
|
mime_type: 'image/jpeg',
|
393
393
|
)
|
394
394
|
])
|
@@ -824,10 +824,10 @@ user_profile = {
|
|
824
824
|
|
825
825
|
response = client.models.generate_content(
|
826
826
|
model='gemini-2.0-flash',
|
827
|
-
contents='Give me
|
827
|
+
contents='Give me a random user profile.',
|
828
828
|
config={
|
829
829
|
'response_mime_type': 'application/json',
|
830
|
-
'response_json_schema':
|
830
|
+
'response_json_schema': user_profile
|
831
831
|
},
|
832
832
|
)
|
833
833
|
print(response.parsed)
|
@@ -1588,7 +1588,7 @@ batch_job = client.batches.create(
|
|
1588
1588
|
}],
|
1589
1589
|
"role": "user",
|
1590
1590
|
}],
|
1591
|
-
"config
|
1591
|
+
"config": {"response_modalities": ["text"]},
|
1592
1592
|
}],
|
1593
1593
|
)
|
1594
1594
|
|
@@ -3,33 +3,37 @@ google/genai/_adapters.py,sha256=Kok38miNYJff2n--l0zEK_hbq0y2rWOH7k75J7SMYbQ,174
|
|
3
3
|
google/genai/_api_client.py,sha256=N9E_4oazw93NDpbQ3kJZ50m10cN2ssDFBM2gY44Ox-Q,60213
|
4
4
|
google/genai/_api_module.py,sha256=lj8eUWx8_LBGBz-49qz6_ywWm3GYp3d8Bg5JoOHbtbI,902
|
5
5
|
google/genai/_automatic_function_calling_util.py,sha256=xXNkJR-pzSMkeSXMz3Jw-kMHFbTJEiRJ3wocuwtWW4I,11627
|
6
|
+
google/genai/_base_transformers.py,sha256=wljA6m4tLl4XLGlBC2DNOls5N9-X9tffBq0M7i8jgpw,1034
|
6
7
|
google/genai/_base_url.py,sha256=E5H4dew14Y16qfnB3XRnjSCi19cJVlkaMNoM_8ip-PM,1597
|
7
8
|
google/genai/_common.py,sha256=SmBlz7AQZbKbT8KE5vsvK5Iz1OaRwHF6J51KDJBbjMo,19936
|
8
9
|
google/genai/_extra_utils.py,sha256=6mxUnbwKkrAJ9zR8JP4nCKuA0F1BFqAc2t5mzdAONxk,20603
|
9
10
|
google/genai/_live_converters.py,sha256=brba9Wk_ljc8auy8w0n49dZXYHTBYhegKQcnjr89QgM,101812
|
11
|
+
google/genai/_local_tokenizer_loader.py,sha256=cGN1F0f7hNjRIGCGTLeox7IGAZf_YcvZjSp2rCyhUak,7465
|
10
12
|
google/genai/_mcp_utils.py,sha256=HuWJ8FUjquv40Mf_QjcL5r5yXWrS-JjINsjlOSbbyAc,3870
|
13
|
+
google/genai/_operations_converters.py,sha256=I1b46qhGCeB5uHNuyrMxpFqmzWuvSFQ5pS52csd1J4E,9080
|
11
14
|
google/genai/_replay_api_client.py,sha256=MRUxUWCC9PoTk-NxsK3rGB8yw8cCrUa8ZeTVU3oEguw,21729
|
12
15
|
google/genai/_test_api_client.py,sha256=4ruFIy5_1qcbKqqIBu3HSQbpSOBrxiecBtDZaTGFR1s,4797
|
13
16
|
google/genai/_tokens_converters.py,sha256=jPHlskl303A63uEshdwLeSSOls9kuNO1WMY5NAYF5U0,24382
|
14
|
-
google/genai/_transformers.py,sha256=
|
17
|
+
google/genai/_transformers.py,sha256=Kfo6LP3HoCco2E9EQYnRyElgOSBXZ_SKI-Spx3AwUWw,38917
|
15
18
|
google/genai/batches.py,sha256=1YIkibVzEX0p_va2kfNL3tc-X7Id13whWuhKto0mch8,87774
|
16
|
-
google/genai/caches.py,sha256=
|
19
|
+
google/genai/caches.py,sha256=6Y3D2qSwlvX8CunOiJRcRWtaiFP0r-9oMcyqnegC7Sc,66451
|
17
20
|
google/genai/chats.py,sha256=pIBw8d13llupLn4a7vP6vnpbzDcvCCrZZ-Q2r8Cvo7g,16652
|
18
21
|
google/genai/client.py,sha256=wXnfZBSv9p-yKtX_gabUrfBXoYHuqHhzK_VgwRttMgY,10777
|
19
22
|
google/genai/errors.py,sha256=GlEvypbRgF3h5BxlocmWVf-S9kzERA_lwGLCMyAvpcY,5714
|
20
|
-
google/genai/files.py,sha256=
|
23
|
+
google/genai/files.py,sha256=rQ0Uhu69vl3tfis7-8nJTvSprG4_iJ917O3RUk5VktI,40499
|
21
24
|
google/genai/live.py,sha256=BUyIOt-PON4SuJtKXA6l3ujzA3GUbYWMGSgZvsyKjrg,39674
|
22
25
|
google/genai/live_music.py,sha256=3GG9nsto8Vhkohcs-4CPMS4DFp1ZtMuLYzHfvEPYAeg,6971
|
23
|
-
google/genai/
|
26
|
+
google/genai/local_tokenizer.py,sha256=HpQk8toJFGvRozdyboOhdAFDOFAiZ07IdXeGiR25nSM,13252
|
27
|
+
google/genai/models.py,sha256=HGClCfhxxbnUzIO4DpnSQDZR6dFu1IrFheZACSbzTiE,270132
|
24
28
|
google/genai/operations.py,sha256=Ccm4EW13cT_EtCq8Fa3n8jlQySyy9KqJ98ZK4pF0DDA,12815
|
25
29
|
google/genai/pagers.py,sha256=m0SfWWn1EJs2k1On3DZx371qb8g2BRm_188ExsicIRc,7098
|
26
30
|
google/genai/py.typed,sha256=RsMFoLwBkAvY05t6izop4UHZtqOPLiKp3GkIEizzmQY,40
|
27
31
|
google/genai/tokens.py,sha256=8RbZ0kgvyKT3SwbgIUOHr6TTZL24v4fqYarhlA8r1ac,12503
|
28
|
-
google/genai/tunings.py,sha256=
|
29
|
-
google/genai/types.py,sha256=
|
30
|
-
google/genai/version.py,sha256=
|
31
|
-
google_genai-1.
|
32
|
-
google_genai-1.
|
33
|
-
google_genai-1.
|
34
|
-
google_genai-1.
|
35
|
-
google_genai-1.
|
32
|
+
google/genai/tunings.py,sha256=vVV9NvrtzoWDLzcTLSrgD5lzFeSRJdCB1QtfzL3yj3c,63275
|
33
|
+
google/genai/types.py,sha256=XMZL1osXHOouqOVyTwS-qwXT5AK2An2HPuqF7pimaf0,531165
|
34
|
+
google/genai/version.py,sha256=KCqwx3Lh-PjkDZtUZzAB9noPMjnyXJ47TxwZyrlQKfc,627
|
35
|
+
google_genai-1.32.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
36
|
+
google_genai-1.32.0.dist-info/METADATA,sha256=Nc6wUVuBTbBhpNtBnXANl5veJADPutVAqLwWv19H5rQ,43080
|
37
|
+
google_genai-1.32.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
38
|
+
google_genai-1.32.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
|
39
|
+
google_genai-1.32.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|