google-genai 1.52.0__py3-none-any.whl → 1.54.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/_api_client.py +6 -6
- google/genai/_live_converters.py +3 -3
- google/genai/batches.py +11 -15
- google/genai/caches.py +40 -20
- google/genai/documents.py +3 -23
- google/genai/errors.py +16 -1
- google/genai/file_search_stores.py +9 -25
- google/genai/files.py +47 -45
- google/genai/live.py +8 -1
- google/genai/models.py +3 -3
- google/genai/tunings.py +121 -43
- google/genai/types.py +197 -127
- google/genai/version.py +1 -1
- {google_genai-1.52.0.dist-info → google_genai-1.54.0.dist-info}/METADATA +51 -30
- {google_genai-1.52.0.dist-info → google_genai-1.54.0.dist-info}/RECORD +18 -18
- {google_genai-1.52.0.dist-info → google_genai-1.54.0.dist-info}/WHEEL +0 -0
- {google_genai-1.52.0.dist-info → google_genai-1.54.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.52.0.dist-info → google_genai-1.54.0.dist-info}/top_level.txt +0 -0
google/genai/tunings.py
CHANGED
|
@@ -110,6 +110,34 @@ def _CancelTuningJobParameters_to_vertex(
|
|
|
110
110
|
return to_object
|
|
111
111
|
|
|
112
112
|
|
|
113
|
+
def _CancelTuningJobResponse_from_mldev(
|
|
114
|
+
from_object: Union[dict[str, Any], object],
|
|
115
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
116
|
+
root_object: Optional[Union[dict[str, Any], object]] = None,
|
|
117
|
+
) -> dict[str, Any]:
|
|
118
|
+
to_object: dict[str, Any] = {}
|
|
119
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
|
120
|
+
setv(
|
|
121
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
return to_object
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _CancelTuningJobResponse_from_vertex(
|
|
128
|
+
from_object: Union[dict[str, Any], object],
|
|
129
|
+
parent_object: Optional[dict[str, Any]] = None,
|
|
130
|
+
root_object: Optional[Union[dict[str, Any], object]] = None,
|
|
131
|
+
) -> dict[str, Any]:
|
|
132
|
+
to_object: dict[str, Any] = {}
|
|
133
|
+
if getv(from_object, ['sdkHttpResponse']) is not None:
|
|
134
|
+
setv(
|
|
135
|
+
to_object, ['sdk_http_response'], getv(from_object, ['sdkHttpResponse'])
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
return to_object
|
|
139
|
+
|
|
140
|
+
|
|
113
141
|
def _CreateTuningJobConfig_to_mldev(
|
|
114
142
|
from_object: Union[dict[str, Any], object],
|
|
115
143
|
parent_object: Optional[dict[str, Any]] = None,
|
|
@@ -839,12 +867,12 @@ def _SpeechConfig_to_vertex(
|
|
|
839
867
|
root_object: Optional[Union[dict[str, Any], object]] = None,
|
|
840
868
|
) -> dict[str, Any]:
|
|
841
869
|
to_object: dict[str, Any] = {}
|
|
842
|
-
if getv(from_object, ['language_code']) is not None:
|
|
843
|
-
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
|
844
|
-
|
|
845
870
|
if getv(from_object, ['voice_config']) is not None:
|
|
846
871
|
setv(to_object, ['voiceConfig'], getv(from_object, ['voice_config']))
|
|
847
872
|
|
|
873
|
+
if getv(from_object, ['language_code']) is not None:
|
|
874
|
+
setv(to_object, ['languageCode'], getv(from_object, ['language_code']))
|
|
875
|
+
|
|
848
876
|
if getv(from_object, ['multi_speaker_voice_config']) is not None:
|
|
849
877
|
raise ValueError(
|
|
850
878
|
'multi_speaker_voice_config parameter is not supported in Vertex AI.'
|
|
@@ -1246,15 +1274,6 @@ class Tunings(_api_module.BaseModule):
|
|
|
1246
1274
|
def _list(
|
|
1247
1275
|
self, *, config: Optional[types.ListTuningJobsConfigOrDict] = None
|
|
1248
1276
|
) -> types.ListTuningJobsResponse:
|
|
1249
|
-
"""Lists `TuningJob` objects.
|
|
1250
|
-
|
|
1251
|
-
Args:
|
|
1252
|
-
config: The configuration for the list request.
|
|
1253
|
-
|
|
1254
|
-
Returns:
|
|
1255
|
-
A list of `TuningJob` objects.
|
|
1256
|
-
"""
|
|
1257
|
-
|
|
1258
1277
|
parameter_model = types._ListTuningJobsParameters(
|
|
1259
1278
|
config=config,
|
|
1260
1279
|
)
|
|
@@ -1319,7 +1338,7 @@ class Tunings(_api_module.BaseModule):
|
|
|
1319
1338
|
*,
|
|
1320
1339
|
name: str,
|
|
1321
1340
|
config: Optional[types.CancelTuningJobConfigOrDict] = None,
|
|
1322
|
-
) ->
|
|
1341
|
+
) -> types.CancelTuningJobResponse:
|
|
1323
1342
|
"""Cancels a tuning job.
|
|
1324
1343
|
|
|
1325
1344
|
Args:
|
|
@@ -1371,6 +1390,23 @@ class Tunings(_api_module.BaseModule):
|
|
|
1371
1390
|
'post', path, request_dict, http_options
|
|
1372
1391
|
)
|
|
1373
1392
|
|
|
1393
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
1394
|
+
|
|
1395
|
+
if self._api_client.vertexai:
|
|
1396
|
+
response_dict = _CancelTuningJobResponse_from_vertex(response_dict)
|
|
1397
|
+
|
|
1398
|
+
if not self._api_client.vertexai:
|
|
1399
|
+
response_dict = _CancelTuningJobResponse_from_mldev(response_dict)
|
|
1400
|
+
|
|
1401
|
+
return_value = types.CancelTuningJobResponse._from_response(
|
|
1402
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
|
1403
|
+
)
|
|
1404
|
+
return_value.sdk_http_response = types.HttpResponse(
|
|
1405
|
+
headers=response.headers
|
|
1406
|
+
)
|
|
1407
|
+
self._api_client._verify_response(return_value)
|
|
1408
|
+
return return_value
|
|
1409
|
+
|
|
1374
1410
|
def _tune(
|
|
1375
1411
|
self,
|
|
1376
1412
|
*,
|
|
@@ -1519,16 +1555,6 @@ class Tunings(_api_module.BaseModule):
|
|
|
1519
1555
|
self._api_client._verify_response(return_value)
|
|
1520
1556
|
return return_value
|
|
1521
1557
|
|
|
1522
|
-
def list(
|
|
1523
|
-
self, *, config: Optional[types.ListTuningJobsConfigOrDict] = None
|
|
1524
|
-
) -> Pager[types.TuningJob]:
|
|
1525
|
-
return Pager(
|
|
1526
|
-
'tuning_jobs',
|
|
1527
|
-
self._list,
|
|
1528
|
-
self._list(config=config),
|
|
1529
|
-
config,
|
|
1530
|
-
)
|
|
1531
|
-
|
|
1532
1558
|
def get(
|
|
1533
1559
|
self,
|
|
1534
1560
|
*,
|
|
@@ -1630,6 +1656,33 @@ class Tunings(_api_module.BaseModule):
|
|
|
1630
1656
|
)
|
|
1631
1657
|
return tuning_job
|
|
1632
1658
|
|
|
1659
|
+
def list(
|
|
1660
|
+
self, *, config: Optional[types.ListTuningJobsConfigOrDict] = None
|
|
1661
|
+
) -> Pager[types.TuningJob]:
|
|
1662
|
+
"""Lists `TuningJob` objects.
|
|
1663
|
+
|
|
1664
|
+
Args:
|
|
1665
|
+
config: The configuration for the list request.
|
|
1666
|
+
|
|
1667
|
+
Returns:
|
|
1668
|
+
A Pager object that contains one page of tuning jobs. When iterating over
|
|
1669
|
+
the pager, it automatically fetches the next page if there are more.
|
|
1670
|
+
|
|
1671
|
+
Usage:
|
|
1672
|
+
|
|
1673
|
+
.. code-block:: python
|
|
1674
|
+
for tuning_job in client.tunings.list():
|
|
1675
|
+
print(tuning_job.name)
|
|
1676
|
+
"""
|
|
1677
|
+
|
|
1678
|
+
list_request = self._list
|
|
1679
|
+
return Pager(
|
|
1680
|
+
'tuning_jobs',
|
|
1681
|
+
list_request,
|
|
1682
|
+
self._list(config=config),
|
|
1683
|
+
config,
|
|
1684
|
+
)
|
|
1685
|
+
|
|
1633
1686
|
|
|
1634
1687
|
class AsyncTunings(_api_module.BaseModule):
|
|
1635
1688
|
|
|
@@ -1713,15 +1766,6 @@ class AsyncTunings(_api_module.BaseModule):
|
|
|
1713
1766
|
async def _list(
|
|
1714
1767
|
self, *, config: Optional[types.ListTuningJobsConfigOrDict] = None
|
|
1715
1768
|
) -> types.ListTuningJobsResponse:
|
|
1716
|
-
"""Lists `TuningJob` objects.
|
|
1717
|
-
|
|
1718
|
-
Args:
|
|
1719
|
-
config: The configuration for the list request.
|
|
1720
|
-
|
|
1721
|
-
Returns:
|
|
1722
|
-
A list of `TuningJob` objects.
|
|
1723
|
-
"""
|
|
1724
|
-
|
|
1725
1769
|
parameter_model = types._ListTuningJobsParameters(
|
|
1726
1770
|
config=config,
|
|
1727
1771
|
)
|
|
@@ -1788,7 +1832,7 @@ class AsyncTunings(_api_module.BaseModule):
|
|
|
1788
1832
|
*,
|
|
1789
1833
|
name: str,
|
|
1790
1834
|
config: Optional[types.CancelTuningJobConfigOrDict] = None,
|
|
1791
|
-
) ->
|
|
1835
|
+
) -> types.CancelTuningJobResponse:
|
|
1792
1836
|
"""Cancels a tuning job asynchronously.
|
|
1793
1837
|
|
|
1794
1838
|
Args:
|
|
@@ -1840,6 +1884,23 @@ class AsyncTunings(_api_module.BaseModule):
|
|
|
1840
1884
|
'post', path, request_dict, http_options
|
|
1841
1885
|
)
|
|
1842
1886
|
|
|
1887
|
+
response_dict = {} if not response.body else json.loads(response.body)
|
|
1888
|
+
|
|
1889
|
+
if self._api_client.vertexai:
|
|
1890
|
+
response_dict = _CancelTuningJobResponse_from_vertex(response_dict)
|
|
1891
|
+
|
|
1892
|
+
if not self._api_client.vertexai:
|
|
1893
|
+
response_dict = _CancelTuningJobResponse_from_mldev(response_dict)
|
|
1894
|
+
|
|
1895
|
+
return_value = types.CancelTuningJobResponse._from_response(
|
|
1896
|
+
response=response_dict, kwargs=parameter_model.model_dump()
|
|
1897
|
+
)
|
|
1898
|
+
return_value.sdk_http_response = types.HttpResponse(
|
|
1899
|
+
headers=response.headers
|
|
1900
|
+
)
|
|
1901
|
+
self._api_client._verify_response(return_value)
|
|
1902
|
+
return return_value
|
|
1903
|
+
|
|
1843
1904
|
async def _tune(
|
|
1844
1905
|
self,
|
|
1845
1906
|
*,
|
|
@@ -1988,16 +2049,6 @@ class AsyncTunings(_api_module.BaseModule):
|
|
|
1988
2049
|
self._api_client._verify_response(return_value)
|
|
1989
2050
|
return return_value
|
|
1990
2051
|
|
|
1991
|
-
async def list(
|
|
1992
|
-
self, *, config: Optional[types.ListTuningJobsConfigOrDict] = None
|
|
1993
|
-
) -> AsyncPager[types.TuningJob]:
|
|
1994
|
-
return AsyncPager(
|
|
1995
|
-
'tuning_jobs',
|
|
1996
|
-
self._list,
|
|
1997
|
-
await self._list(config=config),
|
|
1998
|
-
config,
|
|
1999
|
-
)
|
|
2000
|
-
|
|
2001
2052
|
async def get(
|
|
2002
2053
|
self,
|
|
2003
2054
|
*,
|
|
@@ -2093,6 +2144,33 @@ class AsyncTunings(_api_module.BaseModule):
|
|
|
2093
2144
|
)
|
|
2094
2145
|
return tuning_job
|
|
2095
2146
|
|
|
2147
|
+
async def list(
|
|
2148
|
+
self, *, config: Optional[types.ListTuningJobsConfigOrDict] = None
|
|
2149
|
+
) -> AsyncPager[types.TuningJob]:
|
|
2150
|
+
"""Lists `TuningJob` objects asynchronously.
|
|
2151
|
+
|
|
2152
|
+
Args:
|
|
2153
|
+
config: The configuration for the list request.
|
|
2154
|
+
|
|
2155
|
+
Returns:
|
|
2156
|
+
A Pager object that contains one page of tuning jobs. When iterating over
|
|
2157
|
+
the pager, it automatically fetches the next page if there are more.
|
|
2158
|
+
|
|
2159
|
+
Usage:
|
|
2160
|
+
|
|
2161
|
+
.. code-block:: python
|
|
2162
|
+
async for tuning_job in await client.aio.tunings.list():
|
|
2163
|
+
print(tuning_job.name)
|
|
2164
|
+
"""
|
|
2165
|
+
|
|
2166
|
+
list_request = self._list
|
|
2167
|
+
return AsyncPager(
|
|
2168
|
+
'tuning_jobs',
|
|
2169
|
+
list_request,
|
|
2170
|
+
await self._list(config=config),
|
|
2171
|
+
config,
|
|
2172
|
+
)
|
|
2173
|
+
|
|
2096
2174
|
|
|
2097
2175
|
class _IpythonUtils:
|
|
2098
2176
|
"""Temporary class to hold the IPython related functions."""
|
google/genai/types.py
CHANGED
|
@@ -2497,12 +2497,13 @@ are recommended to pass/receive Json Schema directly to/from the API. For exampl
|
|
|
2497
2497
|
'defs',
|
|
2498
2498
|
]:
|
|
2499
2499
|
raise ValueError(
|
|
2500
|
-
f'JSONSchema field "{field_name}" is not supported by the '
|
|
2501
|
-
'
|
|
2502
|
-
'
|
|
2503
|
-
'
|
|
2504
|
-
|
|
2505
|
-
'"raise_error_on_unsupported_field" unset
|
|
2500
|
+
f'JSONSchema field "{field_name}" is not supported by the Schema'
|
|
2501
|
+
' object. And the "raise_error_on_unsupported_field" argument is'
|
|
2502
|
+
' set to True. If you still want to convert it into the Schema'
|
|
2503
|
+
f' object, please either remove the field "{field_name}" from the'
|
|
2504
|
+
' JSONSchema object, leave the'
|
|
2505
|
+
' "raise_error_on_unsupported_field" unset, or try using'
|
|
2506
|
+
' response_json_schema instead.'
|
|
2506
2507
|
)
|
|
2507
2508
|
if (
|
|
2508
2509
|
field_name in gemini_api_unsupported_field_names
|
|
@@ -4367,6 +4368,163 @@ class ToolConfigDict(TypedDict, total=False):
|
|
|
4367
4368
|
ToolConfigOrDict = Union[ToolConfig, ToolConfigDict]
|
|
4368
4369
|
|
|
4369
4370
|
|
|
4371
|
+
class ReplicatedVoiceConfig(_common.BaseModel):
|
|
4372
|
+
"""ReplicatedVoiceConfig is used to configure replicated voice."""
|
|
4373
|
+
|
|
4374
|
+
mime_type: Optional[str] = Field(
|
|
4375
|
+
default=None,
|
|
4376
|
+
description="""The mime type of the replicated voice.
|
|
4377
|
+
""",
|
|
4378
|
+
)
|
|
4379
|
+
voice_sample_audio: Optional[bytes] = Field(
|
|
4380
|
+
default=None,
|
|
4381
|
+
description="""The sample audio of the replicated voice.
|
|
4382
|
+
""",
|
|
4383
|
+
)
|
|
4384
|
+
|
|
4385
|
+
|
|
4386
|
+
class ReplicatedVoiceConfigDict(TypedDict, total=False):
|
|
4387
|
+
"""ReplicatedVoiceConfig is used to configure replicated voice."""
|
|
4388
|
+
|
|
4389
|
+
mime_type: Optional[str]
|
|
4390
|
+
"""The mime type of the replicated voice.
|
|
4391
|
+
"""
|
|
4392
|
+
|
|
4393
|
+
voice_sample_audio: Optional[bytes]
|
|
4394
|
+
"""The sample audio of the replicated voice.
|
|
4395
|
+
"""
|
|
4396
|
+
|
|
4397
|
+
|
|
4398
|
+
ReplicatedVoiceConfigOrDict = Union[
|
|
4399
|
+
ReplicatedVoiceConfig, ReplicatedVoiceConfigDict
|
|
4400
|
+
]
|
|
4401
|
+
|
|
4402
|
+
|
|
4403
|
+
class PrebuiltVoiceConfig(_common.BaseModel):
|
|
4404
|
+
"""The configuration for the prebuilt speaker to use."""
|
|
4405
|
+
|
|
4406
|
+
voice_name: Optional[str] = Field(
|
|
4407
|
+
default=None, description="""The name of the preset voice to use."""
|
|
4408
|
+
)
|
|
4409
|
+
|
|
4410
|
+
|
|
4411
|
+
class PrebuiltVoiceConfigDict(TypedDict, total=False):
|
|
4412
|
+
"""The configuration for the prebuilt speaker to use."""
|
|
4413
|
+
|
|
4414
|
+
voice_name: Optional[str]
|
|
4415
|
+
"""The name of the preset voice to use."""
|
|
4416
|
+
|
|
4417
|
+
|
|
4418
|
+
PrebuiltVoiceConfigOrDict = Union[PrebuiltVoiceConfig, PrebuiltVoiceConfigDict]
|
|
4419
|
+
|
|
4420
|
+
|
|
4421
|
+
class VoiceConfig(_common.BaseModel):
|
|
4422
|
+
|
|
4423
|
+
replicated_voice_config: Optional[ReplicatedVoiceConfig] = Field(
|
|
4424
|
+
default=None,
|
|
4425
|
+
description="""If true, the model will use a replicated voice for the response.""",
|
|
4426
|
+
)
|
|
4427
|
+
prebuilt_voice_config: Optional[PrebuiltVoiceConfig] = Field(
|
|
4428
|
+
default=None,
|
|
4429
|
+
description="""The configuration for the prebuilt voice to use.""",
|
|
4430
|
+
)
|
|
4431
|
+
|
|
4432
|
+
|
|
4433
|
+
class VoiceConfigDict(TypedDict, total=False):
|
|
4434
|
+
|
|
4435
|
+
replicated_voice_config: Optional[ReplicatedVoiceConfigDict]
|
|
4436
|
+
"""If true, the model will use a replicated voice for the response."""
|
|
4437
|
+
|
|
4438
|
+
prebuilt_voice_config: Optional[PrebuiltVoiceConfigDict]
|
|
4439
|
+
"""The configuration for the prebuilt voice to use."""
|
|
4440
|
+
|
|
4441
|
+
|
|
4442
|
+
VoiceConfigOrDict = Union[VoiceConfig, VoiceConfigDict]
|
|
4443
|
+
|
|
4444
|
+
|
|
4445
|
+
class SpeakerVoiceConfig(_common.BaseModel):
|
|
4446
|
+
"""Configuration for a single speaker in a multi speaker setup."""
|
|
4447
|
+
|
|
4448
|
+
speaker: Optional[str] = Field(
|
|
4449
|
+
default=None,
|
|
4450
|
+
description="""Required. The name of the speaker. This should be the same as the speaker name used in the prompt.""",
|
|
4451
|
+
)
|
|
4452
|
+
voice_config: Optional[VoiceConfig] = Field(
|
|
4453
|
+
default=None,
|
|
4454
|
+
description="""Required. The configuration for the voice of this speaker.""",
|
|
4455
|
+
)
|
|
4456
|
+
|
|
4457
|
+
|
|
4458
|
+
class SpeakerVoiceConfigDict(TypedDict, total=False):
|
|
4459
|
+
"""Configuration for a single speaker in a multi speaker setup."""
|
|
4460
|
+
|
|
4461
|
+
speaker: Optional[str]
|
|
4462
|
+
"""Required. The name of the speaker. This should be the same as the speaker name used in the prompt."""
|
|
4463
|
+
|
|
4464
|
+
voice_config: Optional[VoiceConfigDict]
|
|
4465
|
+
"""Required. The configuration for the voice of this speaker."""
|
|
4466
|
+
|
|
4467
|
+
|
|
4468
|
+
SpeakerVoiceConfigOrDict = Union[SpeakerVoiceConfig, SpeakerVoiceConfigDict]
|
|
4469
|
+
|
|
4470
|
+
|
|
4471
|
+
class MultiSpeakerVoiceConfig(_common.BaseModel):
|
|
4472
|
+
"""The configuration for the multi-speaker setup.
|
|
4473
|
+
|
|
4474
|
+
This data type is not supported in Vertex AI.
|
|
4475
|
+
"""
|
|
4476
|
+
|
|
4477
|
+
speaker_voice_configs: Optional[list[SpeakerVoiceConfig]] = Field(
|
|
4478
|
+
default=None, description="""Required. All the enabled speaker voices."""
|
|
4479
|
+
)
|
|
4480
|
+
|
|
4481
|
+
|
|
4482
|
+
class MultiSpeakerVoiceConfigDict(TypedDict, total=False):
|
|
4483
|
+
"""The configuration for the multi-speaker setup.
|
|
4484
|
+
|
|
4485
|
+
This data type is not supported in Vertex AI.
|
|
4486
|
+
"""
|
|
4487
|
+
|
|
4488
|
+
speaker_voice_configs: Optional[list[SpeakerVoiceConfigDict]]
|
|
4489
|
+
"""Required. All the enabled speaker voices."""
|
|
4490
|
+
|
|
4491
|
+
|
|
4492
|
+
MultiSpeakerVoiceConfigOrDict = Union[
|
|
4493
|
+
MultiSpeakerVoiceConfig, MultiSpeakerVoiceConfigDict
|
|
4494
|
+
]
|
|
4495
|
+
|
|
4496
|
+
|
|
4497
|
+
class SpeechConfig(_common.BaseModel):
|
|
4498
|
+
|
|
4499
|
+
voice_config: Optional[VoiceConfig] = Field(
|
|
4500
|
+
default=None,
|
|
4501
|
+
description="""Configuration for the voice of the response.""",
|
|
4502
|
+
)
|
|
4503
|
+
language_code: Optional[str] = Field(
|
|
4504
|
+
default=None,
|
|
4505
|
+
description="""Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization.""",
|
|
4506
|
+
)
|
|
4507
|
+
multi_speaker_voice_config: Optional[MultiSpeakerVoiceConfig] = Field(
|
|
4508
|
+
default=None,
|
|
4509
|
+
description="""Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field. This field is not supported in Vertex AI.""",
|
|
4510
|
+
)
|
|
4511
|
+
|
|
4512
|
+
|
|
4513
|
+
class SpeechConfigDict(TypedDict, total=False):
|
|
4514
|
+
|
|
4515
|
+
voice_config: Optional[VoiceConfigDict]
|
|
4516
|
+
"""Configuration for the voice of the response."""
|
|
4517
|
+
|
|
4518
|
+
language_code: Optional[str]
|
|
4519
|
+
"""Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization."""
|
|
4520
|
+
|
|
4521
|
+
multi_speaker_voice_config: Optional[MultiSpeakerVoiceConfigDict]
|
|
4522
|
+
"""Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field. This field is not supported in Vertex AI."""
|
|
4523
|
+
|
|
4524
|
+
|
|
4525
|
+
SpeechConfigOrDict = Union[SpeechConfig, SpeechConfigDict]
|
|
4526
|
+
|
|
4527
|
+
|
|
4370
4528
|
class AutomaticFunctionCallingConfig(_common.BaseModel):
|
|
4371
4529
|
"""The configuration for automatic function calling."""
|
|
4372
4530
|
|
|
@@ -4791,38 +4949,6 @@ class SafetySettingDict(TypedDict, total=False):
|
|
|
4791
4949
|
SafetySettingOrDict = Union[SafetySetting, SafetySettingDict]
|
|
4792
4950
|
|
|
4793
4951
|
|
|
4794
|
-
class SpeechConfig(_common.BaseModel):
|
|
4795
|
-
"""The speech generation config."""
|
|
4796
|
-
|
|
4797
|
-
language_code: Optional[str] = Field(
|
|
4798
|
-
default=None,
|
|
4799
|
-
description="""Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization.""",
|
|
4800
|
-
)
|
|
4801
|
-
voice_config: Optional['VoiceConfig'] = Field(
|
|
4802
|
-
default=None, description="""The configuration for the speaker to use."""
|
|
4803
|
-
)
|
|
4804
|
-
multi_speaker_voice_config: Optional['MultiSpeakerVoiceConfig'] = Field(
|
|
4805
|
-
default=None,
|
|
4806
|
-
description="""Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field. This field is not supported in Vertex AI.""",
|
|
4807
|
-
)
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
class SpeechConfigDict(TypedDict, total=False):
|
|
4811
|
-
"""The speech generation config."""
|
|
4812
|
-
|
|
4813
|
-
language_code: Optional[str]
|
|
4814
|
-
"""Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization."""
|
|
4815
|
-
|
|
4816
|
-
voice_config: Optional['VoiceConfigDict']
|
|
4817
|
-
"""The configuration for the speaker to use."""
|
|
4818
|
-
|
|
4819
|
-
multi_speaker_voice_config: Optional['MultiSpeakerVoiceConfigDict']
|
|
4820
|
-
"""Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field. This field is not supported in Vertex AI."""
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
SpeechConfigOrDict = Union[SpeechConfig, SpeechConfigDict]
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
4952
|
SpeechConfigUnion = Union[str, SpeechConfig]
|
|
4827
4953
|
|
|
4828
4954
|
|
|
@@ -4942,6 +5068,9 @@ class GenerateContentConfig(_common.BaseModel):
|
|
|
4942
5068
|
object](https://spec.openapis.org/oas/v3.0.3#schema).
|
|
4943
5069
|
If set, a compatible response_mime_type must also be set.
|
|
4944
5070
|
Compatible mimetypes: `application/json`: Schema for JSON response.
|
|
5071
|
+
|
|
5072
|
+
If `response_schema` doesn't process your schema correctly, try using
|
|
5073
|
+
`response_json_schema` instead.
|
|
4945
5074
|
""",
|
|
4946
5075
|
)
|
|
4947
5076
|
response_json_schema: Optional[Any] = Field(
|
|
@@ -5159,6 +5288,9 @@ class GenerateContentConfigDict(TypedDict, total=False):
|
|
|
5159
5288
|
object](https://spec.openapis.org/oas/v3.0.3#schema).
|
|
5160
5289
|
If set, a compatible response_mime_type must also be set.
|
|
5161
5290
|
Compatible mimetypes: `application/json`: Schema for JSON response.
|
|
5291
|
+
|
|
5292
|
+
If `response_schema` doesn't process your schema correctly, try using
|
|
5293
|
+
`response_json_schema` instead.
|
|
5162
5294
|
"""
|
|
5163
5295
|
|
|
5164
5296
|
response_json_schema: Optional[Any]
|
|
@@ -5437,6 +5569,13 @@ class CitationMetadata(_common.BaseModel):
|
|
|
5437
5569
|
""",
|
|
5438
5570
|
)
|
|
5439
5571
|
|
|
5572
|
+
@model_validator(mode='before')
|
|
5573
|
+
@classmethod
|
|
5574
|
+
def _rename_citation_sources(cls, data: Any) -> Any:
|
|
5575
|
+
if isinstance(data, dict) and 'citationSources' in data:
|
|
5576
|
+
data['citations'] = data.pop('citationSources')
|
|
5577
|
+
return data
|
|
5578
|
+
|
|
5440
5579
|
|
|
5441
5580
|
class CitationMetadataDict(TypedDict, total=False):
|
|
5442
5581
|
"""Citation information when the model quotes another source."""
|
|
@@ -9054,95 +9193,6 @@ class DeleteModelResponseDict(TypedDict, total=False):
|
|
|
9054
9193
|
DeleteModelResponseOrDict = Union[DeleteModelResponse, DeleteModelResponseDict]
|
|
9055
9194
|
|
|
9056
9195
|
|
|
9057
|
-
class PrebuiltVoiceConfig(_common.BaseModel):
|
|
9058
|
-
"""The configuration for the prebuilt speaker to use."""
|
|
9059
|
-
|
|
9060
|
-
voice_name: Optional[str] = Field(
|
|
9061
|
-
default=None, description="""The name of the preset voice to use."""
|
|
9062
|
-
)
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
class PrebuiltVoiceConfigDict(TypedDict, total=False):
|
|
9066
|
-
"""The configuration for the prebuilt speaker to use."""
|
|
9067
|
-
|
|
9068
|
-
voice_name: Optional[str]
|
|
9069
|
-
"""The name of the preset voice to use."""
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
PrebuiltVoiceConfigOrDict = Union[PrebuiltVoiceConfig, PrebuiltVoiceConfigDict]
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
class VoiceConfig(_common.BaseModel):
|
|
9076
|
-
"""The configuration for the voice to use."""
|
|
9077
|
-
|
|
9078
|
-
prebuilt_voice_config: Optional[PrebuiltVoiceConfig] = Field(
|
|
9079
|
-
default=None,
|
|
9080
|
-
description="""The configuration for the prebuilt voice to use.""",
|
|
9081
|
-
)
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
class VoiceConfigDict(TypedDict, total=False):
|
|
9085
|
-
"""The configuration for the voice to use."""
|
|
9086
|
-
|
|
9087
|
-
prebuilt_voice_config: Optional[PrebuiltVoiceConfigDict]
|
|
9088
|
-
"""The configuration for the prebuilt voice to use."""
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
VoiceConfigOrDict = Union[VoiceConfig, VoiceConfigDict]
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
class SpeakerVoiceConfig(_common.BaseModel):
|
|
9095
|
-
"""Configuration for a single speaker in a multi speaker setup."""
|
|
9096
|
-
|
|
9097
|
-
speaker: Optional[str] = Field(
|
|
9098
|
-
default=None,
|
|
9099
|
-
description="""Required. The name of the speaker. This should be the same as the speaker name used in the prompt.""",
|
|
9100
|
-
)
|
|
9101
|
-
voice_config: Optional[VoiceConfig] = Field(
|
|
9102
|
-
default=None,
|
|
9103
|
-
description="""Required. The configuration for the voice of this speaker.""",
|
|
9104
|
-
)
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
class SpeakerVoiceConfigDict(TypedDict, total=False):
|
|
9108
|
-
"""Configuration for a single speaker in a multi speaker setup."""
|
|
9109
|
-
|
|
9110
|
-
speaker: Optional[str]
|
|
9111
|
-
"""Required. The name of the speaker. This should be the same as the speaker name used in the prompt."""
|
|
9112
|
-
|
|
9113
|
-
voice_config: Optional[VoiceConfigDict]
|
|
9114
|
-
"""Required. The configuration for the voice of this speaker."""
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
SpeakerVoiceConfigOrDict = Union[SpeakerVoiceConfig, SpeakerVoiceConfigDict]
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
class MultiSpeakerVoiceConfig(_common.BaseModel):
|
|
9121
|
-
"""The configuration for the multi-speaker setup.
|
|
9122
|
-
|
|
9123
|
-
This data type is not supported in Vertex AI.
|
|
9124
|
-
"""
|
|
9125
|
-
|
|
9126
|
-
speaker_voice_configs: Optional[list[SpeakerVoiceConfig]] = Field(
|
|
9127
|
-
default=None, description="""Required. All the enabled speaker voices."""
|
|
9128
|
-
)
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
class MultiSpeakerVoiceConfigDict(TypedDict, total=False):
|
|
9132
|
-
"""The configuration for the multi-speaker setup.
|
|
9133
|
-
|
|
9134
|
-
This data type is not supported in Vertex AI.
|
|
9135
|
-
"""
|
|
9136
|
-
|
|
9137
|
-
speaker_voice_configs: Optional[list[SpeakerVoiceConfigDict]]
|
|
9138
|
-
"""Required. All the enabled speaker voices."""
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
MultiSpeakerVoiceConfigOrDict = Union[
|
|
9142
|
-
MultiSpeakerVoiceConfig, MultiSpeakerVoiceConfigDict
|
|
9143
|
-
]
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
9196
|
class GenerationConfig(_common.BaseModel):
|
|
9147
9197
|
"""Generation config."""
|
|
9148
9198
|
|
|
@@ -11862,6 +11912,26 @@ _CancelTuningJobParametersOrDict = Union[
|
|
|
11862
11912
|
]
|
|
11863
11913
|
|
|
11864
11914
|
|
|
11915
|
+
class CancelTuningJobResponse(_common.BaseModel):
|
|
11916
|
+
"""Empty response for tunings.cancel method."""
|
|
11917
|
+
|
|
11918
|
+
sdk_http_response: Optional[HttpResponse] = Field(
|
|
11919
|
+
default=None, description="""Used to retain the full HTTP response."""
|
|
11920
|
+
)
|
|
11921
|
+
|
|
11922
|
+
|
|
11923
|
+
class CancelTuningJobResponseDict(TypedDict, total=False):
|
|
11924
|
+
"""Empty response for tunings.cancel method."""
|
|
11925
|
+
|
|
11926
|
+
sdk_http_response: Optional[HttpResponseDict]
|
|
11927
|
+
"""Used to retain the full HTTP response."""
|
|
11928
|
+
|
|
11929
|
+
|
|
11930
|
+
CancelTuningJobResponseOrDict = Union[
|
|
11931
|
+
CancelTuningJobResponse, CancelTuningJobResponseDict
|
|
11932
|
+
]
|
|
11933
|
+
|
|
11934
|
+
|
|
11865
11935
|
class TuningExample(_common.BaseModel):
|
|
11866
11936
|
"""A single example for tuning.
|
|
11867
11937
|
|
google/genai/version.py
CHANGED