google-genai 1.5.0__py3-none-any.whl → 1.6.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 +93 -67
- google/genai/_automatic_function_calling_util.py +4 -14
- google/genai/_transformers.py +61 -37
- google/genai/batches.py +4 -0
- google/genai/caches.py +20 -26
- google/genai/client.py +3 -2
- google/genai/errors.py +11 -19
- google/genai/files.py +7 -7
- google/genai/live.py +276 -93
- google/genai/models.py +131 -66
- google/genai/operations.py +30 -2
- google/genai/pagers.py +3 -5
- google/genai/tunings.py +31 -21
- google/genai/types.py +88 -33
- google/genai/version.py +1 -1
- {google_genai-1.5.0.dist-info → google_genai-1.6.0.dist-info}/METADATA +194 -25
- google_genai-1.6.0.dist-info/RECORD +27 -0
- {google_genai-1.5.0.dist-info → google_genai-1.6.0.dist-info}/WHEEL +1 -1
- google_genai-1.5.0.dist-info/RECORD +0 -27
- {google_genai-1.5.0.dist-info → google_genai-1.6.0.dist-info}/LICENSE +0 -0
- {google_genai-1.5.0.dist-info → google_genai-1.6.0.dist-info}/top_level.txt +0 -0
google/genai/types.py
CHANGED
@@ -719,7 +719,9 @@ class UserContent(Content):
|
|
719
719
|
role: Literal['user'] = Field(default='user', init=False, frozen=True)
|
720
720
|
parts: list[Part] = Field()
|
721
721
|
|
722
|
-
def __init__(
|
722
|
+
def __init__(
|
723
|
+
self, parts: Union['PartUnionDict', list['PartUnionDict'], list['Part']]
|
724
|
+
):
|
723
725
|
from . import _transformers as t
|
724
726
|
|
725
727
|
super().__init__(parts=t.t_parts(parts=parts))
|
@@ -747,7 +749,9 @@ class ModelContent(Content):
|
|
747
749
|
role: Literal['model'] = Field(default='model', init=False, frozen=True)
|
748
750
|
parts: list[Part] = Field()
|
749
751
|
|
750
|
-
def __init__(
|
752
|
+
def __init__(
|
753
|
+
self, parts: Union['PartUnionDict', list['PartUnionDict'], list['Part']]
|
754
|
+
):
|
751
755
|
from . import _transformers as t
|
752
756
|
|
753
757
|
super().__init__(parts=t.t_parts(parts=parts))
|
@@ -821,17 +825,9 @@ class Schema(_common.BaseModel):
|
|
821
825
|
default=None,
|
822
826
|
description="""Optional. Pattern of the Type.STRING to restrict a string to a regular expression.""",
|
823
827
|
)
|
824
|
-
minimum: Optional[float] = Field(
|
825
|
-
default=None,
|
826
|
-
description="""Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER""",
|
827
|
-
)
|
828
828
|
default: Optional[Any] = Field(
|
829
829
|
default=None, description="""Optional. Default value of the data."""
|
830
830
|
)
|
831
|
-
any_of: Optional[list['Schema']] = Field(
|
832
|
-
default=None,
|
833
|
-
description="""Optional. The value should be validated against any (one or more) of the subschemas in the list.""",
|
834
|
-
)
|
835
831
|
max_length: Optional[int] = Field(
|
836
832
|
default=None,
|
837
833
|
description="""Optional. Maximum length of the Type.STRING""",
|
@@ -847,14 +843,14 @@ class Schema(_common.BaseModel):
|
|
847
843
|
default=None,
|
848
844
|
description="""Optional. Minimum number of the properties for Type.OBJECT.""",
|
849
845
|
)
|
850
|
-
maximum: Optional[float] = Field(
|
851
|
-
default=None,
|
852
|
-
description="""Optional. Maximum value of the Type.INTEGER and Type.NUMBER""",
|
853
|
-
)
|
854
846
|
max_properties: Optional[int] = Field(
|
855
847
|
default=None,
|
856
848
|
description="""Optional. Maximum number of the properties for Type.OBJECT.""",
|
857
849
|
)
|
850
|
+
any_of: Optional[list['Schema']] = Field(
|
851
|
+
default=None,
|
852
|
+
description="""Optional. The value should be validated against any (one or more) of the subschemas in the list.""",
|
853
|
+
)
|
858
854
|
description: Optional[str] = Field(
|
859
855
|
default=None, description="""Optional. The description of the data."""
|
860
856
|
)
|
@@ -874,10 +870,18 @@ class Schema(_common.BaseModel):
|
|
874
870
|
default=None,
|
875
871
|
description="""Optional. Maximum number of the elements for Type.ARRAY.""",
|
876
872
|
)
|
873
|
+
maximum: Optional[float] = Field(
|
874
|
+
default=None,
|
875
|
+
description="""Optional. Maximum value of the Type.INTEGER and Type.NUMBER""",
|
876
|
+
)
|
877
877
|
min_items: Optional[int] = Field(
|
878
878
|
default=None,
|
879
879
|
description="""Optional. Minimum number of the elements for Type.ARRAY.""",
|
880
880
|
)
|
881
|
+
minimum: Optional[float] = Field(
|
882
|
+
default=None,
|
883
|
+
description="""Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER""",
|
884
|
+
)
|
881
885
|
nullable: Optional[bool] = Field(
|
882
886
|
default=None,
|
883
887
|
description="""Optional. Indicates if the value may be null.""",
|
@@ -911,15 +915,9 @@ class SchemaDict(TypedDict, total=False):
|
|
911
915
|
pattern: Optional[str]
|
912
916
|
"""Optional. Pattern of the Type.STRING to restrict a string to a regular expression."""
|
913
917
|
|
914
|
-
minimum: Optional[float]
|
915
|
-
"""Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER"""
|
916
|
-
|
917
918
|
default: Optional[Any]
|
918
919
|
"""Optional. Default value of the data."""
|
919
920
|
|
920
|
-
any_of: Optional[list['SchemaDict']]
|
921
|
-
"""Optional. The value should be validated against any (one or more) of the subschemas in the list."""
|
922
|
-
|
923
921
|
max_length: Optional[int]
|
924
922
|
"""Optional. Maximum length of the Type.STRING"""
|
925
923
|
|
@@ -932,12 +930,12 @@ class SchemaDict(TypedDict, total=False):
|
|
932
930
|
min_properties: Optional[int]
|
933
931
|
"""Optional. Minimum number of the properties for Type.OBJECT."""
|
934
932
|
|
935
|
-
maximum: Optional[float]
|
936
|
-
"""Optional. Maximum value of the Type.INTEGER and Type.NUMBER"""
|
937
|
-
|
938
933
|
max_properties: Optional[int]
|
939
934
|
"""Optional. Maximum number of the properties for Type.OBJECT."""
|
940
935
|
|
936
|
+
any_of: Optional[list['SchemaDict']]
|
937
|
+
"""Optional. The value should be validated against any (one or more) of the subschemas in the list."""
|
938
|
+
|
941
939
|
description: Optional[str]
|
942
940
|
"""Optional. The description of the data."""
|
943
941
|
|
@@ -953,9 +951,15 @@ class SchemaDict(TypedDict, total=False):
|
|
953
951
|
max_items: Optional[int]
|
954
952
|
"""Optional. Maximum number of the elements for Type.ARRAY."""
|
955
953
|
|
954
|
+
maximum: Optional[float]
|
955
|
+
"""Optional. Maximum value of the Type.INTEGER and Type.NUMBER"""
|
956
|
+
|
956
957
|
min_items: Optional[int]
|
957
958
|
"""Optional. Minimum number of the elements for Type.ARRAY."""
|
958
959
|
|
960
|
+
minimum: Optional[float]
|
961
|
+
"""Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER"""
|
962
|
+
|
959
963
|
nullable: Optional[bool]
|
960
964
|
"""Optional. Indicates if the value may be null."""
|
961
965
|
|
@@ -1074,12 +1078,11 @@ class FunctionDeclaration(_common.BaseModel):
|
|
1074
1078
|
type='OBJECT',
|
1075
1079
|
properties=parameters_properties,
|
1076
1080
|
)
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
)
|
1081
|
+
declaration.parameters.required = (
|
1082
|
+
_automatic_function_calling_util._get_required_fields(
|
1083
|
+
declaration.parameters
|
1084
|
+
)
|
1085
|
+
)
|
1083
1086
|
if api_option == 'GEMINI_API':
|
1084
1087
|
return declaration
|
1085
1088
|
|
@@ -1663,7 +1666,7 @@ class File(_common.BaseModel):
|
|
1663
1666
|
)
|
1664
1667
|
sha256_hash: Optional[str] = Field(
|
1665
1668
|
default=None,
|
1666
|
-
description="""Output only. SHA-256 hash of the uploaded bytes.""",
|
1669
|
+
description="""Output only. SHA-256 hash of the uploaded bytes. The hash value is encoded in base64 format.""",
|
1667
1670
|
)
|
1668
1671
|
uri: Optional[str] = Field(
|
1669
1672
|
default=None, description="""Output only. The URI of the `File`."""
|
@@ -1712,7 +1715,7 @@ class FileDict(TypedDict, total=False):
|
|
1712
1715
|
"""Output only. The timestamp of when the `File` was last updated."""
|
1713
1716
|
|
1714
1717
|
sha256_hash: Optional[str]
|
1715
|
-
"""Output only. SHA-256 hash of the uploaded bytes."""
|
1718
|
+
"""Output only. SHA-256 hash of the uploaded bytes. The hash value is encoded in base64 format."""
|
1716
1719
|
|
1717
1720
|
uri: Optional[str]
|
1718
1721
|
"""Output only. The URI of the `File`."""
|
@@ -3745,6 +3748,36 @@ class ImageDict(TypedDict, total=False):
|
|
3745
3748
|
ImageOrDict = Union[Image, ImageDict]
|
3746
3749
|
|
3747
3750
|
|
3751
|
+
class SafetyAttributes(_common.BaseModel):
|
3752
|
+
"""Safety attributes of a GeneratedImage or the user-provided prompt."""
|
3753
|
+
|
3754
|
+
categories: Optional[list[str]] = Field(
|
3755
|
+
default=None,
|
3756
|
+
description="""List of RAI categories.
|
3757
|
+
""",
|
3758
|
+
)
|
3759
|
+
scores: Optional[list[float]] = Field(
|
3760
|
+
default=None,
|
3761
|
+
description="""List of scores of each categories.
|
3762
|
+
""",
|
3763
|
+
)
|
3764
|
+
|
3765
|
+
|
3766
|
+
class SafetyAttributesDict(TypedDict, total=False):
|
3767
|
+
"""Safety attributes of a GeneratedImage or the user-provided prompt."""
|
3768
|
+
|
3769
|
+
categories: Optional[list[str]]
|
3770
|
+
"""List of RAI categories.
|
3771
|
+
"""
|
3772
|
+
|
3773
|
+
scores: Optional[list[float]]
|
3774
|
+
"""List of scores of each categories.
|
3775
|
+
"""
|
3776
|
+
|
3777
|
+
|
3778
|
+
SafetyAttributesOrDict = Union[SafetyAttributes, SafetyAttributesDict]
|
3779
|
+
|
3780
|
+
|
3748
3781
|
class GeneratedImage(_common.BaseModel):
|
3749
3782
|
"""An output image."""
|
3750
3783
|
|
@@ -3759,6 +3792,12 @@ class GeneratedImage(_common.BaseModel):
|
|
3759
3792
|
response.
|
3760
3793
|
""",
|
3761
3794
|
)
|
3795
|
+
safety_attributes: Optional[SafetyAttributes] = Field(
|
3796
|
+
default=None,
|
3797
|
+
description="""Safety attributes of the image. Lists of RAI categories and their
|
3798
|
+
scores of each content.
|
3799
|
+
""",
|
3800
|
+
)
|
3762
3801
|
enhanced_prompt: Optional[str] = Field(
|
3763
3802
|
default=None,
|
3764
3803
|
description="""The rewritten prompt used for the image generation if the prompt
|
@@ -3779,6 +3818,11 @@ class GeneratedImageDict(TypedDict, total=False):
|
|
3779
3818
|
response.
|
3780
3819
|
"""
|
3781
3820
|
|
3821
|
+
safety_attributes: Optional[SafetyAttributesDict]
|
3822
|
+
"""Safety attributes of the image. Lists of RAI categories and their
|
3823
|
+
scores of each content.
|
3824
|
+
"""
|
3825
|
+
|
3782
3826
|
enhanced_prompt: Optional[str]
|
3783
3827
|
"""The rewritten prompt used for the image generation if the prompt
|
3784
3828
|
enhancer is enabled.
|
@@ -4070,6 +4114,11 @@ class EditImageConfig(_common.BaseModel):
|
|
4070
4114
|
default=None,
|
4071
4115
|
description="""Describes the editing mode for the request.""",
|
4072
4116
|
)
|
4117
|
+
base_steps: Optional[int] = Field(
|
4118
|
+
default=None,
|
4119
|
+
description="""The number of sampling steps. A higher value has better image
|
4120
|
+
quality, while a lower value has better latency.""",
|
4121
|
+
)
|
4073
4122
|
|
4074
4123
|
|
4075
4124
|
class EditImageConfigDict(TypedDict, total=False):
|
@@ -4138,6 +4187,10 @@ class EditImageConfigDict(TypedDict, total=False):
|
|
4138
4187
|
edit_mode: Optional[EditMode]
|
4139
4188
|
"""Describes the editing mode for the request."""
|
4140
4189
|
|
4190
|
+
base_steps: Optional[int]
|
4191
|
+
"""The number of sampling steps. A higher value has better image
|
4192
|
+
quality, while a lower value has better latency."""
|
4193
|
+
|
4141
4194
|
|
4142
4195
|
EditImageConfigOrDict = Union[EditImageConfig, EditImageConfigDict]
|
4143
4196
|
|
@@ -5178,8 +5231,10 @@ class Video(_common.BaseModel):
|
|
5178
5231
|
IPython_display = None
|
5179
5232
|
|
5180
5233
|
if IPython_display:
|
5181
|
-
|
5182
|
-
|
5234
|
+
IPython_display.display(
|
5235
|
+
IPython_display.Video(
|
5236
|
+
data=self.video_bytes, mimetype=mime_type, embed=True
|
5237
|
+
)
|
5183
5238
|
)
|
5184
5239
|
|
5185
5240
|
def __repr__(self):
|
google/genai/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: google-genai
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.6.0
|
4
4
|
Summary: GenAI Python SDK
|
5
5
|
Author-email: Google LLC <googleapis-packages@google.com>
|
6
6
|
License: Apache-2.0
|
@@ -20,13 +20,13 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
20
|
Requires-Python: >=3.9
|
21
21
|
Description-Content-Type: text/markdown
|
22
22
|
License-File: LICENSE
|
23
|
-
Requires-Dist: anyio<5.0.
|
24
|
-
Requires-Dist: google-auth<3.0.
|
25
|
-
Requires-Dist: httpx<1.0.
|
26
|
-
Requires-Dist: pydantic<3.0.
|
27
|
-
Requires-Dist: requests<3.0.
|
28
|
-
Requires-Dist: websockets<15.
|
29
|
-
Requires-Dist: typing-extensions<5.0.
|
23
|
+
Requires-Dist: anyio<5.0.0,>=4.8.0
|
24
|
+
Requires-Dist: google-auth<3.0.0,>=2.14.1
|
25
|
+
Requires-Dist: httpx<1.0.0,>=0.28.1
|
26
|
+
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
27
|
+
Requires-Dist: requests<3.0.0,>=2.28.1
|
28
|
+
Requires-Dist: websockets<15.0.0,>=13.0.0
|
29
|
+
Requires-Dist: typing-extensions<5.0.0,>=4.11.0
|
30
30
|
|
31
31
|
# Google Gen AI SDK
|
32
32
|
|
@@ -160,37 +160,202 @@ response = client.models.generate_content(
|
|
160
160
|
print(response.text)
|
161
161
|
```
|
162
162
|
|
163
|
-
#### How to structure `contents`
|
164
|
-
|
163
|
+
#### How to structure `contents` argument for `generate_content`
|
164
|
+
The SDK always converts the inputs to the `contents` argument into
|
165
|
+
`list[types.Content]`.
|
166
|
+
The following shows some common ways to provide your inputs.
|
165
167
|
|
166
|
-
Provide a
|
168
|
+
##### Provide a `list[types.Content]`
|
169
|
+
This is the canonical way to provide contents, SDK will not do any conversion.
|
170
|
+
|
171
|
+
##### Provide a `types.Content` instance
|
172
|
+
|
173
|
+
```python
|
174
|
+
contents = types.Content(
|
175
|
+
role='user',
|
176
|
+
parts=[types.Part.from_text(text='Why is the sky blue?')]
|
177
|
+
)
|
178
|
+
```
|
179
|
+
|
180
|
+
SDK converts this to
|
181
|
+
|
182
|
+
```python
|
183
|
+
[
|
184
|
+
types.Content(
|
185
|
+
role='user',
|
186
|
+
parts=[types.Part.from_text(text='Why is the sky blue?')]
|
187
|
+
)
|
188
|
+
]
|
189
|
+
```
|
190
|
+
|
191
|
+
##### Provide a string
|
192
|
+
|
193
|
+
```python
|
194
|
+
contents='Why is the sky blue?'
|
195
|
+
```
|
196
|
+
|
197
|
+
The SDK will assume this is a text part, and it converts this into the following:
|
198
|
+
|
199
|
+
```python
|
200
|
+
[
|
201
|
+
types.UserContent(
|
202
|
+
parts=[
|
203
|
+
types.Part.from_text(text='Why is the sky blue?')
|
204
|
+
]
|
205
|
+
)
|
206
|
+
]
|
207
|
+
```
|
208
|
+
|
209
|
+
Where a `types.UserContent` is a subclass of `types.Content`, it sets the
|
210
|
+
`role` field to be `user`.
|
211
|
+
|
212
|
+
##### Provide a list of string
|
213
|
+
|
214
|
+
```python
|
215
|
+
contents=['Why is the sky blue?', 'Why is the cloud white?']
|
216
|
+
```
|
217
|
+
|
218
|
+
The SDK assumes these are 2 text parts, it converts this into a single content,
|
219
|
+
like the following:
|
220
|
+
|
221
|
+
```python
|
222
|
+
[
|
223
|
+
types.UserContent(
|
224
|
+
parts=[
|
225
|
+
types.Part.from_text(text='Why is the sky blue?'),
|
226
|
+
types.Part.from_text(text='Why is the cloud white?'),
|
227
|
+
]
|
228
|
+
)
|
229
|
+
]
|
230
|
+
```
|
231
|
+
|
232
|
+
Where a `types.UserContent` is a subclass of `types.Content`, the
|
233
|
+
`role` field in `types.UserContent` is fixed to be `user`.
|
234
|
+
|
235
|
+
##### Provide a function call part
|
236
|
+
|
237
|
+
```python
|
238
|
+
contents = types.Part.from_function_call(
|
239
|
+
name='get_weather_by_location',
|
240
|
+
args={'location': 'Boston'}
|
241
|
+
)
|
242
|
+
```
|
243
|
+
|
244
|
+
The SDK converts a function call part to a content with a `model` role:
|
245
|
+
|
246
|
+
```python
|
247
|
+
[
|
248
|
+
types.ModelContent(
|
249
|
+
parts=[
|
250
|
+
types.Part.from_function_call(
|
251
|
+
name='get_weather_by_location',
|
252
|
+
args={'location': 'Boston'}
|
253
|
+
)
|
254
|
+
]
|
255
|
+
)
|
256
|
+
]
|
257
|
+
```
|
258
|
+
|
259
|
+
Where a `types.ModelContent` is a subclass of `types.Content`, the
|
260
|
+
`role` field in `types.ModelContent` is fixed to be `model`.
|
261
|
+
|
262
|
+
##### Provide a list of function call parts
|
167
263
|
|
168
264
|
```python
|
169
|
-
contents=
|
265
|
+
contents = [
|
266
|
+
types.Part.from_function_call(
|
267
|
+
name='get_weather_by_location',
|
268
|
+
args={'location': 'Boston'}
|
269
|
+
),
|
270
|
+
types.Part.from_function_call(
|
271
|
+
name='get_weather_by_location',
|
272
|
+
args={'location': 'New York'}
|
273
|
+
),
|
274
|
+
]
|
275
|
+
```
|
276
|
+
|
277
|
+
The SDK converts a list of function call parts to the a content with a `model` role:
|
278
|
+
|
279
|
+
```python
|
280
|
+
[
|
281
|
+
types.ModelContent(
|
282
|
+
parts=[
|
283
|
+
types.Part.from_function_call(
|
284
|
+
name='get_weather_by_location',
|
285
|
+
args={'location': 'Boston'}
|
286
|
+
),
|
287
|
+
types.Part.from_function_call(
|
288
|
+
name='get_weather_by_location',
|
289
|
+
args={'location': 'New York'}
|
290
|
+
)
|
291
|
+
]
|
292
|
+
)
|
293
|
+
]
|
170
294
|
```
|
171
295
|
|
172
|
-
|
296
|
+
Where a `types.ModelContent` is a subclass of `types.Content`, the
|
297
|
+
`role` field in `types.ModelContent` is fixed to be `model`.
|
298
|
+
|
299
|
+
##### Provide a non function call part
|
173
300
|
|
174
301
|
```python
|
175
|
-
contents=types.
|
176
|
-
|
177
|
-
|
178
|
-
|
302
|
+
contents = types.Part.from_uri(
|
303
|
+
file_uri: 'gs://generativeai-downloads/images/scones.jpg',
|
304
|
+
mime_type: 'image/jpeg',
|
305
|
+
)
|
179
306
|
```
|
180
307
|
|
181
|
-
|
182
|
-
instances:
|
308
|
+
The SDK converts all non function call parts into a content with a `user` role.
|
183
309
|
|
184
310
|
```python
|
185
|
-
|
186
|
-
|
311
|
+
[
|
312
|
+
types.UserContent(parts=[
|
187
313
|
types.Part.from_uri(
|
188
|
-
|
189
|
-
|
190
|
-
)
|
191
|
-
]
|
314
|
+
file_uri: 'gs://generativeai-downloads/images/scones.jpg',
|
315
|
+
mime_type: 'image/jpeg',
|
316
|
+
)
|
317
|
+
])
|
318
|
+
]
|
319
|
+
```
|
320
|
+
|
321
|
+
##### Provide a list of non function call parts
|
322
|
+
|
323
|
+
```python
|
324
|
+
contents = [
|
325
|
+
types.Part.from_text('What is this image about?'),
|
326
|
+
types.Part.from_uri(
|
327
|
+
file_uri: 'gs://generativeai-downloads/images/scones.jpg',
|
328
|
+
mime_type: 'image/jpeg',
|
329
|
+
)
|
330
|
+
]
|
192
331
|
```
|
193
332
|
|
333
|
+
The SDK will convert the list of parts into a content with a `user` role
|
334
|
+
|
335
|
+
```python
|
336
|
+
[
|
337
|
+
types.UserContent(
|
338
|
+
parts=[
|
339
|
+
types.Part.from_text('What is this image about?'),
|
340
|
+
types.Part.from_uri(
|
341
|
+
file_uri: 'gs://generativeai-downloads/images/scones.jpg',
|
342
|
+
mime_type: 'image/jpeg',
|
343
|
+
)
|
344
|
+
]
|
345
|
+
)
|
346
|
+
]
|
347
|
+
```
|
348
|
+
|
349
|
+
##### Mix types in contents
|
350
|
+
You can also provide a list of `types.ContentUnion`. The SDK leaves items of
|
351
|
+
`types.Content` as is, it groups consecutive non function call parts into a
|
352
|
+
single `types.UserContent`, and it groups consecutive function call parts into
|
353
|
+
a single `types.ModelContent`.
|
354
|
+
|
355
|
+
If you put a list within a list, the inner list can only contain
|
356
|
+
`types.PartUnion` items. The SDK will convert the inner list into a single
|
357
|
+
`types.UserContent`.
|
358
|
+
|
194
359
|
### System Instructions and Other Configs
|
195
360
|
|
196
361
|
The output of the model can be influenced by several optional settings
|
@@ -481,6 +646,10 @@ response = client.models.generate_content(
|
|
481
646
|
```
|
482
647
|
### JSON Response Schema
|
483
648
|
|
649
|
+
However you define your schema, don't duplicate it in your input prompt,
|
650
|
+
including by giving examples of expected JSON output. If you do, the generated
|
651
|
+
output might be lower in quality.
|
652
|
+
|
484
653
|
#### Pydantic Model Schema support
|
485
654
|
|
486
655
|
Schemas can be provided as Pydantic Models.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
google/genai/__init__.py,sha256=IYw-PcsdgjSpS1mU_ZcYkTfPocsJ4aVmrDxP7vX7c6Y,709
|
2
|
+
google/genai/_api_client.py,sha256=xEme7KhIrp5lCDlde_HECGzH4TppepR8YraSDiGvhPc,30593
|
3
|
+
google/genai/_api_module.py,sha256=66FsFq9N8PdTegDyx3am3NHpI0Bw7HBmifUMCrZsx_Q,902
|
4
|
+
google/genai/_automatic_function_calling_util.py,sha256=xAH-96LIEmC-yefEIae8TrBPZZAI1UJrn0bAIZsISDE,10899
|
5
|
+
google/genai/_common.py,sha256=u0qX3Uli_7qaYmoTZm9JnVzoMihD4ASPksmqmsjGSBs,10071
|
6
|
+
google/genai/_extra_utils.py,sha256=l9U0uaq4TWdfY7fOpGR3LcsA6-TMEblfQlEXdC0IGPY,12462
|
7
|
+
google/genai/_replay_api_client.py,sha256=OxZIAyyyI4D9uj0avNO0QGf4DPWJ4Pqf_MCbUs5pvYc,18459
|
8
|
+
google/genai/_test_api_client.py,sha256=XNOWq8AkYbqInv1aljNGlFXsv8slQIWTYy_hdcCetD0,4797
|
9
|
+
google/genai/_transformers.py,sha256=9cVaRp1zLOG27D7iNJeW2rw2jbjlvuEUeVl5SUN6ljY,29863
|
10
|
+
google/genai/batches.py,sha256=K6RgkNWkYBjknADWe4hrv6BtXxWTl1N8b91Pg9MUnAc,41545
|
11
|
+
google/genai/caches.py,sha256=JymnKSaSZYGyTl201tR8PgbZF6fRKdXuCKe4BILKkTc,57551
|
12
|
+
google/genai/chats.py,sha256=ds5iF4hqvyHbHE4OlP1b5s93SwD0hlMNpWxT7db2E48,13493
|
13
|
+
google/genai/client.py,sha256=jN4oNT5qQtX0UILuGcZqxmIL66DOJ-T5P086ygnSnSg,9877
|
14
|
+
google/genai/errors.py,sha256=p_JbOU_eDKIIvWT6NBYGpZcxww622ChAi6eX1FuKKY0,3874
|
15
|
+
google/genai/files.py,sha256=N9TQYyuHRQm4Gb2agjyOlWFljwK-hdPUr-mP0vF0Bc8,45532
|
16
|
+
google/genai/live.py,sha256=Ftj_LxQ2zClK-2hbdRZNXkmnQQguduoNyVntIdPtTdM,32033
|
17
|
+
google/genai/models.py,sha256=1ZlRfRqEl2OvaMvU1nIosGhX7g35A-hupUkrAYqwRpg,210141
|
18
|
+
google/genai/operations.py,sha256=Tvlbk_AuQyXGL9b0wJbzgC8QGHGLSVjb1evbe-ZuZN0,20781
|
19
|
+
google/genai/pagers.py,sha256=1jxDjre7M_Udt0ntgOr_79iR0-axjdr_Q6tZZzVRli8,6784
|
20
|
+
google/genai/tunings.py,sha256=2tWvIkofDDnt6VPsfHAbcrfDIo7jAbIlpdwcx6-cUvM,48239
|
21
|
+
google/genai/types.py,sha256=sVOdjxmviV_oA5JQEKKOlg4nwrlTQjbWGqtgqQACP6Y,299883
|
22
|
+
google/genai/version.py,sha256=5_cjSe7IVSPjk4bpIyj-Lx9SCIXuPbulXr4yMMQgdT8,626
|
23
|
+
google_genai-1.6.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
24
|
+
google_genai-1.6.0.dist-info/METADATA,sha256=_zLVCqlXM9ZDEOPgINpGTkytCEN8pFJ_7Gg4DyPKpJQ,32842
|
25
|
+
google_genai-1.6.0.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
26
|
+
google_genai-1.6.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
|
27
|
+
google_genai-1.6.0.dist-info/RECORD,,
|
@@ -1,27 +0,0 @@
|
|
1
|
-
google/genai/__init__.py,sha256=IYw-PcsdgjSpS1mU_ZcYkTfPocsJ4aVmrDxP7vX7c6Y,709
|
2
|
-
google/genai/_api_client.py,sha256=5VOAFiVe3nSwoMy4QmSPKRzxtVY-lJ8yDEO6SdN267Y,29726
|
3
|
-
google/genai/_api_module.py,sha256=66FsFq9N8PdTegDyx3am3NHpI0Bw7HBmifUMCrZsx_Q,902
|
4
|
-
google/genai/_automatic_function_calling_util.py,sha256=AmFRhGdA6QFdUi9V73Fj4Z4R1dg3-y5b-7YxWUdRNk4,11087
|
5
|
-
google/genai/_common.py,sha256=u0qX3Uli_7qaYmoTZm9JnVzoMihD4ASPksmqmsjGSBs,10071
|
6
|
-
google/genai/_extra_utils.py,sha256=l9U0uaq4TWdfY7fOpGR3LcsA6-TMEblfQlEXdC0IGPY,12462
|
7
|
-
google/genai/_replay_api_client.py,sha256=OxZIAyyyI4D9uj0avNO0QGf4DPWJ4Pqf_MCbUs5pvYc,18459
|
8
|
-
google/genai/_test_api_client.py,sha256=XNOWq8AkYbqInv1aljNGlFXsv8slQIWTYy_hdcCetD0,4797
|
9
|
-
google/genai/_transformers.py,sha256=sq4rZPY808LbZpvkx-tvhWrKl9s0eoDenhc8nfTnYA0,29017
|
10
|
-
google/genai/batches.py,sha256=R4ptSnxTn1ADskGo3_arKP1FaWKsVo9oam6GFou9Mv0,41413
|
11
|
-
google/genai/caches.py,sha256=yj8ASOpYt3lYNc0-lni_BEASZ7SUk-qRz2ZD3jjqW9U,57806
|
12
|
-
google/genai/chats.py,sha256=ds5iF4hqvyHbHE4OlP1b5s93SwD0hlMNpWxT7db2E48,13493
|
13
|
-
google/genai/client.py,sha256=uhX1MhEHepqe6biU-ix_d4wsv5xG8NevT7gFEva0XEM,9785
|
14
|
-
google/genai/errors.py,sha256=BMEANEl_EK1ZIIZsO1FxgX1szvsdaEIaqhu4NpnBLow,4213
|
15
|
-
google/genai/files.py,sha256=jPK2B8pLw4Vh9zn8yuC0e30qHarmbZxc1bRPNpMwnfM,45363
|
16
|
-
google/genai/live.py,sha256=z_Y7LSZcPVkfInjLT9J8LWNIXD5E3e6TPDXZeadOcn0,24710
|
17
|
-
google/genai/models.py,sha256=sQT2OEcOYoacfpjF-Bu3-cp5ejOoaNiVm8e_v1j--RM,208476
|
18
|
-
google/genai/operations.py,sha256=YABHc75FvF3XAKjxgDgINEhuNLdUyNaMPKuDZWHglkM,19599
|
19
|
-
google/genai/pagers.py,sha256=-Ge5vQnBGbbScCGTlaZKuSTBcgTCDP4NuyS3vjixlC8,6869
|
20
|
-
google/genai/tunings.py,sha256=e8KrNDDQVbVZHsuFVuDuvpSNdsA33L-R68ulb2p3vEA,47751
|
21
|
-
google/genai/types.py,sha256=K_UU4zX_SM2oPN3xfRyVR10dV1A9td47fMHQvYBwqck,298284
|
22
|
-
google/genai/version.py,sha256=xEXL7YjPjoHY7XhGUYbNRRLHxqn4NKGHgH0_mXO-SN0,626
|
23
|
-
google_genai-1.5.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
24
|
-
google_genai-1.5.0.dist-info/METADATA,sha256=_OZODJs7oHaP1Veht5rLlNvg_pVq3AIUIdV6YFm5g1k,29190
|
25
|
-
google_genai-1.5.0.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
26
|
-
google_genai-1.5.0.dist-info/top_level.txt,sha256=_1QvSJIhFAGfxb79D6DhB7SUw2X6T4rwnz_LLrbcD3c,7
|
27
|
-
google_genai-1.5.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|