google-genai 1.13.0__py3-none-any.whl → 1.15.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/types.py CHANGED
@@ -117,6 +117,18 @@ class Mode(_common.CaseInSensitiveEnum):
117
117
  MODE_DYNAMIC = 'MODE_DYNAMIC'
118
118
 
119
119
 
120
+ class AuthType(_common.CaseInSensitiveEnum):
121
+ """Type of auth scheme."""
122
+
123
+ AUTH_TYPE_UNSPECIFIED = 'AUTH_TYPE_UNSPECIFIED'
124
+ NO_AUTH = 'NO_AUTH'
125
+ API_KEY_AUTH = 'API_KEY_AUTH'
126
+ HTTP_BASIC_AUTH = 'HTTP_BASIC_AUTH'
127
+ GOOGLE_SERVICE_ACCOUNT_AUTH = 'GOOGLE_SERVICE_ACCOUNT_AUTH'
128
+ OAUTH = 'OAUTH'
129
+ OIDC_AUTH = 'OIDC_AUTH'
130
+
131
+
120
132
  class Type(_common.CaseInSensitiveEnum):
121
133
  """Optional. The type of the data."""
122
134
 
@@ -393,6 +405,38 @@ class TurnCoverage(_common.CaseInSensitiveEnum):
393
405
  TURN_INCLUDES_ALL_INPUT = 'TURN_INCLUDES_ALL_INPUT'
394
406
 
395
407
 
408
+ class Blob(_common.BaseModel):
409
+ """Content blob."""
410
+
411
+ display_name: Optional[str] = Field(
412
+ default=None,
413
+ description="""Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is not currently used in the Gemini GenerateContent calls.""",
414
+ )
415
+ data: Optional[bytes] = Field(
416
+ default=None, description="""Required. Raw bytes."""
417
+ )
418
+ mime_type: Optional[str] = Field(
419
+ default=None,
420
+ description="""Required. The IANA standard MIME type of the source data.""",
421
+ )
422
+
423
+
424
+ class BlobDict(TypedDict, total=False):
425
+ """Content blob."""
426
+
427
+ display_name: Optional[str]
428
+ """Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is not currently used in the Gemini GenerateContent calls."""
429
+
430
+ data: Optional[bytes]
431
+ """Required. Raw bytes."""
432
+
433
+ mime_type: Optional[str]
434
+ """Required. The IANA standard MIME type of the source data."""
435
+
436
+
437
+ BlobOrDict = Union[Blob, BlobDict]
438
+
439
+
396
440
  class VideoMetadata(_common.BaseModel):
397
441
  """Metadata describes the input video content."""
398
442
 
@@ -576,31 +620,6 @@ class FunctionResponseDict(TypedDict, total=False):
576
620
  FunctionResponseOrDict = Union[FunctionResponse, FunctionResponseDict]
577
621
 
578
622
 
579
- class Blob(_common.BaseModel):
580
- """Content blob."""
581
-
582
- data: Optional[bytes] = Field(
583
- default=None, description="""Required. Raw bytes."""
584
- )
585
- mime_type: Optional[str] = Field(
586
- default=None,
587
- description="""Required. The IANA standard MIME type of the source data.""",
588
- )
589
-
590
-
591
- class BlobDict(TypedDict, total=False):
592
- """Content blob."""
593
-
594
- data: Optional[bytes]
595
- """Required. Raw bytes."""
596
-
597
- mime_type: Optional[str]
598
- """Required. The IANA standard MIME type of the source data."""
599
-
600
-
601
- BlobOrDict = Union[Blob, BlobDict]
602
-
603
-
604
623
  class Part(_common.BaseModel):
605
624
  """A datatype containing media content.
606
625
 
@@ -616,6 +635,9 @@ class Part(_common.BaseModel):
616
635
  default=None,
617
636
  description="""Indicates if the part is thought from the model.""",
618
637
  )
638
+ inline_data: Optional[Blob] = Field(
639
+ default=None, description="""Optional. Inlined bytes data."""
640
+ )
619
641
  code_execution_result: Optional[CodeExecutionResult] = Field(
620
642
  default=None,
621
643
  description="""Optional. Result of executing the [ExecutableCode].""",
@@ -635,9 +657,6 @@ class Part(_common.BaseModel):
635
657
  default=None,
636
658
  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.""",
637
659
  )
638
- inline_data: Optional[Blob] = Field(
639
- default=None, description="""Optional. Inlined bytes data."""
640
- )
641
660
  text: Optional[str] = Field(
642
661
  default=None, description="""Optional. Text part (can be code)."""
643
662
  )
@@ -713,6 +732,9 @@ class PartDict(TypedDict, total=False):
713
732
  thought: Optional[bool]
714
733
  """Indicates if the part is thought from the model."""
715
734
 
735
+ inline_data: Optional[BlobDict]
736
+ """Optional. Inlined bytes data."""
737
+
716
738
  code_execution_result: Optional[CodeExecutionResultDict]
717
739
  """Optional. Result of executing the [ExecutableCode]."""
718
740
 
@@ -728,9 +750,6 @@ class PartDict(TypedDict, total=False):
728
750
  function_response: Optional[FunctionResponseDict]
729
751
  """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."""
730
752
 
731
- inline_data: Optional[BlobDict]
732
- """Optional. Inlined bytes data."""
733
-
734
753
  text: Optional[str]
735
754
  """Optional. Text part (can be code)."""
736
755
 
@@ -998,6 +1017,210 @@ GoogleSearchRetrievalOrDict = Union[
998
1017
  ]
999
1018
 
1000
1019
 
