google-genai 1.33.0__py3-none-any.whl → 1.35.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/_common.py +5 -1
- google/genai/_extra_utils.py +5 -8
- google/genai/_live_converters.py +102 -44
- google/genai/_tokens_converters.py +24 -3
- google/genai/_transformers.py +55 -15
- google/genai/batches.py +680 -142
- google/genai/caches.py +50 -6
- google/genai/local_tokenizer.py +29 -1
- google/genai/models.py +130 -12
- google/genai/types.py +302 -42
- google/genai/version.py +1 -1
- {google_genai-1.33.0.dist-info → google_genai-1.35.0.dist-info}/METADATA +18 -1
- {google_genai-1.33.0.dist-info → google_genai-1.35.0.dist-info}/RECORD +16 -16
- {google_genai-1.33.0.dist-info → google_genai-1.35.0.dist-info}/WHEEL +0 -0
- {google_genai-1.33.0.dist-info → google_genai-1.35.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.33.0.dist-info → google_genai-1.35.0.dist-info}/top_level.txt +0 -0
google/genai/types.py
CHANGED
@@ -885,6 +885,41 @@ class FileDataDict(TypedDict, total=False):
|
|
885
885
|
FileDataOrDict = Union[FileData, FileDataDict]
|
886
886
|
|
887
887
|
|
888
|
+
class FunctionCall(_common.BaseModel):
|
889
|
+
"""A function call."""
|
890
|
+
|
891
|
+
id: Optional[str] = Field(
|
892
|
+
default=None,
|
893
|
+
description="""The unique id of the function call. If populated, the client to execute the
|
894
|
+
`function_call` and return the response with the matching `id`.""",
|
895
|
+
)
|
896
|
+
args: Optional[dict[str, Any]] = Field(
|
897
|
+
default=None,
|
898
|
+
description="""Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details.""",
|
899
|
+
)
|
900
|
+
name: Optional[str] = Field(
|
901
|
+
default=None,
|
902
|
+
description="""Required. The name of the function to call. Matches [FunctionDeclaration.name].""",
|
903
|
+
)
|
904
|
+
|
905
|
+
|
906
|
+
class FunctionCallDict(TypedDict, total=False):
|
907
|
+
"""A function call."""
|
908
|
+
|
909
|
+
id: Optional[str]
|
910
|
+
"""The unique id of the function call. If populated, the client to execute the
|
911
|
+
`function_call` and return the response with the matching `id`."""
|
912
|
+
|
913
|
+
args: Optional[dict[str, Any]]
|
914
|
+
"""Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details."""
|
915
|
+
|
916
|
+
name: Optional[str]
|
917
|
+
"""Required. The name of the function to call. Matches [FunctionDeclaration.name]."""
|
918
|
+
|
919
|
+
|
920
|
+
FunctionCallOrDict = Union[FunctionCall, FunctionCallDict]
|
921
|
+
|
922
|
+
|
888
923
|
class CodeExecutionResult(_common.BaseModel):
|
889
924
|
"""Result of executing the [ExecutableCode].
|
890
925
|
|
@@ -953,41 +988,6 @@ class ExecutableCodeDict(TypedDict, total=False):
|
|
953
988
|
ExecutableCodeOrDict = Union[ExecutableCode, ExecutableCodeDict]
|
954
989
|
|
955
990
|
|
956
|
-
class FunctionCall(_common.BaseModel):
|
957
|
-
"""A function call."""
|
958
|
-
|
959
|
-
id: Optional[str] = Field(
|
960
|
-
default=None,
|
961
|
-
description="""The unique id of the function call. If populated, the client to execute the
|
962
|
-
`function_call` and return the response with the matching `id`.""",
|
963
|
-
)
|
964
|
-
args: Optional[dict[str, Any]] = Field(
|
965
|
-
default=None,
|
966
|
-
description="""Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details.""",
|
967
|
-
)
|
968
|
-
name: Optional[str] = Field(
|
969
|
-
default=None,
|
970
|
-
description="""Required. The name of the function to call. Matches [FunctionDeclaration.name].""",
|
971
|
-
)
|
972
|
-
|
973
|
-
|
974
|
-
class FunctionCallDict(TypedDict, total=False):
|
975
|
-
"""A function call."""
|
976
|
-
|
977
|
-
id: Optional[str]
|
978
|
-
"""The unique id of the function call. If populated, the client to execute the
|
979
|
-
`function_call` and return the response with the matching `id`."""
|
980
|
-
|
981
|
-
args: Optional[dict[str, Any]]
|
982
|
-
"""Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details."""
|
983
|
-
|
984
|
-
name: Optional[str]
|
985
|
-
"""Required. The name of the function to call. Matches [FunctionDeclaration.name]."""
|
986
|
-
|
987
|
-
|
988
|
-
FunctionCallOrDict = Union[FunctionCall, FunctionCallDict]
|
989
|
-
|
990
|
-
|
991
991
|
class FunctionResponse(_common.BaseModel):
|
992
992
|
"""A function response."""
|
993
993
|
|
@@ -1075,6 +1075,12 @@ class Part(_common.BaseModel):
|
|
1075
1075
|
default=None,
|
1076
1076
|
description="""An opaque signature for the thought so it can be reused in subsequent requests.""",
|
1077
1077
|
)
|
1078
|
+
function_call: Optional[FunctionCall] = Field(
|
1079
|
+
default=None,
|
1080
|
+
description="""A predicted [FunctionCall] returned from the model that contains a string
|
1081
|
+
representing the [FunctionDeclaration.name] and a structured JSON object
|
1082
|
+
containing the parameters and their values.""",
|
1083
|
+
)
|
1078
1084
|
code_execution_result: Optional[CodeExecutionResult] = Field(
|
1079
1085
|
default=None,
|
1080
1086
|
description="""Optional. Result of executing the [ExecutableCode].""",
|
@@ -1083,10 +1089,6 @@ class Part(_common.BaseModel):
|
|
1083
1089
|
default=None,
|
1084
1090
|
description="""Optional. Code generated by the model that is meant to be executed.""",
|
1085
1091
|
)
|
1086
|
-
function_call: Optional[FunctionCall] = Field(
|
1087
|
-
default=None,
|
1088
|
-
description="""Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values.""",
|
1089
|
-
)
|
1090
1092
|
function_response: Optional[FunctionResponse] = Field(
|
1091
1093
|
default=None,
|
1092
1094
|
description="""Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model.""",
|
@@ -1181,15 +1183,17 @@ class PartDict(TypedDict, total=False):
|
|
1181
1183
|
thought_signature: Optional[bytes]
|
1182
1184
|
"""An opaque signature for the thought so it can be reused in subsequent requests."""
|
1183
1185
|
|
1186
|
+
function_call: Optional[FunctionCallDict]
|
1187
|
+
"""A predicted [FunctionCall] returned from the model that contains a string
|
1188
|
+
representing the [FunctionDeclaration.name] and a structured JSON object
|
1189
|
+
containing the parameters and their values."""
|
1190
|
+
|
1184
1191
|
code_execution_result: Optional[CodeExecutionResultDict]
|
1185
1192
|
"""Optional. Result of executing the [ExecutableCode]."""
|
1186
1193
|
|
1187
1194
|
executable_code: Optional[ExecutableCodeDict]
|
1188
1195
|
"""Optional. Code generated by the model that is meant to be executed."""
|
1189
1196
|
|
1190
|
-
function_call: Optional[FunctionCallDict]
|
1191
|
-
"""Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."""
|
1192
|
-
|
1193
1197
|
function_response: Optional[FunctionResponseDict]
|
1194
1198
|
"""Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."""
|
1195
1199
|
|
@@ -8411,6 +8415,36 @@ VideoGenerationReferenceImageOrDict = Union[
|
|
8411
8415
|
]
|
8412
8416
|
|
8413
8417
|
|
8418
|
+
class VideoGenerationMask(_common.BaseModel):
|
8419
|
+
"""A mask for video generation."""
|
8420
|
+
|
8421
|
+
image: Optional[Image] = Field(
|
8422
|
+
default=None,
|
8423
|
+
description="""The image mask to use for generating videos.""",
|
8424
|
+
)
|
8425
|
+
mask_mode: Optional[str] = Field(
|
8426
|
+
default=None,
|
8427
|
+
description="""Describes how the mask will be used. Inpainting masks must
|
8428
|
+
match the aspect ratio of the input video. Outpainting masks can be
|
8429
|
+
either 9:16 or 16:9.""",
|
8430
|
+
)
|
8431
|
+
|
8432
|
+
|
8433
|
+
class VideoGenerationMaskDict(TypedDict, total=False):
|
8434
|
+
"""A mask for video generation."""
|
8435
|
+
|
8436
|
+
image: Optional[ImageDict]
|
8437
|
+
"""The image mask to use for generating videos."""
|
8438
|
+
|
8439
|
+
mask_mode: Optional[str]
|
8440
|
+
"""Describes how the mask will be used. Inpainting masks must
|
8441
|
+
match the aspect ratio of the input video. Outpainting masks can be
|
8442
|
+
either 9:16 or 16:9."""
|
8443
|
+
|
8444
|
+
|
8445
|
+
VideoGenerationMaskOrDict = Union[VideoGenerationMask, VideoGenerationMaskDict]
|
8446
|
+
|
8447
|
+
|
8414
8448
|
class GenerateVideosConfig(_common.BaseModel):
|
8415
8449
|
"""Configuration for generating videos."""
|
8416
8450
|
|
@@ -8483,6 +8517,9 @@ class GenerateVideosConfig(_common.BaseModel):
|
|
8483
8517
|
be associated with a type. Veo 2 supports up to 3 asset images *or* 1
|
8484
8518
|
style image.""",
|
8485
8519
|
)
|
8520
|
+
mask: Optional[VideoGenerationMask] = Field(
|
8521
|
+
default=None, description="""The mask to use for generating videos."""
|
8522
|
+
)
|
8486
8523
|
compression_quality: Optional[VideoCompressionQuality] = Field(
|
8487
8524
|
default=None,
|
8488
8525
|
description="""Compression quality of the generated videos.""",
|
@@ -8550,6 +8587,9 @@ class GenerateVideosConfigDict(TypedDict, total=False):
|
|
8550
8587
|
be associated with a type. Veo 2 supports up to 3 asset images *or* 1
|
8551
8588
|
style image."""
|
8552
8589
|
|
8590
|
+
mask: Optional[VideoGenerationMaskDict]
|
8591
|
+
"""The mask to use for generating videos."""
|
8592
|
+
|
8553
8593
|
compression_quality: Optional[VideoCompressionQuality]
|
8554
8594
|
"""Compression quality of the generated videos."""
|
8555
8595
|
|
@@ -11435,6 +11475,70 @@ class InlinedResponseDict(TypedDict, total=False):
|
|
11435
11475
|
InlinedResponseOrDict = Union[InlinedResponse, InlinedResponseDict]
|
11436
11476
|
|
11437
11477
|
|
11478
|
+
class SingleEmbedContentResponse(_common.BaseModel):
|
11479
|
+
"""Config for `response` parameter."""
|
11480
|
+
|
11481
|
+
embedding: Optional[ContentEmbedding] = Field(
|
11482
|
+
default=None,
|
11483
|
+
description="""The response to the request.
|
11484
|
+
""",
|
11485
|
+
)
|
11486
|
+
token_count: Optional[int] = Field(
|
11487
|
+
default=None,
|
11488
|
+
description="""The error encountered while processing the request.
|
11489
|
+
""",
|
11490
|
+
)
|
11491
|
+
|
11492
|
+
|
11493
|
+
class SingleEmbedContentResponseDict(TypedDict, total=False):
|
11494
|
+
"""Config for `response` parameter."""
|
11495
|
+
|
11496
|
+
embedding: Optional[ContentEmbeddingDict]
|
11497
|
+
"""The response to the request.
|
11498
|
+
"""
|
11499
|
+
|
11500
|
+
token_count: Optional[int]
|
11501
|
+
"""The error encountered while processing the request.
|
11502
|
+
"""
|
11503
|
+
|
11504
|
+
|
11505
|
+
SingleEmbedContentResponseOrDict = Union[
|
11506
|
+
SingleEmbedContentResponse, SingleEmbedContentResponseDict
|
11507
|
+
]
|
11508
|
+
|
11509
|
+
|
11510
|
+
class InlinedEmbedContentResponse(_common.BaseModel):
|
11511
|
+
"""Config for `inlined_embedding_responses` parameter."""
|
11512
|
+
|
11513
|
+
response: Optional[SingleEmbedContentResponse] = Field(
|
11514
|
+
default=None,
|
11515
|
+
description="""The response to the request.
|
11516
|
+
""",
|
11517
|
+
)
|
11518
|
+
error: Optional[JobError] = Field(
|
11519
|
+
default=None,
|
11520
|
+
description="""The error encountered while processing the request.
|
11521
|
+
""",
|
11522
|
+
)
|
11523
|
+
|
11524
|
+
|
11525
|
+
class InlinedEmbedContentResponseDict(TypedDict, total=False):
|
11526
|
+
"""Config for `inlined_embedding_responses` parameter."""
|
11527
|
+
|
11528
|
+
response: Optional[SingleEmbedContentResponseDict]
|
11529
|
+
"""The response to the request.
|
11530
|
+
"""
|
11531
|
+
|
11532
|
+
error: Optional[JobErrorDict]
|
11533
|
+
"""The error encountered while processing the request.
|
11534
|
+
"""
|
11535
|
+
|
11536
|
+
|
11537
|
+
InlinedEmbedContentResponseOrDict = Union[
|
11538
|
+
InlinedEmbedContentResponse, InlinedEmbedContentResponseDict
|
11539
|
+
]
|
11540
|
+
|
11541
|
+
|
11438
11542
|
class BatchJobDestination(_common.BaseModel):
|
11439
11543
|
"""Config for `des` parameter."""
|
11440
11544
|
|
@@ -11470,6 +11574,15 @@ class BatchJobDestination(_common.BaseModel):
|
|
11470
11574
|
the input requests.
|
11471
11575
|
""",
|
11472
11576
|
)
|
11577
|
+
inlined_embed_content_responses: Optional[
|
11578
|
+
list[InlinedEmbedContentResponse]
|
11579
|
+
] = Field(
|
11580
|
+
default=None,
|
11581
|
+
description="""The responses to the requests in the batch. Returned when the batch was
|
11582
|
+
built using inlined requests. The responses will be in the same order as
|
11583
|
+
the input requests.
|
11584
|
+
""",
|
11585
|
+
)
|
11473
11586
|
|
11474
11587
|
|
11475
11588
|
class BatchJobDestinationDict(TypedDict, total=False):
|
@@ -11502,6 +11615,14 @@ class BatchJobDestinationDict(TypedDict, total=False):
|
|
11502
11615
|
the input requests.
|
11503
11616
|
"""
|
11504
11617
|
|
11618
|
+
inlined_embed_content_responses: Optional[
|
11619
|
+
list[InlinedEmbedContentResponseDict]
|
11620
|
+
]
|
11621
|
+
"""The responses to the requests in the batch. Returned when the batch was
|
11622
|
+
built using inlined requests. The responses will be in the same order as
|
11623
|
+
the input requests.
|
11624
|
+
"""
|
11625
|
+
|
11505
11626
|
|
11506
11627
|
BatchJobDestinationOrDict = Union[BatchJobDestination, BatchJobDestinationDict]
|
11507
11628
|
|
@@ -11662,6 +11783,13 @@ class BatchJob(_common.BaseModel):
|
|
11662
11783
|
""",
|
11663
11784
|
)
|
11664
11785
|
|
11786
|
+
@property
|
11787
|
+
def done(self) -> bool:
|
11788
|
+
"""Returns True if the batch job has ended."""
|
11789
|
+
if self.state is None:
|
11790
|
+
return False
|
11791
|
+
return self.state.name in JOB_STATES_ENDED
|
11792
|
+
|
11665
11793
|
|
11666
11794
|
class BatchJobDict(TypedDict, total=False):
|
11667
11795
|
"""Config for batches.create return value."""
|
@@ -11712,6 +11840,138 @@ class BatchJobDict(TypedDict, total=False):
|
|
11712
11840
|
BatchJobOrDict = Union[BatchJob, BatchJobDict]
|
11713
11841
|
|
11714
11842
|
|
11843
|
+
class EmbedContentBatch(_common.BaseModel):
|
11844
|
+
"""Parameters for the embed_content method."""
|
11845
|
+
|
11846
|
+
contents: Optional[ContentListUnion] = Field(
|
11847
|
+
default=None,
|
11848
|
+
description="""The content to embed. Only the `parts.text` fields will be counted.
|
11849
|
+
""",
|
11850
|
+
)
|
11851
|
+
config: Optional[EmbedContentConfig] = Field(
|
11852
|
+
default=None,
|
11853
|
+
description="""Configuration that contains optional parameters.
|
11854
|
+
""",
|
11855
|
+
)
|
11856
|
+
|
11857
|
+
|
11858
|
+
class EmbedContentBatchDict(TypedDict, total=False):
|
11859
|
+
"""Parameters for the embed_content method."""
|
11860
|
+
|
11861
|
+
contents: Optional[ContentListUnionDict]
|
11862
|
+
"""The content to embed. Only the `parts.text` fields will be counted.
|
11863
|
+
"""
|
11864
|
+
|
11865
|
+
config: Optional[EmbedContentConfigDict]
|
11866
|
+
"""Configuration that contains optional parameters.
|
11867
|
+
"""
|
11868
|
+
|
11869
|
+
|
11870
|
+
EmbedContentBatchOrDict = Union[EmbedContentBatch, EmbedContentBatchDict]
|
11871
|
+
|
11872
|
+
|
11873
|
+
class EmbeddingsBatchJobSource(_common.BaseModel):
|
11874
|
+
|
11875
|
+
file_name: Optional[str] = Field(
|
11876
|
+
default=None,
|
11877
|
+
description="""The Gemini Developer API's file resource name of the input data
|
11878
|
+
(e.g. "files/12345").
|
11879
|
+
""",
|
11880
|
+
)
|
11881
|
+
inlined_requests: Optional[EmbedContentBatch] = Field(
|
11882
|
+
default=None,
|
11883
|
+
description="""The Gemini Developer API's inlined input data to run batch job.
|
11884
|
+
""",
|
11885
|
+
)
|
11886
|
+
|
11887
|
+
|
11888
|
+
class EmbeddingsBatchJobSourceDict(TypedDict, total=False):
|
11889
|
+
|
11890
|
+
file_name: Optional[str]
|
11891
|
+
"""The Gemini Developer API's file resource name of the input data
|
11892
|
+
(e.g. "files/12345").
|
11893
|
+
"""
|
11894
|
+
|
11895
|
+
inlined_requests: Optional[EmbedContentBatchDict]
|
11896
|
+
"""The Gemini Developer API's inlined input data to run batch job.
|
11897
|
+
"""
|
11898
|
+
|
11899
|
+
|
11900
|
+
EmbeddingsBatchJobSourceOrDict = Union[
|
11901
|
+
EmbeddingsBatchJobSource, EmbeddingsBatchJobSourceDict
|
11902
|
+
]
|
11903
|
+
|
11904
|
+
|
11905
|
+
class CreateEmbeddingsBatchJobConfig(_common.BaseModel):
|
11906
|
+
"""Config for optional parameters."""
|
11907
|
+
|
11908
|
+
http_options: Optional[HttpOptions] = Field(
|
11909
|
+
default=None, description="""Used to override HTTP request options."""
|
11910
|
+
)
|
11911
|
+
display_name: Optional[str] = Field(
|
11912
|
+
default=None,
|
11913
|
+
description="""The user-defined name of this BatchJob.
|
11914
|
+
""",
|
11915
|
+
)
|
11916
|
+
|
11917
|
+
|
11918
|
+
class CreateEmbeddingsBatchJobConfigDict(TypedDict, total=False):
|
11919
|
+
"""Config for optional parameters."""
|
11920
|
+
|
11921
|
+
http_options: Optional[HttpOptionsDict]
|
11922
|
+
"""Used to override HTTP request options."""
|
11923
|
+
|
11924
|
+
display_name: Optional[str]
|
11925
|
+
"""The user-defined name of this BatchJob.
|
11926
|
+
"""
|
11927
|
+
|
11928
|
+
|
11929
|
+
CreateEmbeddingsBatchJobConfigOrDict = Union[
|
11930
|
+
CreateEmbeddingsBatchJobConfig, CreateEmbeddingsBatchJobConfigDict
|
11931
|
+
]
|
11932
|
+
|
11933
|
+
|
11934
|
+
class _CreateEmbeddingsBatchJobParameters(_common.BaseModel):
|
11935
|
+
"""Config for batches.create parameters."""
|
11936
|
+
|
11937
|
+
model: Optional[str] = Field(
|
11938
|
+
default=None,
|
11939
|
+
description="""The name of the model to produces the predictions via the BatchJob.
|
11940
|
+
""",
|
11941
|
+
)
|
11942
|
+
src: Optional[EmbeddingsBatchJobSource] = Field(
|
11943
|
+
default=None,
|
11944
|
+
description="""input data to run batch job".
|
11945
|
+
""",
|
11946
|
+
)
|
11947
|
+
config: Optional[CreateEmbeddingsBatchJobConfig] = Field(
|
11948
|
+
default=None,
|
11949
|
+
description="""Optional parameters for creating a BatchJob.
|
11950
|
+
""",
|
11951
|
+
)
|
11952
|
+
|
11953
|
+
|
11954
|
+
class _CreateEmbeddingsBatchJobParametersDict(TypedDict, total=False):
|
11955
|
+
"""Config for batches.create parameters."""
|
11956
|
+
|
11957
|
+
model: Optional[str]
|
11958
|
+
"""The name of the model to produces the predictions via the BatchJob.
|
11959
|
+
"""
|
11960
|
+
|
11961
|
+
src: Optional[EmbeddingsBatchJobSourceDict]
|
11962
|
+
"""input data to run batch job".
|
11963
|
+
"""
|
11964
|
+
|
11965
|
+
config: Optional[CreateEmbeddingsBatchJobConfigDict]
|
11966
|
+
"""Optional parameters for creating a BatchJob.
|
11967
|
+
"""
|
11968
|
+
|
11969
|
+
|
11970
|
+
_CreateEmbeddingsBatchJobParametersOrDict = Union[
|
11971
|
+
_CreateEmbeddingsBatchJobParameters, _CreateEmbeddingsBatchJobParametersDict
|
11972
|
+
]
|
11973
|
+
|
11974
|
+
|
11715
11975
|
class GetBatchJobConfig(_common.BaseModel):
|
11716
11976
|
"""Optional parameters."""
|
11717
11977
|
|
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.35.0
|
4
4
|
Summary: GenAI Python SDK
|
5
5
|
Author-email: Google LLC <googleapis-packages@google.com>
|
6
6
|
License: Apache-2.0
|
@@ -30,6 +30,9 @@ Requires-Dist: websockets<15.1.0,>=13.0.0
|
|
30
30
|
Requires-Dist: typing-extensions<5.0.0,>=4.11.0
|
31
31
|
Provides-Extra: aiohttp
|
32
32
|
Requires-Dist: aiohttp<4.0.0; extra == "aiohttp"
|
33
|
+
Provides-Extra: local-tokenizer
|
34
|
+
Requires-Dist: sentencepiece>=0.2.0; extra == "local-tokenizer"
|
35
|
+
Requires-Dist: protobuf; extra == "local-tokenizer"
|
33
36
|
Dynamic: license-file
|
34
37
|
|
35
38
|
# Google Gen AI SDK
|
@@ -1063,6 +1066,20 @@ response = await client.aio.models.count_tokens(
|
|
1063
1066
|
print(response)
|
1064
1067
|
```
|
1065
1068
|
|
1069
|
+
#### Local Count Tokens
|
1070
|
+
|
1071
|
+
```python
|
1072
|
+
tokenizer = genai.LocalTokenizer(model_name='gemini-2.0-flash-001')
|
1073
|
+
result = tokenizer.count_tokens("What is your name?")
|
1074
|
+
```
|
1075
|
+
|
1076
|
+
#### Local Compute Tokens
|
1077
|
+
|
1078
|
+
```python
|
1079
|
+
tokenizer = genai.LocalTokenizer(model_name='gemini-2.0-flash-001')
|
1080
|
+
result = tokenizer.compute_tokens("What is your name?")
|
1081
|
+
```
|
1082
|
+
|
1066
1083
|
### Embed Content
|
1067
1084
|
|
1068
1085
|
```python
|
@@ -5,35 +5,35 @@ google/genai/_api_module.py,sha256=lj8eUWx8_LBGBz-49qz6_ywWm3GYp3d8Bg5JoOHbtbI,9
|
|
5
5
|
google/genai/_automatic_function_calling_util.py,sha256=xXNkJR-pzSMkeSXMz3Jw-kMHFbTJEiRJ3wocuwtWW4I,11627
|
6
6
|
google/genai/_base_transformers.py,sha256=wljA6m4tLl4XLGlBC2DNOls5N9-X9tffBq0M7i8jgpw,1034
|
7
7
|
google/genai/_base_url.py,sha256=E5H4dew14Y16qfnB3XRnjSCi19cJVlkaMNoM_8ip-PM,1597
|
8
|
-
google/genai/_common.py,sha256=
|
9
|
-
google/genai/_extra_utils.py,sha256=
|
10
|
-
google/genai/_live_converters.py,sha256=
|
8
|
+
google/genai/_common.py,sha256=VziliVbesmNtke6Fh2wk-kQlCOxEpmkqYb0y4qfKIo4,20074
|
9
|
+
google/genai/_extra_utils.py,sha256=myEPyU_-RXExXtMGitJUKEMWUPiDudScgTN9LqFC8h4,20468
|
10
|
+
google/genai/_live_converters.py,sha256=MMyDkferhBJiR3-dI8k8Rqr9LVzONtf4ibGq9FNzoew,103278
|
11
11
|
google/genai/_local_tokenizer_loader.py,sha256=cGN1F0f7hNjRIGCGTLeox7IGAZf_YcvZjSp2rCyhUak,7465
|
12
12
|
google/genai/_mcp_utils.py,sha256=HuWJ8FUjquv40Mf_QjcL5r5yXWrS-JjINsjlOSbbyAc,3870
|
13
13
|
google/genai/_operations_converters.py,sha256=I1b46qhGCeB5uHNuyrMxpFqmzWuvSFQ5pS52csd1J4E,9080
|
14
14
|
google/genai/_replay_api_client.py,sha256=hXs5NuCpcZU-e6rfeWBStZmF33_2vn1dAo3NeTA8P2o,22413
|
15
15
|
google/genai/_test_api_client.py,sha256=4ruFIy5_1qcbKqqIBu3HSQbpSOBrxiecBtDZaTGFR1s,4797
|
16
|
-
google/genai/_tokens_converters.py,sha256=
|
17
|
-
google/genai/_transformers.py,sha256=
|
18
|
-
google/genai/batches.py,sha256=
|
19
|
-
google/genai/caches.py,sha256=
|
16
|
+
google/genai/_tokens_converters.py,sha256=42xx5Inv3YMqEdarb3lmt-w54D2tpb9QEBy0DSUATQk,24963
|
17
|
+
google/genai/_transformers.py,sha256=rtaCagL4htyu8MzuxqQJ_xnJqRwwuQKR7CWXYpydBZ4,40260
|
18
|
+
google/genai/batches.py,sha256=UJ-zc2UXqQfej8bqqtgeNrepc7zDQBzRlmkRf4Wlr4U,102880
|
19
|
+
google/genai/caches.py,sha256=OuWOomIf7McQk0_jKivA-aBv__5vDc249rBEPqOh_XE,67637
|
20
20
|
google/genai/chats.py,sha256=pIBw8d13llupLn4a7vP6vnpbzDcvCCrZZ-Q2r8Cvo7g,16652
|
21
21
|
google/genai/client.py,sha256=wXnfZBSv9p-yKtX_gabUrfBXoYHuqHhzK_VgwRttMgY,10777
|
22
22
|
google/genai/errors.py,sha256=GlEvypbRgF3h5BxlocmWVf-S9kzERA_lwGLCMyAvpcY,5714
|
23
23
|
google/genai/files.py,sha256=T8uDgqCQheFwYYYJdN4lax4NOR_q6bJyr0jQf079VeE,40607
|
24
24
|
google/genai/live.py,sha256=BUyIOt-PON4SuJtKXA6l3ujzA3GUbYWMGSgZvsyKjrg,39674
|
25
25
|
google/genai/live_music.py,sha256=3GG9nsto8Vhkohcs-4CPMS4DFp1ZtMuLYzHfvEPYAeg,6971
|
26
|
-
google/genai/local_tokenizer.py,sha256=
|
27
|
-
google/genai/models.py,sha256=
|
26
|
+
google/genai/local_tokenizer.py,sha256=ZYOdZFS2nJbgDGOMrVzn2hZ_1G8I4_PuVsh6HU8jEgo,14055
|
27
|
+
google/genai/models.py,sha256=eyvuAh7Ky-rpWYBFNnXz8cjgGjvP08EYxgHBY8VInBM,268195
|
28
28
|
google/genai/operations.py,sha256=Ccm4EW13cT_EtCq8Fa3n8jlQySyy9KqJ98ZK4pF0DDA,12815
|
29
29
|
google/genai/pagers.py,sha256=m0SfWWn1EJs2k1On3DZx371qb8g2BRm_188ExsicIRc,7098
|
30
30
|
google/genai/py.typed,sha256=RsMFoLwBkAvY05t6izop4UHZtqOPLiKp3GkIEizzmQY,40
|
31
31
|
google/genai/tokens.py,sha256=8RbZ0kgvyKT3SwbgIUOHr6TTZL24v4fqYarhlA8r1ac,12503
|
32
32
|
google/genai/tunings.py,sha256=vVV9NvrtzoWDLzcTLSrgD5lzFeSRJdCB1QtfzL3yj3c,63275
|
33
|
-
google/genai/types.py,sha256=
|
34
|
-
google/genai/version.py,sha256=
|
35
|
-
google_genai-1.
|
36
|
-
google_genai-1.
|
37
|
-
google_genai-1.
|
38
|
-
google_genai-1.
|
39
|
-
google_genai-1.
|
33
|
+
google/genai/types.py,sha256=Q9DLHqo1yOtJvVwmOtfgamAWBkAZyiRxueDsERJoEWA,538267
|
34
|
+
google/genai/version.py,sha256=Pq3QZzlnd_07f54DPx_QcaEPN5OAOBRKFTVUxkd2Trc,627
|
35
|
+
google_genai-1.35.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
36
|
+
google_genai-1.35.0.dist-info/METADATA,sha256=CDRXlHeFhw_a6EcbYRhMt8YYnvcuqtB9-mYv2uN9GcM,43556
|
37
|
+
google_genai-1.35.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
38
|
+
google_genai-1.35.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
|
39
|
+
google_genai-1.35.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|