Skip to content

Commit cd66b68

Browse files
jaycee-licopybara-github
authored andcommitted
chore: Internal cleanup
PiperOrigin-RevId: 919827744
1 parent 0ead888 commit cd66b68

1 file changed

Lines changed: 150 additions & 154 deletions

File tree

google/genai/types.py

Lines changed: 150 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -303,21 +303,6 @@ class DynamicRetrievalConfigMode(_common.CaseInSensitiveEnum):
303303
"""Run retrieval only when system decides it is necessary."""
304304

305305

306-
class FunctionCallingConfigMode(_common.CaseInSensitiveEnum):
307-
"""Function calling mode."""
308-
309-
MODE_UNSPECIFIED = 'MODE_UNSPECIFIED'
310-
"""Unspecified function calling mode. This value should not be used."""
311-
AUTO = 'AUTO'
312-
"""Default model behavior, model decides to predict either function calls or natural language response."""
313-
ANY = 'ANY'
314-
"""Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations"."""
315-
NONE = 'NONE'
316-
"""Model will not predict any function calls. Model behavior is same as when not passing any function declarations."""
317-
VALIDATED = 'VALIDATED'
318-
"""Model is constrained to predict either function calls or natural language response. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations"."""
319-
320-
321306
class ThinkingLevel(_common.CaseInSensitiveEnum):
322307
"""The number of thoughts tokens that the model should generate."""
323308

@@ -427,6 +412,21 @@ class HarmBlockThreshold(_common.CaseInSensitiveEnum):
427412
"""Turn off the safety filter entirely."""
428413

429414