1020
+ class EnterpriseWebSearch(_common.BaseModel):
1021
+ """Tool to search public web data, powered by Vertex AI Search and Sec4 compliance."""
1022
+
1023
+ pass
1024
+
1025
+
1026
+ class EnterpriseWebSearchDict(TypedDict, total=False):
1027
+ """Tool to search public web data, powered by Vertex AI Search and Sec4 compliance."""
1028
+
1029
+ pass
1030
+
1031
+
1032
+ EnterpriseWebSearchOrDict = Union[EnterpriseWebSearch, EnterpriseWebSearchDict]
1033
+
1034
+
1035
+ class ApiKeyConfig(_common.BaseModel):
1036
+ """Config for authentication with API key."""
1037
+
1038
+ api_key_string: Optional[str] = Field(
1039
+ default=None,
1040
+ description="""The API key to be used in the request directly.""",
1041
+ )
1042
+
1043
+
1044
+ class ApiKeyConfigDict(TypedDict, total=False):
1045
+ """Config for authentication with API key."""
1046
+
1047
+ api_key_string: Optional[str]
1048
+ """The API key to be used in the request directly."""
1049
+
1050
+
1051
+ ApiKeyConfigOrDict = Union[ApiKeyConfig, ApiKeyConfigDict]
1052
+
1053
+
1054
+ class AuthConfigGoogleServiceAccountConfig(_common.BaseModel):
1055
+ """Config for Google Service Account Authentication."""
1056
+
1057
+ service_account: Optional[str] = Field(
1058
+ default=None,
1059
+ description="""Optional. The service account that the extension execution service runs as. - If the service account is specified, the `iam.serviceAccounts.getAccessToken` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified service account. - If not specified, the Vertex AI Extension Service Agent will be used to execute the Extension.""",
1060
+ )
1061
+
1062
+
1063
+ class AuthConfigGoogleServiceAccountConfigDict(TypedDict, total=False):
1064
+ """Config for Google Service Account Authentication."""
1065
+
1066
+ service_account: Optional[str]
1067
+ """Optional. The service account that the extension execution service runs as. - If the service account is specified, the `iam.serviceAccounts.getAccessToken` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified service account. - If not specified, the Vertex AI Extension Service Agent will be used to execute the Extension."""
1068
+
1069
+
1070
+ AuthConfigGoogleServiceAccountConfigOrDict = Union[
1071
+ AuthConfigGoogleServiceAccountConfig,
1072
+ AuthConfigGoogleServiceAccountConfigDict,
1073
+ ]
1074
+
1075
+
1076
+ class AuthConfigHttpBasicAuthConfig(_common.BaseModel):
1077
+ """Config for HTTP Basic Authentication."""
1078
+
1079
+ credential_secret: Optional[str] = Field(
1080
+ default=None,
1081
+ description="""Required. The name of the SecretManager secret version resource storing the base64 encoded credentials. Format: `projects/{project}/secrets/{secrete}/versions/{version}` - If specified, the `secretmanager.versions.access` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource.""",
1082
+ )
1083
+
1084
+
1085
+ class AuthConfigHttpBasicAuthConfigDict(TypedDict, total=False):
1086
+ """Config for HTTP Basic Authentication."""
1087
+
1088
+ credential_secret: Optional[str]
1089
+ """Required. The name of the SecretManager secret version resource storing the base64 encoded credentials. Format: `projects/{project}/secrets/{secrete}/versions/{version}` - If specified, the `secretmanager.versions.access` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource."""
1090
+
1091
+
1092
+ AuthConfigHttpBasicAuthConfigOrDict = Union[
1093
+ AuthConfigHttpBasicAuthConfig, AuthConfigHttpBasicAuthConfigDict
1094
+ ]
1095
+
1096
+
1097
+ class AuthConfigOauthConfig(_common.BaseModel):
1098
+ """Config for user oauth."""
1099
+
1100
+ access_token: Optional[str] = Field(
1101
+ default=None,
1102
+ description="""Access token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.""",
1103
+ )
1104
+ service_account: Optional[str] = Field(
1105
+ default=None,
1106
+ description="""The service account used to generate access tokens for executing the Extension. - If the service account is specified, the `iam.serviceAccounts.getAccessToken` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the provided service account.""",
1107
+ )
1108
+
1109
+
1110
+ class AuthConfigOauthConfigDict(TypedDict, total=False):
1111
+ """Config for user oauth."""
1112
+
1113
+ access_token: Optional[str]
1114
+ """Access token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time."""
1115
+
1116
+ service_account: Optional[str]
1117
+ """The service account used to generate access tokens for executing the Extension. - If the service account is specified, the `iam.serviceAccounts.getAccessToken` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the provided service account."""
1118
+
1119
+
1120
+ AuthConfigOauthConfigOrDict = Union[
1121
+ AuthConfigOauthConfig, AuthConfigOauthConfigDict
1122
+ ]
1123
+
1124
+
1125
+ class AuthConfigOidcConfig(_common.BaseModel):
1126
+ """Config for user OIDC auth."""
1127
+
1128
+ id_token: Optional[str] = Field(
1129
+ default=None,
1130
+ description="""OpenID Connect formatted ID token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.""",
1131
+ )
1132
+ service_account: Optional[str] = Field(
1133
+ default=None,
1134
+ description="""The service account used to generate an OpenID Connect (OIDC)-compatible JWT token signed by the Google OIDC Provider (accounts.google.com) for extension endpoint (https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-oidc). - The audience for the token will be set to the URL in the server url defined in the OpenApi spec. - If the service account is provided, the service account should grant `iam.serviceAccounts.getOpenIdToken` permission to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents).""",
1135
+ )
1136
+
1137
+
1138
+ class AuthConfigOidcConfigDict(TypedDict, total=False):
1139
+ """Config for user OIDC auth."""
1140
+
1141
+ id_token: Optional[str]
1142
+ """OpenID Connect formatted ID token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time."""
1143
+
1144
+ service_account: Optional[str]
1145
+ """The service account used to generate an OpenID Connect (OIDC)-compatible JWT token signed by the Google OIDC Provider (accounts.google.com) for extension endpoint (https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-oidc). - The audience for the token will be set to the URL in the server url defined in the OpenApi spec. - If the service account is provided, the service account should grant `iam.serviceAccounts.getOpenIdToken` permission to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents)."""
1146
+
1147
+
1148
+ AuthConfigOidcConfigOrDict = Union[
1149
+ AuthConfigOidcConfig, AuthConfigOidcConfigDict
1150
+ ]
1151
+
1152
+
1153
+ class AuthConfig(_common.BaseModel):
1154
+ """Auth configuration to run the extension."""
1155
+
1156
+ api_key_config: Optional[ApiKeyConfig] = Field(
1157
+ default=None, description="""Config for API key auth."""
1158
+ )
1159
+ auth_type: Optional[AuthType] = Field(
1160
+ default=None, description="""Type of auth scheme."""
1161
+ )
1162
+ google_service_account_config: Optional[
1163
+ AuthConfigGoogleServiceAccountConfig
1164
+ ] = Field(
1165
+ default=None, description="""Config for Google Service Account auth."""
1166
+ )
1167
+ http_basic_auth_config: Optional[AuthConfigHttpBasicAuthConfig] = Field(
1168
+ default=None, description="""Config for HTTP Basic auth."""
1169
+ )
1170
+ oauth_config: Optional[AuthConfigOauthConfig] = Field(
1171
+ default=None, description="""Config for user oauth."""
1172
+ )
1173
+ oidc_config: Optional[AuthConfigOidcConfig] = Field(
1174
+ default=None, description="""Config for user OIDC auth."""
1175
+ )
1176
+
1177
+
1178
+ class AuthConfigDict(TypedDict, total=False):
1179
+ """Auth configuration to run the extension."""
1180
+
1181
+ api_key_config: Optional[ApiKeyConfigDict]
1182
+ """Config for API key auth."""
1183
+
1184
+ auth_type: Optional[AuthType]
1185
+ """Type of auth scheme."""
1186
+
1187
+ google_service_account_config: Optional[
1188
+ AuthConfigGoogleServiceAccountConfigDict
1189
+ ]
1190
+ """Config for Google Service Account auth."""
1191
+
1192
+ http_basic_auth_config: Optional[AuthConfigHttpBasicAuthConfigDict]
1193
+ """Config for HTTP Basic auth."""
1194
+
1195
+ oauth_config: Optional[AuthConfigOauthConfigDict]
1196
+ """Config for user oauth."""
1197
+
1198
+ oidc_config: Optional[AuthConfigOidcConfigDict]
1199
+ """Config for user OIDC auth."""
1200
+
1201
+
1202
+ AuthConfigOrDict = Union[AuthConfig, AuthConfigDict]
1203
+
1204
+
1205
+ class GoogleMaps(_common.BaseModel):
1206
+ """Tool to support Google Maps in Model."""
1207
+
1208
+ auth_config: Optional[AuthConfig] = Field(
1209
+ default=None,
1210
+ description="""Optional. Auth config for the Google Maps tool.""",
1211
+ )
1212
+
1213
+
1214
+ class GoogleMapsDict(TypedDict, total=False):
1215
+ """Tool to support Google Maps in Model."""
1216
+
1217
+ auth_config: Optional[AuthConfigDict]
1218
+ """Optional. Auth config for the Google Maps tool."""
1219
+
1220
+
1221
+ GoogleMapsOrDict = Union[GoogleMaps, GoogleMapsDict]
1222
+
1223
+
1001
1224
  class VertexAISearch(_common.BaseModel):
