google-genai 1.10.0__py3-none-any.whl → 1.11.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 +75 -7
- google/genai/_extra_utils.py +69 -9
- google/genai/_transformers.py +129 -0
- google/genai/live.py +72 -1015
- google/genai/live_converters.py +1298 -0
- google/genai/models.py +74 -6
- google/genai/types.py +509 -21
- google/genai/version.py +1 -1
- {google_genai-1.10.0.dist-info → google_genai-1.11.0.dist-info}/METADATA +1 -1
- {google_genai-1.10.0.dist-info → google_genai-1.11.0.dist-info}/RECORD +13 -12
- {google_genai-1.10.0.dist-info → google_genai-1.11.0.dist-info}/WHEEL +0 -0
- {google_genai-1.10.0.dist-info → google_genai-1.11.0.dist-info}/licenses/LICENSE +0 -0
- {google_genai-1.10.0.dist-info → google_genai-1.11.0.dist-info}/top_level.txt +0 -0
google/genai/types.py
CHANGED
@@ -236,6 +236,17 @@ class AdapterSize(_common.CaseInSensitiveEnum):
|
|
236
236
|
ADAPTER_SIZE_THIRTY_TWO = 'ADAPTER_SIZE_THIRTY_TWO'
|
237
237
|
|
238
238
|
|
239
|
+
class FeatureSelectionPreference(_common.CaseInSensitiveEnum):
|
240
|
+
"""Options for feature selection preference."""
|
241
|
+
|
242
|
+
FEATURE_SELECTION_PREFERENCE_UNSPECIFIED = (
|
243
|
+
'FEATURE_SELECTION_PREFERENCE_UNSPECIFIED'
|
244
|
+
)
|
245
|
+
PRIORITIZE_QUALITY = 'PRIORITIZE_QUALITY'
|
246
|
+
BALANCED = 'BALANCED'
|
247
|
+
PRIORITIZE_COST = 'PRIORITIZE_COST'
|
248
|
+
|
249
|
+
|
239
250
|
class DynamicRetrievalConfigMode(_common.CaseInSensitiveEnum):
|
240
251
|
"""Config for the dynamic retrieval config mode."""
|
241
252
|
|
@@ -820,6 +831,12 @@ class HttpOptions(_common.BaseModel):
|
|
820
831
|
timeout: Optional[int] = Field(
|
821
832
|
default=None, description="""Timeout for the request in milliseconds."""
|
822
833
|
)
|
834
|
+
client_args: Optional[dict[str, Any]] = Field(
|
835
|
+
default=None, description="""Args passed to the HTTP client."""
|
836
|
+
)
|
837
|
+
async_client_args: Optional[dict[str, Any]] = Field(
|
838
|
+
default=None, description="""Args passed to the async HTTP client."""
|
839
|
+
)
|
823
840
|
|
824
841
|
|
825
842
|
class HttpOptionsDict(TypedDict, total=False):
|
@@ -837,10 +854,173 @@ class HttpOptionsDict(TypedDict, total=False):
|
|
837
854
|
timeout: Optional[int]
|
838
855
|
"""Timeout for the request in milliseconds."""
|
839
856
|
|
857
|
+
client_args: Optional[dict[str, Any]]
|
858
|
+
"""Args passed to the HTTP client."""
|
859
|
+
|
860
|
+
async_client_args: Optional[dict[str, Any]]
|
861
|
+
"""Args passed to the async HTTP client."""
|
862
|
+
|
840
863
|
|
841
864
|
HttpOptionsOrDict = Union[HttpOptions, HttpOptionsDict]
|
842
865
|
|
843
866
|
|
867
|
+
class JSONSchemaType(Enum):
|
868
|
+
"""The type of the data supported by JSON Schema.
|
869
|
+
|
870
|
+
The values of the enums are lower case strings, while the values of the enums
|
871
|
+
for the Type class are upper case strings.
|
872
|
+
"""
|
873
|
+
|
874
|
+
NULL = 'null'
|
875
|
+
BOOLEAN = 'boolean'
|
876
|
+
OBJECT = 'object'
|
877
|
+
ARRAY = 'array'
|
878
|
+
NUMBER = 'number'
|
879
|
+
INTEGER = 'integer'
|
880
|
+
STRING = 'string'
|
881
|
+
|
882
|
+
|
883
|
+
class JSONSchema(pydantic.BaseModel):
|
884
|
+
"""A subset of JSON Schema according to 2020-12 JSON Schema draft.
|
885
|
+
|
886
|
+
Represents a subset of a JSON Schema object that is used by the Gemini model.
|
887
|
+
The difference between this class and the Schema class is that this class is
|
888
|
+
compatible with OpenAPI 3.1 schema objects. And the Schema class is used to
|
889
|
+
make API call to Gemini model.
|
890
|
+
"""
|
891
|
+
|
892
|
+
type: Optional[Union[JSONSchemaType, list[JSONSchemaType]]] = Field(
|
893
|
+
default=None,
|
894
|
+
description="""Validation succeeds if the type of the instance matches the type represented by the given type, or matches at least one of the given types.""",
|
895
|
+
)
|
896
|
+
format: Optional[str] = Field(
|
897
|
+
default=None,
|
898
|
+
description='Define semantic information about a string instance.',
|
899
|
+
)
|
900
|
+
title: Optional[str] = Field(
|
901
|
+
default=None,
|
902
|
+
description=(
|
903
|
+
'A preferably short description about the purpose of the instance'
|
904
|
+
' described by the schema.'
|
905
|
+
),
|
906
|
+
)
|
907
|
+
description: Optional[str] = Field(
|
908
|
+
default=None,
|
909
|
+
description=(
|
910
|
+
'An explanation about the purpose of the instance described by the'
|
911
|
+
' schema.'
|
912
|
+
),
|
913
|
+
)
|
914
|
+
default: Optional[Any] = Field(
|
915
|
+
default=None,
|
916
|
+
description=(
|
917
|
+
'This keyword can be used to supply a default JSON value associated'
|
918
|
+
' with a particular schema.'
|
919
|
+
),
|
920
|
+
)
|
921
|
+
items: Optional['JSONSchema'] = Field(
|
922
|
+
default=None,
|
923
|
+
description=(
|
924
|
+
'Validation succeeds if each element of the instance not covered by'
|
925
|
+
' prefixItems validates against this schema.'
|
926
|
+
),
|
927
|
+
)
|
928
|
+
min_items: Optional[int] = Field(
|
929
|
+
default=None,
|
930
|
+
description=(
|
931
|
+
'An array instance is valid if its size is greater than, or equal to,'
|
932
|
+
' the value of this keyword.'
|
933
|
+
),
|
934
|
+
)
|
935
|
+
max_items: Optional[int] = Field(
|
936
|
+
default=None,
|
937
|
+
description=(
|
938
|
+
'An array instance is valid if its size is less than, or equal to,'
|
939
|
+
' the value of this keyword.'
|
940
|
+
),
|
941
|
+
)
|
942
|
+
enum: Optional[list[Any]] = Field(
|
943
|
+
default=None,
|
944
|
+
description=(
|
945
|
+
'Validation succeeds if the instance is equal to one of the elements'
|
946
|
+
' in this keyword’s array value.'
|
947
|
+
),
|
948
|
+
)
|
949
|
+
properties: Optional[dict[str, 'JSONSchema']] = Field(
|
950
|
+
default=None,
|
951
|
+
description=(
|
952
|
+
'Validation succeeds if, for each name that appears in both the'
|
953
|
+
' instance and as a name within this keyword’s value, the child'
|
954
|
+
' instance for that name successfully validates against the'
|
955
|
+
' corresponding schema.'
|
956
|
+
),
|
957
|
+
)
|
958
|
+
required: Optional[list[str]] = Field(
|
959
|
+
default=None,
|
960
|
+
description=(
|
961
|
+
'An object instance is valid against this keyword if every item in'
|
962
|
+
' the array is the name of a property in the instance.'
|
963
|
+
),
|
964
|
+
)
|
965
|
+
min_properties: Optional[int] = Field(
|
966
|
+
default=None,
|
967
|
+
description=(
|
968
|
+
'An object instance is valid if its number of properties is greater'
|
969
|
+
' than, or equal to, the value of this keyword.'
|
970
|
+
),
|
971
|
+
)
|
972
|
+
max_properties: Optional[int] = Field(
|
973
|
+
default=None,
|
974
|
+
description=(
|
975
|
+
'An object instance is valid if its number of properties is less'
|
976
|
+
' than, or equal to, the value of this keyword.'
|
977
|
+
),
|
978
|
+
)
|
979
|
+
minimum: Optional[float] = Field(
|
980
|
+
default=None,
|
981
|
+
description=(
|
982
|
+
'Validation succeeds if the numeric instance is greater than or equal'
|
983
|
+
' to the given number.'
|
984
|
+
),
|
985
|
+
)
|
986
|
+
maximum: Optional[float] = Field(
|
987
|
+
default=None,
|
988
|
+
description=(
|
989
|
+
'Validation succeeds if the numeric instance is less than or equal to'
|
990
|
+
' the given number.'
|
991
|
+
),
|
992
|
+
)
|
993
|
+
min_length: Optional[int] = Field(
|
994
|
+
default=None,
|
995
|
+
description=(
|
996
|
+
'A string instance is valid against this keyword if its length is'
|
997
|
+
' greater than, or equal to, the value of this keyword.'
|
998
|
+
),
|
999
|
+
)
|
1000
|
+
max_length: Optional[int] = Field(
|
1001
|
+
default=None,
|
1002
|
+
description=(
|
1003
|
+
'A string instance is valid against this keyword if its length is'
|
1004
|
+
' less than, or equal to, the value of this keyword.'
|
1005
|
+
),
|
1006
|
+
)
|
1007
|
+
pattern: Optional[str] = Field(
|
1008
|
+
default=None,
|
1009
|
+
description=(
|
1010
|
+
'A string instance is considered valid if the regular expression'
|
1011
|
+
' matches the instance successfully.'
|
1012
|
+
),
|
1013
|
+
)
|
1014
|
+
any_of: Optional[list['JSONSchema']] = Field(
|
1015
|
+
default=None,
|
1016
|
+
description=(
|
1017
|
+
'An instance validates successfully against this keyword if it'
|
1018
|
+
' validates successfully against at least one schema defined by this'
|
1019
|
+
' keyword’s value.'
|
1020
|
+
),
|
1021
|
+
)
|
1022
|
+
|
1023
|
+
|
844
1024
|
class Schema(_common.BaseModel):
|
845
1025
|
"""Schema that defines the format of input and output data.
|
846
1026
|
|
@@ -932,6 +1112,66 @@ class Schema(_common.BaseModel):
|
|
932
1112
|
default=None, description="""Optional. The type of the data."""
|
933
1113
|
)
|
934
1114
|
|
1115
|
+
@property
|
1116
|
+
def json_schema(self) -> JSONSchema:
|
1117
|
+
"""Converts the Schema object to a JSONSchema object, that is compatible with 2020-12 JSON Schema draft.
|
1118
|
+
|
1119
|
+
If a Schema field is not supported by JSONSchema, it will be ignored.
|
1120
|
+
"""
|
1121
|
+
json_schema_field_names: set[str] = set(JSONSchema.model_fields.keys())
|
1122
|
+
schema_field_names: tuple[str] = (
|
1123
|
+
'items',
|
1124
|
+
) # 'additional_properties' to come
|
1125
|
+
list_schema_field_names: tuple[str] = (
|
1126
|
+
'any_of', # 'one_of', 'all_of', 'not' to come
|
1127
|
+
)
|
1128
|
+
dict_schema_field_names: tuple[str] = ('properties',) # 'defs' to come
|
1129
|
+
|
1130
|
+
def convert_schema(schema: Union['Schema', dict[str, Any]]) -> JSONSchema:
|
1131
|
+
if isinstance(schema, pydantic.BaseModel):
|
1132
|
+
schema_dict = schema.model_dump()
|
1133
|
+
else:
|
1134
|
+
schema_dict = schema
|
1135
|
+
json_schema = JSONSchema()
|
1136
|
+
for field_name, field_value in schema_dict.items():
|
1137
|
+
if field_value is None:
|
1138
|
+
continue
|
1139
|
+
elif field_name == 'nullable':
|
1140
|
+
json_schema.type = JSONSchemaType.NULL
|
1141
|
+
elif field_name not in json_schema_field_names:
|
1142
|
+
continue
|
1143
|
+
elif field_name == 'type':
|
1144
|
+
if field_value == Type.TYPE_UNSPECIFIED:
|
1145
|
+
continue
|
1146
|
+
json_schema_type = JSONSchemaType(field_value.lower())
|
1147
|
+
if json_schema.type is None:
|
1148
|
+
json_schema.type = json_schema_type
|
1149
|
+
elif isinstance(json_schema.type, JSONSchemaType):
|
1150
|
+
existing_type: JSONSchemaType = json_schema.type
|
1151
|
+
json_schema.type = [existing_type, json_schema_type]
|
1152
|
+
elif isinstance(json_schema.type, list):
|
1153
|
+
json_schema.type.append(json_schema_type)
|
1154
|
+
elif field_name in schema_field_names:
|
1155
|
+
schema_field_value: 'JSONSchema' = convert_schema(field_value)
|
1156
|
+
setattr(json_schema, field_name, schema_field_value)
|
1157
|
+
elif field_name in list_schema_field_names:
|
1158
|
+
list_schema_field_value: list['JSONSchema'] = [
|
1159
|
+
convert_schema(this_field_value)
|
1160
|
+
for this_field_value in field_value
|
1161
|
+
]
|
1162
|
+
setattr(json_schema, field_name, list_schema_field_value)
|
1163
|
+
elif field_name in dict_schema_field_names:
|
1164
|
+
dict_schema_field_value: dict[str, 'JSONSchema'] = {
|
1165
|
+
key: convert_schema(value) for key, value in field_value.items()
|
1166
|
+
}
|
1167
|
+
setattr(json_schema, field_name, dict_schema_field_value)
|
1168
|
+
else:
|
1169
|
+
setattr(json_schema, field_name, field_value)
|
1170
|
+
|
1171
|
+
return json_schema
|
1172
|
+
|
1173
|
+
return convert_schema(self)
|
1174
|
+
|
935
1175
|
|
936
1176
|
class SchemaDict(TypedDict, total=False):
|
937
1177
|
"""Schema that defines the format of input and output data.
|
@@ -1009,6 +1249,26 @@ class SchemaDict(TypedDict, total=False):
|
|
1009
1249
|
SchemaOrDict = Union[Schema, SchemaDict]
|
1010
1250
|
|
1011
1251
|
|
1252
|
+
class ModelSelectionConfig(_common.BaseModel):
|
1253
|
+
"""Config for model selection."""
|
1254
|
+
|
1255
|
+
feature_selection_preference: Optional[FeatureSelectionPreference] = Field(
|
1256
|
+
default=None, description="""Options for feature selection preference."""
|
1257
|
+
)
|
1258
|
+
|
1259
|
+
|
1260
|
+
class ModelSelectionConfigDict(TypedDict, total=False):
|
1261
|
+
"""Config for model selection."""
|
1262
|
+
|
1263
|
+
feature_selection_preference: Optional[FeatureSelectionPreference]
|
1264
|
+
"""Options for feature selection preference."""
|
1265
|
+
|
1266
|
+
|
1267
|
+
ModelSelectionConfigOrDict = Union[
|
1268
|
+
ModelSelectionConfig, ModelSelectionConfigDict
|
1269
|
+
]
|
1270
|
+
|
1271
|
+
|
1012
1272
|
class SafetySetting(_common.BaseModel):
|
1013
1273
|
"""Safety settings."""
|
1014
1274
|
|
@@ -1301,6 +1561,168 @@ VertexRagStoreRagResourceOrDict = Union[
|
|
1301
1561
|
]
|
1302
1562
|
|
1303
1563
|
|
1564
|
+
class RagRetrievalConfigFilter(_common.BaseModel):
|
1565
|
+
"""Config for filters."""
|
1566
|
+
|
1567
|
+
metadata_filter: Optional[str] = Field(
|
1568
|
+
default=None, description="""Optional. String for metadata filtering."""
|
1569
|
+
)
|
1570
|
+
vector_distance_threshold: Optional[float] = Field(
|
1571
|
+
default=None,
|
1572
|
+
description="""Optional. Only returns contexts with vector distance smaller than the threshold.""",
|
1573
|
+
)
|
1574
|
+
vector_similarity_threshold: Optional[float] = Field(
|
1575
|
+
default=None,
|
1576
|
+
description="""Optional. Only returns contexts with vector similarity larger than the threshold.""",
|
1577
|
+
)
|
1578
|
+
|
1579
|
+
|
1580
|
+
class RagRetrievalConfigFilterDict(TypedDict, total=False):
|
1581
|
+
"""Config for filters."""
|
1582
|
+
|
1583
|
+
metadata_filter: Optional[str]
|
1584
|
+
"""Optional. String for metadata filtering."""
|
1585
|
+
|
1586
|
+
vector_distance_threshold: Optional[float]
|
1587
|
+
"""Optional. Only returns contexts with vector distance smaller than the threshold."""
|
1588
|
+
|
1589
|
+
vector_similarity_threshold: Optional[float]
|
1590
|
+
"""Optional. Only returns contexts with vector similarity larger than the threshold."""
|
1591
|
+
|
1592
|
+
|
1593
|
+
RagRetrievalConfigFilterOrDict = Union[
|
1594
|
+
RagRetrievalConfigFilter, RagRetrievalConfigFilterDict
|
1595
|
+
]
|
1596
|
+
|
1597
|
+
|
1598
|
+
class RagRetrievalConfigHybridSearch(_common.BaseModel):
|
1599
|
+
"""Config for Hybrid Search."""
|
1600
|
+
|
1601
|
+
alpha: Optional[float] = Field(
|
1602
|
+
default=None,
|
1603
|
+
description="""Optional. Alpha value controls the weight between dense and sparse vector search results. The range is [0, 1], while 0 means sparse vector search only and 1 means dense vector search only. The default value is 0.5 which balances sparse and dense vector search equally.""",
|
1604
|
+
)
|
1605
|
+
|
1606
|
+
|
1607
|
+
class RagRetrievalConfigHybridSearchDict(TypedDict, total=False):
|
1608
|
+
"""Config for Hybrid Search."""
|
1609
|
+
|
1610
|
+
alpha: Optional[float]
|
1611
|
+
"""Optional. Alpha value controls the weight between dense and sparse vector search results. The range is [0, 1], while 0 means sparse vector search only and 1 means dense vector search only. The default value is 0.5 which balances sparse and dense vector search equally."""
|
1612
|
+
|
1613
|
+
|
1614
|
+
RagRetrievalConfigHybridSearchOrDict = Union[
|
1615
|
+
RagRetrievalConfigHybridSearch, RagRetrievalConfigHybridSearchDict
|
1616
|
+
]
|
1617
|
+
|
1618
|
+
|
1619
|
+
class RagRetrievalConfigRankingLlmRanker(_common.BaseModel):
|
1620
|
+
"""Config for LlmRanker."""
|
1621
|
+
|
1622
|
+
model_name: Optional[str] = Field(
|
1623
|
+
default=None,
|
1624
|
+
description="""Optional. The model name used for ranking. Format: `gemini-1.5-pro`""",
|
1625
|
+
)
|
1626
|
+
|
1627
|
+
|
1628
|
+
class RagRetrievalConfigRankingLlmRankerDict(TypedDict, total=False):
|
1629
|
+
"""Config for LlmRanker."""
|
1630
|
+
|
1631
|
+
model_name: Optional[str]
|
1632
|
+
"""Optional. The model name used for ranking. Format: `gemini-1.5-pro`"""
|
1633
|
+
|
1634
|
+
|
1635
|
+
RagRetrievalConfigRankingLlmRankerOrDict = Union[
|
1636
|
+
RagRetrievalConfigRankingLlmRanker, RagRetrievalConfigRankingLlmRankerDict
|
1637
|
+
]
|
1638
|
+
|
1639
|
+
|
1640
|
+
class RagRetrievalConfigRankingRankService(_common.BaseModel):
|
1641
|
+
"""Config for Rank Service."""
|
1642
|
+
|
1643
|
+
model_name: Optional[str] = Field(
|
1644
|
+
default=None,
|
1645
|
+
description="""Optional. The model name of the rank service. Format: `semantic-ranker-512@latest`""",
|
1646
|
+
)
|
1647
|
+
|
1648
|
+
|
1649
|
+
class RagRetrievalConfigRankingRankServiceDict(TypedDict, total=False):
|
1650
|
+
"""Config for Rank Service."""
|
1651
|
+
|
1652
|
+
model_name: Optional[str]
|
1653
|
+
"""Optional. The model name of the rank service. Format: `semantic-ranker-512@latest`"""
|
1654
|
+
|
1655
|
+
|
1656
|
+
RagRetrievalConfigRankingRankServiceOrDict = Union[
|
1657
|
+
RagRetrievalConfigRankingRankService,
|
1658
|
+
RagRetrievalConfigRankingRankServiceDict,
|
1659
|
+
]
|
1660
|
+
|
1661
|
+
|
1662
|
+
class RagRetrievalConfigRanking(_common.BaseModel):
|
1663
|
+
"""Config for ranking and reranking."""
|
1664
|
+
|
1665
|
+
llm_ranker: Optional[RagRetrievalConfigRankingLlmRanker] = Field(
|
1666
|
+
default=None, description="""Optional. Config for LlmRanker."""
|
1667
|
+
)
|
1668
|
+
rank_service: Optional[RagRetrievalConfigRankingRankService] = Field(
|
1669
|
+
default=None, description="""Optional. Config for Rank Service."""
|
1670
|
+
)
|
1671
|
+
|
1672
|
+
|
1673
|
+
class RagRetrievalConfigRankingDict(TypedDict, total=False):
|
1674
|
+
"""Config for ranking and reranking."""
|
1675
|
+
|
1676
|
+
llm_ranker: Optional[RagRetrievalConfigRankingLlmRankerDict]
|
1677
|
+
"""Optional. Config for LlmRanker."""
|
1678
|
+
|
1679
|
+
rank_service: Optional[RagRetrievalConfigRankingRankServiceDict]
|
1680
|
+
"""Optional. Config for Rank Service."""
|
1681
|
+
|
1682
|
+
|
1683
|
+
RagRetrievalConfigRankingOrDict = Union[
|
1684
|
+
RagRetrievalConfigRanking, RagRetrievalConfigRankingDict
|
1685
|
+
]
|
1686
|
+
|
1687
|
+
|
1688
|
+
class RagRetrievalConfig(_common.BaseModel):
|
1689
|
+
"""Specifies the context retrieval config."""
|
1690
|
+
|
1691
|
+
filter: Optional[RagRetrievalConfigFilter] = Field(
|
1692
|
+
default=None, description="""Optional. Config for filters."""
|
1693
|
+
)
|
1694
|
+
hybrid_search: Optional[RagRetrievalConfigHybridSearch] = Field(
|
1695
|
+
default=None, description="""Optional. Config for Hybrid Search."""
|
1696
|
+
)
|
1697
|
+
ranking: Optional[RagRetrievalConfigRanking] = Field(
|
1698
|
+
default=None,
|
1699
|
+
description="""Optional. Config for ranking and reranking.""",
|
1700
|
+
)
|
1701
|
+
top_k: Optional[int] = Field(
|
1702
|
+
default=None,
|
1703
|
+
description="""Optional. The number of contexts to retrieve.""",
|
1704
|
+
)
|
1705
|
+
|
1706
|
+
|
1707
|
+
class RagRetrievalConfigDict(TypedDict, total=False):
|
1708
|
+
"""Specifies the context retrieval config."""
|
1709
|
+
|
1710
|
+
filter: Optional[RagRetrievalConfigFilterDict]
|
1711
|
+
"""Optional. Config for filters."""
|
1712
|
+
|
1713
|
+
hybrid_search: Optional[RagRetrievalConfigHybridSearchDict]
|
1714
|
+
"""Optional. Config for Hybrid Search."""
|
1715
|
+
|
1716
|
+
ranking: Optional[RagRetrievalConfigRankingDict]
|
1717
|
+
"""Optional. Config for ranking and reranking."""
|
1718
|
+
|
1719
|
+
top_k: Optional[int]
|
1720
|
+
"""Optional. The number of contexts to retrieve."""
|
1721
|
+
|
1722
|
+
|
1723
|
+
RagRetrievalConfigOrDict = Union[RagRetrievalConfig, RagRetrievalConfigDict]
|
1724
|
+
|
1725
|
+
|
1304
1726
|
class VertexRagStore(_common.BaseModel):
|
1305
1727
|
"""Retrieve from Vertex RAG Store for grounding."""
|
1306
1728
|
|
@@ -1312,6 +1734,10 @@ class VertexRagStore(_common.BaseModel):
|
|
1312
1734
|
default=None,
|
1313
1735
|
description="""Optional. The representation of the rag source. It can be used to specify corpus only or ragfiles. Currently only support one corpus or multiple files from one corpus. In the future we may open up multiple corpora support.""",
|
1314
1736
|
)
|
1737
|
+
rag_retrieval_config: Optional[RagRetrievalConfig] = Field(
|
1738
|
+
default=None,
|
1739
|
+
description="""Optional. The retrieval config for the Rag query.""",
|
1740
|
+
)
|
1315
1741
|
similarity_top_k: Optional[int] = Field(
|
1316
1742
|
default=None,
|
1317
1743
|
description="""Optional. Number of top k results to return from the selected corpora.""",
|
@@ -1331,6 +1757,9 @@ class VertexRagStoreDict(TypedDict, total=False):
|
|
1331
1757
|
rag_resources: Optional[list[VertexRagStoreRagResourceDict]]
|
1332
1758
|
"""Optional. The representation of the rag source. It can be used to specify corpus only or ragfiles. Currently only support one corpus or multiple files from one corpus. In the future we may open up multiple corpora support."""
|
1333
1759
|
|
1760
|
+
rag_retrieval_config: Optional[RagRetrievalConfigDict]
|
1761
|
+
"""Optional. The retrieval config for the Rag query."""
|
1762
|
+
|
1334
1763
|
similarity_top_k: Optional[int]
|
1335
1764
|
"""Optional. Number of top k results to return from the selected corpora."""
|
1336
1765
|
|
@@ -1554,6 +1983,12 @@ class SpeechConfig(_common.BaseModel):
|
|
1554
1983
|
description="""The configuration for the speaker to use.
|
1555
1984
|
""",
|
1556
1985
|
)
|
1986
|
+
language_code: Optional[str] = Field(
|
1987
|
+
default=None,
|
1988
|
+
description="""Language code (ISO 639. e.g. en-US) for the speech synthesization.
|
1989
|
+
Only available for Live API.
|
1990
|
+
""",
|
1991
|
+
)
|
1557
1992
|
|
1558
1993
|
|
1559
1994
|
class SpeechConfigDict(TypedDict, total=False):
|
@@ -1563,6 +1998,11 @@ class SpeechConfigDict(TypedDict, total=False):
|
|
1563
1998
|
"""The configuration for the speaker to use.
|
1564
1999
|
"""
|
1565
2000
|
|
2001
|
+
language_code: Optional[str]
|
2002
|
+
"""Language code (ISO 639. e.g. en-US) for the speech synthesization.
|
2003
|
+
Only available for Live API.
|
2004
|
+
"""
|
2005
|
+
|
1566
2006
|
|
1567
2007
|
SpeechConfigOrDict = Union[SpeechConfig, SpeechConfigDict]
|
1568
2008
|
|
@@ -1990,6 +2430,11 @@ class GenerateContentConfig(_common.BaseModel):
|
|
1990
2430
|
description="""Configuration for model router requests.
|
1991
2431
|
""",
|
1992
2432
|
)
|
2433
|
+
model_selection_config: Optional[ModelSelectionConfig] = Field(
|
2434
|
+
default=None,
|
2435
|
+
description="""Configuration for model selection.
|
2436
|
+
""",
|
2437
|
+
)
|
1993
2438
|
safety_settings: Optional[list[SafetySetting]] = Field(
|
1994
2439
|
default=None,
|
1995
2440
|
description="""Safety settings in the request to block unsafe content in the
|
@@ -2155,6 +2600,10 @@ class GenerateContentConfigDict(TypedDict, total=False):
|
|
2155
2600
|
"""Configuration for model router requests.
|
2156
2601
|
"""
|
2157
2602
|
|
2603
|
+
model_selection_config: Optional[ModelSelectionConfigDict]
|
2604
|
+
"""Configuration for model selection.
|
2605
|
+
"""
|
2606
|
+
|
2158
2607
|
safety_settings: Optional[list[SafetySettingDict]]
|
2159
2608
|
"""Safety settings in the request to block unsafe content in the
|
2160
2609
|
response.
|
@@ -9411,6 +9860,23 @@ ContextWindowCompressionConfigOrDict = Union[
|
|
9411
9860
|
]
|
9412
9861
|
|
9413
9862
|
|
9863
|
+
class AudioTranscriptionConfig(_common.BaseModel):
|
9864
|
+
"""The audio transcription configuration in Setup."""
|
9865
|
+
|
9866
|
+
pass
|
9867
|
+
|
9868
|
+
|
9869
|
+
class AudioTranscriptionConfigDict(TypedDict, total=False):
|
9870
|
+
"""The audio transcription configuration in Setup."""
|
9871
|
+
|
9872
|
+
pass
|
9873
|
+
|
9874
|
+
|
9875
|
+
AudioTranscriptionConfigOrDict = Union[
|
9876
|
+
AudioTranscriptionConfig, AudioTranscriptionConfigDict
|
9877
|
+
]
|
9878
|
+
|
9879
|
+
|
9414
9880
|
class LiveClientSetup(_common.BaseModel):
|
9415
9881
|
"""Message contains configuration that will apply for the duration of the streaming session."""
|
9416
9882
|
|
@@ -9427,7 +9893,7 @@ class LiveClientSetup(_common.BaseModel):
|
|
9427
9893
|
Note: only a subset of fields are supported.
|
9428
9894
|
""",
|
9429
9895
|
)
|
9430
|
-
system_instruction: Optional[
|
9896
|
+
system_instruction: Optional[ContentUnion] = Field(
|
9431
9897
|
default=None,
|
9432
9898
|
description="""The user provided system instructions for the model.
|
9433
9899
|
Note: only text should be used in parts and content in each part will be
|
@@ -9469,7 +9935,7 @@ class LiveClientSetupDict(TypedDict, total=False):
|
|
9469
9935
|
Note: only a subset of fields are supported.
|
9470
9936
|
"""
|
9471
9937
|
|
9472
|
-
system_instruction: Optional[
|
9938
|
+
system_instruction: Optional[ContentUnionDict]
|
9473
9939
|
"""The user provided system instructions for the model.
|
9474
9940
|
Note: only text should be used in parts and content in each part will be
|
9475
9941
|
in a separate paragraph."""
|
@@ -9718,23 +10184,6 @@ class LiveClientMessageDict(TypedDict, total=False):
|
|
9718
10184
|
LiveClientMessageOrDict = Union[LiveClientMessage, LiveClientMessageDict]
|
9719
10185
|
|
9720
10186
|
|
9721
|
-
class AudioTranscriptionConfig(_common.BaseModel):
|
9722
|
-
"""The audio transcription configuration in Setup."""
|
9723
|
-
|
9724
|
-
pass
|
9725
|
-
|
9726
|
-
|
9727
|
-
class AudioTranscriptionConfigDict(TypedDict, total=False):
|
9728
|
-
"""The audio transcription configuration in Setup."""
|
9729
|
-
|
9730
|
-
pass
|
9731
|
-
|
9732
|
-
|
9733
|
-
AudioTranscriptionConfigOrDict = Union[
|
9734
|
-
AudioTranscriptionConfig, AudioTranscriptionConfigDict
|
9735
|
-
]
|
9736
|
-
|
9737
|
-
|
9738
10187
|
class LiveConnectConfig(_common.BaseModel):
|
9739
10188
|
"""Session config for the API connection."""
|
9740
10189
|
|
@@ -9794,7 +10243,7 @@ class LiveConnectConfig(_common.BaseModel):
|
|
9794
10243
|
description="""The speech generation configuration.
|
9795
10244
|
""",
|
9796
10245
|
)
|
9797
|
-
system_instruction: Optional[
|
10246
|
+
system_instruction: Optional[ContentUnion] = Field(
|
9798
10247
|
default=None,
|
9799
10248
|
description="""The user provided system instructions for the model.
|
9800
10249
|
Note: only text should be used in parts and content in each part will be
|
@@ -9825,6 +10274,10 @@ If included the server will send SessionResumptionUpdate messages.""",
|
|
9825
10274
|
specified for the output audio.
|
9826
10275
|
""",
|
9827
10276
|
)
|
10277
|
+
realtime_input_config: Optional[RealtimeInputConfig] = Field(
|
10278
|
+
default=None,
|
10279
|
+
description="""Configures the realtime input behavior in BidiGenerateContent.""",
|
10280
|
+
)
|
9828
10281
|
context_window_compression: Optional[ContextWindowCompressionConfig] = Field(
|
9829
10282
|
default=None,
|
9830
10283
|
description="""Configures context window compression mechanism.
|
@@ -9883,7 +10336,7 @@ class LiveConnectConfigDict(TypedDict, total=False):
|
|
9883
10336
|
"""The speech generation configuration.
|
9884
10337
|
"""
|
9885
10338
|
|
9886
|
-
system_instruction: Optional[
|
10339
|
+
system_instruction: Optional[ContentUnionDict]
|
9887
10340
|
"""The user provided system instructions for the model.
|
9888
10341
|
Note: only text should be used in parts and content in each part will be
|
9889
10342
|
in a separate paragraph."""
|
@@ -9909,6 +10362,9 @@ If included the server will send SessionResumptionUpdate messages."""
|
|
9909
10362
|
specified for the output audio.
|
9910
10363
|
"""
|
9911
10364
|
|
10365
|
+
realtime_input_config: Optional[RealtimeInputConfigDict]
|
10366
|
+
"""Configures the realtime input behavior in BidiGenerateContent."""
|
10367
|
+
|
9912
10368
|
context_window_compression: Optional[ContextWindowCompressionConfigDict]
|
9913
10369
|
"""Configures context window compression mechanism.
|
9914
10370
|
|
@@ -9916,3 +10372,35 @@ If included the server will send SessionResumptionUpdate messages."""
|
|
9916
10372
|
|
9917
10373
|
|
9918
10374
|
LiveConnectConfigOrDict = Union[LiveConnectConfig, LiveConnectConfigDict]
|
10375
|
+
|
10376
|
+
|
10377
|
+
class LiveConnectParameters(_common.BaseModel):
|
10378
|
+
"""Parameters for connecting to the live API."""
|
10379
|
+
|
10380
|
+
model: Optional[str] = Field(
|
10381
|
+
default=None,
|
10382
|
+
description="""ID of the model to use. For a list of models, see `Google models
|
10383
|
+
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_.""",
|
10384
|
+
)
|
10385
|
+
config: Optional[LiveConnectConfig] = Field(
|
10386
|
+
default=None,
|
10387
|
+
description="""Optional configuration parameters for the request.
|
10388
|
+
""",
|
10389
|
+
)
|
10390
|
+
|
10391
|
+
|
10392
|
+
class LiveConnectParametersDict(TypedDict, total=False):
|
10393
|
+
"""Parameters for connecting to the live API."""
|
10394
|
+
|
10395
|
+
model: Optional[str]
|
10396
|
+
"""ID of the model to use. For a list of models, see `Google models
|
10397
|
+
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_."""
|
10398
|
+
|
10399
|
+
config: Optional[LiveConnectConfigDict]
|
10400
|
+
"""Optional configuration parameters for the request.
|
10401
|
+
"""
|
10402
|
+
|
10403
|
+
|
10404
|
+
LiveConnectParametersOrDict = Union[
|
10405
|
+
LiveConnectParameters, LiveConnectParametersDict
|
10406
|
+
]
|
google/genai/version.py
CHANGED