diff --git a/google/genai/_gaos/agents.py b/google/genai/_gaos/agents.py index 38048587c..4294e490a 100644 --- a/google/genai/_gaos/agents.py +++ b/google/genai/_gaos/agents.py @@ -40,19 +40,19 @@ def create( self, *, api_version: Optional[str] = None, - id: Optional[str] = None, base_agent: Optional[str] = None, - system_instruction: Optional[str] = None, + base_environment: Optional[ + Union[agents_agent.BaseEnvironment, agents_agent.BaseEnvironmentParam] + ] = None, description: Optional[str] = None, + id: Optional[str] = None, + system_instruction: Optional[str] = None, tools: Optional[ Union[ Iterable[agents_agenttool.AgentTool], Iterable[agents_agenttool.AgentToolParam], ] ] = None, - base_environment: Optional[ - Union[agents_agent.BaseEnvironment, agents_agent.BaseEnvironmentParam] - ] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -61,12 +61,12 @@ def create( r"""Creates a new Agent (Typed version for SDK). :param api_version: Which version of the API to use. - :param id: The unique identifier for the agent. :param base_agent: The base agent to extend. - :param system_instruction: System instruction for the agent. + :param base_environment: The environment configuration for the agent. :param description: Agent description for developers to quickly read and understand. + :param id: The unique identifier for the agent. + :param system_instruction: System instruction for the agent. :param tools: The tools available to the agent. - :param base_environment: The environment configuration for the agent. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -89,14 +89,14 @@ def create( request = models.CreateAgentRequest( api_version=api_version, body=agents.Agent( - id=id, base_agent=base_agent, - system_instruction=system_instruction, - description=description, - tools=utils.get_pydantic_model(tools, Optional[List[agents.AgentTool]]), base_environment=utils.get_pydantic_model( base_environment, Optional[agents.BaseEnvironment] ), + description=description, + id=id, + system_instruction=system_instruction, + tools=utils.get_pydantic_model(tools, Optional[List[agents.AgentTool]]), ), ) @@ -815,19 +815,19 @@ async def create( self, *, api_version: Optional[str] = None, - id: Optional[str] = None, base_agent: Optional[str] = None, - system_instruction: Optional[str] = None, + base_environment: Optional[ + Union[agents_agent.BaseEnvironment, agents_agent.BaseEnvironmentParam] + ] = None, description: Optional[str] = None, + id: Optional[str] = None, + system_instruction: Optional[str] = None, tools: Optional[ Union[ Iterable[agents_agenttool.AgentTool], Iterable[agents_agenttool.AgentToolParam], ] ] = None, - base_environment: Optional[ - Union[agents_agent.BaseEnvironment, agents_agent.BaseEnvironmentParam] - ] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -836,12 +836,12 @@ async def create( r"""Creates a new Agent (Typed version for SDK). :param api_version: Which version of the API to use. - :param id: The unique identifier for the agent. :param base_agent: The base agent to extend. - :param system_instruction: System instruction for the agent. + :param base_environment: The environment configuration for the agent. :param description: Agent description for developers to quickly read and understand. + :param id: The unique identifier for the agent. + :param system_instruction: System instruction for the agent. :param tools: The tools available to the agent. - :param base_environment: The environment configuration for the agent. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -864,14 +864,14 @@ async def create( request = models.CreateAgentRequest( api_version=api_version, body=agents.Agent( - id=id, base_agent=base_agent, - system_instruction=system_instruction, - description=description, - tools=utils.get_pydantic_model(tools, Optional[List[agents.AgentTool]]), base_environment=utils.get_pydantic_model( base_environment, Optional[agents.BaseEnvironment] ), + description=description, + id=id, + system_instruction=system_instruction, + tools=utils.get_pydantic_model(tools, Optional[List[agents.AgentTool]]), ), ) diff --git a/google/genai/_gaos/types/agents/agent.py b/google/genai/_gaos/types/agents/agent.py index 0cb763245..a568094e0 100644 --- a/google/genai/_gaos/types/agents/agent.py +++ b/google/genai/_gaos/types/agents/agent.py @@ -50,18 +50,18 @@ class AgentParam(TypedDict): } """ - id: NotRequired[str] - r"""The unique identifier for the agent.""" base_agent: NotRequired[str] r"""The base agent to extend.""" - system_instruction: NotRequired[str] - r"""System instruction for the agent.""" + base_environment: NotRequired[BaseEnvironmentParam] + r"""The environment configuration for the agent.""" description: NotRequired[str] r"""Agent description for developers to quickly read and understand.""" + id: NotRequired[str] + r"""The unique identifier for the agent.""" + system_instruction: NotRequired[str] + r"""System instruction for the agent.""" tools: NotRequired[List[AgentToolParam]] r"""The tools available to the agent.""" - base_environment: NotRequired[BaseEnvironmentParam] - r"""The environment configuration for the agent.""" class Agent(BaseModel): @@ -77,34 +77,34 @@ class Agent(BaseModel): } """ - id: Optional[str] = None - r"""The unique identifier for the agent.""" - base_agent: Optional[str] = None r"""The base agent to extend.""" - system_instruction: Optional[str] = None - r"""System instruction for the agent.""" + base_environment: Optional[BaseEnvironment] = None + r"""The environment configuration for the agent.""" description: Optional[str] = None r"""Agent description for developers to quickly read and understand.""" + id: Optional[str] = None + r"""The unique identifier for the agent.""" + + system_instruction: Optional[str] = None + r"""System instruction for the agent.""" + tools: Optional[List[AgentTool]] = None r"""The tools available to the agent.""" - base_environment: Optional[BaseEnvironment] = None - r"""The environment configuration for the agent.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ - "id", "base_agent", - "system_instruction", + "base_environment", "description", + "id", + "system_instruction", "tools", - "base_environment", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/argumentsdelta.py b/google/genai/_gaos/types/interactions/argumentsdelta.py index 893d9cb39..d02bb06be 100644 --- a/google/genai/_gaos/types/interactions/argumentsdelta.py +++ b/google/genai/_gaos/types/interactions/argumentsdelta.py @@ -27,11 +27,13 @@ class ArgumentsDeltaTypedDict(TypedDict): - type: Literal["arguments_delta"] arguments: NotRequired[str] + type: Literal["arguments_delta"] class ArgumentsDelta(BaseModel): + arguments: Optional[str] = None + type: Annotated[ Annotated[ Literal["arguments_delta"], @@ -40,8 +42,6 @@ class ArgumentsDelta(BaseModel): pydantic.Field(alias="type"), ] = "arguments_delta" - arguments: Optional[str] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["arguments"]) diff --git a/google/genai/_gaos/types/interactions/audiocontent.py b/google/genai/_gaos/types/interactions/audiocontent.py index 8d2c30462..7372325d5 100644 --- a/google/genai/_gaos/types/interactions/audiocontent.py +++ b/google/genai/_gaos/types/interactions/audiocontent.py @@ -55,45 +55,45 @@ class AudioContentParam(TypedDict): r"""An audio content block.""" - type: Literal["audio"] + channels: NotRequired[int] + r"""The number of audio channels.""" data: NotRequired[Union[str, Base64FileInput]] r"""The audio content.""" - uri: NotRequired[str] - r"""The URI of the audio.""" mime_type: NotRequired[AudioContentMimeType] r"""The mime type of the audio.""" - channels: NotRequired[int] - r"""The number of audio channels.""" sample_rate: NotRequired[int] r"""The sample rate of the audio.""" + type: Literal["audio"] + uri: NotRequired[str] + r"""The URI of the audio.""" class AudioContent(BaseModel): r"""An audio content block.""" - type: Annotated[ - Annotated[Literal["audio"], AfterValidator(validate_const("audio"))], - pydantic.Field(alias="type"), - ] = "audio" + channels: Optional[int] = None + r"""The number of audio channels.""" data: Optional[Base64EncodedString] = None r"""The audio content.""" - uri: Optional[str] = None - r"""The URI of the audio.""" - mime_type: Optional[AudioContentMimeType] = None r"""The mime type of the audio.""" - channels: Optional[int] = None - r"""The number of audio channels.""" - sample_rate: Optional[int] = None r"""The sample rate of the audio.""" + type: Annotated[ + Annotated[Literal["audio"], AfterValidator(validate_const("audio"))], + pydantic.Field(alias="type"), + ] = "audio" + + uri: Optional[str] = None + r"""The URI of the audio.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["data", "uri", "mime_type", "channels", "sample_rate"]) + optional_fields = set(["channels", "data", "mime_type", "sample_rate", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/audiodelta.py b/google/genai/_gaos/types/interactions/audiodelta.py index 4a990c623..910e99cec 100644 --- a/google/genai/_gaos/types/interactions/audiodelta.py +++ b/google/genai/_gaos/types/interactions/audiodelta.py @@ -46,28 +46,24 @@ class AudioDeltaTypedDict(TypedDict): - type: Literal["audio"] + channels: NotRequired[int] + r"""The number of audio channels.""" data: NotRequired[str] - uri: NotRequired[str] mime_type: NotRequired[AudioDeltaMimeType] rate: NotRequired[int] r"""Deprecated. Use sample_rate instead. The value is ignored.""" sample_rate: NotRequired[int] r"""The sample rate of the audio.""" - channels: NotRequired[int] - r"""The number of audio channels.""" + type: Literal["audio"] + uri: NotRequired[str] class AudioDelta(BaseModel): - type: Annotated[ - Annotated[Literal["audio"], AfterValidator(validate_const("audio"))], - pydantic.Field(alias="type"), - ] = "audio" + channels: Optional[int] = None + r"""The number of audio channels.""" data: Optional[str] = None - uri: Optional[str] = None - mime_type: Optional[AudioDeltaMimeType] = None rate: Annotated[ @@ -81,13 +77,17 @@ class AudioDelta(BaseModel): sample_rate: Optional[int] = None r"""The sample rate of the audio.""" - channels: Optional[int] = None - r"""The number of audio channels.""" + type: Annotated[ + Annotated[Literal["audio"], AfterValidator(validate_const("audio"))], + pydantic.Field(alias="type"), + ] = "audio" + + uri: Optional[str] = None @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["data", "uri", "mime_type", "rate", "sample_rate", "channels"] + ["channels", "data", "mime_type", "rate", "sample_rate", "uri"] ) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/audioresponseformat.py b/google/genai/_gaos/types/interactions/audioresponseformat.py index 09d159658..f5cab9d23 100644 --- a/google/genai/_gaos/types/interactions/audioresponseformat.py +++ b/google/genai/_gaos/types/interactions/audioresponseformat.py @@ -26,6 +26,16 @@ from typing_extensions import Annotated, NotRequired, TypedDict +AudioResponseFormatDelivery = Union[ + Literal[ + "inline", + "uri", + ], + UnrecognizedStr, +] +r"""The delivery mode for the audio output.""" + + AudioResponseFormatMimeType = Union[ Literal[ "audio/mp3", @@ -40,57 +50,47 @@ r"""The MIME type of the audio output.""" -AudioResponseFormatDelivery = Union[ - Literal[ - "inline", - "uri", - ], - UnrecognizedStr, -] -r"""The delivery mode for the audio output.""" - - class AudioResponseFormatParam(TypedDict): r"""Configuration for audio output format.""" - type: Literal["audio"] - mime_type: NotRequired[AudioResponseFormatMimeType] - r"""The MIME type of the audio output.""" - delivery: NotRequired[AudioResponseFormatDelivery] - r"""The delivery mode for the audio output.""" - sample_rate: NotRequired[int] - r"""Sample rate in Hz.""" bit_rate: NotRequired[int] r"""Bit rate in bits per second (bps). Only applicable for compressed formats (MP3, Opus). """ + delivery: NotRequired[AudioResponseFormatDelivery] + r"""The delivery mode for the audio output.""" + mime_type: NotRequired[AudioResponseFormatMimeType] + r"""The MIME type of the audio output.""" + sample_rate: NotRequired[int] + r"""Sample rate in Hz.""" + type: Literal["audio"] class AudioResponseFormat(BaseModel): r"""Configuration for audio output format.""" - type: Annotated[ - Annotated[Literal["audio"], AfterValidator(validate_const("audio"))], - pydantic.Field(alias="type"), - ] = "audio" - - mime_type: Optional[AudioResponseFormatMimeType] = None - r"""The MIME type of the audio output.""" + bit_rate: Optional[int] = None + r"""Bit rate in bits per second (bps). Only applicable for compressed formats + (MP3, Opus). + """ delivery: Optional[AudioResponseFormatDelivery] = None r"""The delivery mode for the audio output.""" + mime_type: Optional[AudioResponseFormatMimeType] = None + r"""The MIME type of the audio output.""" + sample_rate: Optional[int] = None r"""Sample rate in Hz.""" - bit_rate: Optional[int] = None - r"""Bit rate in bits per second (bps). Only applicable for compressed formats - (MP3, Opus). - """ + type: Annotated[ + Annotated[Literal["audio"], AfterValidator(validate_const("audio"))], + pydantic.Field(alias="type"), + ] = "audio" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["mime_type", "delivery", "sample_rate", "bit_rate"]) + optional_fields = set(["bit_rate", "delivery", "mime_type", "sample_rate"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/codeexecutioncallarguments.py b/google/genai/_gaos/types/interactions/codeexecutioncallarguments.py index 8e0af7701..80d48db4e 100644 --- a/google/genai/_gaos/types/interactions/codeexecutioncallarguments.py +++ b/google/genai/_gaos/types/interactions/codeexecutioncallarguments.py @@ -30,24 +30,24 @@ class CodeExecutionCallArgumentsParam(TypedDict): r"""The arguments to pass to the code execution.""" - language: NotRequired[Language] - r"""Programming language of the `code`.""" code: NotRequired[str] r"""The code to be executed.""" + language: NotRequired[Language] + r"""Programming language of the `code`.""" class CodeExecutionCallArguments(BaseModel): r"""The arguments to pass to the code execution.""" - language: Optional[Language] = None - r"""Programming language of the `code`.""" - code: Optional[str] = None r"""The code to be executed.""" + language: Optional[Language] = None + r"""Programming language of the `code`.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["language", "code"]) + optional_fields = set(["code", "language"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/codeexecutioncalldelta.py b/google/genai/_gaos/types/interactions/codeexecutioncalldelta.py index ed701bf2b..3eb9027db 100644 --- a/google/genai/_gaos/types/interactions/codeexecutioncalldelta.py +++ b/google/genai/_gaos/types/interactions/codeexecutioncalldelta.py @@ -33,15 +33,18 @@ class CodeExecutionCallDeltaTypedDict(TypedDict): arguments: CodeExecutionCallArgumentsParam r"""The arguments to pass to the code execution.""" - type: Literal["code_execution_call"] signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["code_execution_call"] class CodeExecutionCallDelta(BaseModel): arguments: CodeExecutionCallArguments r"""The arguments to pass to the code execution.""" + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["code_execution_call"], @@ -50,9 +53,6 @@ class CodeExecutionCallDelta(BaseModel): pydantic.Field(alias="type"), ] = "code_execution_call" - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature"]) diff --git a/google/genai/_gaos/types/interactions/codeexecutioncallstep.py b/google/genai/_gaos/types/interactions/codeexecutioncallstep.py index 6cbd4f59e..87a6bf647 100644 --- a/google/genai/_gaos/types/interactions/codeexecutioncallstep.py +++ b/google/genai/_gaos/types/interactions/codeexecutioncallstep.py @@ -37,9 +37,9 @@ class CodeExecutionCallStepParam(TypedDict): r"""The arguments to pass to the code execution.""" id: str r"""Required. A unique ID for this specific tool call.""" - type: Literal["code_execution_call"] signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" + type: Literal["code_execution_call"] class CodeExecutionCallStep(BaseModel): @@ -51,6 +51,9 @@ class CodeExecutionCallStep(BaseModel): id: str r"""Required. A unique ID for this specific tool call.""" + signature: Optional[Base64EncodedString] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["code_execution_call"], @@ -59,9 +62,6 @@ class CodeExecutionCallStep(BaseModel): pydantic.Field(alias="type"), ] = "code_execution_call" - signature: Optional[Base64EncodedString] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature"]) diff --git a/google/genai/_gaos/types/interactions/codeexecutionresultdelta.py b/google/genai/_gaos/types/interactions/codeexecutionresultdelta.py index 7f1b24fb0..34cfcc912 100644 --- a/google/genai/_gaos/types/interactions/codeexecutionresultdelta.py +++ b/google/genai/_gaos/types/interactions/codeexecutionresultdelta.py @@ -28,15 +28,20 @@ class CodeExecutionResultDeltaTypedDict(TypedDict): result: str - type: Literal["code_execution_result"] is_error: NotRequired[bool] signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["code_execution_result"] class CodeExecutionResultDelta(BaseModel): result: str + is_error: Optional[bool] = None + + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["code_execution_result"], @@ -45,11 +50,6 @@ class CodeExecutionResultDelta(BaseModel): pydantic.Field(alias="type"), ] = "code_execution_result" - is_error: Optional[bool] = None - - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["is_error", "signature"]) diff --git a/google/genai/_gaos/types/interactions/codeexecutionresultstep.py b/google/genai/_gaos/types/interactions/codeexecutionresultstep.py index d78bfbebc..7061225f7 100644 --- a/google/genai/_gaos/types/interactions/codeexecutionresultstep.py +++ b/google/genai/_gaos/types/interactions/codeexecutionresultstep.py @@ -29,25 +29,31 @@ class CodeExecutionResultStepParam(TypedDict): r"""Code execution result step.""" - result: str - r"""Required. The output of the code execution.""" call_id: str r"""Required. ID to match the ID from the function call block.""" - type: Literal["code_execution_result"] + result: str + r"""Required. The output of the code execution.""" is_error: NotRequired[bool] r"""Whether the code execution resulted in an error.""" signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" + type: Literal["code_execution_result"] class CodeExecutionResultStep(BaseModel): r"""Code execution result step.""" + call_id: str + r"""Required. ID to match the ID from the function call block.""" + result: str r"""Required. The output of the code execution.""" - call_id: str - r"""Required. ID to match the ID from the function call block.""" + is_error: Optional[bool] = None + r"""Whether the code execution resulted in an error.""" + + signature: Optional[Base64EncodedString] = None + r"""A signature hash for backend validation.""" type: Annotated[ Annotated[ @@ -57,12 +63,6 @@ class CodeExecutionResultStep(BaseModel): pydantic.Field(alias="type"), ] = "code_execution_result" - is_error: Optional[bool] = None - r"""Whether the code execution resulted in an error.""" - - signature: Optional[Base64EncodedString] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["is_error", "signature"]) diff --git a/google/genai/_gaos/types/interactions/computeruse.py b/google/genai/_gaos/types/interactions/computeruse.py index 7a49e4238..f7a818b3b 100644 --- a/google/genai/_gaos/types/interactions/computeruse.py +++ b/google/genai/_gaos/types/interactions/computeruse.py @@ -26,17 +26,6 @@ from typing_extensions import Annotated, NotRequired, TypedDict -EnvironmentEnum = Union[ - Literal[ - "browser", - "mobile", - "desktop", - ], - UnrecognizedStr, -] -r"""The environment being operated.""" - - DisabledSafetyPolicy = Union[ Literal[ "financial_transactions", @@ -51,31 +40,43 @@ ] +EnvironmentEnum = Union[ + Literal[ + "browser", + "mobile", + "desktop", + ], + UnrecognizedStr, +] +r"""The environment being operated.""" + + class ComputerUseParam(TypedDict): r"""A tool that can be used by the model to interact with the computer.""" - type: Literal["computer_use"] - environment: NotRequired[EnvironmentEnum] - r"""The environment being operated.""" - excluded_predefined_functions: NotRequired[List[str]] - r"""The list of predefined functions that are excluded from the model call.""" + disabled_safety_policies: NotRequired[List[DisabledSafetyPolicy]] + r"""Optional. Disabled safety policies for computer use.""" enable_prompt_injection_detection: NotRequired[bool] r"""Whether enable the prompt injection detection check on computer-use request. """ - disabled_safety_policies: NotRequired[List[DisabledSafetyPolicy]] - r"""Optional. Disabled safety policies for computer use.""" + environment: NotRequired[EnvironmentEnum] + r"""The environment being operated.""" + excluded_predefined_functions: NotRequired[List[str]] + r"""The list of predefined functions that are excluded from the model call.""" + type: Literal["computer_use"] class ComputerUse(BaseModel): r"""A tool that can be used by the model to interact with the computer.""" - type: Annotated[ - Annotated[ - Literal["computer_use"], AfterValidator(validate_const("computer_use")) - ], - pydantic.Field(alias="type"), - ] = "computer_use" + disabled_safety_policies: Optional[List[DisabledSafetyPolicy]] = None + r"""Optional. Disabled safety policies for computer use.""" + + enable_prompt_injection_detection: Optional[bool] = None + r"""Whether enable the prompt injection detection check on computer-use + request. + """ environment: Optional[EnvironmentEnum] = None r"""The environment being operated.""" @@ -83,22 +84,21 @@ class ComputerUse(BaseModel): excluded_predefined_functions: Optional[List[str]] = None r"""The list of predefined functions that are excluded from the model call.""" - enable_prompt_injection_detection: Optional[bool] = None - r"""Whether enable the prompt injection detection check on computer-use - request. - """ - - disabled_safety_policies: Optional[List[DisabledSafetyPolicy]] = None - r"""Optional. Disabled safety policies for computer use.""" + type: Annotated[ + Annotated[ + Literal["computer_use"], AfterValidator(validate_const("computer_use")) + ], + pydantic.Field(alias="type"), + ] = "computer_use" @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ + "disabled_safety_policies", + "enable_prompt_injection_detection", "environment", "excluded_predefined_functions", - "enable_prompt_injection_detection", - "disabled_safety_policies", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/deepresearchagentconfig.py b/google/genai/_gaos/types/interactions/deepresearchagentconfig.py index e3a674ece..9adfb537b 100644 --- a/google/genai/_gaos/types/interactions/deepresearchagentconfig.py +++ b/google/genai/_gaos/types/interactions/deepresearchagentconfig.py @@ -40,10 +40,6 @@ class DeepResearchAgentConfigParam(TypedDict): r"""Configuration for the Deep Research agent.""" - type: Literal["deep-research"] - thinking_summaries: NotRequired[ThinkingSummaries] - visualization: NotRequired[Visualization] - r"""Whether to include visualizations in the response.""" collaborative_planning: NotRequired[bool] r"""Enables human-in-the-loop planning for the Deep Research agent. If set to true, the Deep Research agent will provide a research plan in its response. @@ -52,23 +48,15 @@ class DeepResearchAgentConfigParam(TypedDict): """ enable_bigquery_tool: NotRequired[bool] r"""Enables bigquery tool for the Deep Research agent.""" + thinking_summaries: NotRequired[ThinkingSummaries] + type: Literal["deep-research"] + visualization: NotRequired[Visualization] + r"""Whether to include visualizations in the response.""" class DeepResearchAgentConfig(BaseModel): r"""Configuration for the Deep Research agent.""" - type: Annotated[ - Annotated[ - Literal["deep-research"], AfterValidator(validate_const("deep-research")) - ], - pydantic.Field(alias="type"), - ] = "deep-research" - - thinking_summaries: Optional[ThinkingSummaries] = None - - visualization: Optional[Visualization] = None - r"""Whether to include visualizations in the response.""" - collaborative_planning: Optional[bool] = None r"""Enables human-in-the-loop planning for the Deep Research agent. If set to true, the Deep Research agent will provide a research plan in its response. @@ -79,14 +67,26 @@ class DeepResearchAgentConfig(BaseModel): enable_bigquery_tool: Optional[bool] = None r"""Enables bigquery tool for the Deep Research agent.""" + thinking_summaries: Optional[ThinkingSummaries] = None + + type: Annotated[ + Annotated[ + Literal["deep-research"], AfterValidator(validate_const("deep-research")) + ], + pydantic.Field(alias="type"), + ] = "deep-research" + + visualization: Optional[Visualization] = None + r"""Whether to include visualizations in the response.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ - "thinking_summaries", - "visualization", "collaborative_planning", "enable_bigquery_tool", + "thinking_summaries", + "visualization", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/documentcontent.py b/google/genai/_gaos/types/interactions/documentcontent.py index ad2b333bc..91b4fbef2 100644 --- a/google/genai/_gaos/types/interactions/documentcontent.py +++ b/google/genai/_gaos/types/interactions/documentcontent.py @@ -45,35 +45,35 @@ class DocumentContentParam(TypedDict): r"""A document content block.""" - type: Literal["document"] data: NotRequired[Union[str, Base64FileInput]] r"""The document content.""" - uri: NotRequired[str] - r"""The URI of the document.""" mime_type: NotRequired[DocumentContentMimeType] r"""The mime type of the document.""" + type: Literal["document"] + uri: NotRequired[str] + r"""The URI of the document.""" class DocumentContent(BaseModel): r"""A document content block.""" + data: Optional[Base64EncodedString] = None + r"""The document content.""" + + mime_type: Optional[DocumentContentMimeType] = None + r"""The mime type of the document.""" + type: Annotated[ Annotated[Literal["document"], AfterValidator(validate_const("document"))], pydantic.Field(alias="type"), ] = "document" - data: Optional[Base64EncodedString] = None - r"""The document content.""" - uri: Optional[str] = None r"""The URI of the document.""" - mime_type: Optional[DocumentContentMimeType] = None - r"""The mime type of the document.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["data", "uri", "mime_type"]) + optional_fields = set(["data", "mime_type", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/documentdelta.py b/google/genai/_gaos/types/interactions/documentdelta.py index a99b408ae..8ab0a02aa 100644 --- a/google/genai/_gaos/types/interactions/documentdelta.py +++ b/google/genai/_gaos/types/interactions/documentdelta.py @@ -36,27 +36,27 @@ class DocumentDeltaTypedDict(TypedDict): - type: Literal["document"] data: NotRequired[str] - uri: NotRequired[str] mime_type: NotRequired[DocumentDeltaMimeType] + type: Literal["document"] + uri: NotRequired[str] class DocumentDelta(BaseModel): + data: Optional[str] = None + + mime_type: Optional[DocumentDeltaMimeType] = None + type: Annotated[ Annotated[Literal["document"], AfterValidator(validate_const("document"))], pydantic.Field(alias="type"), ] = "document" - data: Optional[str] = None - uri: Optional[str] = None - mime_type: Optional[DocumentDeltaMimeType] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["data", "uri", "mime_type"]) + optional_fields = set(["data", "mime_type", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/environment.py b/google/genai/_gaos/types/interactions/environment.py index 81cfde69a..22588be0d 100644 --- a/google/genai/_gaos/types/interactions/environment.py +++ b/google/genai/_gaos/types/interactions/environment.py @@ -49,26 +49,19 @@ class EnvironmentParam(TypedDict): r"""Configuration for a custom environment.""" - type: Literal["remote"] - sources: NotRequired[List[SourceParam]] environment_id: NotRequired[str] r"""Optional. The environment ID for the interaction. If specified, the request will update the existing environment instead of creating a new one. """ network: NotRequired[NetworkParam] r"""Network configuration for the environment.""" + sources: NotRequired[List[SourceParam]] + type: Literal["remote"] class Environment(BaseModel): r"""Configuration for a custom environment.""" - type: Annotated[ - Annotated[Literal["remote"], AfterValidator(validate_const("remote"))], - pydantic.Field(alias="type"), - ] = "remote" - - sources: Optional[List[Source]] = None - environment_id: Optional[str] = None r"""Optional. The environment ID for the interaction. If specified, the request will update the existing environment instead of creating a new one. @@ -77,9 +70,16 @@ class Environment(BaseModel): network: Optional[Network] = None r"""Network configuration for the environment.""" + sources: Optional[List[Source]] = None + + type: Annotated[ + Annotated[Literal["remote"], AfterValidator(validate_const("remote"))], + pydantic.Field(alias="type"), + ] = "remote" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["sources", "environment_id", "network"]) + optional_fields = set(["environment_id", "network", "sources"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/errorevent.py b/google/genai/_gaos/types/interactions/errorevent.py index 6d04ad03c..ae8a41232 100644 --- a/google/genai/_gaos/types/interactions/errorevent.py +++ b/google/genai/_gaos/types/interactions/errorevent.py @@ -29,22 +29,17 @@ class ErrorEventTypedDict(TypedDict): - event_type: Literal["error"] error: NotRequired[ErrorTypedDict] r"""Error message from an interaction.""" event_id: NotRequired[str] r"""The event_id token to be used to resume the interaction stream, from this event. """ + event_type: Literal["error"] metadata: NotRequired[StreamMetadataTypedDict] class ErrorEvent(BaseModel): - event_type: Annotated[ - Annotated[Literal["error"], AfterValidator(validate_const("error"))], - pydantic.Field(alias="event_type"), - ] = "error" - error: Optional[Error] = None r"""Error message from an interaction.""" @@ -53,6 +48,11 @@ class ErrorEvent(BaseModel): this event. """ + event_type: Annotated[ + Annotated[Literal["error"], AfterValidator(validate_const("error"))], + pydantic.Field(alias="event_type"), + ] = "error" + metadata: Optional[StreamMetadata] = None @model_serializer(mode="wrap") diff --git a/google/genai/_gaos/types/interactions/filecitation.py b/google/genai/_gaos/types/interactions/filecitation.py index 4b3de1127..c63f4369e 100644 --- a/google/genai/_gaos/types/interactions/filecitation.py +++ b/google/genai/_gaos/types/interactions/filecitation.py @@ -29,55 +29,51 @@ class FileCitationParam(TypedDict): r"""A file citation annotation.""" - type: Literal["file_citation"] + custom_metadata: NotRequired[Dict[str, Any]] + r"""User provided metadata about the retrieved context.""" document_uri: NotRequired[str] r"""The URI of the file.""" + end_index: NotRequired[int] + r"""End of the attributed segment, exclusive.""" file_name: NotRequired[str] r"""The name of the file.""" - source: NotRequired[str] - r"""Source attributed for a portion of the text.""" - custom_metadata: NotRequired[Dict[str, Any]] - r"""User provided metadata about the retrieved context.""" - page_number: NotRequired[int] - r"""Page number of the cited document, if applicable.""" media_id: NotRequired[str] r"""Media ID in-case of image citations, if applicable.""" + page_number: NotRequired[int] + r"""Page number of the cited document, if applicable.""" + source: NotRequired[str] + r"""Source attributed for a portion of the text.""" start_index: NotRequired[int] r"""Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes. """ - end_index: NotRequired[int] - r"""End of the attributed segment, exclusive.""" + type: Literal["file_citation"] class FileCitation(BaseModel): r"""A file citation annotation.""" - type: Annotated[ - Annotated[ - Literal["file_citation"], AfterValidator(validate_const("file_citation")) - ], - pydantic.Field(alias="type"), - ] = "file_citation" + custom_metadata: Optional[Dict[str, Any]] = None + r"""User provided metadata about the retrieved context.""" document_uri: Optional[str] = None r"""The URI of the file.""" + end_index: Optional[int] = None + r"""End of the attributed segment, exclusive.""" + file_name: Optional[str] = None r"""The name of the file.""" - source: Optional[str] = None - r"""Source attributed for a portion of the text.""" - - custom_metadata: Optional[Dict[str, Any]] = None - r"""User provided metadata about the retrieved context.""" + media_id: Optional[str] = None + r"""Media ID in-case of image citations, if applicable.""" page_number: Optional[int] = None r"""Page number of the cited document, if applicable.""" - media_id: Optional[str] = None - r"""Media ID in-case of image citations, if applicable.""" + source: Optional[str] = None + r"""Source attributed for a portion of the text.""" start_index: Optional[int] = None r"""Start of segment of the response that is attributed to this source. @@ -85,21 +81,25 @@ class FileCitation(BaseModel): Index indicates the start of the segment, measured in bytes. """ - end_index: Optional[int] = None - r"""End of the attributed segment, exclusive.""" + type: Annotated[ + Annotated[ + Literal["file_citation"], AfterValidator(validate_const("file_citation")) + ], + pydantic.Field(alias="type"), + ] = "file_citation" @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ + "custom_metadata", "document_uri", + "end_index", "file_name", - "source", - "custom_metadata", - "page_number", "media_id", + "page_number", + "source", "start_index", - "end_index", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/filesearch.py b/google/genai/_gaos/types/interactions/filesearch.py index e01d50a9b..981b0153f 100644 --- a/google/genai/_gaos/types/interactions/filesearch.py +++ b/google/genai/_gaos/types/interactions/filesearch.py @@ -29,37 +29,37 @@ class FileSearchParam(TypedDict): r"""A tool that can be used by the model to search files.""" - type: Literal["file_search"] file_search_store_names: NotRequired[List[str]] r"""The file search store names to search.""" - top_k: NotRequired[int] - r"""The number of semantic retrieval chunks to retrieve.""" metadata_filter: NotRequired[str] r"""Metadata filter to apply to the semantic retrieval documents and chunks.""" + top_k: NotRequired[int] + r"""The number of semantic retrieval chunks to retrieve.""" + type: Literal["file_search"] class FileSearch(BaseModel): r"""A tool that can be used by the model to search files.""" - type: Annotated[ - Annotated[ - Literal["file_search"], AfterValidator(validate_const("file_search")) - ], - pydantic.Field(alias="type"), - ] = "file_search" - file_search_store_names: Optional[List[str]] = None r"""The file search store names to search.""" + metadata_filter: Optional[str] = None + r"""Metadata filter to apply to the semantic retrieval documents and chunks.""" + top_k: Optional[int] = None r"""The number of semantic retrieval chunks to retrieve.""" - metadata_filter: Optional[str] = None - r"""Metadata filter to apply to the semantic retrieval documents and chunks.""" + type: Annotated[ + Annotated[ + Literal["file_search"], AfterValidator(validate_const("file_search")) + ], + pydantic.Field(alias="type"), + ] = "file_search" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["file_search_store_names", "top_k", "metadata_filter"]) + optional_fields = set(["file_search_store_names", "metadata_filter", "top_k"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/filesearchcalldelta.py b/google/genai/_gaos/types/interactions/filesearchcalldelta.py index 53f1c41c4..4663be364 100644 --- a/google/genai/_gaos/types/interactions/filesearchcalldelta.py +++ b/google/genai/_gaos/types/interactions/filesearchcalldelta.py @@ -27,12 +27,15 @@ class FileSearchCallDeltaTypedDict(TypedDict): - type: Literal["file_search_call"] signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["file_search_call"] class FileSearchCallDelta(BaseModel): + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["file_search_call"], @@ -41,9 +44,6 @@ class FileSearchCallDelta(BaseModel): pydantic.Field(alias="type"), ] = "file_search_call" - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature"]) diff --git a/google/genai/_gaos/types/interactions/filesearchcallstep.py b/google/genai/_gaos/types/interactions/filesearchcallstep.py index aaf56b681..aaf410d4a 100644 --- a/google/genai/_gaos/types/interactions/filesearchcallstep.py +++ b/google/genai/_gaos/types/interactions/filesearchcallstep.py @@ -31,9 +31,9 @@ class FileSearchCallStepParam(TypedDict): id: str r"""Required. A unique ID for this specific tool call.""" - type: Literal["file_search_call"] signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" + type: Literal["file_search_call"] class FileSearchCallStep(BaseModel): @@ -42,6 +42,9 @@ class FileSearchCallStep(BaseModel): id: str r"""Required. A unique ID for this specific tool call.""" + signature: Optional[Base64EncodedString] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["file_search_call"], @@ -50,9 +53,6 @@ class FileSearchCallStep(BaseModel): pydantic.Field(alias="type"), ] = "file_search_call" - signature: Optional[Base64EncodedString] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature"]) diff --git a/google/genai/_gaos/types/interactions/filesearchresultdelta.py b/google/genai/_gaos/types/interactions/filesearchresultdelta.py index e1cd83a4d..0a8507ee6 100644 --- a/google/genai/_gaos/types/interactions/filesearchresultdelta.py +++ b/google/genai/_gaos/types/interactions/filesearchresultdelta.py @@ -29,14 +29,17 @@ class FileSearchResultDeltaTypedDict(TypedDict): result: List[FileSearchResultTypedDict] - type: Literal["file_search_result"] signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["file_search_result"] class FileSearchResultDelta(BaseModel): result: List[FileSearchResult] + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["file_search_result"], @@ -45,9 +48,6 @@ class FileSearchResultDelta(BaseModel): pydantic.Field(alias="type"), ] = "file_search_result" - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature"]) diff --git a/google/genai/_gaos/types/interactions/filesearchresultstep.py b/google/genai/_gaos/types/interactions/filesearchresultstep.py index a6a70ca4d..3ef747722 100644 --- a/google/genai/_gaos/types/interactions/filesearchresultstep.py +++ b/google/genai/_gaos/types/interactions/filesearchresultstep.py @@ -31,9 +31,9 @@ class FileSearchResultStepParam(TypedDict): call_id: str r"""Required. ID to match the ID from the function call block.""" - type: Literal["file_search_result"] signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" + type: Literal["file_search_result"] class FileSearchResultStep(BaseModel): @@ -42,6 +42,9 @@ class FileSearchResultStep(BaseModel): call_id: str r"""Required. ID to match the ID from the function call block.""" + signature: Optional[Base64EncodedString] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["file_search_result"], @@ -50,9 +53,6 @@ class FileSearchResultStep(BaseModel): pydantic.Field(alias="type"), ] = "file_search_result" - signature: Optional[Base64EncodedString] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature"]) diff --git a/google/genai/_gaos/types/interactions/filter_.py b/google/genai/_gaos/types/interactions/filter_.py index b74af3870..97c27018f 100644 --- a/google/genai/_gaos/types/interactions/filter_.py +++ b/google/genai/_gaos/types/interactions/filter_.py @@ -26,6 +26,8 @@ class FilterParam(TypedDict): r"""Config for filters.""" + metadata_filter: NotRequired[str] + r"""Optional. String for metadata filtering.""" vector_distance_threshold: NotRequired[float] r"""Optional. Only returns contexts with vector distance smaller than the threshold. @@ -34,13 +36,14 @@ class FilterParam(TypedDict): r"""Optional. Only returns contexts with vector similarity larger than the threshold. """ - metadata_filter: NotRequired[str] - r"""Optional. String for metadata filtering.""" class Filter(BaseModel): r"""Config for filters.""" + metadata_filter: Optional[str] = None + r"""Optional. String for metadata filtering.""" + vector_distance_threshold: Optional[float] = None r"""Optional. Only returns contexts with vector distance smaller than the threshold. @@ -51,16 +54,13 @@ class Filter(BaseModel): threshold. """ - metadata_filter: Optional[str] = None - r"""Optional. String for metadata filtering.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ + "metadata_filter", "vector_distance_threshold", "vector_similarity_threshold", - "metadata_filter", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/function.py b/google/genai/_gaos/types/interactions/function.py index ae6edcd23..83822c568 100644 --- a/google/genai/_gaos/types/interactions/function.py +++ b/google/genai/_gaos/types/interactions/function.py @@ -29,35 +29,35 @@ class FunctionParam(TypedDict): r"""A tool that can be used by the model.""" - type: Literal["function"] - name: NotRequired[str] - r"""The name of the function.""" description: NotRequired[str] r"""A description of the function.""" + name: NotRequired[str] + r"""The name of the function.""" parameters: NotRequired[Any] r"""The JSON Schema for the function's parameters.""" + type: Literal["function"] class Function(BaseModel): r"""A tool that can be used by the model.""" - type: Annotated[ - Annotated[Literal["function"], AfterValidator(validate_const("function"))], - pydantic.Field(alias="type"), - ] = "function" + description: Optional[str] = None + r"""A description of the function.""" name: Optional[str] = None r"""The name of the function.""" - description: Optional[str] = None - r"""A description of the function.""" - parameters: Optional[Any] = None r"""The JSON Schema for the function's parameters.""" + type: Annotated[ + Annotated[Literal["function"], AfterValidator(validate_const("function"))], + pydantic.Field(alias="type"), + ] = "function" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["name", "description", "parameters"]) + optional_fields = set(["description", "name", "parameters"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/functioncallstep.py b/google/genai/_gaos/types/interactions/functioncallstep.py index 8b0fda1e0..943051df0 100644 --- a/google/genai/_gaos/types/interactions/functioncallstep.py +++ b/google/genai/_gaos/types/interactions/functioncallstep.py @@ -28,27 +28,27 @@ class FunctionCallStepParam(TypedDict): r"""A function tool call step.""" - name: str - r"""Required. The name of the tool to call.""" arguments: Dict[str, Any] r"""Required. The arguments to pass to the function.""" id: str r"""Required. A unique ID for this specific tool call.""" + name: str + r"""Required. The name of the tool to call.""" type: Literal["function_call"] class FunctionCallStep(BaseModel): r"""A function tool call step.""" - name: str - r"""Required. The name of the tool to call.""" - arguments: Dict[str, Any] r"""Required. The arguments to pass to the function.""" id: str r"""Required. A unique ID for this specific tool call.""" + name: str + r"""Required. The name of the tool to call.""" + type: Annotated[ Annotated[ Literal["function_call"], AfterValidator(validate_const("function_call")) diff --git a/google/genai/_gaos/types/interactions/functionresultdelta.py b/google/genai/_gaos/types/interactions/functionresultdelta.py index 4a4db6f57..335357fbc 100644 --- a/google/genai/_gaos/types/interactions/functionresultdelta.py +++ b/google/genai/_gaos/types/interactions/functionresultdelta.py @@ -54,9 +54,9 @@ class FunctionResultDeltaTypedDict(TypedDict): call_id: str r"""Required. ID to match the ID from the function call block.""" result: FunctionResultDeltaResultUnionTypedDict - type: Literal["function_result"] - name: NotRequired[str] is_error: NotRequired[bool] + name: NotRequired[str] + type: Literal["function_result"] class FunctionResultDelta(BaseModel): @@ -65,6 +65,10 @@ class FunctionResultDelta(BaseModel): result: FunctionResultDeltaResultUnion + is_error: Optional[bool] = None + + name: Optional[str] = None + type: Annotated[ Annotated[ Literal["function_result"], @@ -73,13 +77,9 @@ class FunctionResultDelta(BaseModel): pydantic.Field(alias="type"), ] = "function_result" - name: Optional[str] = None - - is_error: Optional[bool] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["name", "is_error"]) + optional_fields = set(["is_error", "name"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/functionresultstep.py b/google/genai/_gaos/types/interactions/functionresultstep.py index 6660ed400..44065f005 100644 --- a/google/genai/_gaos/types/interactions/functionresultstep.py +++ b/google/genai/_gaos/types/interactions/functionresultstep.py @@ -59,11 +59,11 @@ class FunctionResultStepParam(TypedDict): r"""Required. ID to match the ID from the function call block.""" result: FunctionResultStepResultUnionParam r"""The result of the tool call.""" - type: Literal["function_result"] - name: NotRequired[str] - r"""The name of the tool that was called.""" is_error: NotRequired[bool] r"""Whether the tool call resulted in an error.""" + name: NotRequired[str] + r"""The name of the tool that was called.""" + type: Literal["function_result"] class FunctionResultStep(BaseModel): @@ -75,6 +75,12 @@ class FunctionResultStep(BaseModel): result: FunctionResultStepResultUnion r"""The result of the tool call.""" + is_error: Optional[bool] = None + r"""Whether the tool call resulted in an error.""" + + name: Optional[str] = None + r"""The name of the tool that was called.""" + type: Annotated[ Annotated[ Literal["function_result"], @@ -83,15 +89,9 @@ class FunctionResultStep(BaseModel): pydantic.Field(alias="type"), ] = "function_result" - name: Optional[str] = None - r"""The name of the tool that was called.""" - - is_error: Optional[bool] = None - r"""Whether the tool call resulted in an error.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["name", "is_error"]) + optional_fields = set(["is_error", "name"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/generationconfig.py b/google/genai/_gaos/types/interactions/generationconfig.py index 1d7c27738..902ab5d20 100644 --- a/google/genai/_gaos/types/interactions/generationconfig.py +++ b/google/genai/_gaos/types/interactions/generationconfig.py @@ -44,62 +44,46 @@ class GenerationConfigParam(TypedDict): r"""Configuration parameters for model interactions.""" - temperature: NotRequired[float] - r"""Controls the randomness of the output.""" - top_p: NotRequired[float] - r"""The maximum cumulative probability of tokens to consider when sampling.""" - seed: NotRequired[int] - r"""Seed used in decoding for reproducibility.""" - stop_sequences: NotRequired[List[str]] - r"""A list of character sequences that will stop output interaction.""" - thinking_level: NotRequired[ThinkingLevel] - thinking_summaries: NotRequired[ThinkingSummaries] - max_output_tokens: NotRequired[int] - r"""The maximum number of tokens to include in the response.""" - speech_config: NotRequired[List[SpeechConfigParam]] - r"""Configuration for speech interaction.""" + frequency_penalty: NotRequired[float] + r"""Penalizes tokens based on their frequency in the generated text. + A positive value helps to reduce the repetition of words and phrases. + Valid values can range from [-2.0, 2.0]. + """ image_config: NotRequired[ImageConfigParam] r"""The configuration for image interaction.""" - video_config: NotRequired[VideoConfigParam] - r"""Configuration options for video generation.""" + max_output_tokens: NotRequired[int] + r"""The maximum number of tokens to include in the response.""" presence_penalty: NotRequired[float] r"""Penalizes tokens that have already appeared in the generated text. A positive value encourages the model to generate more diverse and less repetitive text. Valid values can range from [-2.0, 2.0]. """ - frequency_penalty: NotRequired[float] - r"""Penalizes tokens based on their frequency in the generated text. - A positive value helps to reduce the repetition of words and phrases. - Valid values can range from [-2.0, 2.0]. - """ + seed: NotRequired[int] + r"""Seed used in decoding for reproducibility.""" + speech_config: NotRequired[List[SpeechConfigParam]] + r"""Configuration for speech interaction.""" + stop_sequences: NotRequired[List[str]] + r"""A list of character sequences that will stop output interaction.""" + temperature: NotRequired[float] + r"""Controls the randomness of the output.""" + thinking_level: NotRequired[ThinkingLevel] + thinking_summaries: NotRequired[ThinkingSummaries] tool_choice: NotRequired[ToolChoiceParam] r"""The tool choice configuration.""" + top_p: NotRequired[float] + r"""The maximum cumulative probability of tokens to consider when sampling.""" + video_config: NotRequired[VideoConfigParam] + r"""Configuration options for video generation.""" class GenerationConfig(BaseModel): r"""Configuration parameters for model interactions.""" - temperature: Optional[float] = None - r"""Controls the randomness of the output.""" - - top_p: Optional[float] = None - r"""The maximum cumulative probability of tokens to consider when sampling.""" - - seed: Optional[int] = None - r"""Seed used in decoding for reproducibility.""" - - stop_sequences: Optional[List[str]] = None - r"""A list of character sequences that will stop output interaction.""" - - thinking_level: Optional[ThinkingLevel] = None - - thinking_summaries: Optional[ThinkingSummaries] = None - - max_output_tokens: Optional[int] = None - r"""The maximum number of tokens to include in the response.""" - - speech_config: Optional[List[SpeechConfig]] = None - r"""Configuration for speech interaction.""" + frequency_penalty: Optional[float] = None + r"""Penalizes tokens based on their frequency in the generated text. + A positive value helps to reduce the repetition of words and phrases. + Valid values can range from [-2.0, 2.0]. + """ image_config: Annotated[ Optional[ImageConfig], @@ -109,8 +93,8 @@ class GenerationConfig(BaseModel): ] = None r"""The configuration for image interaction.""" - video_config: Optional[VideoConfig] = None - r"""Configuration options for video generation.""" + max_output_tokens: Optional[int] = None + r"""The maximum number of tokens to include in the response.""" presence_penalty: Optional[float] = None r"""Penalizes tokens that have already appeared in the generated @@ -118,32 +102,48 @@ class GenerationConfig(BaseModel): less repetitive text. Valid values can range from [-2.0, 2.0]. """ - frequency_penalty: Optional[float] = None - r"""Penalizes tokens based on their frequency in the generated text. - A positive value helps to reduce the repetition of words and phrases. - Valid values can range from [-2.0, 2.0]. - """ + seed: Optional[int] = None + r"""Seed used in decoding for reproducibility.""" + + speech_config: Optional[List[SpeechConfig]] = None + r"""Configuration for speech interaction.""" + + stop_sequences: Optional[List[str]] = None + r"""A list of character sequences that will stop output interaction.""" + + temperature: Optional[float] = None + r"""Controls the randomness of the output.""" + + thinking_level: Optional[ThinkingLevel] = None + + thinking_summaries: Optional[ThinkingSummaries] = None tool_choice: Optional[ToolChoice] = None r"""The tool choice configuration.""" + top_p: Optional[float] = None + r"""The maximum cumulative probability of tokens to consider when sampling.""" + + video_config: Optional[VideoConfig] = None + r"""Configuration options for video generation.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ - "temperature", - "top_p", + "frequency_penalty", + "image_config", + "max_output_tokens", + "presence_penalty", "seed", + "speech_config", "stop_sequences", + "temperature", "thinking_level", "thinking_summaries", - "max_output_tokens", - "speech_config", - "image_config", - "video_config", - "presence_penalty", - "frequency_penalty", "tool_choice", + "top_p", + "video_config", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/googlemaps.py b/google/genai/_gaos/types/interactions/googlemaps.py index b4a70e844..0204c5e32 100644 --- a/google/genai/_gaos/types/interactions/googlemaps.py +++ b/google/genai/_gaos/types/interactions/googlemaps.py @@ -29,7 +29,6 @@ class GoogleMapsParam(TypedDict): r"""A tool that can be used by the model to call Google Maps.""" - type: Literal["google_maps"] enable_widget: NotRequired[bool] r"""Whether to return a widget context token in the tool call result of the response. @@ -38,18 +37,12 @@ class GoogleMapsParam(TypedDict): r"""The latitude of the user's location.""" longitude: NotRequired[float] r"""The longitude of the user's location.""" + type: Literal["google_maps"] class GoogleMaps(BaseModel): r"""A tool that can be used by the model to call Google Maps.""" - type: Annotated[ - Annotated[ - Literal["google_maps"], AfterValidator(validate_const("google_maps")) - ], - pydantic.Field(alias="type"), - ] = "google_maps" - enable_widget: Optional[bool] = None r"""Whether to return a widget context token in the tool call result of the response. @@ -61,6 +54,13 @@ class GoogleMaps(BaseModel): longitude: Optional[float] = None r"""The longitude of the user's location.""" + type: Annotated[ + Annotated[ + Literal["google_maps"], AfterValidator(validate_const("google_maps")) + ], + pydantic.Field(alias="type"), + ] = "google_maps" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["enable_widget", "latitude", "longitude"]) diff --git a/google/genai/_gaos/types/interactions/googlemapscalldelta.py b/google/genai/_gaos/types/interactions/googlemapscalldelta.py index 02484ee1f..56f5c3cf8 100644 --- a/google/genai/_gaos/types/interactions/googlemapscalldelta.py +++ b/google/genai/_gaos/types/interactions/googlemapscalldelta.py @@ -31,14 +31,20 @@ class GoogleMapsCallDeltaTypedDict(TypedDict): - type: Literal["google_maps_call"] arguments: NotRequired[GoogleMapsCallArgumentsParam] r"""The arguments to pass to the Google Maps tool.""" signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["google_maps_call"] class GoogleMapsCallDelta(BaseModel): + arguments: Optional[GoogleMapsCallArguments] = None + r"""The arguments to pass to the Google Maps tool.""" + + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["google_maps_call"], @@ -47,12 +53,6 @@ class GoogleMapsCallDelta(BaseModel): pydantic.Field(alias="type"), ] = "google_maps_call" - arguments: Optional[GoogleMapsCallArguments] = None - r"""The arguments to pass to the Google Maps tool.""" - - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["arguments", "signature"]) diff --git a/google/genai/_gaos/types/interactions/googlemapscallstep.py b/google/genai/_gaos/types/interactions/googlemapscallstep.py index 8003f3c9a..b00c3fa8e 100644 --- a/google/genai/_gaos/types/interactions/googlemapscallstep.py +++ b/google/genai/_gaos/types/interactions/googlemapscallstep.py @@ -35,11 +35,11 @@ class GoogleMapsCallStepParam(TypedDict): id: str r"""Required. A unique ID for this specific tool call.""" - type: Literal["google_maps_call"] arguments: NotRequired[GoogleMapsCallArgumentsParam] r"""The arguments to pass to the Google Maps tool.""" signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" + type: Literal["google_maps_call"] class GoogleMapsCallStep(BaseModel): @@ -48,6 +48,12 @@ class GoogleMapsCallStep(BaseModel): id: str r"""Required. A unique ID for this specific tool call.""" + arguments: Optional[GoogleMapsCallArguments] = None + r"""The arguments to pass to the Google Maps tool.""" + + signature: Optional[Base64EncodedString] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["google_maps_call"], @@ -56,12 +62,6 @@ class GoogleMapsCallStep(BaseModel): pydantic.Field(alias="type"), ] = "google_maps_call" - arguments: Optional[GoogleMapsCallArguments] = None - r"""The arguments to pass to the Google Maps tool.""" - - signature: Optional[Base64EncodedString] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["arguments", "signature"]) diff --git a/google/genai/_gaos/types/interactions/googlemapsresultdelta.py b/google/genai/_gaos/types/interactions/googlemapsresultdelta.py index edc7d7bf2..b5b38f4d8 100644 --- a/google/genai/_gaos/types/interactions/googlemapsresultdelta.py +++ b/google/genai/_gaos/types/interactions/googlemapsresultdelta.py @@ -28,14 +28,20 @@ class GoogleMapsResultDeltaTypedDict(TypedDict): - type: Literal["google_maps_result"] result: NotRequired[List[GoogleMapsResultParam]] r"""The results of the Google Maps.""" signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["google_maps_result"] class GoogleMapsResultDelta(BaseModel): + result: Optional[List[GoogleMapsResult]] = None + r"""The results of the Google Maps.""" + + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["google_maps_result"], @@ -44,12 +50,6 @@ class GoogleMapsResultDelta(BaseModel): pydantic.Field(alias="type"), ] = "google_maps_result" - result: Optional[List[GoogleMapsResult]] = None - r"""The results of the Google Maps.""" - - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["result", "signature"]) diff --git a/google/genai/_gaos/types/interactions/googlemapsresultplaces.py b/google/genai/_gaos/types/interactions/googlemapsresultplaces.py index 981e430b9..431389abf 100644 --- a/google/genai/_gaos/types/interactions/googlemapsresultplaces.py +++ b/google/genai/_gaos/types/interactions/googlemapsresultplaces.py @@ -25,24 +25,24 @@ class GoogleMapsResultPlacesParam(TypedDict): - place_id: NotRequired[str] name: NotRequired[str] - url: NotRequired[str] + place_id: NotRequired[str] review_snippets: NotRequired[List[ReviewSnippetParam]] + url: NotRequired[str] class GoogleMapsResultPlaces(BaseModel): - place_id: Optional[str] = None - name: Optional[str] = None - url: Optional[str] = None + place_id: Optional[str] = None review_snippets: Optional[List[ReviewSnippet]] = None + url: Optional[str] = None + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["place_id", "name", "url", "review_snippets"]) + optional_fields = set(["name", "place_id", "review_snippets", "url"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/googlemapsresultstep.py b/google/genai/_gaos/types/interactions/googlemapsresultstep.py index 1617a82c0..7029f5c8f 100644 --- a/google/genai/_gaos/types/interactions/googlemapsresultstep.py +++ b/google/genai/_gaos/types/interactions/googlemapsresultstep.py @@ -30,22 +30,25 @@ class GoogleMapsResultStepParam(TypedDict): r"""Google Maps result step.""" - result: List[GoogleMapsResultParam] call_id: str r"""Required. ID to match the ID from the function call block.""" - type: Literal["google_maps_result"] + result: List[GoogleMapsResultParam] signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" + type: Literal["google_maps_result"] class GoogleMapsResultStep(BaseModel): r"""Google Maps result step.""" - result: List[GoogleMapsResult] - call_id: str r"""Required. ID to match the ID from the function call block.""" + result: List[GoogleMapsResult] + + signature: Optional[Base64EncodedString] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["google_maps_result"], @@ -54,9 +57,6 @@ class GoogleMapsResultStep(BaseModel): pydantic.Field(alias="type"), ] = "google_maps_result" - signature: Optional[Base64EncodedString] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature"]) diff --git a/google/genai/_gaos/types/interactions/googlesearch.py b/google/genai/_gaos/types/interactions/googlesearch.py index 31cdd8e23..a9c6ebd22 100644 --- a/google/genai/_gaos/types/interactions/googlesearch.py +++ b/google/genai/_gaos/types/interactions/googlesearch.py @@ -39,14 +39,17 @@ class GoogleSearchParam(TypedDict): r"""A tool that can be used by the model to search Google.""" - type: Literal["google_search"] search_types: NotRequired[List[GoogleSearchSearchType]] r"""The types of search grounding to enable.""" + type: Literal["google_search"] class GoogleSearch(BaseModel): r"""A tool that can be used by the model to search Google.""" + search_types: Optional[List[GoogleSearchSearchType]] = None + r"""The types of search grounding to enable.""" + type: Annotated[ Annotated[ Literal["google_search"], AfterValidator(validate_const("google_search")) @@ -54,9 +57,6 @@ class GoogleSearch(BaseModel): pydantic.Field(alias="type"), ] = "google_search" - search_types: Optional[List[GoogleSearchSearchType]] = None - r"""The types of search grounding to enable.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["search_types"]) diff --git a/google/genai/_gaos/types/interactions/googlesearchcalldelta.py b/google/genai/_gaos/types/interactions/googlesearchcalldelta.py index 44b54601c..816d20c8a 100644 --- a/google/genai/_gaos/types/interactions/googlesearchcalldelta.py +++ b/google/genai/_gaos/types/interactions/googlesearchcalldelta.py @@ -33,15 +33,18 @@ class GoogleSearchCallDeltaTypedDict(TypedDict): arguments: GoogleSearchCallArgumentsParam r"""The arguments to pass to Google Search.""" - type: Literal["google_search_call"] signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["google_search_call"] class GoogleSearchCallDelta(BaseModel): arguments: GoogleSearchCallArguments r"""The arguments to pass to Google Search.""" + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["google_search_call"], @@ -50,9 +53,6 @@ class GoogleSearchCallDelta(BaseModel): pydantic.Field(alias="type"), ] = "google_search_call" - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature"]) diff --git a/google/genai/_gaos/types/interactions/googlesearchcallstep.py b/google/genai/_gaos/types/interactions/googlesearchcallstep.py index 98a3c7348..1eaee5b1b 100644 --- a/google/genai/_gaos/types/interactions/googlesearchcallstep.py +++ b/google/genai/_gaos/types/interactions/googlesearchcallstep.py @@ -54,11 +54,11 @@ class GoogleSearchCallStepParam(TypedDict): r"""The arguments to pass to Google Search.""" id: str r"""Required. A unique ID for this specific tool call.""" - type: Literal["google_search_call"] search_type: NotRequired[GoogleSearchCallStepSearchType] r"""The type of search grounding enabled.""" signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" + type: Literal["google_search_call"] class GoogleSearchCallStep(BaseModel): @@ -70,6 +70,12 @@ class GoogleSearchCallStep(BaseModel): id: str r"""Required. A unique ID for this specific tool call.""" + search_type: Optional[GoogleSearchCallStepSearchType] = None + r"""The type of search grounding enabled.""" + + signature: Optional[Base64EncodedString] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["google_search_call"], @@ -78,12 +84,6 @@ class GoogleSearchCallStep(BaseModel): pydantic.Field(alias="type"), ] = "google_search_call" - search_type: Optional[GoogleSearchCallStepSearchType] = None - r"""The type of search grounding enabled.""" - - signature: Optional[Base64EncodedString] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["search_type", "signature"]) diff --git a/google/genai/_gaos/types/interactions/googlesearchresultdelta.py b/google/genai/_gaos/types/interactions/googlesearchresultdelta.py index 515a19932..1f88b3957 100644 --- a/google/genai/_gaos/types/interactions/googlesearchresultdelta.py +++ b/google/genai/_gaos/types/interactions/googlesearchresultdelta.py @@ -29,15 +29,20 @@ class GoogleSearchResultDeltaTypedDict(TypedDict): result: List[GoogleSearchResultParam] - type: Literal["google_search_result"] is_error: NotRequired[bool] signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["google_search_result"] class GoogleSearchResultDelta(BaseModel): result: List[GoogleSearchResult] + is_error: Optional[bool] = None + + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["google_search_result"], @@ -46,11 +51,6 @@ class GoogleSearchResultDelta(BaseModel): pydantic.Field(alias="type"), ] = "google_search_result" - is_error: Optional[bool] = None - - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["is_error", "signature"]) diff --git a/google/genai/_gaos/types/interactions/googlesearchresultstep.py b/google/genai/_gaos/types/interactions/googlesearchresultstep.py index 37d9526e2..45bf0fab5 100644 --- a/google/genai/_gaos/types/interactions/googlesearchresultstep.py +++ b/google/genai/_gaos/types/interactions/googlesearchresultstep.py @@ -30,25 +30,31 @@ class GoogleSearchResultStepParam(TypedDict): r"""Google Search result step.""" - result: List[GoogleSearchResultParam] - r"""Required. The results of the Google Search.""" call_id: str r"""Required. ID to match the ID from the function call block.""" - type: Literal["google_search_result"] + result: List[GoogleSearchResultParam] + r"""Required. The results of the Google Search.""" is_error: NotRequired[bool] r"""Whether the Google Search resulted in an error.""" signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" + type: Literal["google_search_result"] class GoogleSearchResultStep(BaseModel): r"""Google Search result step.""" + call_id: str + r"""Required. ID to match the ID from the function call block.""" + result: List[GoogleSearchResult] r"""Required. The results of the Google Search.""" - call_id: str - r"""Required. ID to match the ID from the function call block.""" + is_error: Optional[bool] = None + r"""Whether the Google Search resulted in an error.""" + + signature: Optional[Base64EncodedString] = None + r"""A signature hash for backend validation.""" type: Annotated[ Annotated[ @@ -58,12 +64,6 @@ class GoogleSearchResultStep(BaseModel): pydantic.Field(alias="type"), ] = "google_search_result" - is_error: Optional[bool] = None - r"""Whether the Google Search resulted in an error.""" - - signature: Optional[Base64EncodedString] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["is_error", "signature"]) diff --git a/google/genai/_gaos/types/interactions/groundingtoolcount.py b/google/genai/_gaos/types/interactions/groundingtoolcount.py index 98a03347d..83193b2f9 100644 --- a/google/genai/_gaos/types/interactions/groundingtoolcount.py +++ b/google/genai/_gaos/types/interactions/groundingtoolcount.py @@ -37,24 +37,24 @@ class GroundingToolCountTypedDict(TypedDict): r"""The number of grounding tool counts.""" - type: NotRequired[GroundingToolCountType] - r"""The grounding tool type associated with the count.""" count: NotRequired[int] r"""The number of grounding tool counts.""" + type: NotRequired[GroundingToolCountType] + r"""The grounding tool type associated with the count.""" class GroundingToolCount(BaseModel): r"""The number of grounding tool counts.""" - type: Optional[GroundingToolCountType] = None - r"""The grounding tool type associated with the count.""" - count: Optional[int] = None r"""The number of grounding tool counts.""" + type: Optional[GroundingToolCountType] = None + r"""The grounding tool type associated with the count.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["type", "count"]) + optional_fields = set(["count", "type"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/imagecontent.py b/google/genai/_gaos/types/interactions/imagecontent.py index 070a7f699..2e40535ac 100644 --- a/google/genai/_gaos/types/interactions/imagecontent.py +++ b/google/genai/_gaos/types/interactions/imagecontent.py @@ -52,38 +52,38 @@ class ImageContentParam(TypedDict): r"""An image content block.""" - type: Literal["image"] data: NotRequired[Union[str, Base64FileInput]] r"""The image content.""" - uri: NotRequired[str] - r"""The URI of the image.""" mime_type: NotRequired[ImageContentMimeType] r"""The mime type of the image.""" resolution: NotRequired[MediaResolution] + type: Literal["image"] + uri: NotRequired[str] + r"""The URI of the image.""" class ImageContent(BaseModel): r"""An image content block.""" - type: Annotated[ - Annotated[Literal["image"], AfterValidator(validate_const("image"))], - pydantic.Field(alias="type"), - ] = "image" - data: Optional[Base64EncodedString] = None r"""The image content.""" - uri: Optional[str] = None - r"""The URI of the image.""" - mime_type: Optional[ImageContentMimeType] = None r"""The mime type of the image.""" resolution: Optional[MediaResolution] = None + type: Annotated[ + Annotated[Literal["image"], AfterValidator(validate_const("image"))], + pydantic.Field(alias="type"), + ] = "image" + + uri: Optional[str] = None + r"""The URI of the image.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["data", "uri", "mime_type", "resolution"]) + optional_fields = set(["data", "mime_type", "resolution", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/imagedelta.py b/google/genai/_gaos/types/interactions/imagedelta.py index b230dccaf..4e3780ac9 100644 --- a/google/genai/_gaos/types/interactions/imagedelta.py +++ b/google/genai/_gaos/types/interactions/imagedelta.py @@ -43,30 +43,30 @@ class ImageDeltaTypedDict(TypedDict): - type: Literal["image"] data: NotRequired[str] - uri: NotRequired[str] mime_type: NotRequired[ImageDeltaMimeType] resolution: NotRequired[MediaResolution] + type: Literal["image"] + uri: NotRequired[str] class ImageDelta(BaseModel): + data: Optional[str] = None + + mime_type: Optional[ImageDeltaMimeType] = None + + resolution: Optional[MediaResolution] = None + type: Annotated[ Annotated[Literal["image"], AfterValidator(validate_const("image"))], pydantic.Field(alias="type"), ] = "image" - data: Optional[str] = None - uri: Optional[str] = None - mime_type: Optional[ImageDeltaMimeType] = None - - resolution: Optional[MediaResolution] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["data", "uri", "mime_type", "resolution"]) + optional_fields = set(["data", "mime_type", "resolution", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/imageresponseformat.py b/google/genai/_gaos/types/interactions/imageresponseformat.py index 55d5e440a..fecca31e0 100644 --- a/google/genai/_gaos/types/interactions/imageresponseformat.py +++ b/google/genai/_gaos/types/interactions/imageresponseformat.py @@ -26,20 +26,6 @@ from typing_extensions import Annotated, NotRequired, TypedDict -ImageResponseFormatMimeType = Literal["image/jpeg",] -r"""The MIME type of the image output.""" - - -ImageResponseFormatDelivery = Union[ - Literal[ - "inline", - "uri", - ], - UnrecognizedStr, -] -r"""The delivery mode for the image output.""" - - ImageResponseFormatAspectRatio = Union[ Literal[ "1:1", @@ -62,6 +48,16 @@ r"""The aspect ratio for the image output.""" +ImageResponseFormatDelivery = Union[ + Literal[ + "inline", + "uri", + ], + UnrecognizedStr, +] +r"""The delivery mode for the image output.""" + + ImageResponseFormatImageSize = Union[ Literal[ "512", @@ -74,43 +70,47 @@ r"""The size of the image output.""" +ImageResponseFormatMimeType = Literal["image/jpeg",] +r"""The MIME type of the image output.""" + + class ImageResponseFormatParam(TypedDict): r"""Configuration for image output format.""" - type: Literal["image"] - mime_type: NotRequired[ImageResponseFormatMimeType] - r"""The MIME type of the image output.""" - delivery: NotRequired[ImageResponseFormatDelivery] - r"""The delivery mode for the image output.""" aspect_ratio: NotRequired[ImageResponseFormatAspectRatio] r"""The aspect ratio for the image output.""" + delivery: NotRequired[ImageResponseFormatDelivery] + r"""The delivery mode for the image output.""" image_size: NotRequired[ImageResponseFormatImageSize] r"""The size of the image output.""" + mime_type: NotRequired[ImageResponseFormatMimeType] + r"""The MIME type of the image output.""" + type: Literal["image"] class ImageResponseFormat(BaseModel): r"""Configuration for image output format.""" - type: Annotated[ - Annotated[Literal["image"], AfterValidator(validate_const("image"))], - pydantic.Field(alias="type"), - ] = "image" - - mime_type: Optional[ImageResponseFormatMimeType] = None - r"""The MIME type of the image output.""" + aspect_ratio: Optional[ImageResponseFormatAspectRatio] = None + r"""The aspect ratio for the image output.""" delivery: Optional[ImageResponseFormatDelivery] = None r"""The delivery mode for the image output.""" - aspect_ratio: Optional[ImageResponseFormatAspectRatio] = None - r"""The aspect ratio for the image output.""" - image_size: Optional[ImageResponseFormatImageSize] = None r"""The size of the image output.""" + mime_type: Optional[ImageResponseFormatMimeType] = None + r"""The MIME type of the image output.""" + + type: Annotated[ + Annotated[Literal["image"], AfterValidator(validate_const("image"))], + pydantic.Field(alias="type"), + ] = "image" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["mime_type", "delivery", "aspect_ratio", "image_size"]) + optional_fields = set(["aspect_ratio", "delivery", "image_size", "mime_type"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/interactionstatusupdate.py b/google/genai/_gaos/types/interactions/interactionstatusupdate.py index 2df40570e..4fbe36f72 100644 --- a/google/genai/_gaos/types/interactions/interactionstatusupdate.py +++ b/google/genai/_gaos/types/interactions/interactionstatusupdate.py @@ -44,11 +44,11 @@ class InteractionStatusUpdateTypedDict(TypedDict): interaction_id: str status: InteractionStatusUpdateStatus - event_type: Literal["interaction.status_update"] event_id: NotRequired[str] r"""The event_id token to be used to resume the interaction stream, from this event. """ + event_type: Literal["interaction.status_update"] metadata: NotRequired[StreamMetadataTypedDict] @@ -57,6 +57,11 @@ class InteractionStatusUpdate(BaseModel): status: InteractionStatusUpdateStatus + event_id: Optional[str] = None + r"""The event_id token to be used to resume the interaction stream, from + this event. + """ + event_type: Annotated[ Annotated[ Literal["interaction.status_update"], @@ -65,11 +70,6 @@ class InteractionStatusUpdate(BaseModel): pydantic.Field(alias="event_type"), ] = "interaction.status_update" - event_id: Optional[str] = None - r"""The event_id token to be used to resume the interaction stream, from - this event. - """ - metadata: Optional[StreamMetadata] = None @model_serializer(mode="wrap") diff --git a/google/genai/_gaos/types/interactions/mcpserver.py b/google/genai/_gaos/types/interactions/mcpserver.py index d9650d0d2..b1f0c9722 100644 --- a/google/genai/_gaos/types/interactions/mcpserver.py +++ b/google/genai/_gaos/types/interactions/mcpserver.py @@ -30,44 +30,44 @@ class MCPServerParam(TypedDict): r"""A MCPServer is a server that can be called by the model to perform actions.""" - type: Literal["mcp_server"] + allowed_tools: NotRequired[List[AllowedToolsParam]] + r"""The allowed tools.""" + headers: NotRequired[Dict[str, str]] + r"""Optional: Fields for authentication headers, timeouts, etc., if needed.""" name: NotRequired[str] r"""The name of the MCPServer.""" + type: Literal["mcp_server"] url: NotRequired[str] r"""The full URL for the MCPServer endpoint. Example: \"https://api.example.com/mcp\" """ - headers: NotRequired[Dict[str, str]] - r"""Optional: Fields for authentication headers, timeouts, etc., if needed.""" - allowed_tools: NotRequired[List[AllowedToolsParam]] - r"""The allowed tools.""" class MCPServer(BaseModel): r"""A MCPServer is a server that can be called by the model to perform actions.""" + allowed_tools: Optional[List[AllowedTools]] = None + r"""The allowed tools.""" + + headers: Optional[Dict[str, str]] = None + r"""Optional: Fields for authentication headers, timeouts, etc., if needed.""" + + name: Optional[str] = None + r"""The name of the MCPServer.""" + type: Annotated[ Annotated[Literal["mcp_server"], AfterValidator(validate_const("mcp_server"))], pydantic.Field(alias="type"), ] = "mcp_server" - name: Optional[str] = None - r"""The name of the MCPServer.""" - url: Optional[str] = None r"""The full URL for the MCPServer endpoint. Example: \"https://api.example.com/mcp\" """ - headers: Optional[Dict[str, str]] = None - r"""Optional: Fields for authentication headers, timeouts, etc., if needed.""" - - allowed_tools: Optional[List[AllowedTools]] = None - r"""The allowed tools.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["name", "url", "headers", "allowed_tools"]) + optional_fields = set(["allowed_tools", "headers", "name", "url"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/mcpservertoolcalldelta.py b/google/genai/_gaos/types/interactions/mcpservertoolcalldelta.py index b866f80fa..33c3c3ddf 100644 --- a/google/genai/_gaos/types/interactions/mcpservertoolcalldelta.py +++ b/google/genai/_gaos/types/interactions/mcpservertoolcalldelta.py @@ -26,19 +26,19 @@ class MCPServerToolCallDeltaTypedDict(TypedDict): + arguments: Dict[str, Any] name: str server_name: str - arguments: Dict[str, Any] type: Literal["mcp_server_tool_call"] class MCPServerToolCallDelta(BaseModel): + arguments: Dict[str, Any] + name: str server_name: str - arguments: Dict[str, Any] - type: Annotated[ Annotated[ Literal["mcp_server_tool_call"], diff --git a/google/genai/_gaos/types/interactions/mcpservertoolcallstep.py b/google/genai/_gaos/types/interactions/mcpservertoolcallstep.py index 6c889ef12..20b064f00 100644 --- a/google/genai/_gaos/types/interactions/mcpservertoolcallstep.py +++ b/google/genai/_gaos/types/interactions/mcpservertoolcallstep.py @@ -28,32 +28,32 @@ class MCPServerToolCallStepParam(TypedDict): r"""MCPServer tool call step.""" - name: str - r"""Required. The name of the tool which was called.""" - server_name: str - r"""Required. The name of the used MCP server.""" arguments: Dict[str, Any] r"""Required. The JSON object of arguments for the function.""" id: str r"""Required. A unique ID for this specific tool call.""" + name: str + r"""Required. The name of the tool which was called.""" + server_name: str + r"""Required. The name of the used MCP server.""" type: Literal["mcp_server_tool_call"] class MCPServerToolCallStep(BaseModel): r"""MCPServer tool call step.""" - name: str - r"""Required. The name of the tool which was called.""" - - server_name: str - r"""Required. The name of the used MCP server.""" - arguments: Dict[str, Any] r"""Required. The JSON object of arguments for the function.""" id: str r"""Required. A unique ID for this specific tool call.""" + name: str + r"""Required. The name of the tool which was called.""" + + server_name: str + r"""Required. The name of the used MCP server.""" + type: Annotated[ Annotated[ Literal["mcp_server_tool_call"], diff --git a/google/genai/_gaos/types/interactions/mcpservertoolresultdelta.py b/google/genai/_gaos/types/interactions/mcpservertoolresultdelta.py index 454622dec..662f5da7e 100644 --- a/google/genai/_gaos/types/interactions/mcpservertoolresultdelta.py +++ b/google/genai/_gaos/types/interactions/mcpservertoolresultdelta.py @@ -56,14 +56,18 @@ class MCPServerToolResultDeltaResult(BaseModel): class MCPServerToolResultDeltaTypedDict(TypedDict): result: MCPServerToolResultDeltaResultUnionTypedDict - type: Literal["mcp_server_tool_result"] name: NotRequired[str] server_name: NotRequired[str] + type: Literal["mcp_server_tool_result"] class MCPServerToolResultDelta(BaseModel): result: MCPServerToolResultDeltaResultUnion + name: Optional[str] = None + + server_name: Optional[str] = None + type: Annotated[ Annotated[ Literal["mcp_server_tool_result"], @@ -72,10 +76,6 @@ class MCPServerToolResultDelta(BaseModel): pydantic.Field(alias="type"), ] = "mcp_server_tool_result" - name: Optional[str] = None - - server_name: Optional[str] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["name", "server_name"]) diff --git a/google/genai/_gaos/types/interactions/mcpservertoolresultstep.py b/google/genai/_gaos/types/interactions/mcpservertoolresultstep.py index 3eec383bc..3ab371a55 100644 --- a/google/genai/_gaos/types/interactions/mcpservertoolresultstep.py +++ b/google/genai/_gaos/types/interactions/mcpservertoolresultstep.py @@ -59,11 +59,11 @@ class MCPServerToolResultStepParam(TypedDict): r"""Required. ID to match the ID from the function call block.""" result: MCPServerToolResultStepResultUnionParam r"""The output from the MCP server call. Can be simple text or rich content.""" - type: Literal["mcp_server_tool_result"] name: NotRequired[str] r"""Name of the tool which is called for this specific tool call.""" server_name: NotRequired[str] r"""The name of the used MCP server.""" + type: Literal["mcp_server_tool_result"] class MCPServerToolResultStep(BaseModel): @@ -75,6 +75,12 @@ class MCPServerToolResultStep(BaseModel): result: MCPServerToolResultStepResultUnion r"""The output from the MCP server call. Can be simple text or rich content.""" + name: Optional[str] = None + r"""Name of the tool which is called for this specific tool call.""" + + server_name: Optional[str] = None + r"""The name of the used MCP server.""" + type: Annotated[ Annotated[ Literal["mcp_server_tool_result"], @@ -83,12 +89,6 @@ class MCPServerToolResultStep(BaseModel): pydantic.Field(alias="type"), ] = "mcp_server_tool_result" - name: Optional[str] = None - r"""Name of the tool which is called for this specific tool call.""" - - server_name: Optional[str] = None - r"""The name of the used MCP server.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["name", "server_name"]) diff --git a/google/genai/_gaos/types/interactions/modeloutputstep.py b/google/genai/_gaos/types/interactions/modeloutputstep.py index 094c308eb..48efaed17 100644 --- a/google/genai/_gaos/types/interactions/modeloutputstep.py +++ b/google/genai/_gaos/types/interactions/modeloutputstep.py @@ -31,7 +31,6 @@ class ModelOutputStepParam(TypedDict): r"""Output generated by the model.""" - type: Literal["model_output"] content: NotRequired[List[ContentParam]] error: NotRequired[StatusParam] r"""The `Status` type defines a logical error model that is suitable for @@ -42,18 +41,12 @@ class ModelOutputStepParam(TypedDict): You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). """ + type: Literal["model_output"] class ModelOutputStep(BaseModel): r"""Output generated by the model.""" - type: Annotated[ - Annotated[ - Literal["model_output"], AfterValidator(validate_const("model_output")) - ], - pydantic.Field(alias="type"), - ] = "model_output" - content: Optional[List[Content]] = None error: Optional[Status] = None @@ -66,6 +59,13 @@ class ModelOutputStep(BaseModel): [API Design Guide](https://cloud.google.com/apis/design/errors). """ + type: Annotated[ + Annotated[ + Literal["model_output"], AfterValidator(validate_const("model_output")) + ], + pydantic.Field(alias="type"), + ] = "model_output" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["content", "error"]) diff --git a/google/genai/_gaos/types/interactions/placecitation.py b/google/genai/_gaos/types/interactions/placecitation.py index ddbf084d8..4d28b771b 100644 --- a/google/genai/_gaos/types/interactions/placecitation.py +++ b/google/genai/_gaos/types/interactions/placecitation.py @@ -30,13 +30,12 @@ class PlaceCitationParam(TypedDict): r"""A place citation annotation.""" - type: Literal["place_citation"] - place_id: NotRequired[str] - r"""The ID of the place, in `places/{place_id}` format.""" + end_index: NotRequired[int] + r"""End of the attributed segment, exclusive.""" name: NotRequired[str] r"""Title of the place.""" - url: NotRequired[str] - r"""URI reference of the place.""" + place_id: NotRequired[str] + r"""The ID of the place, in `places/{place_id}` format.""" review_snippets: NotRequired[List[ReviewSnippetParam]] r"""Snippets of reviews that are used to generate answers about the features of a given place in Google Maps. @@ -46,28 +45,22 @@ class PlaceCitationParam(TypedDict): Index indicates the start of the segment, measured in bytes. """ - end_index: NotRequired[int] - r"""End of the attributed segment, exclusive.""" + type: Literal["place_citation"] + url: NotRequired[str] + r"""URI reference of the place.""" class PlaceCitation(BaseModel): r"""A place citation annotation.""" - type: Annotated[ - Annotated[ - Literal["place_citation"], AfterValidator(validate_const("place_citation")) - ], - pydantic.Field(alias="type"), - ] = "place_citation" - - place_id: Optional[str] = None - r"""The ID of the place, in `places/{place_id}` format.""" + end_index: Optional[int] = None + r"""End of the attributed segment, exclusive.""" name: Optional[str] = None r"""Title of the place.""" - url: Optional[str] = None - r"""URI reference of the place.""" + place_id: Optional[str] = None + r"""The ID of the place, in `places/{place_id}` format.""" review_snippets: Optional[List[ReviewSnippet]] = None r"""Snippets of reviews that are used to generate answers about the @@ -80,13 +73,20 @@ class PlaceCitation(BaseModel): Index indicates the start of the segment, measured in bytes. """ - end_index: Optional[int] = None - r"""End of the attributed segment, exclusive.""" + type: Annotated[ + Annotated[ + Literal["place_citation"], AfterValidator(validate_const("place_citation")) + ], + pydantic.Field(alias="type"), + ] = "place_citation" + + url: Optional[str] = None + r"""URI reference of the place.""" @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( - ["place_id", "name", "url", "review_snippets", "start_index", "end_index"] + ["end_index", "name", "place_id", "review_snippets", "start_index", "url"] ) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/ragretrievalconfig.py b/google/genai/_gaos/types/interactions/ragretrievalconfig.py index 2f6e68c5a..cbeb45e55 100644 --- a/google/genai/_gaos/types/interactions/ragretrievalconfig.py +++ b/google/genai/_gaos/types/interactions/ragretrievalconfig.py @@ -30,34 +30,34 @@ class RagRetrievalConfigParam(TypedDict): r"""Specifies the context retrieval config.""" - top_k: NotRequired[int] - r"""Optional. The number of contexts to retrieve.""" - hybrid_search: NotRequired[HybridSearchParam] - r"""Config for Hybrid Search.""" filter_: NotRequired[FilterParam] r"""Config for filters.""" + hybrid_search: NotRequired[HybridSearchParam] + r"""Config for Hybrid Search.""" ranking: NotRequired[RankingParam] r"""Config for Rank Service.""" + top_k: NotRequired[int] + r"""Optional. The number of contexts to retrieve.""" class RagRetrievalConfig(BaseModel): r"""Specifies the context retrieval config.""" - top_k: Optional[int] = None - r"""Optional. The number of contexts to retrieve.""" + filter_: Annotated[Optional[Filter], pydantic.Field(alias="filter")] = None + r"""Config for filters.""" hybrid_search: Optional[HybridSearch] = None r"""Config for Hybrid Search.""" - filter_: Annotated[Optional[Filter], pydantic.Field(alias="filter")] = None - r"""Config for filters.""" - ranking: Optional[Ranking] = None r"""Config for Rank Service.""" + top_k: Optional[int] = None + r"""Optional. The number of contexts to retrieve.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["top_k", "hybrid_search", "filter", "ranking"]) + optional_fields = set(["filter", "hybrid_search", "ranking", "top_k"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/ragstoreconfig.py b/google/genai/_gaos/types/interactions/ragstoreconfig.py index 5d3f54c3c..a7308a363 100644 --- a/google/genai/_gaos/types/interactions/ragstoreconfig.py +++ b/google/genai/_gaos/types/interactions/ragstoreconfig.py @@ -31,12 +31,12 @@ class RagStoreConfigParam(TypedDict): rag_resources: NotRequired[List[RagResourceParam]] r"""Optional. The representation of the rag source.""" + rag_retrieval_config: NotRequired[RagRetrievalConfigParam] + r"""Specifies the context retrieval config.""" similarity_top_k: NotRequired[int] r"""Optional. Number of top k results to return from the selected corpora.""" vector_distance_threshold: NotRequired[float] r"""Optional. Only return results with vector distance smaller than the threshold.""" - rag_retrieval_config: NotRequired[RagRetrievalConfigParam] - r"""Specifies the context retrieval config.""" class RagStoreConfig(BaseModel): @@ -45,6 +45,9 @@ class RagStoreConfig(BaseModel): rag_resources: Optional[List[RagResource]] = None r"""Optional. The representation of the rag source.""" + rag_retrieval_config: Optional[RagRetrievalConfig] = None + r"""Specifies the context retrieval config.""" + similarity_top_k: Annotated[ Optional[int], pydantic.Field( @@ -61,17 +64,14 @@ class RagStoreConfig(BaseModel): ] = None r"""Optional. Only return results with vector distance smaller than the threshold.""" - rag_retrieval_config: Optional[RagRetrievalConfig] = None - r"""Specifies the context retrieval config.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ "rag_resources", + "rag_retrieval_config", "similarity_top_k", "vector_distance_threshold", - "rag_retrieval_config", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/ranking.py b/google/genai/_gaos/types/interactions/ranking.py index 0f709b50a..1caeaa677 100644 --- a/google/genai/_gaos/types/interactions/ranking.py +++ b/google/genai/_gaos/types/interactions/ranking.py @@ -29,14 +29,17 @@ class RankingParam(TypedDict): r"""Config for Rank Service.""" - ranking_config: Literal["rank_service"] model_name: NotRequired[str] r"""Optional. The model name of the rank service.""" + ranking_config: Literal["rank_service"] class Ranking(BaseModel): r"""Config for Rank Service.""" + model_name: Optional[str] = None + r"""Optional. The model name of the rank service.""" + ranking_config: Annotated[ Annotated[ Literal["rank_service"], AfterValidator(validate_const("rank_service")) @@ -44,9 +47,6 @@ class Ranking(BaseModel): pydantic.Field(alias="ranking_config"), ] = "rank_service" - model_name: Optional[str] = None - r"""Optional. The model name of the rank service.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["model_name"]) diff --git a/google/genai/_gaos/types/interactions/retrieval.py b/google/genai/_gaos/types/interactions/retrieval.py index 4cf7d48aa..859ee4e20 100644 --- a/google/genai/_gaos/types/interactions/retrieval.py +++ b/google/genai/_gaos/types/interactions/retrieval.py @@ -44,33 +44,22 @@ class RetrievalParam(TypedDict): r"""A tool that can be used by the model to retrieve files.""" - type: Literal["retrieval"] - retrieval_types: NotRequired[List[RetrievalRetrievalType]] - r"""The types of file retrieval to enable.""" - vertex_ai_search_config: NotRequired[VertexAISearchConfigParam] - r"""Used to specify configuration for VertexAISearch.""" exa_ai_search_config: NotRequired[ExaAISearchConfigParam] r"""Used to specify configuration for ExaAISearch.""" parallel_ai_search_config: NotRequired[ParallelAISearchConfigParam] r"""Used to specify configuration for ParallelAISearch.""" rag_store_config: NotRequired[RagStoreConfigParam] r"""Use to specify configuration for RAG Store.""" + retrieval_types: NotRequired[List[RetrievalRetrievalType]] + r"""The types of file retrieval to enable.""" + type: Literal["retrieval"] + vertex_ai_search_config: NotRequired[VertexAISearchConfigParam] + r"""Used to specify configuration for VertexAISearch.""" class Retrieval(BaseModel): r"""A tool that can be used by the model to retrieve files.""" - type: Annotated[ - Annotated[Literal["retrieval"], AfterValidator(validate_const("retrieval"))], - pydantic.Field(alias="type"), - ] = "retrieval" - - retrieval_types: Optional[List[RetrievalRetrievalType]] = None - r"""The types of file retrieval to enable.""" - - vertex_ai_search_config: Optional[VertexAISearchConfig] = None - r"""Used to specify configuration for VertexAISearch.""" - exa_ai_search_config: Optional[ExaAISearchConfig] = None r"""Used to specify configuration for ExaAISearch.""" @@ -80,15 +69,26 @@ class Retrieval(BaseModel): rag_store_config: Optional[RagStoreConfig] = None r"""Use to specify configuration for RAG Store.""" + retrieval_types: Optional[List[RetrievalRetrievalType]] = None + r"""The types of file retrieval to enable.""" + + type: Annotated[ + Annotated[Literal["retrieval"], AfterValidator(validate_const("retrieval"))], + pydantic.Field(alias="type"), + ] = "retrieval" + + vertex_ai_search_config: Optional[VertexAISearchConfig] = None + r"""Used to specify configuration for VertexAISearch.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ - "retrieval_types", - "vertex_ai_search_config", "exa_ai_search_config", "parallel_ai_search_config", "rag_store_config", + "retrieval_types", + "vertex_ai_search_config", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/retrievalcalldelta.py b/google/genai/_gaos/types/interactions/retrievalcalldelta.py index f2b6d6b30..bcff610a3 100644 --- a/google/genai/_gaos/types/interactions/retrievalcalldelta.py +++ b/google/genai/_gaos/types/interactions/retrievalcalldelta.py @@ -49,11 +49,11 @@ class RetrievalCallDeltaTypedDict(TypedDict): arguments: RetrievalCallArgumentsTypedDict r"""The arguments to pass to Retrieval tools.""" - type: Literal["retrieval_call"] retrieval_type: NotRequired[RetrievalCallDeltaRetrievalType] r"""The type of retrieval tools.""" signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["retrieval_call"] class RetrievalCallDelta(BaseModel): @@ -64,6 +64,12 @@ class RetrievalCallDelta(BaseModel): arguments: RetrievalCallArguments r"""The arguments to pass to Retrieval tools.""" + retrieval_type: Optional[RetrievalCallDeltaRetrievalType] = None + r"""The type of retrieval tools.""" + + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["retrieval_call"], AfterValidator(validate_const("retrieval_call")) @@ -71,12 +77,6 @@ class RetrievalCallDelta(BaseModel): pydantic.Field(alias="type"), ] = "retrieval_call" - retrieval_type: Optional[RetrievalCallDeltaRetrievalType] = None - r"""The type of retrieval tools.""" - - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["retrieval_type", "signature"]) diff --git a/google/genai/_gaos/types/interactions/retrievalresultdelta.py b/google/genai/_gaos/types/interactions/retrievalresultdelta.py index 2e155f6cd..02f5ede00 100644 --- a/google/genai/_gaos/types/interactions/retrievalresultdelta.py +++ b/google/genai/_gaos/types/interactions/retrievalresultdelta.py @@ -32,11 +32,11 @@ class RetrievalResultDeltaTypedDict(TypedDict): ToolResultDelta.type """ - type: Literal["retrieval_result"] is_error: NotRequired[bool] r"""Whether the retrieval resulted in an error.""" signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["retrieval_result"] class RetrievalResultDelta(BaseModel): @@ -45,6 +45,12 @@ class RetrievalResultDelta(BaseModel): ToolResultDelta.type """ + is_error: Optional[bool] = None + r"""Whether the retrieval resulted in an error.""" + + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["retrieval_result"], @@ -53,12 +59,6 @@ class RetrievalResultDelta(BaseModel): pydantic.Field(alias="type"), ] = "retrieval_result" - is_error: Optional[bool] = None - r"""Whether the retrieval resulted in an error.""" - - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["is_error", "signature"]) diff --git a/google/genai/_gaos/types/interactions/reviewsnippet.py b/google/genai/_gaos/types/interactions/reviewsnippet.py index a68fd0818..4e98ae1d3 100644 --- a/google/genai/_gaos/types/interactions/reviewsnippet.py +++ b/google/genai/_gaos/types/interactions/reviewsnippet.py @@ -28,12 +28,12 @@ class ReviewSnippetParam(TypedDict): the features of a specific place in Google Maps. """ + review_id: NotRequired[str] + r"""The ID of the review snippet.""" title: NotRequired[str] r"""Title of the review.""" url: NotRequired[str] r"""A link that corresponds to the user review on Google Maps.""" - review_id: NotRequired[str] - r"""The ID of the review snippet.""" class ReviewSnippet(BaseModel): @@ -41,18 +41,18 @@ class ReviewSnippet(BaseModel): the features of a specific place in Google Maps. """ + review_id: Optional[str] = None + r"""The ID of the review snippet.""" + title: Optional[str] = None r"""Title of the review.""" url: Optional[str] = None r"""A link that corresponds to the user review on Google Maps.""" - review_id: Optional[str] = None - r"""The ID of the review snippet.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["title", "url", "review_id"]) + optional_fields = set(["review_id", "title", "url"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/source.py b/google/genai/_gaos/types/interactions/source.py index 56ca2fe72..13a4b85a8 100644 --- a/google/genai/_gaos/types/interactions/source.py +++ b/google/genai/_gaos/types/interactions/source.py @@ -37,7 +37,10 @@ class SourceParam(TypedDict): r"""A source to be mounted into the environment.""" - type: NotRequired[SourceType] + content: NotRequired[str] + r"""The inline content if `type` is `INLINE`.""" + encoding: NotRequired[str] + r"""Optional encoding for inline content (e.g. `base64`).""" source: NotRequired[str] r"""The source of the environment. For GCS, this is the GCS path. @@ -45,16 +48,17 @@ class SourceParam(TypedDict): """ target: NotRequired[str] r"""Where the source should appear in the environment.""" - content: NotRequired[str] - r"""The inline content if `type` is `INLINE`.""" - encoding: NotRequired[str] - r"""Optional encoding for inline content (e.g. `base64`).""" + type: NotRequired[SourceType] class Source(BaseModel): r"""A source to be mounted into the environment.""" - type: Optional[SourceType] = None + content: Optional[str] = None + r"""The inline content if `type` is `INLINE`.""" + + encoding: Optional[str] = None + r"""Optional encoding for inline content (e.g. `base64`).""" source: Optional[str] = None r"""The source of the environment. @@ -65,15 +69,11 @@ class Source(BaseModel): target: Optional[str] = None r"""Where the source should appear in the environment.""" - content: Optional[str] = None - r"""The inline content if `type` is `INLINE`.""" - - encoding: Optional[str] = None - r"""Optional encoding for inline content (e.g. `base64`).""" + type: Optional[SourceType] = None @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["type", "source", "target", "content", "encoding"]) + optional_fields = set(["content", "encoding", "source", "target", "type"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/speechconfig.py b/google/genai/_gaos/types/interactions/speechconfig.py index c09e2c8a7..751fd77ea 100644 --- a/google/genai/_gaos/types/interactions/speechconfig.py +++ b/google/genai/_gaos/types/interactions/speechconfig.py @@ -26,29 +26,29 @@ class SpeechConfigParam(TypedDict): r"""The configuration for speech interaction.""" - voice: NotRequired[str] - r"""The voice of the speaker.""" language: NotRequired[str] r"""The language of the speech.""" speaker: NotRequired[str] r"""The speaker's name, it should match the speaker name given in the prompt.""" + voice: NotRequired[str] + r"""The voice of the speaker.""" class SpeechConfig(BaseModel): r"""The configuration for speech interaction.""" - voice: Optional[str] = None - r"""The voice of the speaker.""" - language: Optional[str] = None r"""The language of the speech.""" speaker: Optional[str] = None r"""The speaker's name, it should match the speaker name given in the prompt.""" + voice: Optional[str] = None + r"""The voice of the speaker.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["voice", "language", "speaker"]) + optional_fields = set(["language", "speaker", "voice"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/status.py b/google/genai/_gaos/types/interactions/status.py index 776c3b417..298c5a8de 100644 --- a/google/genai/_gaos/types/interactions/status.py +++ b/google/genai/_gaos/types/interactions/status.py @@ -35,15 +35,15 @@ class StatusParam(TypedDict): code: NotRequired[int] r"""The status code, which should be an enum value of google.rpc.Code.""" + details: NotRequired[List[Dict[str, Any]]] + r"""A list of messages that carry the error details. There is a common set of + message types for APIs to use. + """ message: NotRequired[str] r"""A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. """ - details: NotRequired[List[Dict[str, Any]]] - r"""A list of messages that carry the error details. There is a common set of - message types for APIs to use. - """ class Status(BaseModel): @@ -59,20 +59,20 @@ class Status(BaseModel): code: Optional[int] = None r"""The status code, which should be an enum value of google.rpc.Code.""" + details: Optional[List[Dict[str, Any]]] = None + r"""A list of messages that carry the error details. There is a common set of + message types for APIs to use. + """ + message: Optional[str] = None r"""A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client. """ - details: Optional[List[Dict[str, Any]]] = None - r"""A list of messages that carry the error details. There is a common set of - message types for APIs to use. - """ - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["code", "message", "details"]) + optional_fields = set(["code", "details", "message"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/stepdelta.py b/google/genai/_gaos/types/interactions/stepdelta.py index 914b3bb53..c62121d17 100644 --- a/google/genai/_gaos/types/interactions/stepdelta.py +++ b/google/genai/_gaos/types/interactions/stepdelta.py @@ -29,32 +29,32 @@ class StepDeltaTypedDict(TypedDict): - index: int delta: StepDeltaDataTypedDict - event_type: Literal["step.delta"] + index: int event_id: NotRequired[str] r"""The event_id token to be used to resume the interaction stream, from this event. """ + event_type: Literal["step.delta"] metadata: NotRequired[StepDeltaMetadataTypedDict] r"""Optional metadata accompanying ANY streamed event.""" class StepDelta(BaseModel): - index: int - delta: StepDeltaData - event_type: Annotated[ - Annotated[Literal["step.delta"], AfterValidator(validate_const("step.delta"))], - pydantic.Field(alias="event_type"), - ] = "step.delta" + index: int event_id: Optional[str] = None r"""The event_id token to be used to resume the interaction stream, from this event. """ + event_type: Annotated[ + Annotated[Literal["step.delta"], AfterValidator(validate_const("step.delta"))], + pydantic.Field(alias="event_type"), + ] = "step.delta" + metadata: Optional[StepDeltaMetadata] = None r"""Optional metadata accompanying ANY streamed event.""" diff --git a/google/genai/_gaos/types/interactions/stepstart.py b/google/genai/_gaos/types/interactions/stepstart.py index ac5c41c5d..4a0c3a3fa 100644 --- a/google/genai/_gaos/types/interactions/stepstart.py +++ b/google/genai/_gaos/types/interactions/stepstart.py @@ -32,11 +32,11 @@ class StepStartTypedDict(TypedDict): index: int step: StepParam r"""A step in the interaction.""" - event_type: Literal["step.start"] event_id: NotRequired[str] r"""The event_id token to be used to resume the interaction stream, from this event. """ + event_type: Literal["step.start"] metadata: NotRequired[StreamMetadataTypedDict] @@ -46,16 +46,16 @@ class StepStart(BaseModel): step: Step r"""A step in the interaction.""" - event_type: Annotated[ - Annotated[Literal["step.start"], AfterValidator(validate_const("step.start"))], - pydantic.Field(alias="event_type"), - ] = "step.start" - event_id: Optional[str] = None r"""The event_id token to be used to resume the interaction stream, from this event. """ + event_type: Annotated[ + Annotated[Literal["step.start"], AfterValidator(validate_const("step.start"))], + pydantic.Field(alias="event_type"), + ] = "step.start" + metadata: Optional[StreamMetadata] = None @model_serializer(mode="wrap") diff --git a/google/genai/_gaos/types/interactions/stepstop.py b/google/genai/_gaos/types/interactions/stepstop.py index 2fd0d181c..846ffb7a9 100644 --- a/google/genai/_gaos/types/interactions/stepstop.py +++ b/google/genai/_gaos/types/interactions/stepstop.py @@ -30,42 +30,42 @@ class StepStopTypedDict(TypedDict): index: int - event_type: Literal["step.stop"] - usage: NotRequired[UsageTypedDict] - r"""Statistics on the interaction request's token usage.""" - step_usage: NotRequired[UsageTypedDict] - r"""Statistics on the interaction request's token usage.""" event_id: NotRequired[str] r"""The event_id token to be used to resume the interaction stream, from this event. """ + event_type: Literal["step.stop"] metadata: NotRequired[StreamMetadataTypedDict] + step_usage: NotRequired[UsageTypedDict] + r"""Statistics on the interaction request's token usage.""" + usage: NotRequired[UsageTypedDict] + r"""Statistics on the interaction request's token usage.""" class StepStop(BaseModel): index: int + event_id: Optional[str] = None + r"""The event_id token to be used to resume the interaction stream, from + this event. + """ + event_type: Annotated[ Annotated[Literal["step.stop"], AfterValidator(validate_const("step.stop"))], pydantic.Field(alias="event_type"), ] = "step.stop" - usage: Optional[Usage] = None - r"""Statistics on the interaction request's token usage.""" + metadata: Optional[StreamMetadata] = None step_usage: Optional[Usage] = None r"""Statistics on the interaction request's token usage.""" - event_id: Optional[str] = None - r"""The event_id token to be used to resume the interaction stream, from - this event. - """ - - metadata: Optional[StreamMetadata] = None + usage: Optional[Usage] = None + r"""Statistics on the interaction request's token usage.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["usage", "step_usage", "event_id", "metadata"]) + optional_fields = set(["event_id", "metadata", "step_usage", "usage"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/textannotationdelta.py b/google/genai/_gaos/types/interactions/textannotationdelta.py index 9f629c531..68c5580a8 100644 --- a/google/genai/_gaos/types/interactions/textannotationdelta.py +++ b/google/genai/_gaos/types/interactions/textannotationdelta.py @@ -28,12 +28,15 @@ class TextAnnotationDeltaTypedDict(TypedDict): - type: Literal["text_annotation_delta"] annotations: NotRequired[List[AnnotationParam]] r"""Citation information for model-generated content.""" + type: Literal["text_annotation_delta"] class TextAnnotationDelta(BaseModel): + annotations: Optional[List[Annotation]] = None + r"""Citation information for model-generated content.""" + type: Annotated[ Annotated[ Literal["text_annotation_delta"], @@ -42,9 +45,6 @@ class TextAnnotationDelta(BaseModel): pydantic.Field(alias="type"), ] = "text_annotation_delta" - annotations: Optional[List[Annotation]] = None - r"""Citation information for model-generated content.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["annotations"]) diff --git a/google/genai/_gaos/types/interactions/textcontent.py b/google/genai/_gaos/types/interactions/textcontent.py index 894955e43..61a24c980 100644 --- a/google/genai/_gaos/types/interactions/textcontent.py +++ b/google/genai/_gaos/types/interactions/textcontent.py @@ -32,9 +32,9 @@ class TextContentParam(TypedDict): text: str r"""Required. The text content.""" - type: Literal["text"] annotations: NotRequired[List[AnnotationParam]] r"""Citation information for model-generated content.""" + type: Literal["text"] class TextContent(BaseModel): @@ -43,14 +43,14 @@ class TextContent(BaseModel): text: str r"""Required. The text content.""" + annotations: Optional[List[Annotation]] = None + r"""Citation information for model-generated content.""" + type: Annotated[ Annotated[Literal["text"], AfterValidator(validate_const("text"))], pydantic.Field(alias="type"), ] = "text" - annotations: Optional[List[Annotation]] = None - r"""Citation information for model-generated content.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["annotations"]) diff --git a/google/genai/_gaos/types/interactions/textresponseformat.py b/google/genai/_gaos/types/interactions/textresponseformat.py index 72cc22977..b44247dfe 100644 --- a/google/genai/_gaos/types/interactions/textresponseformat.py +++ b/google/genai/_gaos/types/interactions/textresponseformat.py @@ -39,23 +39,18 @@ class TextResponseFormatParam(TypedDict): r"""Configuration for text output format.""" - type: Literal["text"] mime_type: NotRequired[TextResponseFormatMimeType] r"""The MIME type of the text output.""" schema_: NotRequired[Dict[str, Any]] r"""The JSON schema that the output should conform to. Only applicable when mime_type is application/json. """ + type: Literal["text"] class TextResponseFormat(BaseModel): r"""Configuration for text output format.""" - type: Annotated[ - Annotated[Literal["text"], AfterValidator(validate_const("text"))], - pydantic.Field(alias="type"), - ] = "text" - mime_type: Optional[TextResponseFormatMimeType] = None r"""The MIME type of the text output.""" @@ -64,6 +59,11 @@ class TextResponseFormat(BaseModel): mime_type is application/json. """ + type: Annotated[ + Annotated[Literal["text"], AfterValidator(validate_const("text"))], + pydantic.Field(alias="type"), + ] = "text" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["mime_type", "schema"]) diff --git a/google/genai/_gaos/types/interactions/thoughtsignaturedelta.py b/google/genai/_gaos/types/interactions/thoughtsignaturedelta.py index 14a89c16b..139d57c19 100644 --- a/google/genai/_gaos/types/interactions/thoughtsignaturedelta.py +++ b/google/genai/_gaos/types/interactions/thoughtsignaturedelta.py @@ -27,12 +27,15 @@ class ThoughtSignatureDeltaTypedDict(TypedDict): - type: Literal["thought_signature"] signature: NotRequired[str] r"""Signature to match the backend source to be part of the generation.""" + type: Literal["thought_signature"] class ThoughtSignatureDelta(BaseModel): + signature: Optional[str] = None + r"""Signature to match the backend source to be part of the generation.""" + type: Annotated[ Annotated[ Literal["thought_signature"], @@ -41,9 +44,6 @@ class ThoughtSignatureDelta(BaseModel): pydantic.Field(alias="type"), ] = "thought_signature" - signature: Optional[str] = None - r"""Signature to match the backend source to be part of the generation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature"]) diff --git a/google/genai/_gaos/types/interactions/thoughtstep.py b/google/genai/_gaos/types/interactions/thoughtstep.py index b2e7ce816..d9b917a7b 100644 --- a/google/genai/_gaos/types/interactions/thoughtstep.py +++ b/google/genai/_gaos/types/interactions/thoughtstep.py @@ -30,27 +30,27 @@ class ThoughtStepParam(TypedDict): r"""A thought step.""" - type: Literal["thought"] signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" summary: NotRequired[List[ThoughtSummaryContentParam]] r"""A summary of the thought.""" + type: Literal["thought"] class ThoughtStep(BaseModel): r"""A thought step.""" - type: Annotated[ - Annotated[Literal["thought"], AfterValidator(validate_const("thought"))], - pydantic.Field(alias="type"), - ] = "thought" - signature: Optional[Base64EncodedString] = None r"""A signature hash for backend validation.""" summary: Optional[List[ThoughtSummaryContent]] = None r"""A summary of the thought.""" + type: Annotated[ + Annotated[Literal["thought"], AfterValidator(validate_const("thought"))], + pydantic.Field(alias="type"), + ] = "thought" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature", "summary"]) diff --git a/google/genai/_gaos/types/interactions/thoughtsummarydelta.py b/google/genai/_gaos/types/interactions/thoughtsummarydelta.py index 82fff763d..be4491147 100644 --- a/google/genai/_gaos/types/interactions/thoughtsummarydelta.py +++ b/google/genai/_gaos/types/interactions/thoughtsummarydelta.py @@ -28,12 +28,15 @@ class ThoughtSummaryDeltaTypedDict(TypedDict): - type: Literal["thought_summary"] content: NotRequired[ContentParam] r"""The content of the response.""" + type: Literal["thought_summary"] class ThoughtSummaryDelta(BaseModel): + content: Optional[Content] = None + r"""The content of the response.""" + type: Annotated[ Annotated[ Literal["thought_summary"], @@ -42,9 +45,6 @@ class ThoughtSummaryDelta(BaseModel): pydantic.Field(alias="type"), ] = "thought_summary" - content: Optional[Content] = None - r"""The content of the response.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["content"]) diff --git a/google/genai/_gaos/types/interactions/turn.py b/google/genai/_gaos/types/interactions/turn.py index 79608cb0c..2f24c65f0 100644 --- a/google/genai/_gaos/types/interactions/turn.py +++ b/google/genai/_gaos/types/interactions/turn.py @@ -34,27 +34,27 @@ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." ) class TurnParam(TypedDict): + content: NotRequired[TurnContentParam] role: NotRequired[str] r"""The originator of this turn. Must be user for input or model for model output. """ - content: NotRequired[TurnContentParam] @deprecated( "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." ) class Turn(BaseModel): + content: Optional[TurnContent] = None + role: Optional[str] = None r"""The originator of this turn. Must be user for input or model for model output. """ - content: Optional[TurnContent] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["role", "content"]) + optional_fields = set(["content", "role"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/urlcitation.py b/google/genai/_gaos/types/interactions/urlcitation.py index 6583eaaba..32bff017f 100644 --- a/google/genai/_gaos/types/interactions/urlcitation.py +++ b/google/genai/_gaos/types/interactions/urlcitation.py @@ -29,23 +29,35 @@ class URLCitationParam(TypedDict): r"""A URL citation annotation.""" - type: Literal["url_citation"] - url: NotRequired[str] - r"""The URL.""" - title: NotRequired[str] - r"""The title of the URL.""" + end_index: NotRequired[int] + r"""End of the attributed segment, exclusive.""" start_index: NotRequired[int] r"""Start of segment of the response that is attributed to this source. Index indicates the start of the segment, measured in bytes. """ - end_index: NotRequired[int] - r"""End of the attributed segment, exclusive.""" + title: NotRequired[str] + r"""The title of the URL.""" + type: Literal["url_citation"] + url: NotRequired[str] + r"""The URL.""" class URLCitation(BaseModel): r"""A URL citation annotation.""" + end_index: Optional[int] = None + r"""End of the attributed segment, exclusive.""" + + start_index: Optional[int] = None + r"""Start of segment of the response that is attributed to this source. + + Index indicates the start of the segment, measured in bytes. + """ + + title: Optional[str] = None + r"""The title of the URL.""" + type: Annotated[ Annotated[ Literal["url_citation"], AfterValidator(validate_const("url_citation")) @@ -56,21 +68,9 @@ class URLCitation(BaseModel): url: Optional[str] = None r"""The URL.""" - title: Optional[str] = None - r"""The title of the URL.""" - - start_index: Optional[int] = None - r"""Start of segment of the response that is attributed to this source. - - Index indicates the start of the segment, measured in bytes. - """ - - end_index: Optional[int] = None - r"""End of the attributed segment, exclusive.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["url", "title", "start_index", "end_index"]) + optional_fields = set(["end_index", "start_index", "title", "url"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/urlcontextcalldelta.py b/google/genai/_gaos/types/interactions/urlcontextcalldelta.py index f24362835..1e0877f17 100644 --- a/google/genai/_gaos/types/interactions/urlcontextcalldelta.py +++ b/google/genai/_gaos/types/interactions/urlcontextcalldelta.py @@ -33,15 +33,18 @@ class URLContextCallDeltaTypedDict(TypedDict): arguments: URLContextCallArgumentsParam r"""The arguments to pass to the URL context.""" - type: Literal["url_context_call"] signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["url_context_call"] class URLContextCallDelta(BaseModel): arguments: URLContextCallArguments r"""The arguments to pass to the URL context.""" + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["url_context_call"], @@ -50,9 +53,6 @@ class URLContextCallDelta(BaseModel): pydantic.Field(alias="type"), ] = "url_context_call" - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature"]) diff --git a/google/genai/_gaos/types/interactions/urlcontextcallstep.py b/google/genai/_gaos/types/interactions/urlcontextcallstep.py index 68393121d..cb849e6af 100644 --- a/google/genai/_gaos/types/interactions/urlcontextcallstep.py +++ b/google/genai/_gaos/types/interactions/urlcontextcallstep.py @@ -37,9 +37,9 @@ class URLContextCallStepParam(TypedDict): r"""The arguments to pass to the URL context.""" id: str r"""Required. A unique ID for this specific tool call.""" - type: Literal["url_context_call"] signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" + type: Literal["url_context_call"] class URLContextCallStep(BaseModel): @@ -51,6 +51,9 @@ class URLContextCallStep(BaseModel): id: str r"""Required. A unique ID for this specific tool call.""" + signature: Optional[Base64EncodedString] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["url_context_call"], @@ -59,9 +62,6 @@ class URLContextCallStep(BaseModel): pydantic.Field(alias="type"), ] = "url_context_call" - signature: Optional[Base64EncodedString] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["signature"]) diff --git a/google/genai/_gaos/types/interactions/urlcontextresult.py b/google/genai/_gaos/types/interactions/urlcontextresult.py index 4ba3e28df..919a4d290 100644 --- a/google/genai/_gaos/types/interactions/urlcontextresult.py +++ b/google/genai/_gaos/types/interactions/urlcontextresult.py @@ -38,24 +38,24 @@ class URLContextResultParam(TypedDict): r"""The result of the URL context.""" - url: NotRequired[str] - r"""The URL that was fetched.""" status: NotRequired[URLContextResultStatus] r"""The status of the URL retrieval.""" + url: NotRequired[str] + r"""The URL that was fetched.""" class URLContextResult(BaseModel): r"""The result of the URL context.""" - url: Optional[str] = None - r"""The URL that was fetched.""" - status: Optional[URLContextResultStatus] = None r"""The status of the URL retrieval.""" + url: Optional[str] = None + r"""The URL that was fetched.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["url", "status"]) + optional_fields = set(["status", "url"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/urlcontextresultdelta.py b/google/genai/_gaos/types/interactions/urlcontextresultdelta.py index 1c7d0fc55..f4a9b1e7e 100644 --- a/google/genai/_gaos/types/interactions/urlcontextresultdelta.py +++ b/google/genai/_gaos/types/interactions/urlcontextresultdelta.py @@ -29,15 +29,20 @@ class URLContextResultDeltaTypedDict(TypedDict): result: List[URLContextResultParam] - type: Literal["url_context_result"] is_error: NotRequired[bool] signature: NotRequired[str] r"""A signature hash for backend validation.""" + type: Literal["url_context_result"] class URLContextResultDelta(BaseModel): result: List[URLContextResult] + is_error: Optional[bool] = None + + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + type: Annotated[ Annotated[ Literal["url_context_result"], @@ -46,11 +51,6 @@ class URLContextResultDelta(BaseModel): pydantic.Field(alias="type"), ] = "url_context_result" - is_error: Optional[bool] = None - - signature: Optional[str] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["is_error", "signature"]) diff --git a/google/genai/_gaos/types/interactions/urlcontextresultstep.py b/google/genai/_gaos/types/interactions/urlcontextresultstep.py index af91ce439..063fd2723 100644 --- a/google/genai/_gaos/types/interactions/urlcontextresultstep.py +++ b/google/genai/_gaos/types/interactions/urlcontextresultstep.py @@ -30,25 +30,31 @@ class URLContextResultStepParam(TypedDict): r"""URL context result step.""" - result: List[URLContextResultParam] - r"""Required. The results of the URL context.""" call_id: str r"""Required. ID to match the ID from the function call block.""" - type: Literal["url_context_result"] + result: List[URLContextResultParam] + r"""Required. The results of the URL context.""" is_error: NotRequired[bool] r"""Whether the URL context resulted in an error.""" signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" + type: Literal["url_context_result"] class URLContextResultStep(BaseModel): r"""URL context result step.""" + call_id: str + r"""Required. ID to match the ID from the function call block.""" + result: List[URLContextResult] r"""Required. The results of the URL context.""" - call_id: str - r"""Required. ID to match the ID from the function call block.""" + is_error: Optional[bool] = None + r"""Whether the URL context resulted in an error.""" + + signature: Optional[Base64EncodedString] = None + r"""A signature hash for backend validation.""" type: Annotated[ Annotated[ @@ -58,12 +64,6 @@ class URLContextResultStep(BaseModel): pydantic.Field(alias="type"), ] = "url_context_result" - is_error: Optional[bool] = None - r"""Whether the URL context resulted in an error.""" - - signature: Optional[Base64EncodedString] = None - r"""A signature hash for backend validation.""" - @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set(["is_error", "signature"]) diff --git a/google/genai/_gaos/types/interactions/usage.py b/google/genai/_gaos/types/interactions/usage.py index 342409486..ac1f50880 100644 --- a/google/genai/_gaos/types/interactions/usage.py +++ b/google/genai/_gaos/types/interactions/usage.py @@ -28,59 +28,59 @@ class UsageTypedDict(TypedDict): r"""Statistics on the interaction request's token usage.""" - total_input_tokens: NotRequired[int] - r"""Number of tokens in the prompt (context).""" - input_tokens_by_modality: NotRequired[List[ModalityTokensTypedDict]] - r"""A breakdown of input token usage by modality.""" - total_cached_tokens: NotRequired[int] - r"""Number of tokens in the cached part of the prompt (the cached content).""" cached_tokens_by_modality: NotRequired[List[ModalityTokensTypedDict]] r"""A breakdown of cached token usage by modality.""" - total_output_tokens: NotRequired[int] - r"""Total number of tokens across all the generated responses.""" + grounding_tool_count: NotRequired[List[GroundingToolCountTypedDict]] + r"""Grounding tool count.""" + input_tokens_by_modality: NotRequired[List[ModalityTokensTypedDict]] + r"""A breakdown of input token usage by modality.""" output_tokens_by_modality: NotRequired[List[ModalityTokensTypedDict]] r"""A breakdown of output token usage by modality.""" - total_tool_use_tokens: NotRequired[int] - r"""Number of tokens present in tool-use prompt(s).""" tool_use_tokens_by_modality: NotRequired[List[ModalityTokensTypedDict]] r"""A breakdown of tool-use token usage by modality.""" + total_cached_tokens: NotRequired[int] + r"""Number of tokens in the cached part of the prompt (the cached content).""" + total_input_tokens: NotRequired[int] + r"""Number of tokens in the prompt (context).""" + total_output_tokens: NotRequired[int] + r"""Total number of tokens across all the generated responses.""" total_thought_tokens: NotRequired[int] r"""Number of tokens of thoughts for thinking models.""" total_tokens: NotRequired[int] r"""Total token count for the interaction request (prompt + responses + other internal tokens). """ - grounding_tool_count: NotRequired[List[GroundingToolCountTypedDict]] - r"""Grounding tool count.""" + total_tool_use_tokens: NotRequired[int] + r"""Number of tokens present in tool-use prompt(s).""" class Usage(BaseModel): r"""Statistics on the interaction request's token usage.""" - total_input_tokens: Optional[int] = None - r"""Number of tokens in the prompt (context).""" + cached_tokens_by_modality: Optional[List[ModalityTokens]] = None + r"""A breakdown of cached token usage by modality.""" + + grounding_tool_count: Optional[List[GroundingToolCount]] = None + r"""Grounding tool count.""" input_tokens_by_modality: Optional[List[ModalityTokens]] = None r"""A breakdown of input token usage by modality.""" + output_tokens_by_modality: Optional[List[ModalityTokens]] = None + r"""A breakdown of output token usage by modality.""" + + tool_use_tokens_by_modality: Optional[List[ModalityTokens]] = None + r"""A breakdown of tool-use token usage by modality.""" + total_cached_tokens: Optional[int] = None r"""Number of tokens in the cached part of the prompt (the cached content).""" - cached_tokens_by_modality: Optional[List[ModalityTokens]] = None - r"""A breakdown of cached token usage by modality.""" + total_input_tokens: Optional[int] = None + r"""Number of tokens in the prompt (context).""" total_output_tokens: Optional[int] = None r"""Total number of tokens across all the generated responses.""" - output_tokens_by_modality: Optional[List[ModalityTokens]] = None - r"""A breakdown of output token usage by modality.""" - - total_tool_use_tokens: Optional[int] = None - r"""Number of tokens present in tool-use prompt(s).""" - - tool_use_tokens_by_modality: Optional[List[ModalityTokens]] = None - r"""A breakdown of tool-use token usage by modality.""" - total_thought_tokens: Optional[int] = None r"""Number of tokens of thoughts for thinking models.""" @@ -89,24 +89,24 @@ class Usage(BaseModel): internal tokens). """ - grounding_tool_count: Optional[List[GroundingToolCount]] = None - r"""Grounding tool count.""" + total_tool_use_tokens: Optional[int] = None + r"""Number of tokens present in tool-use prompt(s).""" @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ - "total_input_tokens", - "input_tokens_by_modality", - "total_cached_tokens", "cached_tokens_by_modality", - "total_output_tokens", + "grounding_tool_count", + "input_tokens_by_modality", "output_tokens_by_modality", - "total_tool_use_tokens", "tool_use_tokens_by_modality", + "total_cached_tokens", + "total_input_tokens", + "total_output_tokens", "total_thought_tokens", "total_tokens", - "grounding_tool_count", + "total_tool_use_tokens", ] ) serialized = handler(self) diff --git a/google/genai/_gaos/types/interactions/vertexaisearchconfig.py b/google/genai/_gaos/types/interactions/vertexaisearchconfig.py index 8bff1b3fb..fe8f909ac 100644 --- a/google/genai/_gaos/types/interactions/vertexaisearchconfig.py +++ b/google/genai/_gaos/types/interactions/vertexaisearchconfig.py @@ -26,24 +26,24 @@ class VertexAISearchConfigParam(TypedDict): r"""Used to specify configuration for VertexAISearch.""" - engine: NotRequired[str] - r"""Optional. Used to specify Vertex AI Search engine.""" datastores: NotRequired[List[str]] r"""Optional. Used to specify Vertex AI Search datastores.""" + engine: NotRequired[str] + r"""Optional. Used to specify Vertex AI Search engine.""" class VertexAISearchConfig(BaseModel): r"""Used to specify configuration for VertexAISearch.""" - engine: Optional[str] = None - r"""Optional. Used to specify Vertex AI Search engine.""" - datastores: Optional[List[str]] = None r"""Optional. Used to specify Vertex AI Search datastores.""" + engine: Optional[str] = None + r"""Optional. Used to specify Vertex AI Search engine.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["engine", "datastores"]) + optional_fields = set(["datastores", "engine"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/videocontent.py b/google/genai/_gaos/types/interactions/videocontent.py index 7661af265..f2a4edae6 100644 --- a/google/genai/_gaos/types/interactions/videocontent.py +++ b/google/genai/_gaos/types/interactions/videocontent.py @@ -53,38 +53,38 @@ class VideoContentParam(TypedDict): r"""A video content block.""" - type: Literal["video"] data: NotRequired[Union[str, Base64FileInput]] r"""The video content.""" - uri: NotRequired[str] - r"""The URI of the video.""" mime_type: NotRequired[VideoContentMimeType] r"""The mime type of the video.""" resolution: NotRequired[MediaResolution] + type: Literal["video"] + uri: NotRequired[str] + r"""The URI of the video.""" class VideoContent(BaseModel): r"""A video content block.""" - type: Annotated[ - Annotated[Literal["video"], AfterValidator(validate_const("video"))], - pydantic.Field(alias="type"), - ] = "video" - data: Optional[Base64EncodedString] = None r"""The video content.""" - uri: Optional[str] = None - r"""The URI of the video.""" - mime_type: Optional[VideoContentMimeType] = None r"""The mime type of the video.""" resolution: Optional[MediaResolution] = None + type: Annotated[ + Annotated[Literal["video"], AfterValidator(validate_const("video"))], + pydantic.Field(alias="type"), + ] = "video" + + uri: Optional[str] = None + r"""The URI of the video.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["data", "uri", "mime_type", "resolution"]) + optional_fields = set(["data", "mime_type", "resolution", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/videodelta.py b/google/genai/_gaos/types/interactions/videodelta.py index 0d39c4aad..444b5e6ec 100644 --- a/google/genai/_gaos/types/interactions/videodelta.py +++ b/google/genai/_gaos/types/interactions/videodelta.py @@ -44,30 +44,30 @@ class VideoDeltaTypedDict(TypedDict): - type: Literal["video"] data: NotRequired[str] - uri: NotRequired[str] mime_type: NotRequired[VideoDeltaMimeType] resolution: NotRequired[MediaResolution] + type: Literal["video"] + uri: NotRequired[str] class VideoDelta(BaseModel): + data: Optional[str] = None + + mime_type: Optional[VideoDeltaMimeType] = None + + resolution: Optional[MediaResolution] = None + type: Annotated[ Annotated[Literal["video"], AfterValidator(validate_const("video"))], pydantic.Field(alias="type"), ] = "video" - data: Optional[str] = None - uri: Optional[str] = None - mime_type: Optional[VideoDeltaMimeType] = None - - resolution: Optional[MediaResolution] = None - @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["data", "uri", "mime_type", "resolution"]) + optional_fields = set(["data", "mime_type", "resolution", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/interactions/videoresponseformat.py b/google/genai/_gaos/types/interactions/videoresponseformat.py index d33103909..95ddfaf4f 100644 --- a/google/genai/_gaos/types/interactions/videoresponseformat.py +++ b/google/genai/_gaos/types/interactions/videoresponseformat.py @@ -26,67 +26,67 @@ from typing_extensions import Annotated, NotRequired, TypedDict -VideoResponseFormatDelivery = Union[ +VideoResponseFormatAspectRatio = Union[ Literal[ - "inline", - "uri", + "16:9", + "9:16", ], UnrecognizedStr, ] -r"""The delivery mode for the video output.""" +r"""The aspect ratio for the video output.""" -VideoResponseFormatAspectRatio = Union[ +VideoResponseFormatDelivery = Union[ Literal[ - "16:9", - "9:16", + "inline", + "uri", ], UnrecognizedStr, ] -r"""The aspect ratio for the video output.""" +r"""The delivery mode for the video output.""" class VideoResponseFormatParam(TypedDict): r"""Configuration for video output format.""" - type: Literal["video"] + aspect_ratio: NotRequired[VideoResponseFormatAspectRatio] + r"""The aspect ratio for the video output.""" delivery: NotRequired[VideoResponseFormatDelivery] r"""The delivery mode for the video output.""" + duration: NotRequired[str] + r"""The duration for the video output.""" gcs_uri: NotRequired[str] r"""The GCS URI to store the video output. Required for Vertex if delivery mode is URI. """ - aspect_ratio: NotRequired[VideoResponseFormatAspectRatio] - r"""The aspect ratio for the video output.""" - duration: NotRequired[str] - r"""The duration for the video output.""" + type: Literal["video"] class VideoResponseFormat(BaseModel): r"""Configuration for video output format.""" - type: Annotated[ - Annotated[Literal["video"], AfterValidator(validate_const("video"))], - pydantic.Field(alias="type"), - ] = "video" + aspect_ratio: Optional[VideoResponseFormatAspectRatio] = None + r"""The aspect ratio for the video output.""" delivery: Optional[VideoResponseFormatDelivery] = None r"""The delivery mode for the video output.""" + duration: Optional[str] = None + r"""The duration for the video output.""" + gcs_uri: Optional[str] = None r"""The GCS URI to store the video output. Required for Vertex if delivery mode is URI. """ - aspect_ratio: Optional[VideoResponseFormatAspectRatio] = None - r"""The aspect ratio for the video output.""" - - duration: Optional[str] = None - r"""The duration for the video output.""" + type: Annotated[ + Annotated[Literal["video"], AfterValidator(validate_const("video"))], + pydantic.Field(alias="type"), + ] = "video" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["delivery", "gcs_uri", "aspect_ratio", "duration"]) + optional_fields = set(["aspect_ratio", "delivery", "duration", "gcs_uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/webhooks/signingsecret.py b/google/genai/_gaos/types/webhooks/signingsecret.py index 7e862cadd..9a751d3ec 100644 --- a/google/genai/_gaos/types/webhooks/signingsecret.py +++ b/google/genai/_gaos/types/webhooks/signingsecret.py @@ -27,24 +27,24 @@ class SigningSecretTypedDict(TypedDict): r"""Represents a signing secret used to verify webhook payloads.""" - truncated_secret: NotRequired[str] - r"""Output only. The truncated version of the signing secret.""" expire_time: NotRequired[datetime] r"""Output only. The expiration date of the signing secret.""" + truncated_secret: NotRequired[str] + r"""Output only. The truncated version of the signing secret.""" class SigningSecret(BaseModel): r"""Represents a signing secret used to verify webhook payloads.""" - truncated_secret: Optional[str] = None - r"""Output only. The truncated version of the signing secret.""" - expire_time: Optional[datetime] = None r"""Output only. The expiration date of the signing secret.""" + truncated_secret: Optional[str] = None + r"""Output only. The truncated version of the signing secret.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["truncated_secret", "expire_time"]) + optional_fields = set(["expire_time", "truncated_secret"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/webhooks/webhook.py b/google/genai/_gaos/types/webhooks/webhook.py index 01fd0940c..8239a6383 100644 --- a/google/genai/_gaos/types/webhooks/webhook.py +++ b/google/genai/_gaos/types/webhooks/webhook.py @@ -25,6 +25,17 @@ from typing_extensions import NotRequired, TypedDict +WebhookState = Union[ + Literal[ + "enabled", + "disabled", + "disabled_due_to_failed_deliveries", + ], + UnrecognizedStr, +] +r"""Output only. The state of the webhook.""" + + WebhookSubscribedEvent = Union[ Literal[ # Batch processing finished successfully. @@ -46,22 +57,9 @@ ] -WebhookState = Union[ - Literal[ - "enabled", - "disabled", - "disabled_due_to_failed_deliveries", - ], - UnrecognizedStr, -] -r"""Output only. The state of the webhook.""" - - class WebhookTypedDict(TypedDict): r"""A Webhook resource.""" - uri: str - r"""Required. The URI to which webhook events will be sent.""" subscribed_events: List[WebhookSubscribedEvent] r"""Required. The events that the webhook is subscribed to. Available events: @@ -73,28 +71,27 @@ class WebhookTypedDict(TypedDict): - interaction.failed - video.generated """ - name: NotRequired[str] - r"""Optional. The user-provided name of the webhook.""" + uri: str + r"""Required. The URI to which webhook events will be sent.""" create_time: NotRequired[datetime] r"""Output only. The timestamp when the webhook was created.""" - update_time: NotRequired[datetime] - r"""Output only. The timestamp when the webhook was last updated.""" + id: NotRequired[str] + r"""Output only. The ID of the webhook.""" + name: NotRequired[str] + r"""Optional. The user-provided name of the webhook.""" + new_signing_secret: NotRequired[str] + r"""Output only. The new signing secret for the webhook. Only populated on create.""" signing_secrets: NotRequired[List[SigningSecretTypedDict]] r"""Output only. The signing secrets associated with this webhook.""" state: NotRequired[WebhookState] r"""Output only. The state of the webhook.""" - new_signing_secret: NotRequired[str] - r"""Output only. The new signing secret for the webhook. Only populated on create.""" - id: NotRequired[str] - r"""Output only. The ID of the webhook.""" + update_time: NotRequired[datetime] + r"""Output only. The timestamp when the webhook was last updated.""" class Webhook(BaseModel): r"""A Webhook resource.""" - uri: str - r"""Required. The URI to which webhook events will be sent.""" - subscribed_events: List[WebhookSubscribedEvent] r"""Required. The events that the webhook is subscribed to. Available events: @@ -107,14 +104,20 @@ class Webhook(BaseModel): - video.generated """ - name: Optional[str] = None - r"""Optional. The user-provided name of the webhook.""" + uri: str + r"""Required. The URI to which webhook events will be sent.""" create_time: Optional[datetime] = None r"""Output only. The timestamp when the webhook was created.""" - update_time: Optional[datetime] = None - r"""Output only. The timestamp when the webhook was last updated.""" + id: Optional[str] = None + r"""Output only. The ID of the webhook.""" + + name: Optional[str] = None + r"""Optional. The user-provided name of the webhook.""" + + new_signing_secret: Optional[str] = None + r"""Output only. The new signing secret for the webhook. Only populated on create.""" signing_secrets: Optional[List[SigningSecret]] = None r"""Output only. The signing secrets associated with this webhook.""" @@ -122,23 +125,20 @@ class Webhook(BaseModel): state: Optional[WebhookState] = None r"""Output only. The state of the webhook.""" - new_signing_secret: Optional[str] = None - r"""Output only. The new signing secret for the webhook. Only populated on create.""" - - id: Optional[str] = None - r"""Output only. The ID of the webhook.""" + update_time: Optional[datetime] = None + r"""Output only. The timestamp when the webhook was last updated.""" @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ - "name", "create_time", - "update_time", + "id", + "name", + "new_signing_secret", "signing_secrets", "state", - "new_signing_secret", - "id", + "update_time", ] ) serialized = handler(self) @@ -158,8 +158,6 @@ def serialize_model(self, handler): class WebhookInputParam(TypedDict): r"""A Webhook resource.""" - uri: str - r"""Required. The URI to which webhook events will be sent.""" subscribed_events: List[WebhookSubscribedEvent] r"""Required. The events that the webhook is subscribed to. Available events: @@ -171,6 +169,8 @@ class WebhookInputParam(TypedDict): - interaction.failed - video.generated """ + uri: str + r"""Required. The URI to which webhook events will be sent.""" name: NotRequired[str] r"""Optional. The user-provided name of the webhook.""" @@ -178,9 +178,6 @@ class WebhookInputParam(TypedDict): class WebhookInput(BaseModel): r"""A Webhook resource.""" - uri: str - r"""Required. The URI to which webhook events will be sent.""" - subscribed_events: List[WebhookSubscribedEvent] r"""Required. The events that the webhook is subscribed to. Available events: @@ -193,6 +190,9 @@ class WebhookInput(BaseModel): - video.generated """ + uri: str + r"""Required. The URI to which webhook events will be sent.""" + name: Optional[str] = None r"""Optional. The user-provided name of the webhook.""" diff --git a/google/genai/_gaos/types/webhooks/webhooklistresponse.py b/google/genai/_gaos/types/webhooks/webhooklistresponse.py index f42ff488b..86d0cefca 100644 --- a/google/genai/_gaos/types/webhooks/webhooklistresponse.py +++ b/google/genai/_gaos/types/webhooks/webhooklistresponse.py @@ -27,28 +27,28 @@ class WebhookListResponseTypedDict(TypedDict): r"""Response message for WebhookService.ListWebhooks.""" - webhooks: NotRequired[List[WebhookTypedDict]] - r"""The webhooks.""" next_page_token: NotRequired[str] r"""A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. """ + webhooks: NotRequired[List[WebhookTypedDict]] + r"""The webhooks.""" class WebhookListResponse(BaseModel): r"""Response message for WebhookService.ListWebhooks.""" - webhooks: Optional[List[Webhook]] = None - r"""The webhooks.""" - next_page_token: Optional[str] = None r"""A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. """ + webhooks: Optional[List[Webhook]] = None + r"""The webhooks.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["webhooks", "next_page_token"]) + optional_fields = set(["next_page_token", "webhooks"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/types/webhooks/webhookupdate.py b/google/genai/_gaos/types/webhooks/webhookupdate.py index 48bc636c2..63cebd2d2 100644 --- a/google/genai/_gaos/types/webhooks/webhookupdate.py +++ b/google/genai/_gaos/types/webhooks/webhookupdate.py @@ -23,6 +23,14 @@ from typing_extensions import NotRequired, TypedDict +WebhookUpdateState = Literal[ + "enabled", + "disabled", + "disabled_due_to_failed_deliveries", +] +r"""Optional. The state of the webhook.""" + + WebhookUpdateSubscribedEvent = Union[ Literal[ # Batch processing finished successfully. @@ -44,19 +52,11 @@ ] -WebhookUpdateState = Literal[ - "enabled", - "disabled", - "disabled_due_to_failed_deliveries", -] -r"""Optional. The state of the webhook.""" - - class WebhookUpdateParam(TypedDict): name: NotRequired[str] r"""Optional. The user-provided name of the webhook.""" - uri: NotRequired[str] - r"""Optional. The URI to which webhook events will be sent.""" + state: NotRequired[WebhookUpdateState] + r"""Optional. The state of the webhook.""" subscribed_events: NotRequired[List[WebhookUpdateSubscribedEvent]] r"""Optional. The events that the webhook is subscribed to. Available events: @@ -68,16 +68,16 @@ class WebhookUpdateParam(TypedDict): - interaction.failed - video.generated """ - state: NotRequired[WebhookUpdateState] - r"""Optional. The state of the webhook.""" + uri: NotRequired[str] + r"""Optional. The URI to which webhook events will be sent.""" class WebhookUpdate(BaseModel): name: Optional[str] = None r"""Optional. The user-provided name of the webhook.""" - uri: Optional[str] = None - r"""Optional. The URI to which webhook events will be sent.""" + state: Optional[WebhookUpdateState] = None + r"""Optional. The state of the webhook.""" subscribed_events: Optional[List[WebhookUpdateSubscribedEvent]] = None r"""Optional. The events that the webhook is subscribed to. @@ -91,12 +91,12 @@ class WebhookUpdate(BaseModel): - video.generated """ - state: Optional[WebhookUpdateState] = None - r"""Optional. The state of the webhook.""" + uri: Optional[str] = None + r"""Optional. The URI to which webhook events will be sent.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["name", "uri", "subscribed_events", "state"]) + optional_fields = set(["name", "state", "subscribed_events", "uri"]) serialized = handler(self) m = {} diff --git a/google/genai/_gaos/webhooks.py b/google/genai/_gaos/webhooks.py index 3e195052e..e5939301d 100644 --- a/google/genai/_gaos/webhooks.py +++ b/google/genai/_gaos/webhooks.py @@ -44,8 +44,8 @@ def with_streaming_response(self): def create( self, *, - uri: str, subscribed_events: Iterable[webhooks_webhook.WebhookSubscribedEvent], + uri: str, api_version: Optional[str] = None, name: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, @@ -55,7 +55,6 @@ def create( ) -> webhooks.Webhook: r"""Creates a new Webhook. - :param uri: Required. The URI to which webhook events will be sent. :param subscribed_events: Required. The events that the webhook is subscribed to. Available events: - batch.succeeded @@ -65,6 +64,7 @@ def create( - interaction.completed - interaction.failed - video.generated + :param uri: Required. The URI to which webhook events will be sent. :param api_version: Which version of the API to use. :param name: Optional. The user-provided name of the webhook. :param extra_headers: Additional headers to set or replace on requests. @@ -90,10 +90,10 @@ def create( api_version=api_version, body=webhooks.WebhookInput( name=name, - uri=uri, subscribed_events=utils.unmarshal( subscribed_events, List[webhooks.WebhookSubscribedEvent] ), + uri=uri, ), ) @@ -532,11 +532,11 @@ def update( api_version: Optional[str] = None, update_mask: Optional[str] = None, name: Optional[str] = None, - uri: Optional[str] = None, + state: Optional[webhooks_webhookupdate.WebhookUpdateState] = None, subscribed_events: Optional[ Iterable[webhooks_webhookupdate.WebhookUpdateSubscribedEvent] ] = None, - state: Optional[webhooks_webhookupdate.WebhookUpdateState] = None, + uri: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -548,7 +548,7 @@ def update( :param api_version: Which version of the API to use. :param update_mask: Optional. The list of fields to update. :param name: Optional. The user-provided name of the webhook. - :param uri: Optional. The URI to which webhook events will be sent. + :param state: Optional. The state of the webhook. :param subscribed_events: Optional. The events that the webhook is subscribed to. Available events: - batch.succeeded @@ -558,7 +558,7 @@ def update( - interaction.completed - interaction.failed - video.generated - :param state: Optional. The state of the webhook. + :param uri: Optional. The URI to which webhook events will be sent. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -584,12 +584,12 @@ def update( update_mask=update_mask, body=webhooks.WebhookUpdate( name=name, - uri=uri, + state=state, subscribed_events=utils.unmarshal( subscribed_events, Optional[List[webhooks.WebhookUpdateSubscribedEvent]], ), - state=state, + uri=uri, ), ) @@ -1264,8 +1264,8 @@ def with_streaming_response(self): async def create( self, *, - uri: str, subscribed_events: Iterable[webhooks_webhook.WebhookSubscribedEvent], + uri: str, api_version: Optional[str] = None, name: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, @@ -1275,7 +1275,6 @@ async def create( ) -> webhooks.Webhook: r"""Creates a new Webhook. - :param uri: Required. The URI to which webhook events will be sent. :param subscribed_events: Required. The events that the webhook is subscribed to. Available events: - batch.succeeded @@ -1285,6 +1284,7 @@ async def create( - interaction.completed - interaction.failed - video.generated + :param uri: Required. The URI to which webhook events will be sent. :param api_version: Which version of the API to use. :param name: Optional. The user-provided name of the webhook. :param extra_headers: Additional headers to set or replace on requests. @@ -1310,10 +1310,10 @@ async def create( api_version=api_version, body=webhooks.WebhookInput( name=name, - uri=uri, subscribed_events=utils.unmarshal( subscribed_events, List[webhooks.WebhookSubscribedEvent] ), + uri=uri, ), ) @@ -1761,11 +1761,11 @@ async def update( api_version: Optional[str] = None, update_mask: Optional[str] = None, name: Optional[str] = None, - uri: Optional[str] = None, + state: Optional[webhooks_webhookupdate.WebhookUpdateState] = None, subscribed_events: Optional[ Iterable[webhooks_webhookupdate.WebhookUpdateSubscribedEvent] ] = None, - state: Optional[webhooks_webhookupdate.WebhookUpdateState] = None, + uri: Optional[str] = None, extra_headers: Optional[Mapping[str, str]] = None, extra_query: Optional[Mapping[str, Any]] = None, extra_body: Optional[Mapping[str, Any]] = None, @@ -1777,7 +1777,7 @@ async def update( :param api_version: Which version of the API to use. :param update_mask: Optional. The list of fields to update. :param name: Optional. The user-provided name of the webhook. - :param uri: Optional. The URI to which webhook events will be sent. + :param state: Optional. The state of the webhook. :param subscribed_events: Optional. The events that the webhook is subscribed to. Available events: - batch.succeeded @@ -1787,7 +1787,7 @@ async def update( - interaction.completed - interaction.failed - video.generated - :param state: Optional. The state of the webhook. + :param uri: Optional. The URI to which webhook events will be sent. :param extra_headers: Additional headers to set or replace on requests. :param extra_query: Additional query parameters to append to requests. :param extra_body: Additional JSON object fields to merge into request bodies. @@ -1813,12 +1813,12 @@ async def update( update_mask=update_mask, body=webhooks.WebhookUpdate( name=name, - uri=uri, + state=state, subscribed_events=utils.unmarshal( subscribed_events, Optional[List[webhooks.WebhookUpdateSubscribedEvent]], ), - state=state, + uri=uri, ), )