1002
1225
  """Retrieve from Vertex AI Search datastore or engine for grounding.
1003
1226
 
@@ -2120,6 +2343,16 @@ class Tool(_common.BaseModel):
2120
2343
  default=None,
2121
2344
  description="""Optional. GoogleSearchRetrieval tool type. Specialized retrieval tool that is powered by Google search.""",
2122
2345
  )
2346
+ enterprise_web_search: Optional[EnterpriseWebSearch] = Field(
2347
+ default=None,
2348
+ description="""Optional. Enterprise web search tool type. Specialized retrieval
2349
+ tool that is powered by Vertex AI Search and Sec4 compliance.""",
2350
+ )
2351
+ google_maps: Optional[GoogleMaps] = Field(
2352
+ default=None,
2353
+ description="""Optional. Google Maps tool type. Specialized retrieval tool
2354
+ that is powered by Google Maps.""",
2355
+ )
2123
2356
  code_execution: Optional[ToolCodeExecution] = Field(
2124
2357
  default=None,
2125
2358
  description="""Optional. CodeExecution tool type. Enables the model to execute code as part of generation. This field is only used by the Gemini Developer API services.""",
@@ -2143,6 +2376,14 @@ class ToolDict(TypedDict, total=False):
2143
2376
  google_search_retrieval: Optional[GoogleSearchRetrievalDict]
2144
2377
  """Optional. GoogleSearchRetrieval tool type. Specialized retrieval tool that is powered by Google search."""
2145
2378
 
2379
+ enterprise_web_search: Optional[EnterpriseWebSearchDict]
2380
+ """Optional. Enterprise web search tool type. Specialized retrieval
2381
+ tool that is powered by Vertex AI Search and Sec4 compliance."""
2382
+
2383
+ google_maps: Optional[GoogleMapsDict]
2384
+ """Optional. Google Maps tool type. Specialized retrieval tool
2385
+ that is powered by Google Maps."""
2386
+
2146
2387
  code_execution: Optional[ToolCodeExecutionDict]
2147
2388
  """Optional. CodeExecution tool type. Enables the model to execute code as part of generation. This field is only used by the Gemini Developer API services."""
2148
2389
 
@@ -2187,6 +2428,62 @@ FunctionCallingConfigOrDict = Union[
2187
2428
  ]
2188
2429
 
2189
2430
 
2431
+ class LatLng(_common.BaseModel):
2432
+ """An object that represents a latitude/longitude pair.
2433
+
2434
+ This is expressed as a pair of doubles to represent degrees latitude and
2435
+ degrees longitude. Unless specified otherwise, this object must conform to the
2436
+ <a href="https://en.wikipedia.org/wiki/World_Geodetic_System#1984_version">
2437
+ WGS84 standard</a>. Values must be within normalized ranges.
2438
+ """
2439
+
2440
+ latitude: Optional[float] = Field(
2441
+ default=None,
2442
+ description="""The latitude in degrees. It must be in the range [-90.0, +90.0].""",
2443
+ )
2444
+ longitude: Optional[float] = Field(
2445
+ default=None,
2446
+ description="""The longitude in degrees. It must be in the range [-180.0, +180.0]""",
2447
+ )
2448
+
2449
+
2450
+ class LatLngDict(TypedDict, total=False):
2451
+ """An object that represents a latitude/longitude pair.
2452
+
2453
+ This is expressed as a pair of doubles to represent degrees latitude and
2454
+ degrees longitude. Unless specified otherwise, this object must conform to the
2455
+ <a href="https://en.wikipedia.org/wiki/World_Geodetic_System#1984_version">
2456
+ WGS84 standard</a>. Values must be within normalized ranges.
2457
+ """
2458
+
2459
+ latitude: Optional[float]
2460
+ """The latitude in degrees. It must be in the range [-90.0, +90.0]."""
2461
+
2462
+ longitude: Optional[float]
2463
+ """The longitude in degrees. It must be in the range [-180.0, +180.0]"""
2464
+
2465
+
2466
+ LatLngOrDict = Union[LatLng, LatLngDict]
2467
+
2468
+
2469
+ class RetrievalConfig(_common.BaseModel):
2470
+ """Retrieval config."""
2471
+
2472
+ lat_lng: Optional[LatLng] = Field(
2473
+ default=None, description="""Optional. The location of the user."""
2474
+ )
2475
+
2476
+
2477
+ class RetrievalConfigDict(TypedDict, total=False):
2478
+ """Retrieval config."""
2479
+
2480
+ lat_lng: Optional[LatLngDict]
2481
+ """Optional. The location of the user."""
2482
+
2483
+
2484
+ RetrievalConfigOrDict = Union[RetrievalConfig, RetrievalConfigDict]
2485
+
2486
+
2190
2487
  class ToolConfig(_common.BaseModel):
2191
2488
  """Tool config.
