google-genai 1.23.0__py3-none-any.whl → 1.25.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 +43 -31
- google/genai/_common.py +6 -4
- google/genai/_live_converters.py +14 -6
- google/genai/_replay_api_client.py +15 -8
- google/genai/_tokens_converters.py +6 -0
- google/genai/_transformers.py +12 -6
- google/genai/batches.py +84 -12
- google/genai/caches.py +6 -0
- google/genai/errors.py +2 -2
- google/genai/live.py +14 -5
- google/genai/models.py +6 -0
- google/genai/tokens.py +8 -4
- google/genai/tunings.py +12 -0
- google/genai/types.py +312 -34
- google/genai/version.py +1 -1
- {google_genai-1.23.0.dist-info → google_genai-1.25.0.dist-info}/METADATA +96 -7
- google_genai-1.25.0.dist-info/RECORD +35 -0
- google_genai-1.23.0.dist-info/RECORD +0 -35
- {google_genai-1.23.0.dist-info → google_genai-1.25.0.dist-info}/WHEEL +0 -0
- {google_genai-1.23.0.dist-info → google_genai-1.25.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.23.0.dist-info → google_genai-1.25.0.dist-info}/top_level.txt +0 -0
google/genai/live.py
CHANGED
@@ -196,7 +196,7 @@ class AsyncSession:
|
|
196
196
|
if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
|
197
197
|
MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
|
198
198
|
else:
|
199
|
-
MODEL_NAME = 'gemini-2.
|
199
|
+
MODEL_NAME = 'gemini-live-2.5-flash-preview';
|
200
200
|
|
201
201
|
client = genai.Client()
|
202
202
|
async with client.aio.live.connect(
|
@@ -267,7 +267,7 @@ class AsyncSession:
|
|
267
267
|
if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
|
268
268
|
MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
|
269
269
|
else:
|
270
|
-
MODEL_NAME = 'gemini-2.
|
270
|
+
MODEL_NAME = 'gemini-live-2.5-flash-preview';
|
271
271
|
|
272
272
|
|
273
273
|
client = genai.Client()
|
@@ -361,7 +361,7 @@ class AsyncSession:
|
|
361
361
|
if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
|
362
362
|
MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
|
363
363
|
else:
|
364
|
-
MODEL_NAME = 'gemini-2.
|
364
|
+
MODEL_NAME = 'gemini-live-2.5-flash-preview';
|
365
365
|
|
366
366
|
client = genai.Client()
|
367
367
|
|
@@ -372,7 +372,7 @@ class AsyncSession:
|
|
372
372
|
}
|
373
373
|
|
374
374
|
async with client.aio.live.connect(
|
375
|
-
model='models/gemini-2.
|
375
|
+
model='models/gemini-live-2.5-flash-preview',
|
376
376
|
config=config
|
377
377
|
) as session:
|
378
378
|
prompt = "Turn on the lights please"
|
@@ -940,7 +940,16 @@ class AsyncLive(_api_module.BaseModule):
|
|
940
940
|
)
|
941
941
|
method = 'BidiGenerateContentConstrained'
|
942
942
|
key_name = 'access_token'
|
943
|
-
|
943
|
+
if version != 'v1alpha':
|
944
|
+
warnings.warn(
|
945
|
+
message=(
|
946
|
+
"The SDK's ephemeral token support is in v1alpha only."
|
947
|
+
'Please use client = genai.Client(api_key=token.name, '
|
948
|
+
'http_options=types.HttpOptions(api_version="v1alpha"))'
|
949
|
+
' before session connection.'
|
950
|
+
),
|
951
|
+
category=errors.ExperimentalWarning,
|
952
|
+
)
|
944
953
|
uri = f'{base_url}/ws/google.ai.generativelanguage.{version}.GenerativeService.{method}?{key_name}={api_key}'
|
945
954
|
headers = self._api_client._http_options.headers
|
946
955
|
|
google/genai/models.py
CHANGED
@@ -517,6 +517,9 @@ def _Tool_to_mldev(
|
|
517
517
|
if getv(from_object, ['code_execution']) is not None:
|
518
518
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
519
519
|
|
520
|
+
if getv(from_object, ['computer_use']) is not None:
|
521
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
522
|
+
|
520
523
|
return to_object
|
521
524
|
|
522
525
|
|
@@ -1958,6 +1961,9 @@ def _Tool_to_vertex(
|
|
1958
1961
|
if getv(from_object, ['code_execution']) is not None:
|
1959
1962
|
setv(to_object, ['codeExecution'], getv(from_object, ['code_execution']))
|
1960
1963
|
|
1964
|
+
if getv(from_object, ['computer_use']) is not None:
|
1965
|
+
setv(to_object, ['computerUse'], getv(from_object, ['computer_use']))
|
1966
|
+
|
1961
1967
|
return to_object
|
1962
1968
|
|
1963
1969
|
|
google/genai/tokens.py
CHANGED
@@ -166,7 +166,7 @@ class Tokens(_api_module.BaseModule):
|
|
166
166
|
config=types.CreateAuthTokenConfig(
|
167
167
|
uses=10,
|
168
168
|
live_constrained_parameters=types.LiveEphemeralParameters(
|
169
|
-
model='gemini-2.
|
169
|
+
model='gemini-live-2.5-flash-preview',
|
170
170
|
config=types.LiveConnectConfig(
|
171
171
|
system_instruction='You are an LLM called Gemini.'
|
172
172
|
),
|
@@ -202,7 +202,7 @@ class Tokens(_api_module.BaseModule):
|
|
202
202
|
config=types.CreateAuthTokenConfig(
|
203
203
|
uses=10,
|
204
204
|
live_constrained_parameters=types.LiveEphemeralParameters(
|
205
|
-
model='gemini-2.
|
205
|
+
model='gemini-live-2.5-flash-preview',
|
206
206
|
config=types.LiveConnectConfig(
|
207
207
|
system_instruction='You are an LLM called Gemini.'
|
208
208
|
),
|
@@ -284,7 +284,7 @@ class AsyncTokens(_api_module.BaseModule):
|
|
284
284
|
async def create(
|
285
285
|
self, *, config: Optional[types.CreateAuthTokenConfigOrDict] = None
|
286
286
|
) -> types.AuthToken:
|
287
|
-
"""Creates an auth token asynchronously.
|
287
|
+
"""Creates an auth token asynchronously. Support in v1alpha only.
|
288
288
|
|
289
289
|
Args:
|
290
290
|
config (CreateAuthTokenConfig): Optional configuration for the request.
|
@@ -292,12 +292,16 @@ class AsyncTokens(_api_module.BaseModule):
|
|
292
292
|
Usage:
|
293
293
|
|
294
294
|
.. code-block:: python
|
295
|
+
client = genai.Client(
|
296
|
+
api_key=API_KEY,
|
297
|
+
http_options=types.HttpOptions(api_version='v1alpha'),
|
298
|
+
)
|
295
299
|
|
296
300
|
auth_token = await client.aio.tokens.create(
|
297
301
|
config=types.CreateAuthTokenConfig(
|
298
302
|
uses=10,
|
299
303
|
live_constrained_parameters=types.LiveEphemeralParameters(
|
300
|
-
model='gemini-2.
|
304
|
+
model='gemini-live-2.5-flash-preview',
|
301
305
|
config=types.LiveConnectConfig(
|
302
306
|
system_instruction='You are an LLM called Gemini.'
|
303
307
|
),
|
google/genai/tunings.py
CHANGED
@@ -521,6 +521,12 @@ def _TuningJob_from_mldev(
|
|
521
521
|
if getv(from_object, ['pipelineJob']) is not None:
|
522
522
|
setv(to_object, ['pipeline_job'], getv(from_object, ['pipelineJob']))
|
523
523
|
|
524
|
+
if getv(from_object, ['satisfiesPzi']) is not None:
|
525
|
+
setv(to_object, ['satisfies_pzi'], getv(from_object, ['satisfiesPzi']))
|
526
|
+
|
527
|
+
if getv(from_object, ['satisfiesPzs']) is not None:
|
528
|
+
setv(to_object, ['satisfies_pzs'], getv(from_object, ['satisfiesPzs']))
|
529
|
+
|
524
530
|
if getv(from_object, ['serviceAccount']) is not None:
|
525
531
|
setv(to_object, ['service_account'], getv(from_object, ['serviceAccount']))
|
526
532
|
|
@@ -700,6 +706,12 @@ def _TuningJob_from_vertex(
|
|
700
706
|
if getv(from_object, ['pipelineJob']) is not None:
|
701
707
|
setv(to_object, ['pipeline_job'], getv(from_object, ['pipelineJob']))
|
702
708
|
|
709
|
+
if getv(from_object, ['satisfiesPzi']) is not None:
|
710
|
+
setv(to_object, ['satisfies_pzi'], getv(from_object, ['satisfiesPzi']))
|
711
|
+
|
712
|
+
if getv(from_object, ['satisfiesPzs']) is not None:
|
713
|
+
setv(to_object, ['satisfies_pzs'], getv(from_object, ['satisfiesPzs']))
|
714
|
+
|
703
715
|
if getv(from_object, ['serviceAccount']) is not None:
|
704
716
|
setv(to_object, ['service_account'], getv(from_object, ['serviceAccount']))
|
705
717
|
|