415+
class FunctionCallingConfigMode(_common.CaseInSensitiveEnum):
416+
"""Function calling mode."""
417+
418+
MODE_UNSPECIFIED = 'MODE_UNSPECIFIED'
419+
"""Unspecified function calling mode. This value should not be used."""
420+
AUTO = 'AUTO'
421+
"""Default model behavior, model decides to predict either function calls or natural language response."""
422+
ANY = 'ANY'
423+
"""Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations"."""
424+
NONE = 'NONE'
425+
"""Model will not predict any function calls. Model behavior is same as when not passing any function declarations."""
426+
VALIDATED = 'VALIDATED'
427+
"""Model is constrained to predict either function calls or natural language response. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations"."""
428+
429+
430430
class FinishReason(_common.CaseInSensitiveEnum):
431431
"""Output only. The reason why the model stopped generating tokens.
432432

@@ -1593,12 +1593,11 @@ class PartialArgDict(TypedDict, total=False):
15931593

15941594

15951595
class FunctionCall(_common.BaseModel):
1596-
"""A function call."""
1596+
"""A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values."""
15971597

15981598
id: Optional[str] = Field(
15991599
default=None,
1600-
description="""The unique id of the function call. If populated, the client to execute the
1601-
`function_call` and return the response with the matching `id`.""",
1600+
description="""Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`.""",
16021601
)
16031602
args: Optional[dict[str, Any]] = Field(
16041603
default=None,
@@ -1619,11 +1618,10 @@ class FunctionCall(_common.BaseModel):
16191618

16201619

16211620
class FunctionCallDict(TypedDict, total=False):
1622-
"""A function call."""
1621+
"""A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values."""
16231622

16241623
id: Optional[str]
1625-
"""The unique id of the function call. If populated, the client to execute the
1626-
`function_call` and return the response with the matching `id`."""
1624+
"""Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`."""
16271625

16281626
args: Optional[dict[str, Any]]
16291627
"""Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details."""
@@ -4966,139 +4964,6 @@ class ToolDict(TypedDict, total=False):
49664964
SchemaUnionDict = Union[SchemaUnion, SchemaDict]
49674965

49684966

4969-
class LatLng(_common.BaseModel):
4970-
"""An object that represents a latitude/longitude pair.
4971-
4972-
This is expressed as a pair of doubles to represent degrees latitude and
4973-
degrees longitude. Unless specified otherwise, this object must conform to the
4974-
<a href="https://en.wikipedia.org/wiki/World_Geodetic_System#1984_version">
4975-
WGS84 standard</a>. Values must be within normalized ranges.
4976-
"""
4977-
4978-
latitude: Optional[float] = Field(
4979-
default=None,
4980-
description="""The latitude in degrees. It must be in the range [-90.0, +90.0].""",
4981-
)
4982-
longitude: Optional[float] = Field(
4983-
default=None,
4984-
description="""The longitude in degrees. It must be in the range [-180.0, +180.0]""",
4985-
)
4986-
4987-
4988-
class LatLngDict(TypedDict, total=False):
4989-
"""An object that represents a latitude/longitude pair.
4990-
4991-
This is expressed as a pair of doubles to represent degrees latitude and
4992-
degrees longitude. Unless specified otherwise, this object must conform to the
4993-
<a href="https://en.wikipedia.org/wiki/World_Geodetic_System#1984_version">
4994-
WGS84 standard</a>. Values must be within normalized ranges.
4995-
"""
4996-
4997-
latitude: Optional[float]
4998-
"""The latitude in degrees. It must be in the range [-90.0, +90.0]."""
4999-
5000-
longitude: Optional[float]
5001-
"""The longitude in degrees. It must be in the range [-180.0, +180.0]"""
5002-
5003-
5004-
LatLngOrDict = Union[LatLng, LatLngDict]
5005-
5006-
5007-
class RetrievalConfig(_common.BaseModel):
5008-
"""Retrieval config."""
5009-
5010-
lat_lng: Optional[LatLng] = Field(
5011-
default=None, description="""Optional. The location of the user."""
5012-
)
5013-
language_code: Optional[str] = Field(
5014-
default=None, description="""The language code of the user."""
5015-
)
5016-
5017-
5018-
class RetrievalConfigDict(TypedDict, total=False):
5019-
"""Retrieval config."""
5020-
5021-
lat_lng: Optional[LatLngDict]
5022-
"""Optional. The location of the user."""
5023-
5024-
language_code: Optional[str]
5025-
"""The language code of the user."""
5026-
5027-
5028-
RetrievalConfigOrDict = Union[RetrievalConfig, RetrievalConfigDict]
5029-
5030-
5031-
class FunctionCallingConfig(_common.BaseModel):
5032-
"""Function calling config."""
5033-
5034-
allowed_function_names: Optional[list[str]] = Field(
5035-
default=None,
5036-
description="""Optional. Function names to call. Only set when the Mode is ANY. Function names should match FunctionDeclaration.name. With mode set to ANY, model will predict a function call from the set of function names provided.""",
5037-
)
5038-
mode: Optional[FunctionCallingConfigMode] = Field(
5039-
default=None, description="""Optional. Function calling mode."""
5040-
)
5041-
stream_function_call_arguments: Optional[bool] = Field(
5042-
default=None,
5043-
description="""Optional. When set to true, arguments of a single function call will be streamed out in multiple parts/contents/responses. Partial parameter results will be returned in the `FunctionCall.partial_args` field. This field is not supported in Gemini API.""",
5044-
)
5045-
5046-
5047-
class FunctionCallingConfigDict(TypedDict, total=False):
5048-
"""Function calling config."""
5049-
5050-
allowed_function_names: Optional[list[str]]
5051-
"""Optional. Function names to call. Only set when the Mode is ANY. Function names should match FunctionDeclaration.name. With mode set to ANY, model will predict a function call from the set of function names provided."""
5052-
5053-
mode: Optional[FunctionCallingConfigMode]
5054-
"""Optional. Function calling mode."""
5055-
5056-
stream_function_call_arguments: Optional[bool]
5057-
"""Optional. When set to true, arguments of a single function call will be streamed out in multiple parts/contents/responses. Partial parameter results will be returned in the `FunctionCall.partial_args` field. This field is not supported in Gemini API."""
5058-
5059-
5060-
FunctionCallingConfigOrDict = Union[
5061-
FunctionCallingConfig, FunctionCallingConfigDict
5062-
]
5063-
5064-
5065-
class ToolConfig(_common.BaseModel):
5066-
"""Tool config.
5067-
5068-
This config is shared for all tools provided in the request.
5069-
"""
5070-
5071-
retrieval_config: Optional[RetrievalConfig] = Field(
5072-
default=None, description="""Optional. Retrieval config."""
5073-
)
5074-
function_calling_config: Optional[FunctionCallingConfig] = Field(
5075-
default=None, description="""Optional. Function calling config."""
5076-
)
5077-
include_server_side_tool_invocations: Optional[bool] = Field(
5078-
default=None,
5079-
description="""If true, the API response will include the server-side tool calls and responses within the `Content` message. This allows clients to observe the server's tool invocations.""",
5080-
)
5081-
5082-
5083-
class ToolConfigDict(TypedDict, total=False):
5084-
"""Tool config.
5085-
5086-
This config is shared for all tools provided in the request.
5087-
"""
5088-
5089-
retrieval_config: Optional[RetrievalConfigDict]
5090-
"""Optional. Retrieval config."""
5091-
5092-
function_calling_config: Optional[FunctionCallingConfigDict]
5093-
"""Optional. Function calling config."""
5094-
5095-
include_server_side_tool_invocations: Optional[bool]
5096-
"""If true, the API response will include the server-side tool calls and responses within the `Content` message. This allows clients to observe the server's tool invocations."""
5097-
5098-
5099-
ToolConfigOrDict = Union[ToolConfig, ToolConfigDict]
5100-
5101-
51024967
class VoiceConsentSignature(_common.BaseModel):
51034968
"""The signature of the voice consent check."""
51044969