2192
2489
 
@@ -2196,6 +2493,9 @@ class ToolConfig(_common.BaseModel):
2196
2493
  function_calling_config: Optional[FunctionCallingConfig] = Field(
2197
2494
  default=None, description="""Optional. Function calling config."""
2198
2495
  )
2496
+ retrieval_config: Optional[RetrievalConfig] = Field(
2497
+ default=None, description="""Optional. Retrieval config."""
2498
+ )
2199
2499
 
2200
2500
 
2201
2501
  class ToolConfigDict(TypedDict, total=False):
@@ -2207,6 +2507,9 @@ class ToolConfigDict(TypedDict, total=False):
2207
2507
  function_calling_config: Optional[FunctionCallingConfigDict]
2208
2508
  """Optional. Function calling config."""
2209
2509
 
2510
+ retrieval_config: Optional[RetrievalConfigDict]
2511
+ """Optional. Retrieval config."""
2512
+
2210
2513
 
2211
2514
  ToolConfigOrDict = Union[ToolConfig, ToolConfigDict]
2212
2515
 
@@ -2695,12 +2998,23 @@ class GenerateContentConfig(_common.BaseModel):
2695
2998
  )
2696
2999
  response_mime_type: Optional[str] = Field(
2697
3000
  default=None,
2698
- description="""Output response media type of the generated candidate text.
3001
+ description="""Output response mimetype of the generated candidate text.
3002
+ Supported mimetype:
3003
+ - `text/plain`: (default) Text output.
3004
+ - `application/json`: JSON response in the candidates.
3005
+ The model needs to be prompted to output the appropriate response type,
3006
+ otherwise the behavior is undefined.
3007
+ This is a preview feature.
2699
3008
  """,
2700
3009
  )
2701
3010
  response_schema: Optional[SchemaUnion] = Field(
2702
3011
  default=None,
2703
- description="""Schema that the generated candidate text must adhere to.
3012
+ description="""The `Schema` object allows the definition of input and output data types.
3013
+ These types can be objects, but also primitives and arrays.
3014
+ Represents a select subset of an [OpenAPI 3.0 schema
3015
+ object](https://spec.openapis.org/oas/v3.0.3#schema).
3016
+ If set, a compatible response_mime_type must also be set.
3017
+ Compatible mimetypes: `application/json`: Schema for JSON response.
2704
3018
  """,
2705
3019
  )
