google-genai 1.61.0__py3-none-any.whl → 1.62.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/_interactions/_base_client.py +5 -2
- google/genai/_interactions/_compat.py +3 -3
- google/genai/_interactions/_utils/_json.py +50 -0
- google/genai/errors.py +19 -6
- google/genai/live.py +22 -2
- google/genai/live_music.py +14 -1
- google/genai/models.py +486 -197
- google/genai/tests/errors/test_api_error.py +38 -0
- google/genai/tunings.py +48 -16
- google/genai/version.py +1 -1
- {google_genai-1.61.0.dist-info → google_genai-1.62.0.dist-info}/METADATA +1 -1
- {google_genai-1.61.0.dist-info → google_genai-1.62.0.dist-info}/RECORD +15 -14
- {google_genai-1.61.0.dist-info → google_genai-1.62.0.dist-info}/WHEEL +0 -0
- {google_genai-1.61.0.dist-info → google_genai-1.62.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.61.0.dist-info → google_genai-1.62.0.dist-info}/top_level.txt +0 -0
|
@@ -23,6 +23,7 @@ import pickle
|
|
|
23
23
|
|
|
24
24
|
import httpx
|
|
25
25
|
import pytest
|
|
26
|
+
import websockets
|
|
26
27
|
|
|
27
28
|
from ... import errors
|
|
28
29
|
|
|
@@ -257,6 +258,43 @@ def test_constructor_message_not_present():
|
|
|
257
258
|
}
|
|
258
259
|
|
|
259
260
|
|
|
261
|
+
def test_constructor_with_websocket_connection_closed_error():
|
|
262
|
+
actual_error = errors.APIError(
|
|
263
|
+
1007,
|
|
264
|
+
'At most one response modality can be specified in the setup request.'
|
|
265
|
+
' To enable simultaneous transcription and audio output,',
|
|
266
|
+
None,
|
|
267
|
+
)
|
|
268
|
+
assert actual_error.code == 1007
|
|
269
|
+
assert (
|
|
270
|
+
actual_error.details
|
|
271
|
+
== 'At most one response modality can be specified in the setup request.'
|
|
272
|
+
' To enable simultaneous transcription and audio output,',
|
|
273
|
+
)
|
|
274
|
+
assert actual_error.status == None
|
|
275
|
+
assert actual_error.message == None
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
def test_raise_for_websocket_connection_closed_error():
|
|
279
|
+
try:
|
|
280
|
+
errors.APIError.raise_error(
|
|
281
|
+
1007,
|
|
282
|
+
'At most one response modality can be specified in the setup request.'
|
|
283
|
+
' To enable simultaneous transcription and audio output,',
|
|
284
|
+
None,
|
|
285
|
+
)
|
|
286
|
+
except errors.APIError as actual_error:
|
|
287
|
+
assert actual_error.code == 1007
|
|
288
|
+
assert (
|
|
289
|
+
actual_error.details
|
|
290
|
+
== 'At most one response modality can be specified in the setup'
|
|
291
|
+
' request.'
|
|
292
|
+
' To enable simultaneous transcription and audio output,'
|
|
293
|
+
)
|
|
294
|
+
assert actual_error.status == None
|
|
295
|
+
assert actual_error.message == None
|
|
296
|
+
|
|
297
|
+
|
|
260
298
|
def test_raise_for_response_code_exist_json_decoder_error():
|
|
261
299
|
class FakeResponse(httpx.Response):
|
|
262
300
|
|
google/genai/tunings.py
CHANGED
|
@@ -1390,10 +1390,14 @@ class Tunings(_api_module.BaseModule):
|
|
|
1390
1390
|
response_dict = {} if not response.body else json.loads(response.body)
|
|
1391
1391
|
|
|
1392
1392
|
if self._api_client.vertexai:
|
|
1393
|
-
response_dict = _TuningJob_from_vertex(
|
|
1393
|
+
response_dict = _TuningJob_from_vertex(
|
|
1394
|
+
response_dict, None, parameter_model
|
|
1395
|
+
)
|
|
1394
1396
|
|
|
1395
1397
|
if not self._api_client.vertexai:
|
|
1396
|
-
response_dict = _TuningJob_from_mldev(
|
|
1398
|
+
response_dict = _TuningJob_from_mldev(
|
|
1399
|
+
response_dict, None, parameter_model
|
|
1400
|
+
)
|
|
1397
1401
|
|
|
1398
1402
|
return_value = types.TuningJob._from_response(
|
|
1399
1403
|
response=response_dict, kwargs=parameter_model.model_dump()
|
|
@@ -1452,10 +1456,14 @@ class Tunings(_api_module.BaseModule):
|
|
|
1452
1456
|
response_dict = {} if not response.body else json.loads(response.body)
|
|
1453
1457
|
|
|
1454
1458
|
if self._api_client.vertexai:
|
|
1455
|
-
response_dict = _ListTuningJobsResponse_from_vertex(
|
|
1459
|
+
response_dict = _ListTuningJobsResponse_from_vertex(
|
|
1460
|
+
response_dict, None, parameter_model
|
|
1461
|
+
)
|
|
1456
1462
|
|
|
1457
1463
|
if not self._api_client.vertexai:
|
|
1458
|
-
response_dict = _ListTuningJobsResponse_from_mldev(
|
|
1464
|
+
response_dict = _ListTuningJobsResponse_from_mldev(
|
|
1465
|
+
response_dict, None, parameter_model
|
|
1466
|
+
)
|
|
1459
1467
|
|
|
1460
1468
|
return_value = types.ListTuningJobsResponse._from_response(
|
|
1461
1469
|
response=response_dict, kwargs=parameter_model.model_dump()
|
|
@@ -1526,10 +1534,14 @@ class Tunings(_api_module.BaseModule):
|
|
|
1526
1534
|
response_dict = {} if not response.body else json.loads(response.body)
|
|
1527
1535
|
|
|
1528
1536
|
if self._api_client.vertexai:
|
|
1529
|
-
response_dict = _CancelTuningJobResponse_from_vertex(
|
|
1537
|
+
response_dict = _CancelTuningJobResponse_from_vertex(
|
|
1538
|
+
response_dict, None, parameter_model
|
|
1539
|
+
)
|
|
1530
1540
|
|
|
1531
1541
|
if not self._api_client.vertexai:
|
|
1532
|
-
response_dict = _CancelTuningJobResponse_from_mldev(
|
|
1542
|
+
response_dict = _CancelTuningJobResponse_from_mldev(
|
|
1543
|
+
response_dict, None, parameter_model
|
|
1544
|
+
)
|
|
1533
1545
|
|
|
1534
1546
|
return_value = types.CancelTuningJobResponse._from_response(
|
|
1535
1547
|
response=response_dict, kwargs=parameter_model.model_dump()
|
|
@@ -1602,7 +1614,9 @@ class Tunings(_api_module.BaseModule):
|
|
|
1602
1614
|
response_dict = {} if not response.body else json.loads(response.body)
|
|
1603
1615
|
|
|
1604
1616
|
if self._api_client.vertexai:
|
|
1605
|
-
response_dict = _TuningJob_from_vertex(
|
|
1617
|
+
response_dict = _TuningJob_from_vertex(
|
|
1618
|
+
response_dict, None, parameter_model
|
|
1619
|
+
)
|
|
1606
1620
|
|
|
1607
1621
|
return_value = types.TuningJob._from_response(
|
|
1608
1622
|
response=response_dict, kwargs=parameter_model.model_dump()
|
|
@@ -1677,7 +1691,9 @@ class Tunings(_api_module.BaseModule):
|
|
|
1677
1691
|
response_dict = {} if not response.body else json.loads(response.body)
|
|
1678
1692
|
|
|
1679
1693
|
if not self._api_client.vertexai:
|
|
1680
|
-
response_dict = _TuningOperation_from_mldev(
|
|
1694
|
+
response_dict = _TuningOperation_from_mldev(
|
|
1695
|
+
response_dict, None, parameter_model
|
|
1696
|
+
)
|
|
1681
1697
|
|
|
1682
1698
|
return_value = types.TuningOperation._from_response(
|
|
1683
1699
|
response=response_dict, kwargs=parameter_model.model_dump()
|
|
@@ -1882,10 +1898,14 @@ class AsyncTunings(_api_module.BaseModule):
|
|
|
1882
1898
|
response_dict = {} if not response.body else json.loads(response.body)
|
|
1883
1899
|
|
|
1884
1900
|
if self._api_client.vertexai:
|
|
1885
|
-
response_dict = _TuningJob_from_vertex(
|
|
1901
|
+
response_dict = _TuningJob_from_vertex(
|
|
1902
|
+
response_dict, None, parameter_model
|
|
1903
|
+
)
|
|
1886
1904
|
|
|
1887
1905
|
if not self._api_client.vertexai:
|
|
1888
|
-
response_dict = _TuningJob_from_mldev(
|
|
1906
|
+
response_dict = _TuningJob_from_mldev(
|
|
1907
|
+
response_dict, None, parameter_model
|
|
1908
|
+
)
|
|
1889
1909
|
|
|
1890
1910
|
return_value = types.TuningJob._from_response(
|
|
1891
1911
|
response=response_dict, kwargs=parameter_model.model_dump()
|
|
@@ -1946,10 +1966,14 @@ class AsyncTunings(_api_module.BaseModule):
|
|
|
1946
1966
|
response_dict = {} if not response.body else json.loads(response.body)
|
|
1947
1967
|
|
|
1948
1968
|
if self._api_client.vertexai:
|
|
1949
|
-
response_dict = _ListTuningJobsResponse_from_vertex(
|
|
1969
|
+
response_dict = _ListTuningJobsResponse_from_vertex(
|
|
1970
|
+
response_dict, None, parameter_model
|
|
1971
|
+
)
|
|
1950
1972
|
|
|
1951
1973
|
if not self._api_client.vertexai:
|
|
1952
|
-
response_dict = _ListTuningJobsResponse_from_mldev(
|
|
1974
|
+
response_dict = _ListTuningJobsResponse_from_mldev(
|
|
1975
|
+
response_dict, None, parameter_model
|
|
1976
|
+
)
|
|
1953
1977
|
|
|
1954
1978
|
return_value = types.ListTuningJobsResponse._from_response(
|
|
1955
1979
|
response=response_dict, kwargs=parameter_model.model_dump()
|
|
@@ -2020,10 +2044,14 @@ class AsyncTunings(_api_module.BaseModule):
|
|
|
2020
2044
|
response_dict = {} if not response.body else json.loads(response.body)
|
|
2021
2045
|
|
|
2022
2046
|
if self._api_client.vertexai:
|
|
2023
|
-
response_dict = _CancelTuningJobResponse_from_vertex(
|
|
2047
|
+
response_dict = _CancelTuningJobResponse_from_vertex(
|
|
2048
|
+
response_dict, None, parameter_model
|
|
2049
|
+
)
|
|
2024
2050
|
|
|
2025
2051
|
if not self._api_client.vertexai:
|
|
2026
|
-
response_dict = _CancelTuningJobResponse_from_mldev(
|
|
2052
|
+
response_dict = _CancelTuningJobResponse_from_mldev(
|
|
2053
|
+
response_dict, None, parameter_model
|
|
2054
|
+
)
|
|
2027
2055
|
|
|
2028
2056
|
return_value = types.CancelTuningJobResponse._from_response(
|
|
2029
2057
|
response=response_dict, kwargs=parameter_model.model_dump()
|
|
@@ -2096,7 +2124,9 @@ class AsyncTunings(_api_module.BaseModule):
|
|
|
2096
2124
|
response_dict = {} if not response.body else json.loads(response.body)
|
|
2097
2125
|
|
|
2098
2126
|
if self._api_client.vertexai:
|
|
2099
|
-
response_dict = _TuningJob_from_vertex(
|
|
2127
|
+
response_dict = _TuningJob_from_vertex(
|
|
2128
|
+
response_dict, None, parameter_model
|
|
2129
|
+
)
|
|
2100
2130
|
|
|
2101
2131
|
return_value = types.TuningJob._from_response(
|
|
2102
2132
|
response=response_dict, kwargs=parameter_model.model_dump()
|
|
@@ -2171,7 +2201,9 @@ class AsyncTunings(_api_module.BaseModule):
|
|
|
2171
2201
|
response_dict = {} if not response.body else json.loads(response.body)
|
|
2172
2202
|
|
|
2173
2203
|
if not self._api_client.vertexai:
|
|
2174
|
-
response_dict = _TuningOperation_from_mldev(
|
|
2204
|
+
response_dict = _TuningOperation_from_mldev(
|
|
2205
|
+
response_dict, None, parameter_model
|
|
2206
|
+
)
|
|
2175
2207
|
|
|
2176
2208
|
return_value = types.TuningOperation._from_response(
|
|
2177
2209
|
response=response_dict, kwargs=parameter_model.model_dump()
|
google/genai/version.py
CHANGED
|
@@ -20,26 +20,26 @@ google/genai/caches.py,sha256=24GhR6Nj-1Bdaey6ff6NNmP5pIjvlO0S1Dv_-CrCtyI,48118
|
|
|
20
20
|
google/genai/chats.py,sha256=q3_iONHx8l-Y7EG29_f45yjFDdL2VFefUDLMdJtw0sE,16583
|
|
21
21
|
google/genai/client.py,sha256=odJ3erYMO1tkvn_9AOyfLawNX2tZf71fbVzqmmLEjOY,21327
|
|
22
22
|
google/genai/documents.py,sha256=GuYWVgRaYBzHv9aMgcZBrVkFlpBeaAeZsfhgvC_SLTA,16218
|
|
23
|
-
google/genai/errors.py,sha256=
|
|
23
|
+
google/genai/errors.py,sha256=ch8Vo5LJJFp2fbCQlBGLn7zMk23uPBkXdDvf8b-uYi8,8555
|
|
24
24
|
google/genai/file_search_stores.py,sha256=4EW_hRjkaGYu4gbQyNbiswTWk5nUgooxB5pqMi_WAME,41418
|
|
25
25
|
google/genai/files.py,sha256=iGYDbHkbnYsqZhkHuKMjrABsMhJivtdPM6Qgog5Q08M,39059
|
|
26
26
|
google/genai/interactions.py,sha256=GLpo-rTdxb1JfL3LXE0c52JWaEGloLnPeCI9hoO_M2g,642
|
|
27
|
-
google/genai/live.py,sha256=
|
|
28
|
-
google/genai/live_music.py,sha256=
|
|
27
|
+
google/genai/live.py,sha256=A9nqCw5oTsjtu-7raxavjddhK48jUM1M5G7cqehvzkk,42544
|
|
28
|
+
google/genai/live_music.py,sha256=Tc-dfxvWt7gxcpaCmomtNpFu2RcIaU5xuuwsajkdDHs,7288
|
|
29
29
|
google/genai/local_tokenizer.py,sha256=EKZ72cV2Zfutlo_efMOPnLRNZN4WQe57rD3G80cF340,14109
|
|
30
|
-
google/genai/models.py,sha256=
|
|
30
|
+
google/genai/models.py,sha256=bruUlkh8A1LnIDaUUrRHL2sBIc0o6sncCmFm-W2ccCs,251648
|
|
31
31
|
google/genai/operations.py,sha256=FXJOnYp2HA5Xqa5mHW67mSa9p1D_EaGGyUoKc09xFPQ,16384
|
|
32
32
|
google/genai/pagers.py,sha256=1i8NXDuKuQznFin5H5-I0hmj6H5YMTYsEJP7S0ITSbY,7158
|
|
33
33
|
google/genai/py.typed,sha256=RsMFoLwBkAvY05t6izop4UHZtqOPLiKp3GkIEizzmQY,40
|
|
34
34
|
google/genai/tokens.py,sha256=4BPW0gGWFeFVk3INkuY2tfREnsrvzQDhouvRI6_F9Q8,12235
|
|
35
|
-
google/genai/tunings.py,sha256=
|
|
35
|
+
google/genai/tunings.py,sha256=xXePLiUbXAqxKaQaadQa6JVa0AXX1rb4rj7d2z7pAk8,81395
|
|
36
36
|
google/genai/types.py,sha256=GmIqqe9PHbgUBvtOMvx5YRCzcFarMr_tErPCR3eL4G0,662323
|
|
37
|
-
google/genai/version.py,sha256=
|
|
37
|
+
google/genai/version.py,sha256=baXn09WKoxORFH_2FZYVfx2hXcnfVehXLdriWUApne8,627
|
|
38
38
|
google/genai/_interactions/__init__.py,sha256=Zl5wlyZ1be3a1ENIERjj9ocpELL89RdZkHF3MnCkB3M,3571
|
|
39
|
-
google/genai/_interactions/_base_client.py,sha256=
|
|
39
|
+
google/genai/_interactions/_base_client.py,sha256=eVxa4rIq_ZKWmmVON8Me_SiHpmGr2ugTpDV9zTpZ45w,74709
|
|
40
40
|
google/genai/_interactions/_client.py,sha256=VkBifJIA0IchcNRUUb4E8w02udzmJMedYPXYnqX1iKc,21234
|
|
41
41
|
google/genai/_interactions/_client_adapter.py,sha256=QLQa352-22JgCa72uFo0UGzZr0v-BaTZ4yUVKCQ5LIU,1349
|
|
42
|
-
google/genai/_interactions/_compat.py,sha256=
|
|
42
|
+
google/genai/_interactions/_compat.py,sha256=eVykYZJNmzZw9idjzze7HdTUYSYhqm9Dl3uI77TiDfo,7204
|
|
43
43
|
google/genai/_interactions/_constants.py,sha256=t7rpey7f7Z65WNYx8OzR-VGkTEHaz_WCLOREzHLjFhk,1039
|
|
44
44
|
google/genai/_interactions/_exceptions.py,sha256=XvtN0Ir69uwzlI9s-2gvXZJyDa3NZ0IqsMapC9nM8Bc,3825
|
|
45
45
|
google/genai/_interactions/_files.py,sha256=K7qgCZWoSaNI4RrdY1cUnNMXNF3Usq1IgCvzqwFgfMQ,4144
|
|
@@ -53,6 +53,7 @@ google/genai/_interactions/_version.py,sha256=HYUoiFQBODx2RJNZpIxeUnGFUe8Gc9FEO6
|
|
|
53
53
|
google/genai/_interactions/_utils/__init__.py,sha256=fNs6SzzZLqVABQ0TgZ3z1LBri3iVIdtvKo0GcTiNXJM,2882
|
|
54
54
|
google/genai/_interactions/_utils/_compat.py,sha256=NfPeqV7YsaW2h40s7NODt-uOngiMLf9KboR0W-f64gU,1794
|
|
55
55
|
google/genai/_interactions/_utils/_datetime_parse.py,sha256=dYUm7Y3pBD4dzQmpr-onIalbkEQH8gSqdSok5wx24wE,4781
|
|
56
|
+
google/genai/_interactions/_utils/_json.py,sha256=miy3kDffBjNQQQyYCVdHiMRU-ymfcXI2nyY7S6_Efzs,1539
|
|
56
57
|
google/genai/_interactions/_utils/_logs.py,sha256=z9QPllBTUdyCkIpb3iHi_NZnM3GTG_OQtD4t1Htpex4,1404
|
|
57
58
|
google/genai/_interactions/_utils/_proxy.py,sha256=V_QfMtbDL4_OFaYynWeyCCkP7KPBuV7GEJspth55rS0,2552
|
|
58
59
|
google/genai/_interactions/_utils/_reflection.py,sha256=F4i9cYP3sGnxZ-dhp3lcFSRiB115znLodOM-gcVh-wA,1941
|
|
@@ -221,7 +222,7 @@ google/genai/tests/documents/test_delete.py,sha256=O33JZOTpdhrCRmAudC6YudHpuv46u
|
|
|
221
222
|
google/genai/tests/documents/test_get.py,sha256=Z-aMd_vxjnxUVDg_4iphCkXJnqDM6ZMaiqa87ip172s,3191
|
|
222
223
|
google/genai/tests/documents/test_list.py,sha256=qgdc__sH88NA8Ptd83BfPsGLaoZntdn0D6eHajr-jl0,2425
|
|
223
224
|
google/genai/tests/errors/__init__.py,sha256=8hdiuOvLIiX_to2O6rc8Af04-85qQuRu62gOhQQyNx8,39
|
|
224
|
-
google/genai/tests/errors/test_api_error.py,sha256=
|
|
225
|
+
google/genai/tests/errors/test_api_error.py,sha256=aeWHvizYE4tXMX_DEaYsH0FTfjQUtkWcNA3jWQ3gF8k,12181
|
|
225
226
|
google/genai/tests/file_search_stores/__init__.py,sha256=IGpNdiCD34aFEuUWM4QyGS-ekZM29FxL1uM2oRP1E4M,644
|
|
226
227
|
google/genai/tests/file_search_stores/test_create.py,sha256=1a90j-1oOYBPF7DPIxgMFblhxLtmo_KBL3eUrCOLpzI,2090
|
|
227
228
|
google/genai/tests/file_search_stores/test_delete.py,sha256=hRfxcMbaB3Q93izLd0JfS4HOu7sttugV0bLmF6GrGIs,2158
|
|
@@ -352,8 +353,8 @@ google/genai/tests/types/test_part_type.py,sha256=a_0eE2CgE7Ju6ePmu3DrupsZZCFiyD
|
|
|
352
353
|
google/genai/tests/types/test_schema_from_json_schema.py,sha256=WiraJx5mRLW8lKHiWsyHTBYge4jVpeCYklbqGd4BkZQ,13894
|
|
353
354
|
google/genai/tests/types/test_schema_json_schema.py,sha256=zn1gjsXcHTztzmajr8YX3Yb6rWnchjgjw6Yj1NZnG-0,15536
|
|
354
355
|
google/genai/tests/types/test_types.py,sha256=Tqc_PpGo9-XH1xfkAjTCM9xngan_4w__hgpA0BkyA8g,84416
|
|
355
|
-
google_genai-1.
|
|
356
|
-
google_genai-1.
|
|
357
|
-
google_genai-1.
|
|
358
|
-
google_genai-1.
|
|
359
|
-
google_genai-1.
|
|
356
|
+
google_genai-1.62.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
357
|
+
google_genai-1.62.0.dist-info/METADATA,sha256=kZdH4KSMC2R7oZBE2eQB6_NqBq6JHaydSeSC4cNKWAM,53135
|
|
358
|
+
google_genai-1.62.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
359
|
+
google_genai-1.62.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
|
|
360
|
+
google_genai-1.62.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|