google-genai 1.3.0__py3-none-any.whl → 1.5.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 +143 -69
- google/genai/_api_module.py +1 -1
- google/genai/_automatic_function_calling_util.py +15 -15
- google/genai/_common.py +6 -3
- google/genai/_extra_utils.py +62 -46
- google/genai/_replay_api_client.py +73 -4
- google/genai/_test_api_client.py +8 -8
- google/genai/_transformers.py +194 -66
- google/genai/batches.py +180 -134
- google/genai/caches.py +316 -216
- google/genai/chats.py +179 -35
- google/genai/client.py +3 -3
- google/genai/errors.py +1 -2
- google/genai/files.py +175 -119
- google/genai/live.py +73 -64
- google/genai/models.py +898 -637
- google/genai/operations.py +96 -66
- google/genai/pagers.py +16 -7
- google/genai/tunings.py +172 -112
- google/genai/types.py +228 -178
- google/genai/version.py +1 -1
- {google_genai-1.3.0.dist-info → google_genai-1.5.0.dist-info}/METADATA +8 -1
- google_genai-1.5.0.dist-info/RECORD +27 -0
- {google_genai-1.3.0.dist-info → google_genai-1.5.0.dist-info}/WHEEL +1 -1
- google_genai-1.3.0.dist-info/RECORD +0 -27
- {google_genai-1.3.0.dist-info → google_genai-1.5.0.dist-info}/LICENSE +0 -0
- {google_genai-1.3.0.dist-info → google_genai-1.5.0.dist-info}/top_level.txt +0 -0
google/genai/types.py
CHANGED
@@ -21,8 +21,9 @@ import inspect
|
|
21
21
|
import json
|
22
22
|
import logging
|
23
23
|
import sys
|
24
|
+
import types as builtin_types
|
24
25
|
import typing
|
25
|
-
from typing import Any, Callable,
|
26
|
+
from typing import Any, Callable, Literal, Optional, Union, _UnionGenericAlias # type: ignore
|
26
27
|
import pydantic
|
27
28
|
from pydantic import Field
|
28
29
|
from typing_extensions import TypedDict
|
@@ -30,11 +31,11 @@ from . import _common
|
|
30
31
|
|
31
32
|
if sys.version_info >= (3, 10):
|
32
33
|
# Supports both Union[t1, t2] and t1 | t2
|
33
|
-
VersionedUnionType = Union[
|
34
|
-
_UNION_TYPES = (typing.Union,
|
34
|
+
VersionedUnionType = Union[builtin_types.UnionType, _UnionGenericAlias]
|
35
|
+
_UNION_TYPES = (typing.Union, builtin_types.UnionType)
|
35
36
|
else:
|
36
37
|
# Supports only Union[t1, t2]
|
37
|
-
VersionedUnionType =
|
38
|
+
VersionedUnionType = _UnionGenericAlias
|
38
39
|
_UNION_TYPES = (typing.Union,)
|
39
40
|
|
40
41
|
_is_pillow_image_imported = False
|
@@ -55,6 +56,8 @@ else:
|
|
55
56
|
|
56
57
|
logger = logging.getLogger('google_genai.types')
|
57
58
|
|
59
|
+
T = typing.TypeVar('T', bound='GenerateContentResponse')
|
60
|
+
|
58
61
|
|
59
62
|
class Outcome(_common.CaseInSensitiveEnum):
|
60
63
|
"""Required. Outcome of the code execution."""
|
@@ -73,7 +76,7 @@ class Language(_common.CaseInSensitiveEnum):
|
|
73
76
|
|
74
77
|
|
75
78
|
class Type(_common.CaseInSensitiveEnum):
|
76
|
-
"""
|
79
|
+
"""Optional. The type of the data."""
|
77
80
|
|
78
81
|
TYPE_UNSPECIFIED = 'TYPE_UNSPECIFIED'
|
79
82
|
STRING = 'STRING'
|
@@ -714,13 +717,12 @@ class UserContent(Content):
|
|
714
717
|
"""
|
715
718
|
|
716
719
|
role: Literal['user'] = Field(default='user', init=False, frozen=True)
|
717
|
-
parts: list[Part] = Field(
|
720
|
+
parts: list[Part] = Field()
|
718
721
|
|
719
|
-
|
720
|
-
def validate_parts(cls, value):
|
722
|
+
def __init__(self, parts: Union['PartUnionDict', list['PartUnionDict']]):
|
721
723
|
from . import _transformers as t
|
722
724
|
|
723
|
-
|
725
|
+
super().__init__(parts=t.t_parts(parts=parts))
|
724
726
|
|
725
727
|
|
726
728
|
class ModelContent(Content):
|
@@ -743,13 +745,12 @@ class ModelContent(Content):
|
|
743
745
|
"""
|
744
746
|
|
745
747
|
role: Literal['model'] = Field(default='model', init=False, frozen=True)
|
746
|
-
parts: list[Part] = Field(
|
748
|
+
parts: list[Part] = Field()
|
747
749
|
|
748
|
-
|
749
|
-
def validate_parts(cls, value):
|
750
|
+
def __init__(self, parts: Union['PartUnionDict', list['PartUnionDict']]):
|
750
751
|
from . import _transformers as t
|
751
752
|
|
752
|
-
|
753
|
+
super().__init__(parts=t.t_parts(parts=parts))
|
753
754
|
|
754
755
|
|
755
756
|
class ContentDict(TypedDict, total=False):
|
@@ -812,18 +813,10 @@ class Schema(_common.BaseModel):
|
|
812
813
|
Represents a select subset of an OpenAPI 3.0 schema object.
|
813
814
|
"""
|
814
815
|
|
815
|
-
min_items: Optional[int] = Field(
|
816
|
-
default=None,
|
817
|
-
description="""Optional. Minimum number of the elements for Type.ARRAY.""",
|
818
|
-
)
|
819
816
|
example: Optional[Any] = Field(
|
820
817
|
default=None,
|
821
818
|
description="""Optional. Example of the object. Will only populated when the object is the root.""",
|
822
819
|
)
|
823
|
-
property_ordering: Optional[list[str]] = Field(
|
824
|
-
default=None,
|
825
|
-
description="""Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties.""",
|
826
|
-
)
|
827
820
|
pattern: Optional[str] = Field(
|
828
821
|
default=None,
|
829
822
|
description="""Optional. Pattern of the Type.STRING to restrict a string to a regular expression.""",
|
@@ -835,7 +828,7 @@ class Schema(_common.BaseModel):
|
|
835
828
|
default: Optional[Any] = Field(
|
836
829
|
default=None, description="""Optional. Default value of the data."""
|
837
830
|
)
|
838
|
-
any_of: list['Schema'] = Field(
|
831
|
+
any_of: Optional[list['Schema']] = Field(
|
839
832
|
default=None,
|
840
833
|
description="""Optional. The value should be validated against any (one or more) of the subschemas in the list.""",
|
841
834
|
)
|
@@ -854,25 +847,14 @@ class Schema(_common.BaseModel):
|
|
854
847
|
default=None,
|
855
848
|
description="""Optional. Minimum number of the properties for Type.OBJECT.""",
|
856
849
|
)
|
857
|
-
max_items: Optional[int] = Field(
|
858
|
-
default=None,
|
859
|
-
description="""Optional. Maximum number of the elements for Type.ARRAY.""",
|
860
|
-
)
|
861
850
|
maximum: Optional[float] = Field(
|
862
851
|
default=None,
|
863
852
|
description="""Optional. Maximum value of the Type.INTEGER and Type.NUMBER""",
|
864
853
|
)
|
865
|
-
nullable: Optional[bool] = Field(
|
866
|
-
default=None,
|
867
|
-
description="""Optional. Indicates if the value may be null.""",
|
868
|
-
)
|
869
854
|
max_properties: Optional[int] = Field(
|
870
855
|
default=None,
|
871
856
|
description="""Optional. Maximum number of the properties for Type.OBJECT.""",
|
872
857
|
)
|
873
|
-
type: Optional[Type] = Field(
|
874
|
-
default=None, description="""Optional. The type of the data."""
|
875
|
-
)
|
876
858
|
description: Optional[str] = Field(
|
877
859
|
default=None, description="""Optional. The description of the data."""
|
878
860
|
)
|
@@ -884,18 +866,37 @@ class Schema(_common.BaseModel):
|
|
884
866
|
default=None,
|
885
867
|
description="""Optional. The format of the data. Supported formats: for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc""",
|
886
868
|
)
|
887
|
-
items: 'Schema' = Field(
|
869
|
+
items: Optional['Schema'] = Field(
|
888
870
|
default=None,
|
889
871
|
description="""Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY.""",
|
890
872
|
)
|
891
|
-
|
873
|
+
max_items: Optional[int] = Field(
|
874
|
+
default=None,
|
875
|
+
description="""Optional. Maximum number of the elements for Type.ARRAY.""",
|
876
|
+
)
|
877
|
+
min_items: Optional[int] = Field(
|
878
|
+
default=None,
|
879
|
+
description="""Optional. Minimum number of the elements for Type.ARRAY.""",
|
880
|
+
)
|
881
|
+
nullable: Optional[bool] = Field(
|
882
|
+
default=None,
|
883
|
+
description="""Optional. Indicates if the value may be null.""",
|
884
|
+
)
|
885
|
+
properties: Optional[dict[str, 'Schema']] = Field(
|
892
886
|
default=None,
|
893
887
|
description="""Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT.""",
|
894
888
|
)
|
889
|
+
property_ordering: Optional[list[str]] = Field(
|
890
|
+
default=None,
|
891
|
+
description="""Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties.""",
|
892
|
+
)
|
895
893
|
required: Optional[list[str]] = Field(
|
896
894
|
default=None,
|
897
895
|
description="""Optional. Required properties of Type.OBJECT.""",
|
898
896
|
)
|
897
|
+
type: Optional[Type] = Field(
|
898
|
+
default=None, description="""Optional. The type of the data."""
|
899
|
+
)
|
899
900
|
|
900
901
|
|
901
902
|
class SchemaDict(TypedDict, total=False):
|
@@ -904,15 +905,9 @@ class SchemaDict(TypedDict, total=False):
|
|
904
905
|
Represents a select subset of an OpenAPI 3.0 schema object.
|
905
906
|
"""
|
906
907
|
|
907
|
-
min_items: Optional[int]
|
908
|
-
"""Optional. Minimum number of the elements for Type.ARRAY."""
|
909
|
-
|
910
908
|
example: Optional[Any]
|
911
909
|
"""Optional. Example of the object. Will only populated when the object is the root."""
|
912
910
|
|
913
|
-
property_ordering: Optional[list[str]]
|
914
|
-
"""Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties."""
|
915
|
-
|
916
911
|
pattern: Optional[str]
|
917
912
|
"""Optional. Pattern of the Type.STRING to restrict a string to a regular expression."""
|
918
913
|
|
@@ -922,7 +917,7 @@ class SchemaDict(TypedDict, total=False):
|
|
922
917
|
default: Optional[Any]
|
923
918
|
"""Optional. Default value of the data."""
|
924
919
|
|
925
|
-
any_of: list['SchemaDict']
|
920
|
+
any_of: Optional[list['SchemaDict']]
|
926
921
|
"""Optional. The value should be validated against any (one or more) of the subschemas in the list."""
|
927
922
|
|
928
923
|
max_length: Optional[int]
|
@@ -937,21 +932,12 @@ class SchemaDict(TypedDict, total=False):
|
|
937
932
|
min_properties: Optional[int]
|
938
933
|
"""Optional. Minimum number of the properties for Type.OBJECT."""
|
939
934
|
|
940
|
-
max_items: Optional[int]
|
941
|
-
"""Optional. Maximum number of the elements for Type.ARRAY."""
|
942
|
-
|
943
935
|
maximum: Optional[float]
|
944
936
|
"""Optional. Maximum value of the Type.INTEGER and Type.NUMBER"""
|
945
937
|
|
946
|
-
nullable: Optional[bool]
|
947
|
-
"""Optional. Indicates if the value may be null."""
|
948
|
-
|
949
938
|
max_properties: Optional[int]
|
950
939
|
"""Optional. Maximum number of the properties for Type.OBJECT."""
|
951
940
|
|
952
|
-
type: Optional[Type]
|
953
|
-
"""Optional. The type of the data."""
|
954
|
-
|
955
941
|
description: Optional[str]
|
956
942
|
"""Optional. The description of the data."""
|
957
943
|
|
@@ -961,15 +947,30 @@ class SchemaDict(TypedDict, total=False):
|
|
961
947
|
format: Optional[str]
|
962
948
|
"""Optional. The format of the data. Supported formats: for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc"""
|
963
949
|
|
964
|
-
items: 'SchemaDict'
|
950
|
+
items: Optional['SchemaDict']
|
965
951
|
"""Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY."""
|
966
952
|
|
967
|
-
|
953
|
+
max_items: Optional[int]
|
954
|
+
"""Optional. Maximum number of the elements for Type.ARRAY."""
|
955
|
+
|
956
|
+
min_items: Optional[int]
|
957
|
+
"""Optional. Minimum number of the elements for Type.ARRAY."""
|
958
|
+
|
959
|
+
nullable: Optional[bool]
|
960
|
+
"""Optional. Indicates if the value may be null."""
|
961
|
+
|
962
|
+
properties: Optional[dict[str, 'SchemaDict']]
|
968
963
|
"""Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT."""
|
969
964
|
|
965
|
+
property_ordering: Optional[list[str]]
|
966
|
+
"""Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties."""
|
967
|
+
|
970
968
|
required: Optional[list[str]]
|
971
969
|
"""Optional. Required properties of Type.OBJECT."""
|
972
970
|
|
971
|
+
type: Optional[Type]
|
972
|
+
"""Optional. The type of the data."""
|
973
|
+
|
973
974
|
|
974
975
|
SchemaOrDict = Union[Schema, SchemaDict]
|
975
976
|
|
@@ -1737,7 +1738,7 @@ FileOrDict = Union[File, FileDict]
|
|
1737
1738
|
if _is_pillow_image_imported:
|
1738
1739
|
PartUnion = Union[File, Part, PIL_Image, str]
|
1739
1740
|
else:
|
1740
|
-
PartUnion = Union[File, Part, str]
|
1741
|
+
PartUnion = Union[File, Part, str] # type: ignore[misc]
|
1741
1742
|
|
1742
1743
|
|
1743
1744
|
PartUnionDict = Union[PartUnion, PartDict]
|
@@ -1749,7 +1750,9 @@ ContentUnion = Union[Content, list[PartUnion], PartUnion]
|
|
1749
1750
|
ContentUnionDict = Union[ContentUnion, ContentDict]
|
1750
1751
|
|
1751
1752
|
|
1752
|
-
SchemaUnion = Union[
|
1753
|
+
SchemaUnion = Union[
|
1754
|
+
dict, type, Schema, builtin_types.GenericAlias, VersionedUnionType
|
1755
|
+
]
|
1753
1756
|
|
1754
1757
|
|
1755
1758
|
SchemaUnionDict = Union[SchemaUnion, SchemaDict]
|
@@ -2884,6 +2887,16 @@ class GenerateContentResponse(_common.BaseModel):
|
|
2884
2887
|
description="""Response variations returned by the model.
|
2885
2888
|
""",
|
2886
2889
|
)
|
2890
|
+
create_time: Optional[datetime.datetime] = Field(
|
2891
|
+
default=None,
|
2892
|
+
description="""Timestamp when the request is made to the server.
|
2893
|
+
""",
|
2894
|
+
)
|
2895
|
+
response_id: Optional[str] = Field(
|
2896
|
+
default=None,
|
2897
|
+
description="""Identifier for each response.
|
2898
|
+
""",
|
2899
|
+
)
|
2887
2900
|
model_version: Optional[str] = Field(
|
2888
2901
|
default=None,
|
2889
2902
|
description="""Output only. The model version used to generate the response.""",
|
@@ -2896,7 +2909,7 @@ class GenerateContentResponse(_common.BaseModel):
|
|
2896
2909
|
default=None, description="""Usage metadata about the response(s)."""
|
2897
2910
|
)
|
2898
2911
|
automatic_function_calling_history: Optional[list[Content]] = None
|
2899
|
-
parsed: Union[pydantic.BaseModel, dict, Enum] = Field(
|
2912
|
+
parsed: Optional[Union[pydantic.BaseModel, dict, Enum]] = Field(
|
2900
2913
|
default=None,
|
2901
2914
|
description="""Parsed response if response_schema is provided. Not available for streaming.""",
|
2902
2915
|
)
|
@@ -2918,20 +2931,24 @@ class GenerateContentResponse(_common.BaseModel):
|
|
2918
2931
|
)
|
2919
2932
|
text = ''
|
2920
2933
|
any_text_part_text = False
|
2934
|
+
non_text_parts = []
|
2921
2935
|
for part in self.candidates[0].content.parts:
|
2922
2936
|
for field_name, field_value in part.model_dump(
|
2923
2937
|
exclude={'text', 'thought'}
|
2924
2938
|
).items():
|
2925
2939
|
if field_value is not None:
|
2926
|
-
|
2927
|
-
'GenerateContentResponse.text only supports text parts, but got'
|
2928
|
-
f' {field_name} part'
|
2929
|
-
)
|
2940
|
+
non_text_parts.append(field_name)
|
2930
2941
|
if isinstance(part.text, str):
|
2931
2942
|
if isinstance(part.thought, bool) and part.thought:
|
2932
2943
|
continue
|
2933
2944
|
any_text_part_text = True
|
2934
2945
|
text += part.text
|
2946
|
+
if non_text_parts:
|
2947
|
+
logger.warning(
|
2948
|
+
'Warning: there are non-text parts in the response:'
|
2949
|
+
f' {non_text_parts},returning concatenated text from text parts,check'
|
2950
|
+
' out the non text parts for full response from model.'
|
2951
|
+
)
|
2935
2952
|
# part.text == '' is different from part.text is None
|
2936
2953
|
return text if any_text_part_text else None
|
2937
2954
|
|
@@ -2997,9 +3014,12 @@ class GenerateContentResponse(_common.BaseModel):
|
|
2997
3014
|
|
2998
3015
|
@classmethod
|
2999
3016
|
def _from_response(
|
3000
|
-
cls
|
3001
|
-
|
3002
|
-
|
3017
|
+
cls: typing.Type[T],
|
3018
|
+
*,
|
3019
|
+
response: dict[str, object],
|
3020
|
+
kwargs: dict[str, object],
|
3021
|
+
) -> T:
|
3022
|
+
result = super()._from_response(response=response, kwargs=kwargs)
|
3003
3023
|
|
3004
3024
|
# Handles response schema.
|
3005
3025
|
response_schema = _common.get_value_by_path(
|
@@ -3008,19 +3028,20 @@ class GenerateContentResponse(_common.BaseModel):
|
|
3008
3028
|
if (
|
3009
3029
|
inspect.isclass(response_schema)
|
3010
3030
|
and not (
|
3011
|
-
isinstance(response_schema, GenericAlias)
|
3031
|
+
isinstance(response_schema, builtin_types.GenericAlias)
|
3012
3032
|
) # Needed for Python 3.9 and 3.10
|
3013
3033
|
and issubclass(response_schema, pydantic.BaseModel)
|
3014
3034
|
):
|
3015
3035
|
# Pydantic schema.
|
3016
3036
|
try:
|
3017
|
-
result.
|
3037
|
+
if result.text is not None:
|
3038
|
+
result.parsed = response_schema.model_validate_json(result.text)
|
3018
3039
|
# may not be a valid json per stream response
|
3019
3040
|
except pydantic.ValidationError:
|
3020
3041
|
pass
|
3021
3042
|
except json.decoder.JSONDecodeError:
|
3022
3043
|
pass
|
3023
|
-
elif isinstance(response_schema, EnumMeta):
|
3044
|
+
elif isinstance(response_schema, EnumMeta) and result.text is not None:
|
3024
3045
|
# Enum with "application/json" returns response in double quotes.
|
3025
3046
|
enum_value = result.text.replace('"', '')
|
3026
3047
|
try:
|
@@ -3029,20 +3050,21 @@ class GenerateContentResponse(_common.BaseModel):
|
|
3029
3050
|
hasattr(response_schema, '__name__')
|
3030
3051
|
and response_schema.__name__ == 'PlaceholderLiteralEnum'
|
3031
3052
|
):
|
3032
|
-
result.parsed = str(response_schema(enum_value).name)
|
3053
|
+
result.parsed = str(response_schema(enum_value).name) # type: ignore
|
3033
3054
|
except ValueError:
|
3034
3055
|
pass
|
3035
|
-
elif isinstance(response_schema, GenericAlias) or isinstance(
|
3056
|
+
elif isinstance(response_schema, builtin_types.GenericAlias) or isinstance(
|
3036
3057
|
response_schema, type
|
3037
3058
|
):
|
3038
3059
|
|
3039
3060
|
class Placeholder(pydantic.BaseModel):
|
3040
|
-
placeholder: response_schema
|
3061
|
+
placeholder: response_schema # type: ignore[valid-type]
|
3041
3062
|
|
3042
3063
|
try:
|
3043
|
-
|
3044
|
-
|
3045
|
-
|
3064
|
+
if result.text is not None:
|
3065
|
+
parsed = {'placeholder': json.loads(result.text)}
|
3066
|
+
placeholder = Placeholder.model_validate(parsed)
|
3067
|
+
result.parsed = placeholder.placeholder
|
3046
3068
|
except json.decoder.JSONDecodeError:
|
3047
3069
|
pass
|
3048
3070
|
except pydantic.ValidationError:
|
@@ -3055,7 +3077,8 @@ class GenerateContentResponse(_common.BaseModel):
|
|
3055
3077
|
# want the result converted to. So just return json.
|
3056
3078
|
# JSON schema.
|
3057
3079
|
try:
|
3058
|
-
result.
|
3080
|
+
if result.text is not None:
|
3081
|
+
result.parsed = json.loads(result.text)
|
3059
3082
|
# may not be a valid json per stream response
|
3060
3083
|
except json.decoder.JSONDecodeError:
|
3061
3084
|
pass
|
@@ -3065,20 +3088,22 @@ class GenerateContentResponse(_common.BaseModel):
|
|
3065
3088
|
for union_type in union_types:
|
3066
3089
|
if issubclass(union_type, pydantic.BaseModel):
|
3067
3090
|
try:
|
3091
|
+
if result.text is not None:
|
3068
3092
|
|
3069
|
-
|
3070
|
-
|
3093
|
+
class Placeholder(pydantic.BaseModel): # type: ignore[no-redef]
|
3094
|
+
placeholder: response_schema # type: ignore[valid-type]
|
3071
3095
|
|
3072
|
-
|
3073
|
-
|
3074
|
-
|
3096
|
+
parsed = {'placeholder': json.loads(result.text)}
|
3097
|
+
placeholder = Placeholder.model_validate(parsed)
|
3098
|
+
result.parsed = placeholder.placeholder
|
3075
3099
|
except json.decoder.JSONDecodeError:
|
3076
3100
|
pass
|
3077
3101
|
except pydantic.ValidationError:
|
3078
3102
|
pass
|
3079
3103
|
else:
|
3080
3104
|
try:
|
3081
|
-
result.
|
3105
|
+
if result.text is not None:
|
3106
|
+
result.parsed = json.loads(result.text)
|
3082
3107
|
# may not be a valid json per stream response
|
3083
3108
|
except json.decoder.JSONDecodeError:
|
3084
3109
|
pass
|
@@ -3093,6 +3118,14 @@ class GenerateContentResponseDict(TypedDict, total=False):
|
|
3093
3118
|
"""Response variations returned by the model.
|
3094
3119
|
"""
|
3095
3120
|
|
3121
|
+
create_time: Optional[datetime.datetime]
|
3122
|
+
"""Timestamp when the request is made to the server.
|
3123
|
+
"""
|
3124
|
+
|
3125
|
+
response_id: Optional[str]
|
3126
|
+
"""Identifier for each response.
|
3127
|
+
"""
|
3128
|
+
|
3096
3129
|
model_version: Optional[str]
|
3097
3130
|
"""Output only. The model version used to generate the response."""
|
3098
3131
|
|
@@ -3370,6 +3403,11 @@ class GenerateImagesConfig(_common.BaseModel):
|
|
3370
3403
|
description="""Number of images to generate.
|
3371
3404
|
""",
|
3372
3405
|
)
|
3406
|
+
aspect_ratio: Optional[str] = Field(
|
3407
|
+
default=None,
|
3408
|
+
description="""Aspect ratio of the generated images.
|
3409
|
+
""",
|
3410
|
+
)
|
3373
3411
|
guidance_scale: Optional[float] = Field(
|
3374
3412
|
default=None,
|
3375
3413
|
description="""Controls how much the model adheres to the text prompt. Large
|
@@ -3425,11 +3463,6 @@ class GenerateImagesConfig(_common.BaseModel):
|
|
3425
3463
|
description="""Whether to add a watermark to the generated images.
|
3426
3464
|
""",
|
3427
3465
|
)
|
3428
|
-
aspect_ratio: Optional[str] = Field(
|
3429
|
-
default=None,
|
3430
|
-
description="""Aspect ratio of the generated images.
|
3431
|
-
""",
|
3432
|
-
)
|
3433
3466
|
enhance_prompt: Optional[bool] = Field(
|
3434
3467
|
default=None,
|
3435
3468
|
description="""Whether to use the prompt rewriting logic.
|
@@ -3455,6 +3488,10 @@ class GenerateImagesConfigDict(TypedDict, total=False):
|
|
3455
3488
|
"""Number of images to generate.
|
3456
3489
|
"""
|
3457
3490
|
|
3491
|
+
aspect_ratio: Optional[str]
|
3492
|
+
"""Aspect ratio of the generated images.
|
3493
|
+
"""
|
3494
|
+
|
3458
3495
|
guidance_scale: Optional[float]
|
3459
3496
|
"""Controls how much the model adheres to the text prompt. Large
|
3460
3497
|
values increase output and prompt alignment, but may compromise image
|
@@ -3500,10 +3537,6 @@ class GenerateImagesConfigDict(TypedDict, total=False):
|
|
3500
3537
|
"""Whether to add a watermark to the generated images.
|
3501
3538
|
"""
|
3502
3539
|
|
3503
|
-
aspect_ratio: Optional[str]
|
3504
|
-
"""Aspect ratio of the generated images.
|
3505
|
-
"""
|
3506
|
-
|
3507
3540
|
enhance_prompt: Optional[bool]
|
3508
3541
|
"""Whether to use the prompt rewriting logic.
|
3509
3542
|
"""
|
@@ -3579,18 +3612,23 @@ class Image(_common.BaseModel):
|
|
3579
3612
|
"""Image."""
|
3580
3613
|
|
3581
3614
|
@classmethod
|
3582
|
-
def from_file(
|
3615
|
+
def from_file(
|
3616
|
+
cls, *, location: str, mime_type: Optional[str] = None
|
3617
|
+
) -> 'Image':
|
3583
3618
|
"""Lazy-loads an image from a local file or Google Cloud Storage.
|
3584
3619
|
|
3585
3620
|
Args:
|
3586
3621
|
location: The local path or Google Cloud Storage URI from which to load
|
3587
3622
|
the image.
|
3623
|
+
mime_type: The MIME type of the image. If not provided, the MIME type
|
3624
|
+
will be automatically determined.
|
3588
3625
|
|
3589
3626
|
Returns:
|
3590
3627
|
A loaded image as an `Image` object.
|
3591
3628
|
"""
|
3592
3629
|
import urllib
|
3593
3630
|
import pathlib
|
3631
|
+
import mimetypes
|
3594
3632
|
|
3595
3633
|
parsed_url = urllib.parse.urlparse(location)
|
3596
3634
|
if (
|
@@ -3609,7 +3647,10 @@ class Image(_common.BaseModel):
|
|
3609
3647
|
|
3610
3648
|
# Load image from local path
|
3611
3649
|
image_bytes = pathlib.Path(location).read_bytes()
|
3612
|
-
|
3650
|
+
|
3651
|
+
if not mime_type:
|
3652
|
+
mime_type, _ = mimetypes.guess_type(location)
|
3653
|
+
image = cls(image_bytes=image_bytes, mime_type=mime_type)
|
3613
3654
|
return image
|
3614
3655
|
|
3615
3656
|
def show(self):
|
@@ -3626,7 +3667,8 @@ class Image(_common.BaseModel):
|
|
3626
3667
|
IPython_display.display(self._pil_image)
|
3627
3668
|
|
3628
3669
|
@property
|
3629
|
-
def _pil_image(self) -> 'PIL_Image
|
3670
|
+
def _pil_image(self) -> 'PIL_Image':
|
3671
|
+
PIL_Image: Optional[builtin_types.ModuleType]
|
3630
3672
|
try:
|
3631
3673
|
from PIL import Image as PIL_Image
|
3632
3674
|
except ImportError:
|
@@ -3639,6 +3681,8 @@ class Image(_common.BaseModel):
|
|
3639
3681
|
'The PIL module is not available. Please install the Pillow'
|
3640
3682
|
' package. `pip install pillow`'
|
3641
3683
|
)
|
3684
|
+
if self.image_bytes is None:
|
3685
|
+
raise ValueError('The image bytes are not set.')
|
3642
3686
|
self._loaded_image = PIL_Image.open(io.BytesIO(self.image_bytes))
|
3643
3687
|
return self._loaded_image
|
3644
3688
|
|
@@ -3650,6 +3694,8 @@ class Image(_common.BaseModel):
|
|
3650
3694
|
"""
|
3651
3695
|
import pathlib
|
3652
3696
|
|
3697
|
+
if self.image_bytes is None:
|
3698
|
+
raise ValueError('The image bytes are not set.')
|
3653
3699
|
pathlib.Path(location).write_bytes(self.image_bytes)
|
3654
3700
|
|
3655
3701
|
|
@@ -3895,7 +3941,8 @@ class _ReferenceImageAPI(_common.BaseModel):
|
|
3895
3941
|
default=None, description="""The id of the reference image."""
|
3896
3942
|
)
|
3897
3943
|
reference_type: Optional[str] = Field(
|
3898
|
-
default=None,
|
3944
|
+
default=None,
|
3945
|
+
description="""The type of the reference image. Only set by the SDK.""",
|
3899
3946
|
)
|
3900
3947
|
mask_image_config: Optional[MaskReferenceConfig] = Field(
|
3901
3948
|
default=None,
|
@@ -3925,7 +3972,7 @@ class _ReferenceImageAPIDict(TypedDict, total=False):
|
|
3925
3972
|
"""The id of the reference image."""
|
3926
3973
|
|
3927
3974
|
reference_type: Optional[str]
|
3928
|
-
"""The type of the reference image."""
|
3975
|
+
"""The type of the reference image. Only set by the SDK."""
|
3929
3976
|
|
3930
3977
|
mask_image_config: Optional[MaskReferenceConfigDict]
|
3931
3978
|
"""Configuration for the mask reference image."""
|
@@ -3964,6 +4011,11 @@ class EditImageConfig(_common.BaseModel):
|
|
3964
4011
|
description="""Number of images to generate.
|
3965
4012
|
""",
|
3966
4013
|
)
|
4014
|
+
aspect_ratio: Optional[str] = Field(
|
4015
|
+
default=None,
|
4016
|
+
description="""Aspect ratio of the generated images.
|
4017
|
+
""",
|
4018
|
+
)
|
3967
4019
|
guidance_scale: Optional[float] = Field(
|
3968
4020
|
default=None,
|
3969
4021
|
description="""Controls how much the model adheres to the text prompt. Large
|
@@ -4038,6 +4090,10 @@ class EditImageConfigDict(TypedDict, total=False):
|
|
4038
4090
|
"""Number of images to generate.
|
4039
4091
|
"""
|
4040
4092
|
|
4093
|
+
aspect_ratio: Optional[str]
|
4094
|
+
"""Aspect ratio of the generated images.
|
4095
|
+
"""
|
4096
|
+
|
4041
4097
|
guidance_scale: Optional[float]
|
4042
4098
|
"""Controls how much the model adheres to the text prompt. Large
|
4043
4099
|
values increase output and prompt alignment, but may compromise image
|
@@ -5040,6 +5096,11 @@ class _GenerateVideosParameters(_common.BaseModel):
|
|
5040
5096
|
default=None,
|
5041
5097
|
description="""The text prompt for generating the videos. Optional for image to video use cases.""",
|
5042
5098
|
)
|
5099
|
+
image: Optional[Image] = Field(
|
5100
|
+
default=None,
|
5101
|
+
description="""The input image for generating the videos.
|
5102
|
+
Optional if prompt is provided.""",
|
5103
|
+
)
|
5043
5104
|
config: Optional[GenerateVideosConfig] = Field(
|
5044
5105
|
default=None, description="""Configuration for generating videos."""
|
5045
5106
|
)
|
@@ -5055,6 +5116,10 @@ class _GenerateVideosParametersDict(TypedDict, total=False):
|
|
5055
5116
|
prompt: Optional[str]
|
5056
5117
|
"""The text prompt for generating the videos. Optional for image to video use cases."""
|
5057
5118
|
|
5119
|
+
image: Optional[ImageDict]
|
5120
|
+
"""The input image for generating the videos.
|
5121
|
+
Optional if prompt is provided."""
|
5122
|
+
|
5058
5123
|
config: Optional[GenerateVideosConfigDict]
|
5059
5124
|
"""Configuration for generating videos."""
|
5060
5125
|
|
@@ -5080,8 +5145,6 @@ class Video(_common.BaseModel):
|
|
5080
5145
|
def save(
|
5081
5146
|
self,
|
5082
5147
|
path: str,
|
5083
|
-
# *,
|
5084
|
-
# client: Optional[ApiClient] = None,
|
5085
5148
|
) -> None:
|
5086
5149
|
"""Saves the video to a file.
|
5087
5150
|
|
@@ -5090,27 +5153,24 @@ class Video(_common.BaseModel):
|
|
5090
5153
|
"""
|
5091
5154
|
import pathlib # pylint: disable=g-import-not-at-top
|
5092
5155
|
|
5093
|
-
if not self.
|
5156
|
+
if not self.video_bytes:
|
5094
5157
|
raise NotImplementedError('Saving remote videos is not supported.')
|
5095
|
-
if not self.uri:
|
5096
|
-
raise ValueError('No data or uri provided.')
|
5097
|
-
if not client:
|
5098
|
-
raise ValueError('Client is required to save remote videos.')
|
5099
|
-
self.data = client.files.download(self.uri)
|
5100
5158
|
|
5101
|
-
pathlib.Path(path).write_bytes(self.
|
5159
|
+
pathlib.Path(path).write_bytes(self.video_bytes)
|
5102
5160
|
|
5103
5161
|
def show(self):
|
5104
5162
|
"""Shows the video.
|
5105
5163
|
|
5164
|
+
If the video has no mime_type, it is assumed to be video/mp4.
|
5165
|
+
|
5106
5166
|
This method only works in a notebook environment.
|
5107
5167
|
"""
|
5108
|
-
if self.uri:
|
5168
|
+
if self.uri and not self.video_bytes:
|
5109
5169
|
return ValueError('Showing remote videos is not supported.')
|
5110
5170
|
if not self.video_bytes:
|
5111
5171
|
return ValueError('Video has no bytes.')
|
5112
|
-
|
5113
|
-
|
5172
|
+
|
5173
|
+
mime_type = self.mime_type or 'video/mp4'
|
5114
5174
|
|
5115
5175
|
try:
|
5116
5176
|
from IPython import display as IPython_display
|
@@ -5119,7 +5179,7 @@ class Video(_common.BaseModel):
|
|
5119
5179
|
|
5120
5180
|
if IPython_display:
|
5121
5181
|
return IPython_display.Video(
|
5122
|
-
data=self.video_bytes, mimetype=
|
5182
|
+
data=self.video_bytes, mimetype=mime_type, embed=True
|
5123
5183
|
)
|
5124
5184
|
|
5125
5185
|
def __repr__(self):
|
@@ -8195,19 +8255,17 @@ class RawReferenceImage(_common.BaseModel):
|
|
8195
8255
|
default=None, description="""The id of the reference image."""
|
8196
8256
|
)
|
8197
8257
|
reference_type: Optional[str] = Field(
|
8198
|
-
default=None,
|
8258
|
+
default=None,
|
8259
|
+
description="""The type of the reference image. Only set by the SDK.""",
|
8199
8260
|
)
|
8200
8261
|
|
8201
|
-
|
8202
|
-
|
8203
|
-
|
8204
|
-
|
8205
|
-
|
8206
|
-
|
8207
|
-
|
8208
|
-
reference_id=reference_id,
|
8209
|
-
reference_type='REFERENCE_TYPE_RAW',
|
8210
|
-
)
|
8262
|
+
@pydantic.model_validator(mode='before')
|
8263
|
+
@classmethod
|
8264
|
+
def _validate_mask_image_config(self, values):
|
8265
|
+
if 'reference_type' in values:
|
8266
|
+
raise ValueError('Cannot set internal reference_type field directly.')
|
8267
|
+
values['reference_type'] = 'REFERENCE_TYPE_RAW'
|
8268
|
+
return values
|
8211
8269
|
|
8212
8270
|
|
8213
8271
|
class RawReferenceImageDict(TypedDict, total=False):
|
@@ -8225,7 +8283,7 @@ class RawReferenceImageDict(TypedDict, total=False):
|
|
8225
8283
|
"""The id of the reference image."""
|
8226
8284
|
|
8227
8285
|
reference_type: Optional[str]
|
8228
|
-
"""The type of the reference image."""
|
8286
|
+
"""The type of the reference image. Only set by the SDK."""
|
8229
8287
|
|
8230
8288
|
|
8231
8289
|
RawReferenceImageOrDict = Union[RawReferenceImage, RawReferenceImageDict]
|
@@ -8251,7 +8309,8 @@ class MaskReferenceImage(_common.BaseModel):
|
|
8251
8309
|
default=None, description="""The id of the reference image."""
|
8252
8310
|
)
|
8253
8311
|
reference_type: Optional[str] = Field(
|
8254
|
-
default=None,
|
8312
|
+
default=None,
|
8313
|
+
description="""The type of the reference image. Only set by the SDK.""",
|
8255
8314
|
)
|
8256
8315
|
config: Optional[MaskReferenceConfig] = Field(
|
8257
8316
|
default=None,
|
@@ -8262,18 +8321,15 @@ class MaskReferenceImage(_common.BaseModel):
|
|
8262
8321
|
default=None, description=""""""
|
8263
8322
|
)
|
8264
8323
|
|
8265
|
-
|
8266
|
-
|
8267
|
-
|
8268
|
-
|
8269
|
-
|
8270
|
-
|
8271
|
-
|
8272
|
-
|
8273
|
-
|
8274
|
-
reference_type='REFERENCE_TYPE_MASK',
|
8275
|
-
)
|
8276
|
-
self.mask_image_config = config
|
8324
|
+
@pydantic.model_validator(mode='before')
|
8325
|
+
@classmethod
|
8326
|
+
def _validate_mask_image_config(self, values):
|
8327
|
+
config = values.get('config', None)
|
8328
|
+
values['mask_image_config'] = config
|
8329
|
+
if 'reference_type' in values:
|
8330
|
+
raise ValueError('Cannot set internal reference_type field directly.')
|
8331
|
+
values['reference_type'] = 'REFERENCE_TYPE_MASK'
|
8332
|
+
return values
|
8277
8333
|
|
8278
8334
|
|
8279
8335
|
class MaskReferenceImageDict(TypedDict, total=False):
|
@@ -8295,7 +8351,7 @@ class MaskReferenceImageDict(TypedDict, total=False):
|
|
8295
8351
|
"""The id of the reference image."""
|
8296
8352
|
|
8297
8353
|
reference_type: Optional[str]
|
8298
|
-
"""The type of the reference image."""
|
8354
|
+
"""The type of the reference image. Only set by the SDK."""
|
8299
8355
|
|
8300
8356
|
config: Optional[MaskReferenceConfigDict]
|
8301
8357
|
"""Configuration for the mask reference image."""
|
@@ -8324,7 +8380,8 @@ class ControlReferenceImage(_common.BaseModel):
|
|
8324
8380
|
default=None, description="""The id of the reference image."""
|
8325
8381
|
)
|
8326
8382
|
reference_type: Optional[str] = Field(
|
8327
|
-
default=None,
|
8383
|
+
default=None,
|
8384
|
+
description="""The type of the reference image. Only set by the SDK.""",
|
8328
8385
|
)
|
8329
8386
|
config: Optional[ControlReferenceConfig] = Field(
|
8330
8387
|
default=None,
|
@@ -8335,18 +8392,15 @@ class ControlReferenceImage(_common.BaseModel):
|
|
8335
8392
|
default=None, description=""""""
|
8336
8393
|
)
|
8337
8394
|
|
8338
|
-
|
8339
|
-
|
8340
|
-
|
8341
|
-
|
8342
|
-
|
8343
|
-
|
8344
|
-
|
8345
|
-
|
8346
|
-
|
8347
|
-
reference_type='REFERENCE_TYPE_CONTROL',
|
8348
|
-
)
|
8349
|
-
self.control_image_config = config
|
8395
|
+
@pydantic.model_validator(mode='before')
|
8396
|
+
@classmethod
|
8397
|
+
def _validate_mask_image_config(self, values):
|
8398
|
+
config = values.get('config', None)
|
8399
|
+
values['control_image_config'] = config
|
8400
|
+
if 'reference_type' in values:
|
8401
|
+
raise ValueError('Cannot set internal reference_type field directly.')
|
8402
|
+
values['reference_type'] = 'REFERENCE_TYPE_CONTROL'
|
8403
|
+
return values
|
8350
8404
|
|
8351
8405
|
|
8352
8406
|
class ControlReferenceImageDict(TypedDict, total=False):
|
@@ -8368,7 +8422,7 @@ class ControlReferenceImageDict(TypedDict, total=False):
|
|
8368
8422
|
"""The id of the reference image."""
|
8369
8423
|
|
8370
8424
|
reference_type: Optional[str]
|
8371
|
-
"""The type of the reference image."""
|
8425
|
+
"""The type of the reference image. Only set by the SDK."""
|
8372
8426
|
|
8373
8427
|
config: Optional[ControlReferenceConfigDict]
|
8374
8428
|
"""Configuration for the control reference image."""
|
@@ -8397,7 +8451,8 @@ class StyleReferenceImage(_common.BaseModel):
|
|
8397
8451
|
default=None, description="""The id of the reference image."""
|
8398
8452
|
)
|
8399
8453
|
reference_type: Optional[str] = Field(
|
8400
|
-
default=None,
|
8454
|
+
default=None,
|
8455
|
+
description="""The type of the reference image. Only set by the SDK.""",
|
8401
8456
|
)
|
8402
8457
|
config: Optional[StyleReferenceConfig] = Field(
|
8403
8458
|
default=None,
|
@@ -8408,18 +8463,15 @@ class StyleReferenceImage(_common.BaseModel):
|
|
8408
8463
|
default=None, description=""""""
|
8409
8464
|
)
|
8410
8465
|
|
8411
|
-
|
8412
|
-
|
8413
|
-
|
8414
|
-
|
8415
|
-
|
8416
|
-
|
8417
|
-
|
8418
|
-
|
8419
|
-
|
8420
|
-
reference_type='REFERENCE_TYPE_STYLE',
|
8421
|
-
)
|
8422
|
-
self.style_image_config = config
|
8466
|
+
@pydantic.model_validator(mode='before')
|
8467
|
+
@classmethod
|
8468
|
+
def _validate_mask_image_config(self, values):
|
8469
|
+
config = values.get('config', None)
|
8470
|
+
values['style_image_config'] = config
|
8471
|
+
if 'reference_type' in values:
|
8472
|
+
raise ValueError('Cannot set internal reference_type field directly.')
|
8473
|
+
values['reference_type'] = 'REFERENCE_TYPE_STYLE'
|
8474
|
+
return values
|
8423
8475
|
|
8424
8476
|
|
8425
8477
|
class StyleReferenceImageDict(TypedDict, total=False):
|
@@ -8439,7 +8491,7 @@ class StyleReferenceImageDict(TypedDict, total=False):
|
|
8439
8491
|
"""The id of the reference image."""
|
8440
8492
|
|
8441
8493
|
reference_type: Optional[str]
|
8442
|
-
"""The type of the reference image."""
|
8494
|
+
"""The type of the reference image. Only set by the SDK."""
|
8443
8495
|
|
8444
8496
|
config: Optional[StyleReferenceConfigDict]
|
8445
8497
|
"""Configuration for the style reference image."""
|
@@ -8466,7 +8518,8 @@ class SubjectReferenceImage(_common.BaseModel):
|
|
8466
8518
|
default=None, description="""The id of the reference image."""
|
8467
8519
|
)
|
8468
8520
|
reference_type: Optional[str] = Field(
|
8469
|
-
default=None,
|
8521
|
+
default=None,
|
8522
|
+
description="""The type of the reference image. Only set by the SDK.""",
|
8470
8523
|
)
|
8471
8524
|
config: Optional[SubjectReferenceConfig] = Field(
|
8472
8525
|
default=None,
|
@@ -8477,18 +8530,15 @@ class SubjectReferenceImage(_common.BaseModel):
|
|
8477
8530
|
default=None, description=""""""
|
8478
8531
|
)
|
8479
8532
|
|
8480
|
-
|
8481
|
-
|
8482
|
-
|
8483
|
-
|
8484
|
-
|
8485
|
-
|
8486
|
-
|
8487
|
-
|
8488
|
-
|
8489
|
-
reference_type='REFERENCE_TYPE_SUBJECT',
|
8490
|
-
)
|
8491
|
-
self.subject_image_config = config
|
8533
|
+
@pydantic.model_validator(mode='before')
|
8534
|
+
@classmethod
|
8535
|
+
def _validate_mask_image_config(self, values):
|
8536
|
+
config = values.get('config', None)
|
8537
|
+
values['subject_image_config'] = config
|
8538
|
+
if 'reference_type' in values:
|
8539
|
+
raise ValueError('Cannot set internal reference_type field directly.')
|
8540
|
+
values['reference_type'] = 'REFERENCE_TYPE_SUBJECT'
|
8541
|
+
return values
|
8492
8542
|
|
8493
8543
|
|
8494
8544
|
class SubjectReferenceImageDict(TypedDict, total=False):
|
@@ -8508,7 +8558,7 @@ class SubjectReferenceImageDict(TypedDict, total=False):
|
|
8508
8558
|
"""The id of the reference image."""
|
8509
8559
|
|
8510
8560
|
reference_type: Optional[str]
|
8511
|
-
"""The type of the reference image."""
|
8561
|
+
"""The type of the reference image. Only set by the SDK."""
|
8512
8562
|
|
8513
8563
|
config: Optional[SubjectReferenceConfigDict]
|
8514
8564
|
"""Configuration for the subject reference image."""
|
@@ -8729,7 +8779,7 @@ The following fields are supported:
|
|
8729
8779
|
Note: only text should be used in parts and content in each part will be
|
8730
8780
|
in a separate paragraph.""",
|
8731
8781
|
)
|
8732
|
-
tools: Optional[
|
8782
|
+
tools: Optional[ToolListUnion] = Field(
|
8733
8783
|
default=None,
|
8734
8784
|
description=""" A list of `Tools` the model may use to generate the next response.
|
8735
8785
|
|
@@ -8766,7 +8816,7 @@ The following fields are supported:
|
|
8766
8816
|
Note: only text should be used in parts and content in each part will be
|
8767
8817
|
in a separate paragraph."""
|
8768
8818
|
|
8769
|
-
tools: Optional[
|
8819
|
+
tools: Optional[ToolListUnionDict]
|
8770
8820
|
""" A list of `Tools` the model may use to generate the next response.
|
8771
8821
|
|
8772
8822
|
A `Tool` is a piece of code that enables the system to interact with
|
@@ -8978,7 +9028,7 @@ class LiveConnectConfig(_common.BaseModel):
|
|
8978
9028
|
Note: only text should be used in parts and content in each part will be
|
8979
9029
|
in a separate paragraph.""",
|
8980
9030
|
)
|
8981
|
-
tools: Optional[
|
9031
|
+
tools: Optional[ToolListUnion] = Field(
|
8982
9032
|
default=None,
|
8983
9033
|
description="""A list of `Tools` the model may use to generate the next response.
|
8984
9034
|
|
@@ -9008,7 +9058,7 @@ class LiveConnectConfigDict(TypedDict, total=False):
|
|
9008
9058
|
Note: only text should be used in parts and content in each part will be
|
9009
9059
|
in a separate paragraph."""
|
9010
9060
|
|
9011
|
-
tools: Optional[
|
9061
|
+
tools: Optional[ToolListUnionDict]
|
9012
9062
|
"""A list of `Tools` the model may use to generate the next response.
|
9013
9063
|
|
9014
9064
|
A `Tool` is a piece of code that enables the system to interact with
|