2706
3020
  routing_config: Optional[GenerationConfigRoutingConfig] = Field(
@@ -2867,11 +3181,22 @@ class GenerateContentConfigDict(TypedDict, total=False):
2867
3181
  """
2868
3182
 
2869
3183
  response_mime_type: Optional[str]
2870
- """Output response media type of the generated candidate text.
3184
+ """Output response mimetype of the generated candidate text.
3185
+ Supported mimetype:
3186
+ - `text/plain`: (default) Text output.
3187
+ - `application/json`: JSON response in the candidates.
3188
+ The model needs to be prompted to output the appropriate response type,
3189
+ otherwise the behavior is undefined.
3190
+ This is a preview feature.
2871
3191
  """
2872
3192
 
2873
3193
  response_schema: Optional[SchemaUnionDict]
2874
- """Schema that the generated candidate text must adhere to.
3194
+ """The `Schema` object allows the definition of input and output data types.
3195
+ These types can be objects, but also primitives and arrays.
3196
+ Represents a select subset of an [OpenAPI 3.0 schema
3197
+ object](https://spec.openapis.org/oas/v3.0.3#schema).
3198
+ If set, a compatible response_mime_type must also be set.
3199
+ Compatible mimetypes: `application/json`: Schema for JSON response.
2875
3200
  """
2876
3201
 
2877
3202
  routing_config: Optional[GenerationConfigRoutingConfigDict]
@@ -5153,7 +5478,7 @@ EditImageResponseOrDict = Union[EditImageResponse, EditImageResponseDict]
5153
5478
 
5154
5479
 
5155
5480
  class _UpscaleImageAPIConfig(_common.BaseModel):
5156
- """API config for UpscaleImage with fields not exposed to users.
5481
+ """Internal API config for UpscaleImage.
5157
5482
 
5158
5483
  These fields require default values sent to the API which are not intended
5159
5484
  to be modifiable or exposed to users in the SDK method.
@@ -5181,7 +5506,7 @@ class _UpscaleImageAPIConfig(_common.BaseModel):
5181
5506
 
5182
5507
 
5183
5508
  class _UpscaleImageAPIConfigDict(TypedDict, total=False):
5184
- """API config for UpscaleImage with fields not exposed to users.
5509
+ """Internal API config for UpscaleImage.
5185
5510
 
5186
5511
  These fields require default values sent to the API which are not intended
5187
5512
  to be modifiable or exposed to users in the SDK method.
@@ -5366,6 +5691,45 @@ class TunedModelInfoDict(TypedDict, total=False):
5366
5691
  TunedModelInfoOrDict = Union[TunedModelInfo, TunedModelInfoDict]
5367
5692
 
5368
5693
 
5694
+ class Checkpoint(_common.BaseModel):
5695
+ """Describes the machine learning model version checkpoint."""
5696
+
5697
+ checkpoint_id: Optional[str] = Field(
5698
+ default=None,
5699
+ description="""The ID of the checkpoint.
5700
+ """,
5701
+ )
5702
+ epoch: Optional[int] = Field(
5703
+ default=None,
5704
+ description="""The epoch of the checkpoint.
5705
+ """,
5706
+ )
5707
+ step: Optional[int] = Field(
5708
+ default=None,
5709
+ description="""The step of the checkpoint.
5710
+ """,
5711
+ )
5712
+
5713
+
5714
+ class CheckpointDict(TypedDict, total=False):
5715
+ """Describes the machine learning model version checkpoint."""
5716
+
5717
+ checkpoint_id: Optional[str]
5718
+ """The ID of the checkpoint.
5719
+ """
5720
+
5721
+ epoch: Optional[int]
5722
+ """The epoch of the checkpoint.
5723
+ """
5724
+
5725
+ step: Optional[int]
5726
+ """The step of the checkpoint.
5727
+ """
5728
+
5729
+
5730
+ CheckpointOrDict = Union[Checkpoint, CheckpointDict]
5731
+
5732
+
5369
5733
  class Model(_common.BaseModel):
5370
5734
  """A trained machine learning model."""
5371
5735
 
@@ -5410,6 +5774,14 @@ class Model(_common.BaseModel):
5410
5774
  default=None,
5411
5775
  description="""List of actions that are supported by the model.""",
5412
5776
  )
5777
+ default_checkpoint_id: Optional[str] = Field(
5778
+ default=None,
5779
+ description="""The default checkpoint id of a model version.
5780
+ """,
5781
+ )
5782
+ checkpoints: Optional[list[Checkpoint]] = Field(
5783
+ default=None, description="""The checkpoints of the model."""
5784
+ )
5413
5785
 
5414
5786
 
5415
5787
  class ModelDict(TypedDict, total=False):
@@ -5449,6 +5821,13 @@ class ModelDict(TypedDict, total=False):
5449
5821
  supported_actions: Optional[list[str]]
5450
5822
  """List of actions that are supported by the model."""
5451
5823
 
5824
+ default_checkpoint_id: Optional[str]
5825
+ """The default checkpoint id of a model version.
5826
+ """
5827
+
5828
+ checkpoints: Optional[list[CheckpointDict]]
5829
+ """The checkpoints of the model."""
5830
+
5452
5831
 
5453
5832
  ModelOrDict = Union[Model, ModelDict]
5454
5833
 
@@ -5530,6 +5909,7 @@ class UpdateModelConfig(_common.BaseModel):
5530
5909
  )
5531
5910
  display_name: Optional[str] = Field(default=None, description="""""")
5532
5911
  description: Optional[str] = Field(default=None, description="""""")
5912
+ default_checkpoint_id: Optional[str] = Field(default=None, description="""""")
5533
5913
 
5534
5914
 
5535
5915
  class UpdateModelConfigDict(TypedDict, total=False):
@@ -5544,6 +5924,9 @@ class UpdateModelConfigDict(TypedDict, total=False):
5544
5924
  description: Optional[str]
5545
5925
  """"""
5546
5926
 
5927
+ default_checkpoint_id: Optional[str]
5928
+ """"""
5929
+
5547
5930
 
5548
5931
  UpdateModelConfigOrDict = Union[UpdateModelConfig, UpdateModelConfigDict]
5549
5932
 
@@ -6323,6 +6706,58 @@ _GetTuningJobParametersOrDict = Union[
6323
6706
  ]
6324
6707
 
6325
6708
 
6709
+ class TunedModelCheckpoint(_common.BaseModel):
6710
+ """TunedModelCheckpoint for the Tuned Model of a Tuning Job."""
6711
+
6712
+ checkpoint_id: Optional[str] = Field(
6713
+ default=None,
6714
+ description="""The ID of the checkpoint.
6715
+ """,
6716
+ )
6717
+ epoch: Optional[int] = Field(
6718
+ default=None,
6719
+ description="""The epoch of the checkpoint.
6720
+ """,
6721
+ )
6722
+ step: Optional[int] = Field(
6723
+ default=None,
6724
+ description="""The step of the checkpoint.
6725
+ """,
6726
+ )
6727
+ endpoint: Optional[str] = Field(
6728
+ default=None,
6729
+ description="""The Endpoint resource name that the checkpoint is deployed to.
6730
+ Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`.
6731
+ """,
6732
+ )
6733
+
6734
+
6735
+ class TunedModelCheckpointDict(TypedDict, total=False):
6736
+ """TunedModelCheckpoint for the Tuned Model of a Tuning Job."""
6737
+
6738
+ checkpoint_id: Optional[str]
6739
+ """The ID of the checkpoint.
6740
+ """
6741
+
6742
+ epoch: Optional[int]
6743
+ """The epoch of the checkpoint.
6744
+ """
6745
+
6746
+ step: Optional[int]
6747
+ """The step of the checkpoint.
6748
+ """
6749
+
6750
+ endpoint: Optional[str]
6751
+ """The Endpoint resource name that the checkpoint is deployed to.
6752
+ Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`.
6753
+ """
6754
+
6755
+
6756
+ TunedModelCheckpointOrDict = Union[
6757
+ TunedModelCheckpoint, TunedModelCheckpointDict
6758
+ ]
6759
+
6760
+
6326
6761
  class TunedModel(_common.BaseModel):
6327
6762
 
6328
6763
  model: Optional[str] = Field(
@@ -6333,6 +6768,12 @@ class TunedModel(_common.BaseModel):
6333
6768
  default=None,
6334
6769
  description="""Output only. A resource name of an Endpoint. Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`.""",
6335
6770
  )
6771
+ checkpoints: Optional[list[TunedModelCheckpoint]] = Field(
6772
+ default=None,
6773
+ description="""The checkpoints associated with this TunedModel.
6774
+ This field is only populated for tuning jobs that enable intermediate
6775
+ checkpoints.""",
6776
+ )
6336
6777
 
6337
6778
 
6338
6779
  class TunedModelDict(TypedDict, total=False):
@@ -6343,6 +6784,11 @@ class TunedModelDict(TypedDict, total=False):
6343
6784
  endpoint: Optional[str]
6344
6785
  """Output only. A resource name of an Endpoint. Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`."""
6345
6786
 
6787
+ checkpoints: Optional[list[TunedModelCheckpointDict]]
6788
+ """The checkpoints associated with this TunedModel.
6789
+ This field is only populated for tuning jobs that enable intermediate
6790
+ checkpoints."""
6791
+
6346
6792
 
6347
6793
  TunedModelOrDict = Union[TunedModel, TunedModelDict]
6348
6794
 
@@ -6440,6 +6886,10 @@ class SupervisedTuningSpec(_common.BaseModel):
6440
6886
  default=None,
6441
6887
  description="""Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file.""",
6442
6888
  )
6889
+ export_last_checkpoint_only: Optional[bool] = Field(
6890
+ default=None,
6891
+ description="""Optional. If set to true, disable intermediate checkpoints for SFT and only the last checkpoint will be exported.""",
6892
+ )
6443
6893
 
6444
6894
 
6445
6895
  class SupervisedTuningSpecDict(TypedDict, total=False):
@@ -6454,6 +6904,9 @@ class SupervisedTuningSpecDict(TypedDict, total=False):
6454
6904
  validation_dataset_uri: Optional[str]
6455
6905
  """Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file."""
6456
6906
 
6907
+ export_last_checkpoint_only: Optional[bool]
6908
+ """Optional. If set to true, disable intermediate checkpoints for SFT and only the last checkpoint will be exported."""
6909
+
6457
6910
 
6458
6911
  SupervisedTuningSpecOrDict = Union[
6459
6912
  SupervisedTuningSpec, SupervisedTuningSpecDict
@@ -7365,6 +7818,10 @@ class CreateTuningJobConfig(_common.BaseModel):
7365
7818
  default=None,
7366
7819
  description="""Multiplier for adjusting the default learning rate.""",
7367
7820
  )
7821
+ export_last_checkpoint_only: Optional[bool] = Field(
7822
+ default=None,
7823
+ description="""If set to true, disable intermediate checkpoints for SFT and only the last checkpoint will be exported. Otherwise, enable intermediate checkpoints for SFT.""",
7824
+ )
7368
7825
  adapter_size: Optional[AdapterSize] = Field(
7369
7826
  default=None, description="""Adapter size for tuning."""
7370
7827
  )
@@ -7399,6 +7856,9 @@ class CreateTuningJobConfigDict(TypedDict, total=False):
7399
7856
  learning_rate_multiplier: Optional[float]
7400
7857
  """Multiplier for adjusting the default learning rate."""
7401
7858
 
7859
+ export_last_checkpoint_only: Optional[bool]
7860
+ """If set to true, disable intermediate checkpoints for SFT and only the last checkpoint will be exported. Otherwise, enable intermediate checkpoints for SFT."""
7861
+
7402
7862
  adapter_size: Optional[AdapterSize]
7403
7863
  """Adapter size for tuning."""
7404
7864
 
@@ -9914,11 +10374,23 @@ class LiveServerMessage(_common.BaseModel):
9914
10374
  ):
9915
10375
  return None
9916
10376
  text = ''
10377
+ non_text_parts = []
9917
10378
  for part in self.server_content.model_turn.parts:
10379
+ for field_name, field_value in part.model_dump(
10380
+ exclude={'text', 'thought'}
10381
+ ).items():
10382
+ if field_value is not None:
10383
+ non_text_parts.append(field_name)
9918
10384
  if isinstance(part.text, str):
9919
10385
  if isinstance(part.thought, bool) and part.thought:
9920
10386
  continue
9921
10387
  text += part.text
10388
+ if non_text_parts:
10389
+ logger.warning(
10390
+ 'Warning: there are non-text parts in the response:'
10391
+ f' {non_text_parts}, returning concatenated text result from text'
10392
+ ' parts, check out the non text parts for full response from model.'
10393
+ )
9922
10394
  return text if text else None
9923
10395
 
9924
10396
  @property
@@ -9932,9 +10404,21 @@ class LiveServerMessage(_common.BaseModel):
9932
10404
  ):
9933
10405
  return None
9934
10406
  concatenated_data = b''
10407
+ non_data_parts = []
9935
10408
  for part in self.server_content.model_turn.parts:
10409
+ for field_name, field_value in part.model_dump(
10410
+ exclude={'inline_data'}
10411
+ ).items():
10412
+ if field_value is not None:
10413
+ non_data_parts.append(field_name)
9936
10414
  if part.inline_data and isinstance(part.inline_data.data, bytes):
9937
10415
  concatenated_data += part.inline_data.data
10416
+ if non_data_parts:
10417
+ logger.warning(
10418
+ 'Warning: there are non-data parts in the response:'
10419
+ f' {non_data_parts}, returning concatenated data result from data'
10420
+ ' parts, check out the non data parts for full response from model.'
10421
+ )
9938
10422
  return concatenated_data if len(concatenated_data) > 0 else None
9939
10423
 
9940
10424
 
@@ -10212,6 +10696,17 @@ class LiveClientSetup(_common.BaseModel):
10212
10696
 
10213
10697
  If included, server will compress context window to fit into given length.""",
10214
10698
  )
10699
+ input_audio_transcription: Optional[AudioTranscriptionConfig] = Field(
10700
+ default=None,
10701
+ description="""The transcription of the input aligns with the input audio language.
10702
+ """,
10703
+ )
10704
+ output_audio_transcription: Optional[AudioTranscriptionConfig] = Field(
10705
+ default=None,
10706
+ description="""The transcription of the output aligns with the language code
10707
+ specified for the output audio.
10708
+ """,
10709
+ )
10215
10710
 
10216
10711
 
10217
10712
  class LiveClientSetupDict(TypedDict, total=False):
@@ -10250,6 +10745,15 @@ class LiveClientSetupDict(TypedDict, total=False):
10250
10745
 
10251
10746
  If included, server will compress context window to fit into given length."""
10252
10747
 
10748
+ input_audio_transcription: Optional[AudioTranscriptionConfigDict]
10749
+ """The transcription of the input aligns with the input audio language.
10750
+ """
10751
+
10752
+ output_audio_transcription: Optional[AudioTranscriptionConfigDict]
10753
+ """The transcription of the output aligns with the language code
10754
+ specified for the output audio.
10755
+ """
10756
+
10253
10757
 
10254
10758
  LiveClientSetupOrDict = Union[LiveClientSetup, LiveClientSetupDict]
10255
10759
 
@@ -10452,6 +10956,87 @@ LiveClientRealtimeInputOrDict = Union[
10452
10956
  LiveClientRealtimeInput, LiveClientRealtimeInputDict
10453
10957
  ]
10454
10958
 
10959
+ if _is_pillow_image_imported:
10960
+ BlobImageUnion = Union[Blob, PIL_Image]
10961
+ else:
10962
+ BlobImageUnion = Blob # type: ignore[misc]
10963
+
10964
+
10965
+ BlobImageUnionDict = Union[BlobImageUnion, BlobDict]
10966
+
10967
+
10968
+ class LiveSendRealtimeInputParameters(_common.BaseModel):
10969
+ """Parameters for sending realtime input to the live API."""
10970
+
10971
+ media: Optional[BlobImageUnion] = Field(
10972
+ default=None, description="""Realtime input to send to the session."""
10973
+ )
10974
+ audio: Optional[Blob] = Field(
10975
+ default=None, description="""The realtime audio input stream."""
10976
+ )
10977
+ audio_stream_end: Optional[bool] = Field(
10978
+ default=None,
10979
+ description="""
10980
+ Indicates that the audio stream has ended, e.g. because the microphone was
10981
+ turned off.
10982
+
10983
+ This should only be sent when automatic activity detection is enabled
10984
+ (which is the default).
10985
+
10986
+ The client can reopen the stream by sending an audio message.
10987
+ """,
10988
+ )
10989
+ video: Optional[BlobImageUnion] = Field(
10990
+ default=None, description="""The realtime video input stream."""
10991
+ )
10992
+ text: Optional[str] = Field(
10993
+ default=None, description="""The realtime text input stream."""
10994
+ )
10995
+ activity_start: Optional[ActivityStart] = Field(
10996
+ default=None, description="""Marks the start of user activity."""
10997
+ )
10998
+ activity_end: Optional[ActivityEnd] = Field(
10999
+ default=None, description="""Marks the end of user activity."""
11000
+ )
11001
+
11002
+
11003
+ class LiveSendRealtimeInputParametersDict(TypedDict, total=False):
11004
+ """Parameters for sending realtime input to the live API."""
11005
+
11006
+ media: Optional[BlobImageUnionDict]
11007
+ """Realtime input to send to the session."""
11008
+
11009
+ audio: Optional[BlobDict]
11010
+ """The realtime audio input stream."""
11011
+
11012
+ audio_stream_end: Optional[bool]
11013
+ """
11014
+ Indicates that the audio stream has ended, e.g. because the microphone was
11015
+ turned off.
11016
+
11017
+ This should only be sent when automatic activity detection is enabled
11018
+ (which is the default).
11019
+
11020
+ The client can reopen the stream by sending an audio message.
11021
+ """
11022
+
11023
+ video: Optional[BlobImageUnionDict]
11024
+ """The realtime video input stream."""
11025
+
11026
+ text: Optional[str]
11027
+ """The realtime text input stream."""
11028
+
11029
+ activity_start: Optional[ActivityStartDict]
11030
+ """Marks the start of user activity."""
11031
+
11032
+ activity_end: Optional[ActivityEndDict]
11033
+ """Marks the end of user activity."""
11034
+
11035
+
11036
+ LiveSendRealtimeInputParametersOrDict = Union[
11037
+ LiveSendRealtimeInputParameters, LiveSendRealtimeInputParametersDict
11038
+ ]
11039
+
10455
11040
 
10456
11041
  class LiveClientToolResponse(_common.BaseModel):
10457
11042
  """Client generated response to a `ToolCall` received from the server.
@@ -10750,84 +11335,3 @@ class LiveConnectParametersDict(TypedDict, total=False):
10750
11335
  LiveConnectParametersOrDict = Union[
10751
11336
  LiveConnectParameters, LiveConnectParametersDict
10752
11337
  ]
10753
-
10754
- if _is_pillow_image_imported:
10755
- BlobImageUnion = Union[Blob, PIL_Image]
10756
- else:
10757
- BlobImageUnion = Blob # type: ignore[misc]
10758
-
10759
-
10760
- BlobImageUnionDict = Union[BlobImageUnion, BlobDict]
10761
-
10762
-
10763
- class LiveSendRealtimeInputParameters(_common.BaseModel):
10764
- """Parameters for sending realtime input to the live API."""
10765
-
10766
- media: Optional[BlobImageUnion] = Field(
10767
- default=None, description="""Realtime input to send to the session."""
10768
- )
10769
- audio: Optional[Blob] = Field(
10770
- default=None, description="""The realtime audio input stream."""
10771
- )
10772
- audio_stream_end: Optional[bool] = Field(
10773
- default=None,
10774
- description="""
10775
- Indicates that the audio stream has ended, e.g. because the microphone was
10776
- turned off.
10777
-
10778
- This should only be sent when automatic activity detection is enabled
10779
- (which is the default).
10780
-
10781
- The client can reopen the stream by sending an audio message.
10782
- """,
10783
- )
10784
- video: Optional[BlobImageUnion] = Field(
10785
- default=None, description="""The realtime video input stream."""
10786
- )
10787
- text: Optional[str] = Field(
10788
- default=None, description="""The realtime text input stream."""
10789
- )
10790
- activity_start: Optional[ActivityStart] = Field(
10791
- default=None, description="""Marks the start of user activity."""
10792
- )
10793
- activity_end: Optional[ActivityEnd] = Field(
10794
- default=None, description="""Marks the end of user activity."""
10795
- )
10796
-
10797
-
10798
- class LiveSendRealtimeInputParametersDict(TypedDict, total=False):
10799
- """Parameters for sending realtime input to the live API."""
10800
-
10801
- media: Optional[BlobImageUnionDict]
10802
- """Realtime input to send to the session."""
10803
-
10804
- audio: Optional[BlobDict]
10805
- """The realtime audio input stream."""
10806
-
10807
- audio_stream_end: Optional[bool]
10808
- """
10809
- Indicates that the audio stream has ended, e.g. because the microphone was
10810
- turned off.
10811
-
10812
- This should only be sent when automatic activity detection is enabled
10813
- (which is the default).
10814
-
10815
- The client can reopen the stream by sending an audio message.
10816
- """
10817
-
10818
- video: Optional[BlobImageUnionDict]
10819
- """The realtime video input stream."""
10820
-
10821
- text: Optional[str]
10822
- """The realtime text input stream."""
10823
-
10824
- activity_start: Optional[ActivityStartDict]
10825
- """Marks the start of user activity."""
10826
-
10827
- activity_end: Optional[ActivityEndDict]
10828
- """Marks the end of user activity."""
10829
-
10830
-
10831
- LiveSendRealtimeInputParametersOrDict = Union[
10832
- LiveSendRealtimeInputParameters, LiveSendRealtimeInputParametersDict
10833
- ]