@@ -5811,6 +5676,137 @@ class SafetySettingDict(TypedDict, total=False):
58115676
SafetySettingOrDict = Union[SafetySetting, SafetySettingDict]
58125677

58135678

5679+
class LatLng(_common.BaseModel):
5680+
"""An object that represents a latitude/longitude pair.
5681+
5682+
This is expressed as a pair of doubles to represent degrees latitude and
5683+
degrees longitude. Unless specified otherwise, this object must conform to the
5684+
WGS84 standard. Values must be within normalized ranges.
5685+
"""
5686+
5687+
latitude: Optional[float] = Field(
5688+
default=None,
5689+
description="""The latitude in degrees. It must be in the range [-90.0, +90.0].""",
5690+
)
5691+
longitude: Optional[float] = Field(
5692+
default=None,
5693+
description="""The longitude in degrees. It must be in the range [-180.0, +180.0].""",
5694+
)
5695+
5696+
5697+
class LatLngDict(TypedDict, total=False):
5698+
"""An object that represents a latitude/longitude pair.
5699+
5700+
This is expressed as a pair of doubles to represent degrees latitude and
5701+
degrees longitude. Unless specified otherwise, this object must conform to the
5702+
WGS84 standard. Values must be within normalized ranges.
5703+
"""
5704+
5705+
latitude: Optional[float]
5706+
"""The latitude in degrees. It must be in the range [-90.0, +90.0]."""
5707+
5708+
longitude: Optional[float]
5709+
"""The longitude in degrees. It must be in the range [-180.0, +180.0]."""
5710+
5711+
5712+
LatLngOrDict = Union[LatLng, LatLngDict]
5713+
5714+
5715+
class RetrievalConfig(_common.BaseModel):
5716+
"""Retrieval config."""
5717+
5718+
lat_lng: Optional[LatLng] = Field(
5719+
default=None, description="""The location of the user."""
5720+
)
5721+
language_code: Optional[str] = Field(
5722+
default=None, description="""The language code of the user."""
5723+
)
5724+
5725+
5726+
class RetrievalConfigDict(TypedDict, total=False):
5727+
"""Retrieval config."""
5728+
5729+
lat_lng: Optional[LatLngDict]
5730+
"""The location of the user."""
5731+
5732+
language_code: Optional[str]
5733+
"""The language code of the user."""
5734+
5735+
5736+
RetrievalConfigOrDict = Union[RetrievalConfig, RetrievalConfigDict]
5737+
5738+
5739+
class FunctionCallingConfig(_common.BaseModel):
5740+
"""Function calling config."""
5741+
5742+
allowed_function_names: Optional[list[str]] = Field(
5743+
default=None,
5744+
description="""Optional. Function names to call. Only set when the Mode is ANY. Function names should match FunctionDeclaration.name. With mode set to ANY, model will predict a function call from the set of function names provided.""",
5745+
)
5746+
mode: Optional[FunctionCallingConfigMode] = Field(
5747+
default=None, description="""Optional. Function calling mode."""
5748+
)
5749+
stream_function_call_arguments: Optional[bool] = Field(
5750+
default=None,
5751+
description="""Optional. When set to true, arguments of a single function call will be streamed out in multiple parts/contents/responses. Partial parameter results will be returned in the `FunctionCall.partial_args` field. This field is not supported in Gemini API.""",
5752+
)
5753+
5754+
5755+
class FunctionCallingConfigDict(TypedDict, total=False):
5756+
"""Function calling config."""
5757+
5758+
allowed_function_names: Optional[list[str]]
5759+
"""Optional. Function names to call. Only set when the Mode is ANY. Function names should match FunctionDeclaration.name. With mode set to ANY, model will predict a function call from the set of function names provided."""
5760+
5761+
mode: Optional[FunctionCallingConfigMode]
5762+
"""Optional. Function calling mode."""
5763+
5764+
stream_function_call_arguments: Optional[bool]
5765+
"""Optional. When set to true, arguments of a single function call will be streamed out in multiple parts/contents/responses. Partial parameter results will be returned in the `FunctionCall.partial_args` field. This field is not supported in Gemini API."""
5766+
5767+
5768+
FunctionCallingConfigOrDict = Union[
5769+
FunctionCallingConfig, FunctionCallingConfigDict
5770+
]
5771+
5772+
5773+
class ToolConfig(_common.BaseModel):
5774+
"""Tool config.
5775+
5776+
This config is shared for all tools provided in the request.
5777+
"""
5778+
5779+
retrieval_config: Optional[RetrievalConfig] = Field(
5780+
default=None, description="""Optional. Retrieval config."""
5781+
)
5782+
function_calling_config: Optional[FunctionCallingConfig] = Field(
5783+
default=None, description="""Optional. Function calling config."""
5784+
)
5785+
include_server_side_tool_invocations: Optional[bool] = Field(
5786+
default=None,
5787+
description="""Optional. If true, the API response will include the server-side tool calls and responses within the `Content` message. This allows clients to observe the server's tool interactions. This field is not supported in Vertex AI.""",
5788+
)
5789+
5790+
5791+
class ToolConfigDict(TypedDict, total=False):
5792+
"""Tool config.
5793+
5794+
This config is shared for all tools provided in the request.
5795+
"""
5796+
5797+
retrieval_config: Optional[RetrievalConfigDict]
5798+
"""Optional. Retrieval config."""
5799+
5800+
function_calling_config: Optional[FunctionCallingConfigDict]
5801+
"""Optional. Function calling config."""
5802+
5803+
include_server_side_tool_invocations: Optional[bool]
5804+
"""Optional. If true, the API response will include the server-side tool calls and responses within the `Content` message. This allows clients to observe the server's tool interactions. This field is not supported in Vertex AI."""
5805+
5806+
5807+
ToolConfigOrDict = Union[ToolConfig, ToolConfigDict]
5808+
5809+
58145810
SpeechConfigUnion = Union[str, SpeechConfig]
58155811

58165812

0 commit comments

Comments
 (0)