From 385150358c61a6b05ebabb8166c2dc16ffbeb633 Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Thu, 21 May 2026 21:36:30 -0700 Subject: [PATCH] chore:test PiperOrigin-RevId: 919428423 --- google/genai/_common.py | 40 +- .../genai/_interactions/resources/agents.py | 877 ++--- .../_interactions/resources/interactions.py | 2968 ++++++++--------- .../genai/_interactions/resources/webhooks.py | 1700 +++++----- google/genai/_interactions/types/__init__.py | 169 +- google/genai/_interactions/types/agent.py | 154 +- .../types/agent_create_params.py | 87 +- .../types/agent_delete_response.py | 19 +- .../_interactions/types/agent_list_params.py | 12 +- .../types/agent_list_response.py | 8 +- .../_interactions/types/allowed_tools.py | 9 +- .../types/allowed_tools_param.py | 17 +- .../genai/_interactions/types/annotation.py | 13 +- .../_interactions/types/annotation_param.py | 9 +- .../_interactions/types/audio_content.py | 41 +- .../types/audio_content_param.py | 37 +- .../types/audio_response_format.py | 22 +- .../types/audio_response_format_param.py | 21 +- .../types/code_execution_call_arguments.py | 22 +- .../code_execution_call_arguments_param.py | 33 + .../types/code_execution_call_step.py | 29 +- .../types/code_execution_call_step_param.py | 34 +- .../types/code_execution_result_step.py | 18 +- .../types/code_execution_result_step_param.py | 27 +- google/genai/_interactions/types/content.py | 11 +- .../_interactions/types/content_param.py | 13 +- .../types/deep_research_agent_config.py | 21 +- .../types/deep_research_agent_config_param.py | 24 +- .../_interactions/types/document_content.py | 22 +- .../types/document_content_param.py | 20 +- .../types/dynamic_agent_config.py | 19 +- .../types/dynamic_agent_config_param.py | 11 +- .../genai/_interactions/types/environment.py | 56 +- .../_interactions/types/environment_param.py | 71 +- .../genai/_interactions/types/error_event.py | 21 +- .../_interactions/types/file_citation.py | 25 +- .../types/file_citation_param.py | 28 +- .../types/file_search_call_step.py | 10 +- .../types/file_search_call_step_param.py | 19 +- .../types/file_search_result_step.py | 18 +- .../types/file_search_result_step_param.py | 19 +- google/genai/_interactions/types/function.py | 17 +- .../_interactions/types/function_call_step.py | 16 +- .../types/function_call_step_param.py | 26 +- .../_interactions/types/function_param.py | 19 +- .../types/function_result_step.py | 30 +- .../types/function_result_step_param.py | 36 +- .../types/function_result_subcontent_param.py | 27 + .../_interactions/types/generation_config.py | 27 +- .../types/generation_config_param.py | 37 +- .../types/google_maps_call_arguments.py | 7 +- .../types/google_maps_call_arguments_param.py | 30 + .../types/google_maps_call_step.py | 20 +- .../types/google_maps_call_step_param.py | 31 +- .../_interactions/types/google_maps_result.py | 53 +- .../types/google_maps_result_item_param.py | 32 + .../types/google_maps_result_places_param.py | 36 + ...google_maps_result_review_snippet_param.py | 37 + .../types/google_maps_result_step.py | 55 +- .../types/google_maps_result_step_param.py | 58 +- ...e_maps_result_step_review_snippet_param.py | 37 + .../types/google_search_call_arguments.py | 7 +- .../google_search_call_arguments_param.py | 30 + .../types/google_search_call_step.py | 23 +- .../types/google_search_call_step_param.py | 32 +- .../types/google_search_result.py | 7 +- .../types/google_search_result_item_param.py | 29 + .../types/google_search_result_step.py | 21 +- .../types/google_search_result_step_param.py | 37 +- .../genai/_interactions/types/image_config.py | 15 +- .../_interactions/types/image_config_param.py | 16 +- .../_interactions/types/image_content.py | 32 +- .../types/image_content_param.py | 28 +- .../types/image_response_format.py | 18 +- .../types/image_response_format_param.py | 21 +- .../genai/_interactions/types/interaction.py | 377 +-- .../types/interaction_completed_event.py | 21 +- .../types/interaction_create_params.py | 313 +- .../types/interaction_created_event.py | 16 +- .../types/interaction_get_params.py | 37 +- .../types/interaction_sse_event.py | 30 +- .../types/interaction_status_update.py | 18 +- .../types/mcp_server_tool_call_step.py | 17 +- .../types/mcp_server_tool_call_step_param.py | 27 +- .../types/mcp_server_tool_result_step.py | 28 +- .../mcp_server_tool_result_step_param.py | 36 +- google/genai/_interactions/types/model.py | 32 +- .../_interactions/types/model_output_step.py | 9 +- .../types/model_output_step_param.py | 13 +- .../genai/_interactions/types/model_param.py | 32 +- .../_interactions/types/place_citation.py | 40 +- .../types/place_citation_param.py | 48 +- .../_interactions/types/response_modality.py | 23 + .../types/response_modality_param.py | 23 + .../types/review_snippet_param.py | 37 + .../_interactions/types/signing_secret.py | 13 +- .../_interactions/types/speech_config.py | 9 +- .../types/speech_config_param.py | 10 +- google/genai/_interactions/types/step.py | 46 +- .../genai/_interactions/types/step_delta.py | 388 +-- .../genai/_interactions/types/step_param.py | 43 +- .../genai/_interactions/types/step_start.py | 32 +- google/genai/_interactions/types/step_stop.py | 27 +- .../genai/_interactions/types/text_content.py | 13 +- .../_interactions/types/text_content_param.py | 15 +- .../types/text_response_format.py | 23 +- .../types/text_response_format_param.py | 23 +- .../_interactions/types/thinking_level.py | 9 +- .../genai/_interactions/types/thought_step.py | 37 +- .../_interactions/types/thought_step_param.py | 30 +- .../types/thought_summary_content_param.py | 27 + google/genai/_interactions/types/tool.py | 110 +- .../_interactions/types/tool_choice_config.py | 8 +- .../types/tool_choice_config_param.py | 8 +- .../_interactions/types/tool_choice_type.py | 5 +- .../types/tool_choice_type_param.py | 23 + .../genai/_interactions/types/tool_param.py | 127 +- .../genai/_interactions/types/url_citation.py | 21 +- .../_interactions/types/url_citation_param.py | 24 +- .../types/url_context_call_arguments.py | 11 +- .../types/url_context_call_arguments_param.py | 30 + .../types/url_context_call_step.py | 22 +- .../types/url_context_call_step_param.py | 31 +- .../_interactions/types/url_context_result.py | 12 +- .../types/url_context_result_item_param.py | 33 + .../types/url_context_result_step.py | 24 +- .../types/url_context_result_step_param.py | 40 +- google/genai/_interactions/types/usage.py | 74 +- .../genai/_interactions/types/usage_param.py | 87 +- .../_interactions/types/user_input_step.py | 9 +- .../types/user_input_step_param.py | 13 +- .../_interactions/types/video_content.py | 40 +- .../types/video_content_param.py | 36 +- google/genai/_interactions/types/webhook.py | 115 +- .../_interactions/types/webhook_config.py | 21 +- .../types/webhook_config_param.py | 24 +- .../types/webhook_create_params.py | 82 +- .../types/webhook_delete_response.py | 19 +- .../_interactions/types/webhook_get_params.py | 33 + .../types/webhook_list_params.py | 23 +- .../types/webhook_list_response.py | 15 +- .../types/webhook_ping_params.py | 50 +- .../types/webhook_ping_response.py | 5 +- .../webhook_rotate_signing_secret_params.py | 19 +- .../webhook_rotate_signing_secret_response.py | 7 +- .../types/webhook_update_params.py | 121 +- 146 files changed, 5709 insertions(+), 5256 deletions(-) create mode 100644 google/genai/_interactions/types/code_execution_call_arguments_param.py create mode 100644 google/genai/_interactions/types/function_result_subcontent_param.py create mode 100644 google/genai/_interactions/types/google_maps_call_arguments_param.py create mode 100644 google/genai/_interactions/types/google_maps_result_item_param.py create mode 100644 google/genai/_interactions/types/google_maps_result_places_param.py create mode 100644 google/genai/_interactions/types/google_maps_result_review_snippet_param.py create mode 100644 google/genai/_interactions/types/google_maps_result_step_review_snippet_param.py create mode 100644 google/genai/_interactions/types/google_search_call_arguments_param.py create mode 100644 google/genai/_interactions/types/google_search_result_item_param.py create mode 100644 google/genai/_interactions/types/response_modality.py create mode 100644 google/genai/_interactions/types/response_modality_param.py create mode 100644 google/genai/_interactions/types/review_snippet_param.py create mode 100644 google/genai/_interactions/types/thought_summary_content_param.py create mode 100644 google/genai/_interactions/types/tool_choice_type_param.py create mode 100644 google/genai/_interactions/types/url_context_call_arguments_param.py create mode 100644 google/genai/_interactions/types/url_context_result_item_param.py create mode 100644 google/genai/_interactions/types/webhook_get_params.py diff --git a/google/genai/_common.py b/google/genai/_common.py index f4a6984f7..f90d8795f 100644 --- a/google/genai/_common.py +++ b/google/genai/_common.py @@ -23,17 +23,53 @@ import logging import re import typing -from typing import Any, Callable, FrozenSet, Optional, Union, get_args, get_origin +from typing import Any, Callable, FrozenSet, Optional, Union, get_args, get_origin, TYPE_CHECKING, TypeVar, overload import uuid import warnings import pydantic from pydantic import alias_generators -from typing_extensions import TypeAlias +from typing_extensions import Protocol, SupportsIndex, TypeAlias logger = logging.getLogger('google_genai._common') StringDict: TypeAlias = dict[str, Any] +_T_co = TypeVar("_T_co", covariant=True) + +if TYPE_CHECKING: + # This works because str.__contains__ does not accept object (either in typeshed or at runtime) + # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + # + # Note: index() and count() methods are intentionally omitted to allow pyright to properly + # infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr. + class SequenceNotStr(Protocol[_T_co]): + + @overload + def __getitem__(self, index: SupportsIndex, /) -> _T_co: + ... + + @overload + def __getitem__(self, index: slice, /) -> typing.Sequence[_T_co]: + ... + + def __contains__(self, value: object, /) -> bool: + ... + + def __len__(self) -> int: + ... + + def __iter__(self) -> typing.Iterator[_T_co]: + ... + + def __reversed__(self) -> typing.Iterator[_T_co]: + ... + +else: + # just point this to a normal `Sequence` at runtime to avoid having to special case + # deserializing our custom sequence type + SequenceNotStr = typing.Sequence + + class ExperimentalWarning(Warning): """Warning for experimental features.""" diff --git a/google/genai/_interactions/resources/agents.py b/google/genai/_interactions/resources/agents.py index 1bbbe9975..566bc659c 100644 --- a/google/genai/_interactions/resources/agents.py +++ b/google/genai/_interactions/resources/agents.py @@ -17,163 +17,168 @@ from __future__ import annotations -from typing import Iterable +from typing import Iterable, List, Union import httpx +from typing_extensions import Literal -from ..types import agent_list_params, agent_create_params -from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._base_client import make_request_options from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource +from .._resource import AsyncAPIResource, SyncAPIResource from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, + to_raw_response_wrapper, + to_streamed_response_wrapper, ) +from .._types import Body, Headers, NotGiven, Omit, Query, not_given, omit +from .._utils import async_maybe_transform, maybe_transform +from ..types import agent_create_params, agent_list_params from ..types.agent import Agent -from .._base_client import make_request_options -from ..types.agent_list_response import AgentListResponse from ..types.agent_delete_response import AgentDeleteResponse +from ..types.agent_list_response import AgentListResponse __all__ = ["AgentsResource", "AsyncAgentsResource"] class AgentsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> AgentsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers - """ - return AgentsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AgentsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response - """ - return AgentsResourceWithStreamingResponse(self) - - def create( - self, - *, - api_version: str | None = None, - id: str | Omit = omit, - base_agent: str | Omit = omit, - base_environment: agent_create_params.BaseEnvironment | Omit = omit, - description: str | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[agent_create_params.Tool] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Agent: - """ - Creates a new Agent (Typed version for SDK). - - Args: - id: The unique identifier for the agent. - - base_agent: The base agent to extend. - - base_environment: The environment configuration for the agent. - - description: Agent description for developers to quickly read and understand. - system_instruction: System instruction for the agent. - - tools: The tools available to the agent. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - return self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path='agents'), - body=maybe_transform( + @cached_property + def with_raw_response(self) -> AgentsResourceWithRawResponse: + """This property can be used as a prefix for any HTTP method call to return + + the raw response object instead of the parsed content. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers + """ + return AgentsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AgentsResourceWithStreamingResponse: + """An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response + """ + return AgentsResourceWithStreamingResponse(self) + + def create( + self, + *, + api_version: str | None = None, + id: str | Omit = omit, + base_agent: str | Omit = omit, + base_environment: agent_create_params.BaseEnvironment | Omit = omit, + description: str | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[agent_create_params.Tool] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Agent: + """Creates a new Agent (Typed version for SDK). + + Args: + id: The unique identifier for the agent. + base_agent: The base agent to extend. + base_environment: The environment configuration for the agent. + description: Agent description for developers to quickly read and + understand. + system_instruction: System instruction for the agent. + tools: The tools available to the agent. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + return self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, path="agents" + ), + body=maybe_transform( + { + "id": id, + "base_agent": base_agent, + "base_environment": base_environment, + "description": description, + "system_instruction": system_instruction, + "tools": tools, + }, + agent_create_params.AgentCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Agent, + ) + + def list( + self, + *, + api_version: str | None = None, + page_size: int | Omit = omit, + page_token: str | Omit = omit, + parent: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AgentListResponse: + """Lists all Agents. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + return self._get( + self._client._build_maybe_vertex_path( + api_version=api_version, path="agents" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( { - "id": id, - "base_agent": base_agent, - "base_environment": base_environment, - "description": description, - "system_instruction": system_instruction, - "tools": tools, + "page_size": page_size, + "page_token": page_token, + "parent": parent, }, - agent_create_params.AgentCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + agent_list_params.AgentListParams, ), - cast_to=Agent, - ) - - def list( - self, - *, - api_version: str | None = None, - page_size: int | Omit = omit, - page_token: str | Omit = omit, - parent: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AgentListResponse: - """ - Lists all Agents. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - return self._get( - self._client._build_maybe_vertex_path(api_version=api_version, path='agents'), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "page_size": page_size, - "page_token": page_token, - "parent": parent, - }, - agent_list_params.AgentListParams, - ), - ), - cast_to=AgentListResponse, - ) + ), + cast_to=AgentListResponse, + ) - def delete( + def delete( self, id: str, *, @@ -185,205 +190,225 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AgentDeleteResponse: - """ - Deletes an Agent. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._delete( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'agents/{id}'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AgentDeleteResponse, - ) - - def get( - self, - id: str, - *, - api_version: str | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Agent: - """ - Gets a specific Agent. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._get( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'agents/{id}'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Agent, - ) + """Deletes an Agent. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return self._delete( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"agents/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=AgentDeleteResponse, + ) + + def get( + self, + id: str, + *, + api_version: str | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Agent: + """Gets a specific Agent. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return self._get( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"agents/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Agent, + ) class AsyncAgentsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncAgentsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncAgentsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAgentsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response - """ - return AsyncAgentsResourceWithStreamingResponse(self) - - async def create( - self, - *, - api_version: str | None = None, - id: str | Omit = omit, - base_agent: str | Omit = omit, - base_environment: agent_create_params.BaseEnvironment | Omit = omit, - description: str | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[agent_create_params.Tool] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Agent: - """ - Creates a new Agent (Typed version for SDK). - - Args: - id: The unique identifier for the agent. - - base_agent: The base agent to extend. - - base_environment: The environment configuration for the agent. - - description: Agent description for developers to quickly read and understand. - system_instruction: System instruction for the agent. - - tools: The tools available to the agent. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - return await self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path='agents'), - body=await async_maybe_transform( + @cached_property + def with_raw_response(self) -> AsyncAgentsResourceWithRawResponse: + """This property can be used as a prefix for any HTTP method call to return + + the raw response object instead of the parsed content. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncAgentsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response( + self, + ) -> AsyncAgentsResourceWithStreamingResponse: + """An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response + """ + return AsyncAgentsResourceWithStreamingResponse(self) + + async def create( + self, + *, + api_version: str | None = None, + id: str | Omit = omit, + base_agent: str | Omit = omit, + base_environment: agent_create_params.BaseEnvironment | Omit = omit, + description: str | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[agent_create_params.Tool] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Agent: + """Creates a new Agent (Typed version for SDK). + + Args: + id: The unique identifier for the agent. + base_agent: The base agent to extend. + base_environment: The environment configuration for the agent. + description: Agent description for developers to quickly read and + understand. + system_instruction: System instruction for the agent. + tools: The tools available to the agent. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + return await self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, path="agents" + ), + body=await async_maybe_transform( + { + "id": id, + "base_agent": base_agent, + "base_environment": base_environment, + "description": description, + "system_instruction": system_instruction, + "tools": tools, + }, + agent_create_params.AgentCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Agent, + ) + + async def list( + self, + *, + api_version: str | None = None, + page_size: int | Omit = omit, + page_token: str | Omit = omit, + parent: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AgentListResponse: + """Lists all Agents. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + return await self._get( + self._client._build_maybe_vertex_path( + api_version=api_version, path="agents" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( { - "id": id, - "base_agent": base_agent, - "base_environment": base_environment, - "description": description, - "system_instruction": system_instruction, - "tools": tools, + "page_size": page_size, + "page_token": page_token, + "parent": parent, }, - agent_create_params.AgentCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Agent, - ) - - async def list( - self, - *, - api_version: str | None = None, - page_size: int | Omit = omit, - page_token: str | Omit = omit, - parent: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AgentListResponse: - """ - Lists all Agents. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - return await self._get( - self._client._build_maybe_vertex_path(api_version=api_version, path='agents'), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "page_size": page_size, - "page_token": page_token, - "parent": parent, - }, - agent_list_params.AgentListParams, - ), + agent_list_params.AgentListParams, ), - cast_to=AgentListResponse, - ) + ), + cast_to=AgentListResponse, + ) - async def delete( + async def delete( self, id: str, *, @@ -395,138 +420,156 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AgentDeleteResponse: - """ - Deletes an Agent. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._delete( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'agents/{id}'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AgentDeleteResponse, - ) - - async def get( - self, - id: str, - *, - api_version: str | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Agent: - """ - Gets a specific Agent. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._get( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'agents/{id}'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Agent, - ) + """Deletes an Agent. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return await self._delete( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"agents/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=AgentDeleteResponse, + ) + + async def get( + self, + id: str, + *, + api_version: str | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Agent: + """Gets a specific Agent. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return await self._get( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"agents/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Agent, + ) class AgentsResourceWithRawResponse: - def __init__(self, agents: AgentsResource) -> None: - self._agents = agents - self.create = to_raw_response_wrapper( + def __init__(self, agents: AgentsResource) -> None: + self._agents = agents + + self.create = to_raw_response_wrapper( agents.create, ) - self.list = to_raw_response_wrapper( + self.list = to_raw_response_wrapper( agents.list, ) - self.delete = to_raw_response_wrapper( + self.delete = to_raw_response_wrapper( agents.delete, ) - self.get = to_raw_response_wrapper( + self.get = to_raw_response_wrapper( agents.get, ) class AsyncAgentsResourceWithRawResponse: - def __init__(self, agents: AsyncAgentsResource) -> None: - self._agents = agents - self.create = async_to_raw_response_wrapper( + def __init__(self, agents: AsyncAgentsResource) -> None: + self._agents = agents + + self.create = async_to_raw_response_wrapper( agents.create, ) - self.list = async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( agents.list, ) - self.delete = async_to_raw_response_wrapper( + self.delete = async_to_raw_response_wrapper( agents.delete, ) - self.get = async_to_raw_response_wrapper( + self.get = async_to_raw_response_wrapper( agents.get, ) class AgentsResourceWithStreamingResponse: - def __init__(self, agents: AgentsResource) -> None: - self._agents = agents - self.create = to_streamed_response_wrapper( + def __init__(self, agents: AgentsResource) -> None: + self._agents = agents + + self.create = to_streamed_response_wrapper( agents.create, ) - self.list = to_streamed_response_wrapper( + self.list = to_streamed_response_wrapper( agents.list, ) - self.delete = to_streamed_response_wrapper( + self.delete = to_streamed_response_wrapper( agents.delete, ) - self.get = to_streamed_response_wrapper( + self.get = to_streamed_response_wrapper( agents.get, ) class AsyncAgentsResourceWithStreamingResponse: - def __init__(self, agents: AsyncAgentsResource) -> None: - self._agents = agents - self.create = async_to_streamed_response_wrapper( + def __init__(self, agents: AsyncAgentsResource) -> None: + self._agents = agents + + self.create = async_to_streamed_response_wrapper( agents.create, ) - self.list = async_to_streamed_response_wrapper( + self.list = async_to_streamed_response_wrapper( agents.list, ) - self.delete = async_to_streamed_response_wrapper( + self.delete = async_to_streamed_response_wrapper( agents.delete, ) - self.get = async_to_streamed_response_wrapper( - agents.get, - ) + self.get = async_to_streamed_response_wrapper( + agents.get, + ) diff --git a/google/genai/_interactions/resources/interactions.py b/google/genai/_interactions/resources/interactions.py index 274c546c9..9d95dae1b 100644 --- a/google/genai/_interactions/resources/interactions.py +++ b/google/genai/_interactions/resources/interactions.py @@ -17,1580 +17,1550 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, overload +from typing import Iterable, List, Union import httpx +from typing_extensions import Literal, overload -from ..types import interaction_get_params, interaction_create_params -from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import required_args, maybe_transform, async_maybe_transform -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._streaming import Stream, AsyncStream from .._base_client import make_request_options +from .._compat import cached_property from .._legacy_lyria import ( - LegacyLyriaInteractionStream, LegacyLyriaInteractionAsyncStream, - LegacyLyriaInteractionDetectingStream, LegacyLyriaInteractionDetectingAsyncStream, + LegacyLyriaInteractionDetectingStream, + LegacyLyriaInteractionStream, is_legacy_lyria_request, ) -from ..types.tool_param import ToolParam +from .._resource import AsyncAPIResource, SyncAPIResource +from .._response import ( + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, + to_raw_response_wrapper, + to_streamed_response_wrapper, +) +from .._streaming import AsyncStream, Stream +from .._types import Body, Headers, NotGiven, Omit, Query, not_given, omit +from .._utils import async_maybe_transform, maybe_transform, required_args +from ..types import interaction_create_params, interaction_get_params +from ..types.generation_config_param import GenerationConfigParam from ..types.interaction import Interaction +from ..types.interaction_sse_event import InteractionSSEEvent from ..types.model_param import ModelParam +from ..types.tool_param import ToolParam from ..types.webhook_config_param import WebhookConfigParam -from ..types.interaction_sse_event import InteractionSSEEvent -from ..types.generation_config_param import GenerationConfigParam __all__ = ["InteractionsResource", "AsyncInteractionsResource"] class InteractionsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> InteractionsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers - """ - return InteractionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> InteractionsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response - """ - return InteractionsResourceWithStreamingResponse(self) - - @overload - def create( - self, - *, - api_version: str | None = None, - input: interaction_create_params.Input, - model: ModelParam, - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - generation_config: GenerationConfigParam | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - stream: Literal[False] | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction: - """ - Creates a new interaction. - - Args: - input: The input for the interaction. - - model: The name of the `Model` used for generating the interaction. - - background: Input only. Whether to run the model interaction in the background. - - environment: The environment configuration for the interaction. Can be an object specifying - remote environment sources or a string referencing an existing environment ID. - - generation_config: Input only. Configuration parameters for the model interaction. - - previous_interaction_id: The ID of the previous interaction, if any. - - response_format: Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - - response_mime_type: The mime type of the response. This is required if response_format is set. - - response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - - service_tier: The service tier for the interaction. - - store: Input only. Whether to store the response and request for later retrieval. - - stream: Input only. Whether the interaction will be streamed. - - system_instruction: System instruction for the interaction. - - tools: A list of tool declarations the model may call during interaction. - - webhook_config: Optional. Webhook configuration for receiving notifications when the interaction - completes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def create( - self, - *, - api_version: str | None = None, - input: interaction_create_params.Input, - model: ModelParam, - stream: Literal[True], - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - generation_config: GenerationConfigParam | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Stream[InteractionSSEEvent]: - """ - Creates a new interaction. - - Args: - input: The input for the interaction. - - model: The name of the `Model` used for generating the interaction. - - stream: Input only. Whether the interaction will be streamed. - - background: Input only. Whether to run the model interaction in the background. - - environment: The environment configuration for the interaction. Can be an object specifying - remote environment sources or a string referencing an existing environment ID. - - generation_config: Input only. Configuration parameters for the model interaction. - - previous_interaction_id: The ID of the previous interaction, if any. - - response_format: Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - - response_mime_type: The mime type of the response. This is required if response_format is set. - - response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - service_tier: The service tier for the interaction. - - store: Input only. Whether to store the response and request for later retrieval. - - system_instruction: System instruction for the interaction. - - tools: A list of tool declarations the model may call during interaction. - - webhook_config: Optional. Webhook configuration for receiving notifications when the interaction - completes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def create( - self, - *, - api_version: str | None = None, - agent: Union[ - Literal[ - "deep-research-pro-preview-12-2025", - "deep-research-preview-04-2026", - "deep-research-max-preview-04-2026", - ], - str, - ], - input: interaction_create_params.Input, - agent_config: interaction_create_params.AgentConfig | Omit = omit, - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - stream: Literal[False] | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction: - """ - Creates a new interaction. - - Args: - agent: The name of the `Agent` used for generating the interaction. - - input: The input for the interaction. - - agent_config: Configuration parameters for the agent interaction. - - background: Input only. Whether to run the model interaction in the background. - - environment: The environment configuration for the interaction. Can be an object specifying - remote environment sources or a string referencing an existing environment ID. - - previous_interaction_id: The ID of the previous interaction, if any. - - response_format: Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - - response_mime_type: The mime type of the response. This is required if response_format is set. - - response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - - service_tier: The service tier for the interaction. - - store: Input only. Whether to store the response and request for later retrieval. - - stream: Input only. Whether the interaction will be streamed. - - system_instruction: System instruction for the interaction. - - tools: A list of tool declarations the model may call during interaction. - - webhook_config: Optional. Webhook configuration for receiving notifications when the interaction - completes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def create( - self, - *, - api_version: str | None = None, - agent: Union[ - Literal[ - "deep-research-pro-preview-12-2025", - "deep-research-preview-04-2026", - "deep-research-max-preview-04-2026", - ], - str, - ], - input: interaction_create_params.Input, - stream: Literal[True], - agent_config: interaction_create_params.AgentConfig | Omit = omit, - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Stream[InteractionSSEEvent]: - """ - Creates a new interaction. - - Args: - agent: The name of the `Agent` used for generating the interaction. - - input: The input for the interaction. - - stream: Input only. Whether the interaction will be streamed. - - agent_config: Configuration parameters for the agent interaction. - - background: Input only. Whether to run the model interaction in the background. - - environment: The environment configuration for the interaction. Can be an object specifying - remote environment sources or a string referencing an existing environment ID. - - previous_interaction_id: The ID of the previous interaction, if any. - - response_format: Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - - response_mime_type: The mime type of the response. This is required if response_format is set. - - response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - - service_tier: The service tier for the interaction. - - store: Input only. Whether to store the response and request for later retrieval. - - system_instruction: System instruction for the interaction. - - tools: A list of tool declarations the model may call during interaction. - - webhook_config: Optional. Webhook configuration for receiving notifications when the interaction - completes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def create( - self, - *, - api_version: str | None = None, - input: interaction_create_params.Input, - model: ModelParam, - stream: bool, - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - generation_config: GenerationConfigParam | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction | Stream[InteractionSSEEvent]: - """ - Creates a new interaction. - - Args: - input: The input for the interaction. - - model: The name of the `Model` used for generating the interaction. - - stream: Input only. Whether the interaction will be streamed. - - background: Input only. Whether to run the model interaction in the background. - - environment: The environment configuration for the interaction. Can be an object specifying - remote environment sources or a string referencing an existing environment ID. - - generation_config: Input only. Configuration parameters for the model interaction. - - previous_interaction_id: The ID of the previous interaction, if any. - - response_format: Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - - response_mime_type: The mime type of the response. This is required if response_format is set. - - response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - - service_tier: The service tier for the interaction. - - store: Input only. Whether to store the response and request for later retrieval. - - system_instruction: System instruction for the interaction. - - tools: A list of tool declarations the model may call during interaction. - - webhook_config: Optional. Webhook configuration for receiving notifications when the interaction - completes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @required_args(["input", "model"], ["input", "model", "stream"], ["agent", "input"], ["agent", "input", "stream"]) - def create( - self, - *, - api_version: str | None = None, - input: interaction_create_params.Input, - model: ModelParam | Omit = omit, - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - generation_config: GenerationConfigParam | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - agent: Union[ - Literal[ - "deep-research-pro-preview-12-2025", - "deep-research-preview-04-2026", - "deep-research-max-preview-04-2026", - ], - str, - ] - | Omit = omit, - agent_config: interaction_create_params.AgentConfig | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction | Stream[InteractionSSEEvent]: - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if model is not omit and agent_config is not omit: - raise ValueError("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.") - if agent is not omit and generation_config is not omit: - raise ValueError("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.") - - # For streaming requests against vertex+legacy-lyria, swap in the - # Stream subclass that activates the per-event SSE remap during - # iteration. Non-streaming and `get()` paths don't need any resource- - # layer signal here — `Interaction._maybe_coerce_outputs` looks at the - # response body's `model` field directly. - stream_cls = ( - LegacyLyriaInteractionStream[InteractionSSEEvent] - if (stream and is_legacy_lyria_request(is_vertex=self._client._is_vertex, model=model)) - else Stream[InteractionSSEEvent] + @cached_property + def with_raw_response(self) -> InteractionsResourceWithRawResponse: + """This property can be used as a prefix for any HTTP method call to return + + the raw response object instead of the parsed content. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers + """ + return InteractionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response( + self, + ) -> InteractionsResourceWithStreamingResponse: + """An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response + """ + return InteractionsResourceWithStreamingResponse(self) + + @overload + def create( + self, + *, + api_version: str | None = None, + input: interaction_create_params.Input, + model: ModelParam, + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + generation_config: GenerationConfigParam | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + stream: Literal[False] | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction: + """Creates a new interaction. + + Args: + input: The input for the interaction. + model: The name of the `Model` used for generating the interaction. + background: Input only. Whether to run the model interaction in the + background. + environment: The environment configuration for the interaction. Can be an + object specifying remote environment sources or a string referencing an + existing environment ID. + generation_config: Input only. Configuration parameters for the model + interaction. + previous_interaction_id: The ID of the previous interaction, if any. + response_format: Enforces that the generated response is a JSON object + that complies with the JSON schema specified in this field. + response_mime_type: The mime type of the response. This is required if + response_format is set. + response_modalities: The requested modalities of the response (TEXT, + IMAGE, AUDIO). + service_tier: The service tier for the interaction. + store: Input only. Whether to store the response and request for later + retrieval. + stream: Input only. Whether the interaction will be streamed. + system_instruction: System instruction for the interaction. + tools: A list of tool declarations the model may call during interaction. + webhook_config: Optional. Webhook configuration for receiving + notifications when the interaction completes. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + def create( + self, + *, + api_version: str | None = None, + input: interaction_create_params.Input, + model: ModelParam, + stream: Literal[True], + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + generation_config: GenerationConfigParam | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Stream[InteractionSSEEvent]: + """Creates a new interaction. + + Args: + input: The input for the interaction. + model: The name of the `Model` used for generating the interaction. + stream: Input only. Whether the interaction will be streamed. + background: Input only. Whether to run the model interaction in the + background. + environment: The environment configuration for the interaction. Can be an + object specifying remote environment sources or a string referencing an + existing environment ID. + generation_config: Input only. Configuration parameters for the model + interaction. + previous_interaction_id: The ID of the previous interaction, if any. + response_format: Enforces that the generated response is a JSON object + that complies with the JSON schema specified in this field. + response_mime_type: The mime type of the response. This is required if + response_format is set. + response_modalities: The requested modalities of the response (TEXT, + IMAGE, AUDIO). + service_tier: The service tier for the interaction. + store: Input only. Whether to store the response and request for later + retrieval. + system_instruction: System instruction for the interaction. + tools: A list of tool declarations the model may call during interaction. + webhook_config: Optional. Webhook configuration for receiving + notifications when the interaction completes. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + def create( + self, + *, + api_version: str | None = None, + input: interaction_create_params.Input, + model: ModelParam, + stream: bool, + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + generation_config: GenerationConfigParam | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction | Stream[InteractionSSEEvent]: + """Creates a new interaction. + + Args: + input: The input for the interaction. + model: The name of the `Model` used for generating the interaction. + stream: Input only. Whether the interaction will be streamed. + background: Input only. Whether to run the model interaction in the + background. + environment: The environment configuration for the interaction. Can be an + object specifying remote environment sources or a string referencing an + existing environment ID. + generation_config: Input only. Configuration parameters for the model + interaction. + previous_interaction_id: The ID of the previous interaction, if any. + response_format: Enforces that the generated response is a JSON object + that complies with the JSON schema specified in this field. + response_mime_type: The mime type of the response. This is required if + response_format is set. + response_modalities: The requested modalities of the response (TEXT, + IMAGE, AUDIO). + service_tier: The service tier for the interaction. + store: Input only. Whether to store the response and request for later + retrieval. + system_instruction: System instruction for the interaction. + tools: A list of tool declarations the model may call during interaction. + webhook_config: Optional. Webhook configuration for receiving + notifications when the interaction completes. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + def create( + self, + *, + api_version: str | None = None, + agent: Union[ + Literal[ + "deep-research-pro-preview-12-2025", + "deep-research-preview-04-2026", + "deep-research-max-preview-04-2026", + ], + str, + ], + input: interaction_create_params.Input, + agent_config: interaction_create_params.AgentConfig | Omit = omit, + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + stream: Literal[False] | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction: + """Creates a new interaction. + + Args: + agent: The name of the `Agent` used for generating the interaction. + input: The input for the interaction. + agent_config: Configuration parameters for the agent interaction. + background: Input only. Whether to run the model interaction in the + background. + environment: The environment configuration for the interaction. Can be an + object specifying remote environment sources or a string referencing an + existing environment ID. + previous_interaction_id: The ID of the previous interaction, if any. + response_format: Enforces that the generated response is a JSON object + that complies with the JSON schema specified in this field. + response_mime_type: The mime type of the response. This is required if + response_format is set. + response_modalities: The requested modalities of the response (TEXT, + IMAGE, AUDIO). + service_tier: The service tier for the interaction. + store: Input only. Whether to store the response and request for later + retrieval. + stream: Input only. Whether the interaction will be streamed. + system_instruction: System instruction for the interaction. + tools: A list of tool declarations the model may call during interaction. + webhook_config: Optional. Webhook configuration for receiving + notifications when the interaction completes. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + def create( + self, + *, + api_version: str | None = None, + agent: Union[ + Literal[ + "deep-research-pro-preview-12-2025", + "deep-research-preview-04-2026", + "deep-research-max-preview-04-2026", + ], + str, + ], + input: interaction_create_params.Input, + stream: Literal[True], + agent_config: interaction_create_params.AgentConfig | Omit = omit, + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Stream[InteractionSSEEvent]: + """Creates a new interaction. + + Args: + agent: The name of the `Agent` used for generating the interaction. + input: The input for the interaction. + stream: Input only. Whether the interaction will be streamed. + agent_config: Configuration parameters for the agent interaction. + background: Input only. Whether to run the model interaction in the + background. + environment: The environment configuration for the interaction. Can be an + object specifying remote environment sources or a string referencing an + existing environment ID. + previous_interaction_id: The ID of the previous interaction, if any. + response_format: Enforces that the generated response is a JSON object + that complies with the JSON schema specified in this field. + response_mime_type: The mime type of the response. This is required if + response_format is set. + response_modalities: The requested modalities of the response (TEXT, + IMAGE, AUDIO). + service_tier: The service tier for the interaction. + store: Input only. Whether to store the response and request for later + retrieval. + system_instruction: System instruction for the interaction. + tools: A list of tool declarations the model may call during interaction. + webhook_config: Optional. Webhook configuration for receiving + notifications when the interaction completes. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @required_args( + ["input", "model"], + ["input", "model", "stream"], + ["agent", "input"], + ["agent", "input", "stream"], + ) + def create( + self, + *, + api_version: str | None = None, + input: interaction_create_params.Input, + agent: ( + Union[ + Literal[ + "deep-research-pro-preview-12-2025", + "deep-research-preview-04-2026", + "deep-research-max-preview-04-2026", + ], + str, + ] + | Omit + ) = omit, + agent_config: interaction_create_params.AgentConfig | Omit = omit, + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + generation_config: GenerationConfigParam | Omit = omit, + model: ModelParam | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + stream: Literal[False] | Literal[True] | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction | Stream[InteractionSSEEvent]: + if model is not omit and agent_config is not omit: + raise ValueError( + "Invalid request: specified `model` and `agent_config`. If" + " specifying `model`, use `generation_config`." + ) + if agent is not omit and generation_config is not omit: + raise ValueError( + "Invalid request: specified `agent` and `generation_config`. If" + " specifying `agent`, use `agent_config`." + ) + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + stream_cls = ( + LegacyLyriaInteractionStream[InteractionSSEEvent] + if ( + stream + and is_legacy_lyria_request( + is_vertex=self._client._is_vertex, model=model + ) ) - return self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path='interactions'), - body=maybe_transform( + else Stream[InteractionSSEEvent] + ) + return self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, path="interactions" + ), + body=maybe_transform( + { + "input": input, + "agent": agent, + "agent_config": agent_config, + "background": background, + "environment": environment, + "generation_config": generation_config, + "model": model, + "previous_interaction_id": previous_interaction_id, + "response_format": response_format, + "response_mime_type": response_mime_type, + "response_modalities": response_modalities, + "service_tier": service_tier, + "store": store, + "stream": stream, + "system_instruction": system_instruction, + "tools": tools, + "webhook_config": webhook_config, + }, + interaction_create_params.CreateModelInteractionParamsStreaming + if stream + else interaction_create_params.CreateModelInteractionParamsNonStreaming, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Interaction, + stream=stream or False, + stream_cls=stream_cls, + ) + + def delete( + self, + id: str, + *, + api_version: str | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> object: + """Deletes the interaction by id. + + Args: + id: The unique identifier of the interaction to delete. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return self._delete( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"interactions/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=object, + ) + + def cancel( + self, + id: str, + *, + api_version: str | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction: + """Cancels an interaction by id. + + This only applies to background interactions that are still running. + + Args: + id: The unique identifier of the interaction to cancel. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"interactions/{id}/cancel" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Interaction, + ) + + @overload + def get( + self, + id: str, + *, + api_version: str | None = None, + include_input: bool | Omit = omit, + last_event_id: str | Omit = omit, + stream: Literal[False] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction: + """Retrieves the full details of a single interaction based on its `Interaction.id`. + + Args: + id: The unique identifier of the interaction to retrieve. + include_input: If set to true, includes the input in the response. + last_event_id: Optional. If set, resumes the interaction stream from the + next chunk after the event marked by the event id. Can only be used if + `stream` is true. + stream: If set to true, the generated content will be streamed + incrementally. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + def get( + self, + id: str, + *, + api_version: str | None = None, + stream: Literal[True], + include_input: bool | Omit = omit, + last_event_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Stream[InteractionSSEEvent]: + """Retrieves the full details of a single interaction based on its `Interaction.id`. + + Args: + id: The unique identifier of the interaction to retrieve. + stream: If set to true, the generated content will be streamed + incrementally. + include_input: If set to true, includes the input in the response. + last_event_id: Optional. If set, resumes the interaction stream from the + next chunk after the event marked by the event id. Can only be used if + `stream` is true. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + def get( + self, + id: str, + *, + api_version: str | None = None, + stream: bool, + include_input: bool | Omit = omit, + last_event_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction | Stream[InteractionSSEEvent]: + """Retrieves the full details of a single interaction based on its `Interaction.id`. + + Args: + id: The unique identifier of the interaction to retrieve. + stream: If set to true, the generated content will be streamed + incrementally. + include_input: If set to true, includes the input in the response. + last_event_id: Optional. If set, resumes the interaction stream from the + next chunk after the event marked by the event id. Can only be used if + `stream` is true. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + def get( + self, + id: str, + *, + api_version: str | None = None, + include_input: bool | Omit = omit, + last_event_id: str | Omit = omit, + stream: Literal[False] | Literal[True] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction | Stream[InteractionSSEEvent]: + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + stream_cls = ( + LegacyLyriaInteractionDetectingStream[InteractionSSEEvent] + if (stream and self._client._is_vertex) + else Stream[InteractionSSEEvent] + ) + return self._get( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"interactions/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( { - "input": input, - "model": model, - "background": background, - "environment": environment, - "generation_config": generation_config, - "previous_interaction_id": previous_interaction_id, - "response_format": response_format, - "response_mime_type": response_mime_type, - "response_modalities": response_modalities, - "service_tier": service_tier, - "store": store, + "include_input": include_input, + "last_event_id": last_event_id, "stream": stream, - "system_instruction": system_instruction, - "tools": tools, - "webhook_config": webhook_config, - "agent": agent, - "agent_config": agent_config, }, - interaction_create_params.CreateModelInteractionParamsStreaming - if stream - else interaction_create_params.CreateModelInteractionParamsNonStreaming, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Interaction, - stream=stream or False, - stream_cls=stream_cls, - ) - - def delete( - self, - id: str, - *, - api_version: str | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: - """ - Deletes the interaction by id. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._delete( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - def cancel( - self, - id: str, - *, - api_version: str | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction: - """Cancels an interaction by id. - - This only applies to background interactions that - are still running. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}/cancel'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Interaction, - ) - - @overload - def get( - self, - id: str, - *, - api_version: str | None = None, - include_input: bool | Omit = omit, - last_event_id: str | Omit = omit, - stream: Literal[False] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction: - """ - Retrieves the full details of a single interaction based on its - `Interaction.id`. - - Args: - include_input: If set to true, includes the input in the response. - - last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the - event marked by the event id. Can only be used if `stream` is true. - - stream: If set to true, the generated content will be streamed incrementally. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def get( - self, - id: str, - *, - api_version: str | None = None, - stream: Literal[True], - include_input: bool | Omit = omit, - last_event_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Stream[InteractionSSEEvent]: - """ - Retrieves the full details of a single interaction based on its - `Interaction.id`. - - Args: - stream: If set to true, the generated content will be streamed incrementally. - - include_input: If set to true, includes the input in the response. - - last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the - event marked by the event id. Can only be used if `stream` is true. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def get( - self, - id: str, - *, - api_version: str | None = None, - stream: bool, - include_input: bool | Omit = omit, - last_event_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction | Stream[InteractionSSEEvent]: - """ - Retrieves the full details of a single interaction based on its - `Interaction.id`. - - Args: - stream: If set to true, the generated content will be streamed incrementally. - - include_input: If set to true, includes the input in the response. - - last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the - event marked by the event id. Can only be used if `stream` is true. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - def get( - self, - id: str, - *, - api_version: str | None = None, - include_input: bool | Omit = omit, - last_event_id: str | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction | Stream[InteractionSSEEvent]: - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - - # We don't know the model up front for `get`, so we can't apply the - # same `is_legacy_lyria_request` gate that `create` uses. Instead, on - # vertex we hand the stream off to the detecting subclass, which - # activates the shim only after observing the first legacy event_type. - # For non-legacy interactions the subclass is a no-op vs. plain Stream. - stream_cls = ( - LegacyLyriaInteractionDetectingStream[InteractionSSEEvent] - if (stream and self._client._is_vertex) - else Stream[InteractionSSEEvent] - ) - return self._get( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}'), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "include_input": include_input, - "last_event_id": last_event_id, - "stream": stream, - }, - interaction_get_params.InteractionGetParams, - ), + interaction_get_params.InteractionGetParams, ), - cast_to=Interaction, - stream=stream or False, - stream_cls=stream_cls, - ) + ), + cast_to=Interaction, + stream=stream or False, + stream_cls=stream_cls, + ) class AsyncInteractionsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncInteractionsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncInteractionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncInteractionsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response - """ - return AsyncInteractionsResourceWithStreamingResponse(self) - - @overload - async def create( - self, - *, - api_version: str | None = None, - input: interaction_create_params.Input, - model: ModelParam, - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - generation_config: GenerationConfigParam | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - stream: Literal[False] | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction: - """ - Creates a new interaction. - - Args: - input: The input for the interaction. - - model: The name of the `Model` used for generating the interaction. - - background: Input only. Whether to run the model interaction in the background. - - environment: The environment configuration for the interaction. Can be an object specifying - remote environment sources or a string referencing an existing environment ID. - - generation_config: Input only. Configuration parameters for the model interaction. - - previous_interaction_id: The ID of the previous interaction, if any. - - response_format: Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - - response_mime_type: The mime type of the response. This is required if response_format is set. - - response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - - service_tier: The service tier for the interaction. - - store: Input only. Whether to store the response and request for later retrieval. - - stream: Input only. Whether the interaction will be streamed. - - system_instruction: System instruction for the interaction. - - tools: A list of tool declarations the model may call during interaction. - - webhook_config: Optional. Webhook configuration for receiving notifications when the interaction - completes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - api_version: str | None = None, - input: interaction_create_params.Input, - model: ModelParam, - stream: Literal[True], - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - generation_config: GenerationConfigParam | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncStream[InteractionSSEEvent]: - """ - Creates a new interaction. - - Args: - input: The input for the interaction. - - model: The name of the `Model` used for generating the interaction. - - stream: Input only. Whether the interaction will be streamed. - - background: Input only. Whether to run the model interaction in the background. - - environment: The environment configuration for the interaction. Can be an object specifying - remote environment sources or a string referencing an existing environment ID. - - generation_config: Input only. Configuration parameters for the model interaction. - - previous_interaction_id: The ID of the previous interaction, if any. - - response_format: Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - - response_mime_type: The mime type of the response. This is required if response_format is set. - - response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - - service_tier: The service tier for the interaction. - - store: Input only. Whether to store the response and request for later retrieval. - - system_instruction: System instruction for the interaction. - - tools: A list of tool declarations the model may call during interaction. - - webhook_config: Optional. Webhook configuration for receiving notifications when the interaction - completes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - api_version: str | None = None, - agent: Union[ - Literal[ - "deep-research-pro-preview-12-2025", - "deep-research-preview-04-2026", - "deep-research-max-preview-04-2026", - ], - str, - ], - input: interaction_create_params.Input, - agent_config: interaction_create_params.AgentConfig | Omit = omit, - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - stream: Literal[False] | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction: - """ - Creates a new interaction. - - Args: - agent: The name of the `Agent` used for generating the interaction. - - input: The input for the interaction. - - agent_config: Configuration parameters for the agent interaction. - - background: Input only. Whether to run the model interaction in the background. - - environment: The environment configuration for the interaction. Can be an object specifying - remote environment sources or a string referencing an existing environment ID. - - previous_interaction_id: The ID of the previous interaction, if any. - - response_format: Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - response_mime_type: The mime type of the response. This is required if response_format is set. - - response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - - service_tier: The service tier for the interaction. - - store: Input only. Whether to store the response and request for later retrieval. - - stream: Input only. Whether the interaction will be streamed. - - system_instruction: System instruction for the interaction. - - tools: A list of tool declarations the model may call during interaction. - - webhook_config: Optional. Webhook configuration for receiving notifications when the interaction - completes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - api_version: str | None = None, - agent: Union[ - Literal[ - "deep-research-pro-preview-12-2025", - "deep-research-preview-04-2026", - "deep-research-max-preview-04-2026", - ], - str, - ], - input: interaction_create_params.Input, - stream: Literal[True], - agent_config: interaction_create_params.AgentConfig | Omit = omit, - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncStream[InteractionSSEEvent]: - """ - Creates a new interaction. - - Args: - agent: The name of the `Agent` used for generating the interaction. - - input: The input for the interaction. - - stream: Input only. Whether the interaction will be streamed. - - agent_config: Configuration parameters for the agent interaction. - - background: Input only. Whether to run the model interaction in the background. - - environment: The environment configuration for the interaction. Can be an object specifying - remote environment sources or a string referencing an existing environment ID. - - previous_interaction_id: The ID of the previous interaction, if any. - - response_format: Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - - response_mime_type: The mime type of the response. This is required if response_format is set. - - response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - - service_tier: The service tier for the interaction. - - store: Input only. Whether to store the response and request for later retrieval. - - system_instruction: System instruction for the interaction. - - tools: A list of tool declarations the model may call during interaction. - - webhook_config: Optional. Webhook configuration for receiving notifications when the interaction - completes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - *, - api_version: str | None = None, - input: interaction_create_params.Input, - model: ModelParam, - stream: bool, - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - generation_config: GenerationConfigParam | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction | AsyncStream[InteractionSSEEvent]: - """ - Creates a new interaction. - - Args: - input: The input for the interaction. - - model: The name of the `Model` used for generating the interaction. - - stream: Input only. Whether the interaction will be streamed. - - background: Input only. Whether to run the model interaction in the background. - - environment: The environment configuration for the interaction. Can be an object specifying - remote environment sources or a string referencing an existing environment ID. - - generation_config: Input only. Configuration parameters for the model interaction. - - previous_interaction_id: The ID of the previous interaction, if any. - - response_format: Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - - response_mime_type: The mime type of the response. This is required if response_format is set. - - response_modalities: The requested modalities of the response (TEXT, IMAGE, AUDIO). - - service_tier: The service tier for the interaction. - - store: Input only. Whether to store the response and request for later retrieval. - - system_instruction: System instruction for the interaction. - - tools: A list of tool declarations the model may call during interaction. - - webhook_config: Optional. Webhook configuration for receiving notifications when the interaction - completes. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @required_args(["input", "model"], ["input", "model", "stream"], ["agent", "input"], ["agent", "input", "stream"]) - async def create( - self, - *, - api_version: str | None = None, - input: interaction_create_params.Input, - model: ModelParam | Omit = omit, - background: bool | Omit = omit, - environment: interaction_create_params.Environment | Omit = omit, - generation_config: GenerationConfigParam | Omit = omit, - previous_interaction_id: str | Omit = omit, - response_format: interaction_create_params.ResponseFormat | Omit = omit, - response_mime_type: str | Omit = omit, - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] | Omit = omit, - service_tier: Literal["flex", "standard", "priority"] | Omit = omit, - store: bool | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - system_instruction: str | Omit = omit, - tools: Iterable[ToolParam] | Omit = omit, - webhook_config: WebhookConfigParam | Omit = omit, - agent: Union[ - Literal[ - "deep-research-pro-preview-12-2025", - "deep-research-preview-04-2026", - "deep-research-max-preview-04-2026", - ], - str, - ] - | Omit = omit, - agent_config: interaction_create_params.AgentConfig | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction | AsyncStream[InteractionSSEEvent]: - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if model is not omit and agent_config is not omit: - raise ValueError("Invalid request: specified `model` and `agent_config`. If specifying `model`, use `generation_config`.") - if agent is not omit and generation_config is not omit: - raise ValueError("Invalid request: specified `agent` and `generation_config`. If specifying `agent`, use `agent_config`.") - - # See sync `create` above for rationale. - stream_cls = ( - LegacyLyriaInteractionAsyncStream[InteractionSSEEvent] - if (stream and is_legacy_lyria_request(is_vertex=self._client._is_vertex, model=model)) - else AsyncStream[InteractionSSEEvent] + @cached_property + def with_raw_response(self) -> AsyncInteractionsResourceWithRawResponse: + """This property can be used as a prefix for any HTTP method call to return + + the raw response object instead of the parsed content. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncInteractionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response( + self, + ) -> AsyncInteractionsResourceWithStreamingResponse: + """An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response + """ + return AsyncInteractionsResourceWithStreamingResponse(self) + + @overload + async def create( + self, + *, + api_version: str | None = None, + input: interaction_create_params.Input, + model: ModelParam, + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + generation_config: GenerationConfigParam | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + stream: Literal[False] | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction: + """Creates a new interaction. + + Args: + input: The input for the interaction. + model: The name of the `Model` used for generating the interaction. + background: Input only. Whether to run the model interaction in the + background. + environment: The environment configuration for the interaction. Can be an + object specifying remote environment sources or a string referencing an + existing environment ID. + generation_config: Input only. Configuration parameters for the model + interaction. + previous_interaction_id: The ID of the previous interaction, if any. + response_format: Enforces that the generated response is a JSON object + that complies with the JSON schema specified in this field. + response_mime_type: The mime type of the response. This is required if + response_format is set. + response_modalities: The requested modalities of the response (TEXT, + IMAGE, AUDIO). + service_tier: The service tier for the interaction. + store: Input only. Whether to store the response and request for later + retrieval. + stream: Input only. Whether the interaction will be streamed. + system_instruction: System instruction for the interaction. + tools: A list of tool declarations the model may call during interaction. + webhook_config: Optional. Webhook configuration for receiving + notifications when the interaction completes. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + async def create( + self, + *, + api_version: str | None = None, + input: interaction_create_params.Input, + model: ModelParam, + stream: Literal[True], + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + generation_config: GenerationConfigParam | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncStream[InteractionSSEEvent]: + """Creates a new interaction. + + Args: + input: The input for the interaction. + model: The name of the `Model` used for generating the interaction. + stream: Input only. Whether the interaction will be streamed. + background: Input only. Whether to run the model interaction in the + background. + environment: The environment configuration for the interaction. Can be an + object specifying remote environment sources or a string referencing an + existing environment ID. + generation_config: Input only. Configuration parameters for the model + interaction. + previous_interaction_id: The ID of the previous interaction, if any. + response_format: Enforces that the generated response is a JSON object + that complies with the JSON schema specified in this field. + response_mime_type: The mime type of the response. This is required if + response_format is set. + response_modalities: The requested modalities of the response (TEXT, + IMAGE, AUDIO). + service_tier: The service tier for the interaction. + store: Input only. Whether to store the response and request for later + retrieval. + system_instruction: System instruction for the interaction. + tools: A list of tool declarations the model may call during interaction. + webhook_config: Optional. Webhook configuration for receiving + notifications when the interaction completes. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + async def create( + self, + *, + api_version: str | None = None, + input: interaction_create_params.Input, + model: ModelParam, + stream: bool, + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + generation_config: GenerationConfigParam | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction | AsyncStream[InteractionSSEEvent]: + """Creates a new interaction. + + Args: + input: The input for the interaction. + model: The name of the `Model` used for generating the interaction. + stream: Input only. Whether the interaction will be streamed. + background: Input only. Whether to run the model interaction in the + background. + environment: The environment configuration for the interaction. Can be an + object specifying remote environment sources or a string referencing an + existing environment ID. + generation_config: Input only. Configuration parameters for the model + interaction. + previous_interaction_id: The ID of the previous interaction, if any. + response_format: Enforces that the generated response is a JSON object + that complies with the JSON schema specified in this field. + response_mime_type: The mime type of the response. This is required if + response_format is set. + response_modalities: The requested modalities of the response (TEXT, + IMAGE, AUDIO). + service_tier: The service tier for the interaction. + store: Input only. Whether to store the response and request for later + retrieval. + system_instruction: System instruction for the interaction. + tools: A list of tool declarations the model may call during interaction. + webhook_config: Optional. Webhook configuration for receiving + notifications when the interaction completes. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + async def create( + self, + *, + api_version: str | None = None, + agent: Union[ + Literal[ + "deep-research-pro-preview-12-2025", + "deep-research-preview-04-2026", + "deep-research-max-preview-04-2026", + ], + str, + ], + input: interaction_create_params.Input, + agent_config: interaction_create_params.AgentConfig | Omit = omit, + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + stream: Literal[False] | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction: + """Creates a new interaction. + + Args: + agent: The name of the `Agent` used for generating the interaction. + input: The input for the interaction. + agent_config: Configuration parameters for the agent interaction. + background: Input only. Whether to run the model interaction in the + background. + environment: The environment configuration for the interaction. Can be an + object specifying remote environment sources or a string referencing an + existing environment ID. + previous_interaction_id: The ID of the previous interaction, if any. + response_format: Enforces that the generated response is a JSON object + that complies with the JSON schema specified in this field. + response_mime_type: The mime type of the response. This is required if + response_format is set. + response_modalities: The requested modalities of the response (TEXT, + IMAGE, AUDIO). + service_tier: The service tier for the interaction. + store: Input only. Whether to store the response and request for later + retrieval. + stream: Input only. Whether the interaction will be streamed. + system_instruction: System instruction for the interaction. + tools: A list of tool declarations the model may call during interaction. + webhook_config: Optional. Webhook configuration for receiving + notifications when the interaction completes. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + async def create( + self, + *, + api_version: str | None = None, + agent: Union[ + Literal[ + "deep-research-pro-preview-12-2025", + "deep-research-preview-04-2026", + "deep-research-max-preview-04-2026", + ], + str, + ], + input: interaction_create_params.Input, + stream: Literal[True], + agent_config: interaction_create_params.AgentConfig | Omit = omit, + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncStream[InteractionSSEEvent]: + """Creates a new interaction. + + Args: + agent: The name of the `Agent` used for generating the interaction. + input: The input for the interaction. + stream: Input only. Whether the interaction will be streamed. + agent_config: Configuration parameters for the agent interaction. + background: Input only. Whether to run the model interaction in the + background. + environment: The environment configuration for the interaction. Can be an + object specifying remote environment sources or a string referencing an + existing environment ID. + previous_interaction_id: The ID of the previous interaction, if any. + response_format: Enforces that the generated response is a JSON object + that complies with the JSON schema specified in this field. + response_mime_type: The mime type of the response. This is required if + response_format is set. + response_modalities: The requested modalities of the response (TEXT, + IMAGE, AUDIO). + service_tier: The service tier for the interaction. + store: Input only. Whether to store the response and request for later + retrieval. + system_instruction: System instruction for the interaction. + tools: A list of tool declarations the model may call during interaction. + webhook_config: Optional. Webhook configuration for receiving + notifications when the interaction completes. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @required_args( + ["input", "model"], + ["input", "model", "stream"], + ["agent", "input"], + ["agent", "input", "stream"], + ) + async def create( + self, + *, + api_version: str | None = None, + input: interaction_create_params.Input, + agent: ( + Union[ + Literal[ + "deep-research-pro-preview-12-2025", + "deep-research-preview-04-2026", + "deep-research-max-preview-04-2026", + ], + str, + ] + | Omit + ) = omit, + agent_config: interaction_create_params.AgentConfig | Omit = omit, + background: bool | Omit = omit, + environment: interaction_create_params.Environment | Omit = omit, + generation_config: GenerationConfigParam | Omit = omit, + model: ModelParam | Omit = omit, + previous_interaction_id: str | Omit = omit, + response_format: interaction_create_params.ResponseFormat | Omit = omit, + response_mime_type: str | Omit = omit, + response_modalities: ( + List[Literal["text", "image", "audio", "video", "document"]] | Omit + ) = omit, + service_tier: Literal["flex", "standard", "priority"] | Omit = omit, + store: bool | Omit = omit, + stream: Literal[False] | Literal[True] | Omit = omit, + system_instruction: str | Omit = omit, + tools: Iterable[ToolParam] | Omit = omit, + webhook_config: WebhookConfigParam | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction | AsyncStream[InteractionSSEEvent]: + if model is not omit and agent_config is not omit: + raise ValueError( + "Invalid request: specified `model` and `agent_config`. If" + " specifying `model`, use `generation_config`." + ) + if agent is not omit and generation_config is not omit: + raise ValueError( + "Invalid request: specified `agent` and `generation_config`. If" + " specifying `agent`, use `agent_config`." + ) + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + stream_cls = ( + LegacyLyriaInteractionAsyncStream[InteractionSSEEvent] + if ( + stream + and is_legacy_lyria_request( + is_vertex=self._client._is_vertex, model=model + ) ) - return await self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path='interactions'), - body=await async_maybe_transform( + else AsyncStream[InteractionSSEEvent] + ) + return await self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, path="interactions" + ), + body=await async_maybe_transform( + { + "input": input, + "agent": agent, + "agent_config": agent_config, + "background": background, + "environment": environment, + "generation_config": generation_config, + "model": model, + "previous_interaction_id": previous_interaction_id, + "response_format": response_format, + "response_mime_type": response_mime_type, + "response_modalities": response_modalities, + "service_tier": service_tier, + "store": store, + "stream": stream, + "system_instruction": system_instruction, + "tools": tools, + "webhook_config": webhook_config, + }, + interaction_create_params.CreateModelInteractionParamsStreaming + if stream + else interaction_create_params.CreateModelInteractionParamsNonStreaming, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Interaction, + stream=stream or False, + stream_cls=stream_cls, + ) + + async def delete( + self, + id: str, + *, + api_version: str | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> object: + """Deletes the interaction by id. + + Args: + id: The unique identifier of the interaction to delete. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return await self._delete( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"interactions/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=object, + ) + + async def cancel( + self, + id: str, + *, + api_version: str | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction: + """Cancels an interaction by id. + + This only applies to background interactions that are still running. + + Args: + id: The unique identifier of the interaction to cancel. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return await self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"interactions/{id}/cancel" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Interaction, + ) + + @overload + async def get( + self, + id: str, + *, + api_version: str | None = None, + include_input: bool | Omit = omit, + last_event_id: str | Omit = omit, + stream: Literal[False] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction: + """Retrieves the full details of a single interaction based on its `Interaction.id`. + + Args: + id: The unique identifier of the interaction to retrieve. + include_input: If set to true, includes the input in the response. + last_event_id: Optional. If set, resumes the interaction stream from the + next chunk after the event marked by the event id. Can only be used if + `stream` is true. + stream: If set to true, the generated content will be streamed + incrementally. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + async def get( + self, + id: str, + *, + api_version: str | None = None, + stream: Literal[True], + include_input: bool | Omit = omit, + last_event_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncStream[InteractionSSEEvent]: + """Retrieves the full details of a single interaction based on its `Interaction.id`. + + Args: + id: The unique identifier of the interaction to retrieve. + stream: If set to true, the generated content will be streamed + incrementally. + include_input: If set to true, includes the input in the response. + last_event_id: Optional. If set, resumes the interaction stream from the + next chunk after the event marked by the event id. Can only be used if + `stream` is true. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + @overload + async def get( + self, + id: str, + *, + api_version: str | None = None, + stream: bool, + include_input: bool | Omit = omit, + last_event_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction | AsyncStream[InteractionSSEEvent]: + """Retrieves the full details of a single interaction based on its `Interaction.id`. + + Args: + id: The unique identifier of the interaction to retrieve. + stream: If set to true, the generated content will be streamed + incrementally. + include_input: If set to true, includes the input in the response. + last_event_id: Optional. If set, resumes the interaction stream from the + next chunk after the event marked by the event id. Can only be used if + `stream` is true. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + ... + + async def get( + self, + id: str, + *, + api_version: str | None = None, + include_input: bool | Omit = omit, + last_event_id: str | Omit = omit, + stream: Literal[False] | Literal[True] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Interaction | AsyncStream[InteractionSSEEvent]: + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + stream_cls = ( + LegacyLyriaInteractionDetectingAsyncStream[InteractionSSEEvent] + if (stream and self._client._is_vertex) + else AsyncStream[InteractionSSEEvent] + ) + return await self._get( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"interactions/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( { - "input": input, - "model": model, - "background": background, - "environment": environment, - "generation_config": generation_config, - "previous_interaction_id": previous_interaction_id, - "response_format": response_format, - "response_mime_type": response_mime_type, - "response_modalities": response_modalities, - "service_tier": service_tier, - "store": store, + "include_input": include_input, + "last_event_id": last_event_id, "stream": stream, - "system_instruction": system_instruction, - "tools": tools, - "webhook_config": webhook_config, - "agent": agent, - "agent_config": agent_config, }, - interaction_create_params.CreateModelInteractionParamsStreaming - if stream - else interaction_create_params.CreateModelInteractionParamsNonStreaming, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Interaction, - stream=stream or False, - stream_cls=stream_cls, - ) - - async def delete( - self, - id: str, - *, - api_version: str | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: - """ - Deletes the interaction by id. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._delete( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - async def cancel( - self, - id: str, - *, - api_version: str | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction: - """Cancels an interaction by id. - - This only applies to background interactions that - are still running. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}/cancel'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Interaction, - ) - - @overload - async def get( - self, - id: str, - *, - api_version: str | None = None, - include_input: bool | Omit = omit, - last_event_id: str | Omit = omit, - stream: Literal[False] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction: - """ - Retrieves the full details of a single interaction based on its - `Interaction.id`. - - Args: - include_input: If set to true, includes the input in the response. - - last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the - event marked by the event id. Can only be used if `stream` is true. - - stream: If set to true, the generated content will be streamed incrementally. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def get( - self, - id: str, - *, - api_version: str | None = None, - stream: Literal[True], - include_input: bool | Omit = omit, - last_event_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncStream[InteractionSSEEvent]: - """ - Retrieves the full details of a single interaction based on its - `Interaction.id`. - - Args: - stream: If set to true, the generated content will be streamed incrementally. - - include_input: If set to true, includes the input in the response. - - last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the - event marked by the event id. Can only be used if `stream` is true. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def get( - self, - id: str, - *, - api_version: str | None = None, - stream: bool, - include_input: bool | Omit = omit, - last_event_id: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction | AsyncStream[InteractionSSEEvent]: - """ - Retrieves the full details of a single interaction based on its - `Interaction.id`. - - Args: - stream: If set to true, the generated content will be streamed incrementally. - - include_input: If set to true, includes the input in the response. - - last_event_id: Optional. If set, resumes the interaction stream from the next chunk after the - event marked by the event id. Can only be used if `stream` is true. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - async def get( - self, - id: str, - *, - api_version: str | None = None, - include_input: bool | Omit = omit, - last_event_id: str | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Interaction | AsyncStream[InteractionSSEEvent]: - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - - # See sync `get` above for rationale. - stream_cls = ( - LegacyLyriaInteractionDetectingAsyncStream[InteractionSSEEvent] - if (stream and self._client._is_vertex) - else AsyncStream[InteractionSSEEvent] - ) - return await self._get( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'interactions/{id}'), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "include_input": include_input, - "last_event_id": last_event_id, - "stream": stream, - }, - interaction_get_params.InteractionGetParams, - ), + interaction_get_params.InteractionGetParams, ), - cast_to=Interaction, - stream=stream or False, - stream_cls=stream_cls, - ) + ), + cast_to=Interaction, + stream=stream or False, + stream_cls=stream_cls, + ) class InteractionsResourceWithRawResponse: - def __init__(self, interactions: InteractionsResource) -> None: - self._interactions = interactions - self.create = to_raw_response_wrapper( + def __init__(self, interactions: InteractionsResource) -> None: + self._interactions = interactions + + self.create = to_raw_response_wrapper( interactions.create, ) - self.delete = to_raw_response_wrapper( + self.delete = to_raw_response_wrapper( interactions.delete, ) - self.cancel = to_raw_response_wrapper( + self.cancel = to_raw_response_wrapper( interactions.cancel, ) - self.get = to_raw_response_wrapper( + self.get = to_raw_response_wrapper( interactions.get, ) class AsyncInteractionsResourceWithRawResponse: - def __init__(self, interactions: AsyncInteractionsResource) -> None: - self._interactions = interactions - self.create = async_to_raw_response_wrapper( + def __init__(self, interactions: AsyncInteractionsResource) -> None: + self._interactions = interactions + + self.create = async_to_raw_response_wrapper( interactions.create, ) - self.delete = async_to_raw_response_wrapper( + self.delete = async_to_raw_response_wrapper( interactions.delete, ) - self.cancel = async_to_raw_response_wrapper( + self.cancel = async_to_raw_response_wrapper( interactions.cancel, ) - self.get = async_to_raw_response_wrapper( + self.get = async_to_raw_response_wrapper( interactions.get, ) class InteractionsResourceWithStreamingResponse: - def __init__(self, interactions: InteractionsResource) -> None: - self._interactions = interactions - self.create = to_streamed_response_wrapper( + def __init__(self, interactions: InteractionsResource) -> None: + self._interactions = interactions + + self.create = to_streamed_response_wrapper( interactions.create, ) - self.delete = to_streamed_response_wrapper( + self.delete = to_streamed_response_wrapper( interactions.delete, ) - self.cancel = to_streamed_response_wrapper( + self.cancel = to_streamed_response_wrapper( interactions.cancel, ) - self.get = to_streamed_response_wrapper( + self.get = to_streamed_response_wrapper( interactions.get, ) class AsyncInteractionsResourceWithStreamingResponse: - def __init__(self, interactions: AsyncInteractionsResource) -> None: - self._interactions = interactions - self.create = async_to_streamed_response_wrapper( + def __init__(self, interactions: AsyncInteractionsResource) -> None: + self._interactions = interactions + + self.create = async_to_streamed_response_wrapper( interactions.create, ) - self.delete = async_to_streamed_response_wrapper( + self.delete = async_to_streamed_response_wrapper( interactions.delete, ) - self.cancel = async_to_streamed_response_wrapper( + self.cancel = async_to_streamed_response_wrapper( interactions.cancel, ) - self.get = async_to_streamed_response_wrapper( - interactions.get, - ) + self.get = async_to_streamed_response_wrapper( + interactions.get, + ) diff --git a/google/genai/_interactions/resources/webhooks.py b/google/genai/_interactions/resources/webhooks.py index d1117cc45..6c9825982 100644 --- a/google/genai/_interactions/resources/webhooks.py +++ b/google/genai/_interactions/resources/webhooks.py @@ -17,279 +17,267 @@ from __future__ import annotations -from typing import List, Union -from typing_extensions import Literal +from typing import Iterable, List, Union import httpx +from typing_extensions import Literal -from ..types import ( - webhook_list_params, - webhook_ping_params, - webhook_create_params, - webhook_update_params, - webhook_rotate_signing_secret_params, -) -from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._base_client import make_request_options from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource +from .._resource import AsyncAPIResource, SyncAPIResource from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, + to_raw_response_wrapper, + to_streamed_response_wrapper, ) -from .._base_client import make_request_options +from .._types import Body, Headers, NotGiven, Omit, Query, not_given, omit +from .._utils import async_maybe_transform, maybe_transform +from ..types import webhook_create_params, webhook_list_params, webhook_ping_params, webhook_rotate_signing_secret_params, webhook_update_params from ..types.webhook import Webhook +from ..types.webhook_delete_response import WebhookDeleteResponse from ..types.webhook_list_response import WebhookListResponse from ..types.webhook_ping_response import WebhookPingResponse -from ..types.webhook_delete_response import WebhookDeleteResponse from ..types.webhook_rotate_signing_secret_response import WebhookRotateSigningSecretResponse __all__ = ["WebhooksResource", "AsyncWebhooksResource"] class WebhooksResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> WebhooksResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers - """ - return WebhooksResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> WebhooksResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response - """ - return WebhooksResourceWithStreamingResponse(self) - - def create( - self, - *, - api_version: str | None = None, - subscribed_events: List[ - Union[ - Literal[ - "batch.succeeded", - "batch.expired", - "batch.failed", - "interaction.requires_action", - "interaction.completed", - "interaction.failed", - "video.generated", - ], - str, - ] - ], - uri: str, - name: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Webhook: - """Creates a new Webhook. - - Args: - subscribed_events: - Required. - - The events that the webhook is subscribed to. Available events: - - - batch.succeeded - - batch.expired - - batch.failed - - interaction.requires_action - - interaction.completed - - interaction.failed - - video.generated - - uri: Required. The URI to which webhook events will be sent. - - name: Optional. The user-provided name of the webhook. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - return self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path='webhooks'), - body=maybe_transform( + @cached_property + def with_raw_response(self) -> WebhooksResourceWithRawResponse: + """This property can be used as a prefix for any HTTP method call to return + + the raw response object instead of the parsed content. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers + """ + return WebhooksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> WebhooksResourceWithStreamingResponse: + """An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response + """ + return WebhooksResourceWithStreamingResponse(self) + + def create( + self, + *, + api_version: str | None = None, + subscribed_events: List[ + Union[ + str, + Literal["batch.succeeded"], + Literal["batch.expired"], + Literal["batch.failed"], + Literal["interaction.requires_action"], + Literal["interaction.completed"], + Literal["interaction.failed"], + Literal["video.generated"], + ] + ], + uri: str, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Webhook: + """Creates a new Webhook. + + Args: + subscribed_events: Required. The events that the webhook is subscribed to. + Available events: - batch.succeeded - batch.expired - batch.failed - + interaction.requires_action - interaction.completed - interaction.failed + - video.generated + uri: Required. The URI to which webhook events will be sent. + name: Optional. The user-provided name of the webhook. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + return self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, path="webhooks" + ), + body=maybe_transform( + { + "subscribed_events": subscribed_events, + "uri": uri, + "name": name, + }, + webhook_create_params.WebhookCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Webhook, + ) + + def update( + self, + id: str, + *, + api_version: str | None = None, + name: str | Omit = omit, + state: ( + Literal["enabled", "disabled", "disabled_due_to_failed_deliveries"] + | Omit + ) = omit, + subscribed_events: ( + List[ + Union[ + str, + Literal["batch.succeeded"], + Literal["batch.expired"], + Literal["batch.failed"], + Literal["interaction.requires_action"], + Literal["interaction.completed"], + Literal["interaction.failed"], + Literal["video.generated"], + ] + ] + | Omit + ) = omit, + update_mask: str | Omit = omit, + uri: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Webhook: + """Updates an existing Webhook. + + Args: + name: Optional. The user-provided name of the webhook. + state: Optional. The state of the webhook. + subscribed_events: Optional. The events that the webhook is subscribed to. + Available events: - batch.succeeded - batch.expired - batch.failed - + interaction.requires_action - interaction.completed - interaction.failed + - video.generated + update_mask: Optional. The list of fields to update. + uri: Optional. The URI to which webhook events will be sent. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return self._patch( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"webhooks/{id}" + ), + body=maybe_transform( + { + "name": name, + "state": state, + "subscribed_events": subscribed_events, + "uri": uri, + }, + webhook_update_params.WebhookUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( { - "subscribed_events": subscribed_events, - "uri": uri, - "name": name, + "update_mask": update_mask, }, - webhook_create_params.WebhookCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + webhook_update_params.WebhookUpdateParams, ), - cast_to=Webhook, - ) - - def update( - self, - id: str, - *, - api_version: str | None = None, - update_mask: str | Omit = omit, - name: str | Omit = omit, - state: Literal["enabled", "disabled", "disabled_due_to_failed_deliveries"] | Omit = omit, - subscribed_events: List[ - Union[ - Literal[ - "batch.succeeded", - "batch.expired", - "batch.failed", - "interaction.requires_action", - "interaction.completed", - "interaction.failed", - "video.generated", - ], - str, - ] - ] - | Omit = omit, - uri: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Webhook: - """Updates an existing Webhook. - - Args: - update_mask: Optional. - - The list of fields to update. - - name: Optional. The user-provided name of the webhook. - - state: Optional. The state of the webhook. - - subscribed_events: - Optional. The events that the webhook is subscribed to. Available events: - - - batch.succeeded - - batch.expired - - batch.failed - - interaction.requires_action - - interaction.completed - - interaction.failed - - video.generated - - uri: Optional. The URI to which webhook events will be sent. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._patch( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'), - body=maybe_transform( + ), + cast_to=Webhook, + ) + + def list( + self, + *, + api_version: str | None = None, + page_size: int | Omit = omit, + page_token: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> WebhookListResponse: + """Lists all Webhooks. + + Args: + page_size: Optional. The maximum number of webhooks to return. The service + may return fewer than this value. If unspecified, at most 50 webhooks + will be returned. The maximum value is 1000. + page_token: Optional. A page token, received from a previous + `ListWebhooks` call. Provide this to retrieve the subsequent page. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + return self._get( + self._client._build_maybe_vertex_path( + api_version=api_version, path="webhooks" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( { - "name": name, - "state": state, - "subscribed_events": subscribed_events, - "uri": uri, + "page_size": page_size, + "page_token": page_token, }, - webhook_update_params.WebhookUpdateParams, + webhook_list_params.WebhookListParams, ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"update_mask": update_mask}, webhook_update_params.WebhookUpdateParams), - ), - cast_to=Webhook, - ) - - def list( - self, - *, - api_version: str | None = None, - page_size: int | Omit = omit, - page_token: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WebhookListResponse: - """Lists all Webhooks. - - Args: - page_size: Optional. - - The maximum number of webhooks to return. The service may return fewer - than this value. If unspecified, at most 50 webhooks will be returned. The - maximum value is 1000. - - page_token: Optional. A page token, received from a previous `ListWebhooks` call. Provide - this to retrieve the subsequent page. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - return self._get( - self._client._build_maybe_vertex_path(api_version=api_version, path='webhooks'), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "page_size": page_size, - "page_token": page_token, - }, - webhook_list_params.WebhookListParams, - ), - ), - cast_to=WebhookListResponse, - ) + ), + cast_to=WebhookListResponse, + ) - def delete( + def delete( self, id: str, *, @@ -301,402 +289,430 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookDeleteResponse: - """ - Deletes a Webhook. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._delete( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WebhookDeleteResponse, - ) - - def get( - self, - id: str, - *, - api_version: str | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Webhook: - """ - Gets a specific Webhook. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._get( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Webhook, - ) - - def ping( - self, - id: str, - *, - api_version: str | None = None, - body: webhook_ping_params.Body | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WebhookPingResponse: - """ - Sends a ping event to a Webhook. - - Args: - body: Request message for WebhookService.PingWebhook. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}:ping'), - body=maybe_transform(body, webhook_ping_params.WebhookPingParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WebhookPingResponse, - ) - - def rotate_signing_secret( - self, - id: str, - *, - api_version: str | None = None, - revocation_behavior: Literal["revoke_previous_secrets_after_h24", "revoke_previous_secrets_immediately"] - | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WebhookRotateSigningSecretResponse: - """ - Generates a new signing secret for a Webhook. - - Args: - revocation_behavior: Optional. The revocation behavior for previous signing secrets. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}:rotateSigningSecret'), - body=maybe_transform( - {"revocation_behavior": revocation_behavior}, - webhook_rotate_signing_secret_params.WebhookRotateSigningSecretParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WebhookRotateSigningSecretResponse, - ) + """Deletes a Webhook. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return self._delete( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"webhooks/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=WebhookDeleteResponse, + ) + + def get( + self, + id: str, + *, + api_version: str | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Webhook: + """Gets a specific Webhook. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return self._get( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"webhooks/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Webhook, + ) + + def ping( + self, + id: str, + *, + api_version: str | None = None, + body: webhook_ping_params.Body | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> WebhookPingResponse: + """Sends a ping event to a Webhook. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"webhooks/{id}:ping" + ), + body=maybe_transform(body, webhook_ping_params.WebhookPingParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=WebhookPingResponse, + ) + + def rotate_signing_secret( + self, + id: str, + *, + api_version: str | None = None, + revocation_behavior: ( + Literal[ + "revoke_previous_secrets_after_h24", + "revoke_previous_secrets_immediately", + ] + | Omit + ) = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> WebhookRotateSigningSecretResponse: + """Generates a new signing secret for a Webhook. + + Args: + revocation_behavior: Optional. The revocation behavior for previous + signing secrets. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, + path=f"webhooks/{id}:rotateSigningSecret", + ), + body=maybe_transform( + { + "revocation_behavior": revocation_behavior, + }, + webhook_rotate_signing_secret_params.WebhookRotateSigningSecretParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=WebhookRotateSigningSecretResponse, + ) class AsyncWebhooksResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncWebhooksResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers - """ - return AsyncWebhooksResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncWebhooksResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response - """ - return AsyncWebhooksResourceWithStreamingResponse(self) - - async def create( - self, - *, - api_version: str | None = None, - subscribed_events: List[ - Union[ - Literal[ - "batch.succeeded", - "batch.expired", - "batch.failed", - "interaction.requires_action", - "interaction.completed", - "interaction.failed", - "video.generated", - ], - str, - ] - ], - uri: str, - name: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Webhook: - """Creates a new Webhook. - - Args: - subscribed_events: - Required. - - The events that the webhook is subscribed to. Available events: - - - batch.succeeded - - batch.expired - - batch.failed - - interaction.requires_action - - interaction.completed - - interaction.failed - - video.generated - uri: Required. The URI to which webhook events will be sent. - - name: Optional. The user-provided name of the webhook. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - return await self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path='webhooks'), - body=await async_maybe_transform( + @cached_property + def with_raw_response(self) -> AsyncWebhooksResourceWithRawResponse: + """This property can be used as a prefix for any HTTP method call to return + + the raw response object instead of the parsed content. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers + """ + return AsyncWebhooksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response( + self, + ) -> AsyncWebhooksResourceWithStreamingResponse: + """An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see + https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response + """ + return AsyncWebhooksResourceWithStreamingResponse(self) + + async def create( + self, + *, + api_version: str | None = None, + subscribed_events: List[ + Union[ + str, + Literal["batch.succeeded"], + Literal["batch.expired"], + Literal["batch.failed"], + Literal["interaction.requires_action"], + Literal["interaction.completed"], + Literal["interaction.failed"], + Literal["video.generated"], + ] + ], + uri: str, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Webhook: + """Creates a new Webhook. + + Args: + subscribed_events: Required. The events that the webhook is subscribed to. + Available events: - batch.succeeded - batch.expired - batch.failed - + interaction.requires_action - interaction.completed - interaction.failed + - video.generated + uri: Required. The URI to which webhook events will be sent. + name: Optional. The user-provided name of the webhook. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + return await self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, path="webhooks" + ), + body=await async_maybe_transform( + { + "subscribed_events": subscribed_events, + "uri": uri, + "name": name, + }, + webhook_create_params.WebhookCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Webhook, + ) + + async def update( + self, + id: str, + *, + api_version: str | None = None, + name: str | Omit = omit, + state: ( + Literal["enabled", "disabled", "disabled_due_to_failed_deliveries"] + | Omit + ) = omit, + subscribed_events: ( + List[ + Union[ + str, + Literal["batch.succeeded"], + Literal["batch.expired"], + Literal["batch.failed"], + Literal["interaction.requires_action"], + Literal["interaction.completed"], + Literal["interaction.failed"], + Literal["video.generated"], + ] + ] + | Omit + ) = omit, + update_mask: str | Omit = omit, + uri: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Webhook: + """Updates an existing Webhook. + + Args: + name: Optional. The user-provided name of the webhook. + state: Optional. The state of the webhook. + subscribed_events: Optional. The events that the webhook is subscribed to. + Available events: - batch.succeeded - batch.expired - batch.failed - + interaction.requires_action - interaction.completed - interaction.failed + - video.generated + update_mask: Optional. The list of fields to update. + uri: Optional. The URI to which webhook events will be sent. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return await self._patch( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"webhooks/{id}" + ), + body=await async_maybe_transform( + { + "name": name, + "state": state, + "subscribed_events": subscribed_events, + "uri": uri, + }, + webhook_update_params.WebhookUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( { - "subscribed_events": subscribed_events, - "uri": uri, - "name": name, + "update_mask": update_mask, }, - webhook_create_params.WebhookCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + webhook_update_params.WebhookUpdateParams, ), - cast_to=Webhook, - ) - - async def update( - self, - id: str, - *, - api_version: str | None = None, - update_mask: str | Omit = omit, - name: str | Omit = omit, - state: Literal["enabled", "disabled", "disabled_due_to_failed_deliveries"] | Omit = omit, - subscribed_events: List[ - Union[ - Literal[ - "batch.succeeded", - "batch.expired", - "batch.failed", - "interaction.requires_action", - "interaction.completed", - "interaction.failed", - "video.generated", - ], - str, - ] - ] - | Omit = omit, - uri: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Webhook: - """Updates an existing Webhook. - - Args: - update_mask: Optional. - - The list of fields to update. - - name: Optional. The user-provided name of the webhook. - - state: Optional. The state of the webhook. - - subscribed_events: - Optional. The events that the webhook is subscribed to. Available events: - - - batch.succeeded - - batch.expired - - batch.failed - - interaction.requires_action - - interaction.completed - - interaction.failed - - video.generated - - uri: Optional. The URI to which webhook events will be sent. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._patch( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'), - body=await async_maybe_transform( + ), + cast_to=Webhook, + ) + + async def list( + self, + *, + api_version: str | None = None, + page_size: int | Omit = omit, + page_token: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> WebhookListResponse: + """Lists all Webhooks. + + Args: + page_size: Optional. The maximum number of webhooks to return. The service + may return fewer than this value. If unspecified, at most 50 webhooks + will be returned. The maximum value is 1000. + page_token: Optional. A page token, received from a previous + `ListWebhooks` call. Provide this to retrieve the subsequent page. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + return await self._get( + self._client._build_maybe_vertex_path( + api_version=api_version, path="webhooks" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( { - "name": name, - "state": state, - "subscribed_events": subscribed_events, - "uri": uri, + "page_size": page_size, + "page_token": page_token, }, - webhook_update_params.WebhookUpdateParams, + webhook_list_params.WebhookListParams, ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"update_mask": update_mask}, webhook_update_params.WebhookUpdateParams - ), - ), - cast_to=Webhook, - ) + ), + cast_to=WebhookListResponse, + ) - async def list( - self, - *, - api_version: str | None = None, - page_size: int | Omit = omit, - page_token: str | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WebhookListResponse: - """Lists all Webhooks. - - Args: - page_size: Optional. - - The maximum number of webhooks to return. The service may return fewer - than this value. If unspecified, at most 50 webhooks will be returned. The - maximum value is 1000. - - page_token: Optional. A page token, received from a previous `ListWebhooks` call. Provide - this to retrieve the subsequent page. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - return await self._get( - self._client._build_maybe_vertex_path(api_version=api_version, path='webhooks'), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "page_size": page_size, - "page_token": page_token, - }, - webhook_list_params.WebhookListParams, - ), - ), - cast_to=WebhookListResponse, - ) - - async def delete( + async def delete( self, id: str, *, @@ -708,262 +724,302 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WebhookDeleteResponse: - """ - Deletes a Webhook. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._delete( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WebhookDeleteResponse, - ) - - async def get( - self, - id: str, - *, - api_version: str | None = None, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Webhook: - """ - Gets a specific Webhook. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._get( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}'), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Webhook, - ) - - async def ping( - self, - id: str, - *, - api_version: str | None = None, - body: webhook_ping_params.Body | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WebhookPingResponse: - """ - Sends a ping event to a Webhook. - - Args: - body: Request message for WebhookService.PingWebhook. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}:ping'), - body=await async_maybe_transform(body, webhook_ping_params.WebhookPingParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WebhookPingResponse, - ) - - async def rotate_signing_secret( - self, - id: str, - *, - api_version: str | None = None, - revocation_behavior: Literal["revoke_previous_secrets_after_h24", "revoke_previous_secrets_immediately"] - | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> WebhookRotateSigningSecretResponse: - """ - Generates a new signing secret for a Webhook. - - Args: - revocation_behavior: Optional. The revocation behavior for previous signing secrets. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if api_version is None: - api_version = self._client._get_api_version_path_param() - if not api_version: - raise ValueError(f"Expected a non-empty value for `api_version` but received {api_version!r}") - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._post( - self._client._build_maybe_vertex_path(api_version=api_version, path=f'webhooks/{id}:rotateSigningSecret'), - body=await async_maybe_transform( - {"revocation_behavior": revocation_behavior}, - webhook_rotate_signing_secret_params.WebhookRotateSigningSecretParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=WebhookRotateSigningSecretResponse, - ) + """Deletes a Webhook. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return await self._delete( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"webhooks/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=WebhookDeleteResponse, + ) + + async def get( + self, + id: str, + *, + api_version: str | None = None, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Webhook: + """Gets a specific Webhook. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return await self._get( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"webhooks/{id}" + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=Webhook, + ) + + async def ping( + self, + id: str, + *, + api_version: str | None = None, + body: webhook_ping_params.Body | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> WebhookPingResponse: + """Sends a ping event to a Webhook. + + Args: + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return await self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, path=f"webhooks/{id}:ping" + ), + body=await async_maybe_transform( + body, webhook_ping_params.WebhookPingParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=WebhookPingResponse, + ) + + async def rotate_signing_secret( + self, + id: str, + *, + api_version: str | None = None, + revocation_behavior: ( + Literal[ + "revoke_previous_secrets_after_h24", + "revoke_previous_secrets_immediately", + ] + | Omit + ) = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> WebhookRotateSigningSecretResponse: + """Generates a new signing secret for a Webhook. + + Args: + revocation_behavior: Optional. The revocation behavior for previous + signing secrets. + extra_headers: Send extra headers + extra_query: Add additional query parameters to the request + extra_body: Add additional JSON properties to the request + timeout: Override the client-level default timeout for this request, in + seconds + """ + if api_version is None: + api_version = self._client._get_api_version_path_param() + if not api_version: + raise ValueError( + "Expected a non-empty value for `api_version` but received" + f" {api_version!r}" + ) + if not id: + raise ValueError( + f"Expected a non-empty value for `id` but received {id!r}" + ) + return await self._post( + self._client._build_maybe_vertex_path( + api_version=api_version, + path=f"webhooks/{id}:rotateSigningSecret", + ), + body=await async_maybe_transform( + { + "revocation_behavior": revocation_behavior, + }, + webhook_rotate_signing_secret_params.WebhookRotateSigningSecretParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + ), + cast_to=WebhookRotateSigningSecretResponse, + ) class WebhooksResourceWithRawResponse: - def __init__(self, webhooks: WebhooksResource) -> None: - self._webhooks = webhooks - self.create = to_raw_response_wrapper( + def __init__(self, webhooks: WebhooksResource) -> None: + self._webhooks = webhooks + + self.create = to_raw_response_wrapper( webhooks.create, ) - self.update = to_raw_response_wrapper( + self.update = to_raw_response_wrapper( webhooks.update, ) - self.list = to_raw_response_wrapper( + self.list = to_raw_response_wrapper( webhooks.list, ) - self.delete = to_raw_response_wrapper( + self.delete = to_raw_response_wrapper( webhooks.delete, ) - self.get = to_raw_response_wrapper( + self.get = to_raw_response_wrapper( webhooks.get, ) - self.ping = to_raw_response_wrapper( + self.ping = to_raw_response_wrapper( webhooks.ping, ) - self.rotate_signing_secret = to_raw_response_wrapper( + self.rotate_signing_secret = to_raw_response_wrapper( webhooks.rotate_signing_secret, ) class AsyncWebhooksResourceWithRawResponse: - def __init__(self, webhooks: AsyncWebhooksResource) -> None: - self._webhooks = webhooks - self.create = async_to_raw_response_wrapper( + def __init__(self, webhooks: AsyncWebhooksResource) -> None: + self._webhooks = webhooks + + self.create = async_to_raw_response_wrapper( webhooks.create, ) - self.update = async_to_raw_response_wrapper( + self.update = async_to_raw_response_wrapper( webhooks.update, ) - self.list = async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( webhooks.list, ) - self.delete = async_to_raw_response_wrapper( + self.delete = async_to_raw_response_wrapper( webhooks.delete, ) - self.get = async_to_raw_response_wrapper( + self.get = async_to_raw_response_wrapper( webhooks.get, ) - self.ping = async_to_raw_response_wrapper( + self.ping = async_to_raw_response_wrapper( webhooks.ping, ) - self.rotate_signing_secret = async_to_raw_response_wrapper( + self.rotate_signing_secret = async_to_raw_response_wrapper( webhooks.rotate_signing_secret, ) class WebhooksResourceWithStreamingResponse: - def __init__(self, webhooks: WebhooksResource) -> None: - self._webhooks = webhooks - self.create = to_streamed_response_wrapper( + def __init__(self, webhooks: WebhooksResource) -> None: + self._webhooks = webhooks + + self.create = to_streamed_response_wrapper( webhooks.create, ) - self.update = to_streamed_response_wrapper( + self.update = to_streamed_response_wrapper( webhooks.update, ) - self.list = to_streamed_response_wrapper( + self.list = to_streamed_response_wrapper( webhooks.list, ) - self.delete = to_streamed_response_wrapper( + self.delete = to_streamed_response_wrapper( webhooks.delete, ) - self.get = to_streamed_response_wrapper( + self.get = to_streamed_response_wrapper( webhooks.get, ) - self.ping = to_streamed_response_wrapper( + self.ping = to_streamed_response_wrapper( webhooks.ping, ) - self.rotate_signing_secret = to_streamed_response_wrapper( + self.rotate_signing_secret = to_streamed_response_wrapper( webhooks.rotate_signing_secret, ) class AsyncWebhooksResourceWithStreamingResponse: - def __init__(self, webhooks: AsyncWebhooksResource) -> None: - self._webhooks = webhooks - self.create = async_to_streamed_response_wrapper( + def __init__(self, webhooks: AsyncWebhooksResource) -> None: + self._webhooks = webhooks + + self.create = async_to_streamed_response_wrapper( webhooks.create, ) - self.update = async_to_streamed_response_wrapper( + self.update = async_to_streamed_response_wrapper( webhooks.update, ) - self.list = async_to_streamed_response_wrapper( + self.list = async_to_streamed_response_wrapper( webhooks.list, ) - self.delete = async_to_streamed_response_wrapper( + self.delete = async_to_streamed_response_wrapper( webhooks.delete, ) - self.get = async_to_streamed_response_wrapper( + self.get = async_to_streamed_response_wrapper( webhooks.get, ) - self.ping = async_to_streamed_response_wrapper( + self.ping = async_to_streamed_response_wrapper( webhooks.ping, ) - self.rotate_signing_secret = async_to_streamed_response_wrapper( - webhooks.rotate_signing_secret, - ) + self.rotate_signing_secret = async_to_streamed_response_wrapper( + webhooks.rotate_signing_secret, + ) diff --git a/google/genai/_interactions/types/__init__.py b/google/genai/_interactions/types/__init__.py index 9a1f90467..f47c1cf67 100644 --- a/google/genai/_interactions/types/__init__.py +++ b/google/genai/_interactions/types/__init__.py @@ -11,135 +11,50 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from .step import Step as Step +from .environment import NetworkAllowlist as NetworkAllowlist +from .environment_param import NetworkAllowlistParam as NetworkAllowlistParam +from .environment import NetworkAllowlistAllowlist as NetworkAllowlistAllowlist +from .environment_param import NetworkAllowlistAllowlistParam as NetworkAllowlistAllowlistParam +from .tool import Tool as Tool +from .tool_param import ToolParam as ToolParam +from .environment import NetworkAllowlistAllowlist as NetworkAllowlistAllowlist +from .environment_param import NetworkAllowlistAllowlistParam as NetworkAllowlistAllowlistParam +from .code_execution_call_arguments import Arguments as Arguments +from .code_execution_call_arguments_param import Arguments as Arguments +from .environment import NetworkAllowlist as NetworkAllowlist +from .environment_param import NetworkAllowlistParam as NetworkAllowlistParam +from .mcp_server_tool_result_step import ResultFunctionResultSubcontentList as ResultFunctionResultSubcontentList +from .function_result_subcontent_param import ResultFunctionResultSubcontentList as ResultFunctionResultSubcontentList +from .google_maps_call_step import Arguments as Arguments +from .google_maps_call_arguments_param import Arguments as Arguments +from .google_maps_result_step import ResultPlace as ResultPlace +from .google_maps_result_item_param import ResultPlace as ResultPlace +from .google_maps_result_step import Place as Place +from .google_maps_result_places_param import Place as Place +from .google_maps_result import PlaceReviewSnippet as PlaceReviewSnippet +from .google_maps_result_review_snippet_param import PlaceReviewSnippet as PlaceReviewSnippet +from .google_maps_result_step import ResultPlaceReviewSnippet as ResultPlaceReviewSnippet +from .google_maps_result_step_review_snippet_param import ResultPlaceReviewSnippet as ResultPlaceReviewSnippet +from .google_search_call_step import Arguments as Arguments +from .google_search_call_arguments_param import Arguments as Arguments +from .google_search_result_step import Result as Result +from .google_search_result_item_param import Result as Result +from .usage import CachedTokensByModality as CachedTokensByModality +from .usage_param import CachedTokensByModality as CachedTokensByModality +from .google_maps_result import Place as Place +from .place_citation import PlaceReviewSnippet as PlaceReviewSnippet +from .review_snippet_param import PlaceReviewSnippet as PlaceReviewSnippet +from .thought_step import Summary as Summary +from .thought_summary_content_param import Summary as Summary from .tool import Tool as Tool -from .agent import Agent as Agent -from .model import Model as Model -from .usage import Usage as Usage -from .content import Content as Content -from .webhook import Webhook as Webhook -from .function import Function as Function -from .step_stop import StepStop as StepStop -from .annotation import Annotation as Annotation -from .step_delta import StepDelta as StepDelta -from .step_param import StepParam as StepParam -from .step_start import StepStart as StepStart from .tool_param import ToolParam as ToolParam -from .environment import Environment as Environment -from .error_event import ErrorEvent as ErrorEvent -from .interaction import Interaction as Interaction -from .model_param import ModelParam as ModelParam -from .usage_param import UsageParam as UsageParam -from .image_config import ImageConfig as ImageConfig -from .text_content import TextContent as TextContent -from .thought_step import ThoughtStep as ThoughtStep -from .url_citation import URLCitation as URLCitation -from .allowed_tools import AllowedTools as AllowedTools -from .audio_content import AudioContent as AudioContent -from .content_param import ContentParam as ContentParam -from .file_citation import FileCitation as FileCitation -from .image_content import ImageContent as ImageContent -from .speech_config import SpeechConfig as SpeechConfig -from .video_content import VideoContent as VideoContent -from .function_param import FunctionParam as FunctionParam -from .place_citation import PlaceCitation as PlaceCitation -from .signing_secret import SigningSecret as SigningSecret -from .thinking_level import ThinkingLevel as ThinkingLevel -from .webhook_config import WebhookConfig as WebhookConfig -from .user_input_step import UserInputStep as UserInputStep -from .annotation_param import AnnotationParam as AnnotationParam -from .document_content import DocumentContent as DocumentContent -from .tool_choice_type import ToolChoiceType as ToolChoiceType -from .agent_list_params import AgentListParams as AgentListParams -from .environment_param import EnvironmentParam as EnvironmentParam -from .generation_config import GenerationConfig as GenerationConfig -from .model_output_step import ModelOutputStep as ModelOutputStep -from .function_call_step import FunctionCallStep as FunctionCallStep -from .google_maps_result import GoogleMapsResult as GoogleMapsResult -from .image_config_param import ImageConfigParam as ImageConfigParam -from .text_content_param import TextContentParam as TextContentParam -from .thought_step_param import ThoughtStepParam as ThoughtStepParam -from .tool_choice_config import ToolChoiceConfig as ToolChoiceConfig -from .url_citation_param import URLCitationParam as URLCitationParam -from .url_context_result import URLContextResult as URLContextResult -from .agent_create_params import AgentCreateParams as AgentCreateParams -from .agent_list_response import AgentListResponse as AgentListResponse -from .allowed_tools_param import AllowedToolsParam as AllowedToolsParam -from .audio_content_param import AudioContentParam as AudioContentParam -from .file_citation_param import FileCitationParam as FileCitationParam -from .image_content_param import ImageContentParam as ImageContentParam -from .speech_config_param import SpeechConfigParam as SpeechConfigParam -from .video_content_param import VideoContentParam as VideoContentParam -from .webhook_list_params import WebhookListParams as WebhookListParams -from .webhook_ping_params import WebhookPingParams as WebhookPingParams -from .dynamic_agent_config import DynamicAgentConfig as DynamicAgentConfig -from .function_result_step import FunctionResultStep as FunctionResultStep -from .google_search_result import GoogleSearchResult as GoogleSearchResult -from .place_citation_param import PlaceCitationParam as PlaceCitationParam -from .text_response_format import TextResponseFormat as TextResponseFormat -from .webhook_config_param import WebhookConfigParam as WebhookConfigParam -from .agent_delete_response import AgentDeleteResponse as AgentDeleteResponse -from .audio_response_format import AudioResponseFormat as AudioResponseFormat -from .file_search_call_step import FileSearchCallStep as FileSearchCallStep -from .google_maps_call_step import GoogleMapsCallStep as GoogleMapsCallStep -from .image_response_format import ImageResponseFormat as ImageResponseFormat -from .interaction_sse_event import InteractionSSEEvent as InteractionSSEEvent -from .url_context_call_step import URLContextCallStep as URLContextCallStep -from .user_input_step_param import UserInputStepParam as UserInputStepParam -from .webhook_create_params import WebhookCreateParams as WebhookCreateParams -from .webhook_list_response import WebhookListResponse as WebhookListResponse -from .webhook_ping_response import WebhookPingResponse as WebhookPingResponse -from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams -from .document_content_param import DocumentContentParam as DocumentContentParam -from .interaction_get_params import InteractionGetParams as InteractionGetParams -from .file_search_result_step import FileSearchResultStep as FileSearchResultStep -from .generation_config_param import GenerationConfigParam as GenerationConfigParam -from .google_maps_result_step import GoogleMapsResultStep as GoogleMapsResultStep -from .google_search_call_step import GoogleSearchCallStep as GoogleSearchCallStep -from .model_output_step_param import ModelOutputStepParam as ModelOutputStepParam -from .url_context_result_step import URLContextResultStep as URLContextResultStep -from .webhook_delete_response import WebhookDeleteResponse as WebhookDeleteResponse -from .code_execution_call_step import CodeExecutionCallStep as CodeExecutionCallStep -from .function_call_step_param import FunctionCallStepParam as FunctionCallStepParam -from .tool_choice_config_param import ToolChoiceConfigParam as ToolChoiceConfigParam -from .google_search_result_step import GoogleSearchResultStep as GoogleSearchResultStep -from .interaction_create_params import InteractionCreateParams as InteractionCreateParams -from .interaction_created_event import InteractionCreatedEvent as InteractionCreatedEvent -from .interaction_status_update import InteractionStatusUpdate as InteractionStatusUpdate -from .mcp_server_tool_call_step import MCPServerToolCallStep as MCPServerToolCallStep -from .code_execution_result_step import CodeExecutionResultStep as CodeExecutionResultStep -from .deep_research_agent_config import DeepResearchAgentConfig as DeepResearchAgentConfig -from .dynamic_agent_config_param import DynamicAgentConfigParam as DynamicAgentConfigParam -from .function_result_step_param import FunctionResultStepParam as FunctionResultStepParam -from .google_maps_call_arguments import GoogleMapsCallArguments as GoogleMapsCallArguments -from .text_response_format_param import TextResponseFormatParam as TextResponseFormatParam -from .url_context_call_arguments import URLContextCallArguments as URLContextCallArguments -from .audio_response_format_param import AudioResponseFormatParam as AudioResponseFormatParam -from .file_search_call_step_param import FileSearchCallStepParam as FileSearchCallStepParam -from .google_maps_call_step_param import GoogleMapsCallStepParam as GoogleMapsCallStepParam -from .image_response_format_param import ImageResponseFormatParam as ImageResponseFormatParam -from .interaction_completed_event import InteractionCompletedEvent as InteractionCompletedEvent -from .mcp_server_tool_result_step import MCPServerToolResultStep as MCPServerToolResultStep -from .url_context_call_step_param import URLContextCallStepParam as URLContextCallStepParam -from .google_search_call_arguments import GoogleSearchCallArguments as GoogleSearchCallArguments -from .code_execution_call_arguments import CodeExecutionCallArguments as CodeExecutionCallArguments -from .file_search_result_step_param import FileSearchResultStepParam as FileSearchResultStepParam -from .google_maps_result_step_param import GoogleMapsResultStepParam as GoogleMapsResultStepParam -from .google_search_call_step_param import GoogleSearchCallStepParam as GoogleSearchCallStepParam -from .url_context_result_step_param import URLContextResultStepParam as URLContextResultStepParam -from .code_execution_call_step_param import CodeExecutionCallStepParam as CodeExecutionCallStepParam -from .google_search_result_step_param import GoogleSearchResultStepParam as GoogleSearchResultStepParam -from .mcp_server_tool_call_step_param import MCPServerToolCallStepParam as MCPServerToolCallStepParam -from .code_execution_result_step_param import CodeExecutionResultStepParam as CodeExecutionResultStepParam -from .deep_research_agent_config_param import DeepResearchAgentConfigParam as DeepResearchAgentConfigParam -from .mcp_server_tool_result_step_param import MCPServerToolResultStepParam as MCPServerToolResultStepParam -from .webhook_rotate_signing_secret_params import WebhookRotateSigningSecretParams as WebhookRotateSigningSecretParams -from .webhook_rotate_signing_secret_response import ( - WebhookRotateSigningSecretResponse as WebhookRotateSigningSecretResponse, -) +from .url_context_call_step import Arguments as Arguments +from .url_context_call_arguments_param import Arguments as Arguments +from .url_context_result_step import Result as Result +from .url_context_result_item_param import Result as Result +from .tool import RetrievalVertexAISearchConfig as RetrievalVertexAISearchConfig +from .tool_param import RetrievalVertexAISearchConfig as RetrievalVertexAISearchConfig diff --git a/google/genai/_interactions/types/agent.py b/google/genai/_interactions/types/agent.py index 015f0abd4..b06695e4d 100644 --- a/google/genai/_interactions/types/agent.py +++ b/google/genai/_interactions/types/agent.py @@ -11,30 +11,99 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional -from typing_extensions import Literal, Annotated, TypeAlias +# Code generated by the in-house datatype generator DO NOT EDIT. -from .._utils import PropertyInfo +from __future__ import annotations +from typing import Dict, List, Union, Optional, Iterable +from typing_extensions import Literal, TypeAlias, TypedDict, Required from .._models import BaseModel -from .environment import Environment + from .allowed_tools import AllowedTools +from .environment_param import EnvironmentParam +from .interaction_create_params import Environment +from .tool import Tool +from .tool_param import ToolParam + +__all__ = ["Agent", "AgentGetParams", "AgentParam", "BaseEnvironment", "ToolCodeExecution", "ToolGoogleSearch", "ToolMCPServer", "ToolURLContext"] + + +class Agent(BaseModel): + """An agent definition for the CreateAgent API. +This message is the target for annotation-parser-based JSON parsing. +New format: + { + "id": "customer-sentinel", + "base_agent": "", + "system_instruction": "...", + "base_environment": { "type": "remote", "sources": [...] }, + "tools": [ {"type": "code_execution"} ] + }""" + + base_agent: Optional[str] = None + """The base agent to extend.""" + + + base_environment: Optional[Union[Environment, str]] = None + """The environment configuration for the agent.""" + + + description: Optional[str] = None + """Agent description for developers to quickly read and understand.""" + + + id: Optional[str] = None + """The unique identifier for the agent.""" + + + system_instruction: Optional[str] = None + """System instruction for the agent.""" + + + tools: Optional[List[Tool]] = None + """The tools available to the agent.""" + + + +class AgentGetParams(TypedDict, total=False): + """Parameters for AgentGetParams""" + + id: Required[str] + + api_version: str + """Which version of the API to use.""" + + + +class AgentParam(TypedDict, total=False): + """TypedDict parameter equivalent for Agent.""" + + base_agent: str + """The base agent to extend.""" + + + base_environment: Union[EnvironmentParam, str] + """The environment configuration for the agent.""" + + + description: str + """Agent description for developers to quickly read and understand.""" + + + id: str + """The unique identifier for the agent.""" + + + system_instruction: str + """System instruction for the agent.""" + + + tools: Iterable[ToolParam] + """The tools available to the agent.""" -__all__ = [ - "Agent", - "BaseEnvironment", - "Tool", - "ToolCodeExecution", - "ToolGoogleSearch", - "ToolURLContext", - "ToolMCPServer", -] -BaseEnvironment: TypeAlias = Union[Environment, str] +BaseEnvironment: TypeAlias = Union[str, Environment] class ToolCodeExecution(BaseModel): """A tool that can be used by the model to execute code.""" @@ -45,69 +114,38 @@ class ToolCodeExecution(BaseModel): class ToolGoogleSearch(BaseModel): """A tool that can be used by the model to search Google.""" - type: Literal["google_search"] - search_types: Optional[List[Literal["web_search", "image_search", "enterprise_web_search"]]] = None """The types of search grounding to enable.""" -class ToolURLContext(BaseModel): - """A tool that can be used by the model to fetch URL context.""" - - type: Literal["url_context"] + type: Literal["google_search"] class ToolMCPServer(BaseModel): """A MCPServer is a server that can be called by the model to perform actions.""" - type: Literal["mcp_server"] - allowed_tools: Optional[List[AllowedTools]] = None """The allowed tools.""" + headers: Optional[Dict[str, str]] = None """Optional: Fields for authentication headers, timeouts, etc., if needed.""" + name: Optional[str] = None """The name of the MCPServer.""" - url: Optional[str] = None - """The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp" """ + type: Literal["mcp_server"] -Tool: TypeAlias = Annotated[ - Union[ToolCodeExecution, ToolGoogleSearch, ToolURLContext, ToolMCPServer], PropertyInfo(discriminator="type") -] + url: Optional[str] = None + """The full URL for the MCPServer endpoint. +Example: "https://api.example.com/mcp" """ -class Agent(BaseModel): - """ - An agent definition for the CreateAgent API. - This message is the target for annotation-parser-based JSON parsing. - New format: - { - "id": "customer-sentinel", - "base_agent": "", - "system_instruction": "...", - "base_environment": { "type": "remote", "sources": [...] }, - "tools": [ {"type": "code_execution"} ] - } - """ - id: Optional[str] = None - """The unique identifier for the agent.""" - - base_agent: Optional[str] = None - """The base agent to extend.""" - - base_environment: Optional[BaseEnvironment] = None - """The environment configuration for the agent.""" - - description: Optional[str] = None - """Agent description for developers to quickly read and understand.""" +class ToolURLContext(BaseModel): + """A tool that can be used by the model to fetch URL context.""" - system_instruction: Optional[str] = None - """System instruction for the agent.""" + type: Literal["url_context"] - tools: Optional[List[Tool]] = None - """The tools available to the agent.""" diff --git a/google/genai/_interactions/types/agent_create_params.py b/google/genai/_interactions/types/agent_create_params.py index edcfad8f0..fe88dc35a 100644 --- a/google/genai/_interactions/types/agent_create_params.py +++ b/google/genai/_interactions/types/agent_create_params.py @@ -11,91 +11,56 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Dict, List, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing import Union, Iterable +from typing_extensions import TypedDict from .environment_param import EnvironmentParam -from .allowed_tools_param import AllowedToolsParam +from .tool_param import ToolParam -__all__ = [ - "AgentCreateParams", - "BaseEnvironment", - "Tool", - "ToolCodeExecution", - "ToolGoogleSearch", - "ToolURLContext", - "ToolMCPServer", -] +__all__ = ["AgentCreateParams"] class AgentCreateParams(TypedDict, total=False): - api_version: str - - id: str - """The unique identifier for the agent.""" + """An agent definition for the CreateAgent API. +This message is the target for annotation-parser-based JSON parsing. +New format: + { + "id": "customer-sentinel", + "base_agent": "", + "system_instruction": "...", + "base_environment": { "type": "remote", "sources": [...] }, + "tools": [ {"type": "code_execution"} ] + }""" base_agent: str """The base agent to extend.""" - base_environment: BaseEnvironment + + base_environment: Union[EnvironmentParam, str] """The environment configuration for the agent.""" + description: str """Agent description for developers to quickly read and understand.""" - system_instruction: str - """System instruction for the agent.""" - - tools: Iterable[Tool] - """The tools available to the agent.""" - - -BaseEnvironment: TypeAlias = Union[EnvironmentParam, str] - - -class ToolCodeExecution(TypedDict, total=False): - """A tool that can be used by the model to execute code.""" - - type: Required[Literal["code_execution"]] - - -class ToolGoogleSearch(TypedDict, total=False): - """A tool that can be used by the model to search Google.""" - - type: Required[Literal["google_search"]] - - search_types: List[Literal["web_search", "image_search", "enterprise_web_search"]] - """The types of search grounding to enable.""" - - -class ToolURLContext(TypedDict, total=False): - """A tool that can be used by the model to fetch URL context.""" - - type: Required[Literal["url_context"]] + id: str + """The unique identifier for the agent.""" -class ToolMCPServer(TypedDict, total=False): - """A MCPServer is a server that can be called by the model to perform actions.""" - type: Required[Literal["mcp_server"]] + system_instruction: str + """System instruction for the agent.""" - allowed_tools: Iterable[AllowedToolsParam] - """The allowed tools.""" - headers: Dict[str, str] - """Optional: Fields for authentication headers, timeouts, etc., if needed.""" + tools: Iterable[ToolParam] + """The tools available to the agent.""" - name: str - """The name of the MCPServer.""" - url: str - """The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp" """ + api_version: str + """Which version of the API to use.""" -Tool: TypeAlias = Union[ToolCodeExecution, ToolGoogleSearch, ToolURLContext, ToolMCPServer] diff --git a/google/genai/_interactions/types/agent_delete_response.py b/google/genai/_interactions/types/agent_delete_response.py index cf91eaff2..947628a2f 100644 --- a/google/genai/_interactions/types/agent_delete_response.py +++ b/google/genai/_interactions/types/agent_delete_response.py @@ -11,24 +11,23 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from .._models import BaseModel __all__ = ["AgentDeleteResponse"] class AgentDeleteResponse(BaseModel): - """ - A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to use it as the request - or the response type of an API method. For instance: + """A generic empty message that you can re-use to avoid defining duplicated +empty messages in your APIs. A typical example is to use it as the request +or the response type of an API method. For instance: - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } - """ + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + }""" pass + diff --git a/google/genai/_interactions/types/agent_list_params.py b/google/genai/_interactions/types/agent_list_params.py index 54db37f6f..ba2e20215 100644 --- a/google/genai/_interactions/types/agent_list_params.py +++ b/google/genai/_interactions/types/agent_list_params.py @@ -11,13 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing_extensions import Annotated, TypedDict +from .._utils import PropertyInfo from .._utils import PropertyInfo @@ -25,10 +24,15 @@ class AgentListParams(TypedDict, total=False): + """Parameters for AgentListParams""" + api_version: str + """Which version of the API to use.""" + + + parent: str page_size: Annotated[int, PropertyInfo(alias="pageSize")] page_token: Annotated[str, PropertyInfo(alias="pageToken")] - parent: str diff --git a/google/genai/_interactions/types/agent_list_response.py b/google/genai/_interactions/types/agent_list_response.py index 845e917b2..b0e872f4f 100644 --- a/google/genai/_interactions/types/agent_list_response.py +++ b/google/genai/_interactions/types/agent_list_response.py @@ -11,16 +11,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional - from pydantic import Field as FieldInfo +from .._models import BaseModel from .agent import Agent -from .._models import BaseModel __all__ = ["AgentListResponse"] @@ -29,3 +28,4 @@ class AgentListResponse(BaseModel): agents: Optional[List[Agent]] = None next_page_token: Optional[str] = FieldInfo(alias="nextPageToken", default=None) + diff --git a/google/genai/_interactions/types/allowed_tools.py b/google/genai/_interactions/types/allowed_tools.py index 903310eb6..440b93663 100644 --- a/google/genai/_interactions/types/allowed_tools.py +++ b/google/genai/_interactions/types/allowed_tools.py @@ -11,13 +11,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional - from .._models import BaseModel + from .tool_choice_type import ToolChoiceType __all__ = ["AllowedTools"] @@ -29,5 +29,8 @@ class AllowedTools(BaseModel): mode: Optional[ToolChoiceType] = None """The mode of the tool choice.""" + tools: Optional[List[str]] = None """The names of the allowed tools.""" + + diff --git a/google/genai/_interactions/types/allowed_tools_param.py b/google/genai/_interactions/types/allowed_tools_param.py index 566017d31..968018cfc 100644 --- a/google/genai/_interactions/types/allowed_tools_param.py +++ b/google/genai/_interactions/types/allowed_tools_param.py @@ -11,25 +11,26 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - +from typing import Iterable from typing_extensions import TypedDict -from .._types import SequenceNotStr -from .tool_choice_type import ToolChoiceType +from .tool_choice_type_param import ToolChoiceTypeParam __all__ = ["AllowedToolsParam"] class AllowedToolsParam(TypedDict, total=False): - """The configuration for allowed tools.""" + """TypedDict parameter equivalent for AllowedTools.""" - mode: ToolChoiceType + mode: ToolChoiceTypeParam """The mode of the tool choice.""" - tools: SequenceNotStr[str] + + tools: Iterable[str] """The names of the allowed tools.""" + + diff --git a/google/genai/_interactions/types/annotation.py b/google/genai/_interactions/types/annotation.py index 9c38a05c8..fc86973d4 100644 --- a/google/genai/_interactions/types/annotation.py +++ b/google/genai/_interactions/types/annotation.py @@ -11,18 +11,21 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Union from typing_extensions import Annotated, TypeAlias - from .._utils import PropertyInfo -from .url_citation import URLCitation + from .file_citation import FileCitation from .place_citation import PlaceCitation +from .url_citation import UrlCitation __all__ = ["Annotation"] -Annotation: TypeAlias = Annotated[Union[URLCitation, FileCitation, PlaceCitation], PropertyInfo(discriminator="type")] + +Annotation: TypeAlias = Annotated[ + Union[UrlCitation, FileCitation, PlaceCitation], PropertyInfo(discriminator="type") +] diff --git a/google/genai/_interactions/types/annotation_param.py b/google/genai/_interactions/types/annotation_param.py index ae6875035..78b6ffd80 100644 --- a/google/genai/_interactions/types/annotation_param.py +++ b/google/genai/_interactions/types/annotation_param.py @@ -11,19 +11,18 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing import Union from typing_extensions import TypeAlias -from .url_citation_param import URLCitationParam from .file_citation_param import FileCitationParam from .place_citation_param import PlaceCitationParam +from .url_citation_param import UrlCitationParam __all__ = ["AnnotationParam"] -AnnotationParam: TypeAlias = Union[URLCitationParam, FileCitationParam, PlaceCitationParam] + +AnnotationParam: TypeAlias = Union[UrlCitationParam, FileCitationParam, PlaceCitationParam] diff --git a/google/genai/_interactions/types/audio_content.py b/google/genai/_interactions/types/audio_content.py index 132c481fb..3fdea474c 100644 --- a/google/genai/_interactions/types/audio_content.py +++ b/google/genai/_interactions/types/audio_content.py @@ -11,14 +11,16 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional -from typing_extensions import Literal +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations +from typing import Union, Optional +from typing_extensions import Literal, Annotated from .._models import BaseModel +from .._utils import PropertyInfo + +from google.genai._common import Base64FileInput __all__ = ["AudioContent"] @@ -26,34 +28,25 @@ class AudioContent(BaseModel): """An audio content block.""" - type: Literal["audio"] - channels: Optional[int] = None """The number of audio channels.""" - data: Optional[str] = None + + data: Optional[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] = None """The audio content.""" - mime_type: Optional[ - Literal[ - "audio/wav", - "audio/mp3", - "audio/aiff", - "audio/aac", - "audio/ogg", - "audio/flac", - "audio/mpeg", - "audio/m4a", - "audio/l16", - "audio/opus", - "audio/alaw", - "audio/mulaw", - ] - ] = None + + mime_type: Optional[Literal["audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac", "audio/mpeg", "audio/m4a", "audio/l16", "audio/opus", "audio/alaw", "audio/mulaw"]] = None """The mime type of the audio.""" + sample_rate: Optional[int] = None """The sample rate of the audio.""" + + type: Literal["audio"] + uri: Optional[str] = None """The URI of the audio.""" + + diff --git a/google/genai/_interactions/types/audio_content_param.py b/google/genai/_interactions/types/audio_content_param.py index 1b296428a..af201ccd2 100644 --- a/google/genai/_interactions/types/audio_content_param.py +++ b/google/genai/_interactions/types/audio_content_param.py @@ -11,54 +11,41 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing import Union -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput +from typing_extensions import Literal, Annotated, TypedDict, Required from .._utils import PropertyInfo -from .._models import set_pydantic_config + +from google.genai._common import Base64FileInput __all__ = ["AudioContentParam"] class AudioContentParam(TypedDict, total=False): - """An audio content block.""" - - type: Required[Literal["audio"]] + """TypedDict parameter equivalent for AudioContent.""" channels: int """The number of audio channels.""" + data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] """The audio content.""" - mime_type: Literal[ - "audio/wav", - "audio/mp3", - "audio/aiff", - "audio/aac", - "audio/ogg", - "audio/flac", - "audio/mpeg", - "audio/m4a", - "audio/l16", - "audio/opus", - "audio/alaw", - "audio/mulaw", - ] + + mime_type: Literal["audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac", "audio/mpeg", "audio/m4a", "audio/l16", "audio/opus", "audio/alaw", "audio/mulaw"] """The mime type of the audio.""" + sample_rate: int """The sample rate of the audio.""" + + type: Required[Literal["audio"]] + uri: str """The URI of the audio.""" -set_pydantic_config(AudioContentParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/audio_response_format.py b/google/genai/_interactions/types/audio_response_format.py index 80dccaf0d..1fe248cf8 100644 --- a/google/genai/_interactions/types/audio_response_format.py +++ b/google/genai/_interactions/types/audio_response_format.py @@ -11,13 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel __all__ = ["AudioResponseFormat"] @@ -26,21 +25,22 @@ class AudioResponseFormat(BaseModel): """Configuration for audio output format.""" - type: Literal["audio"] - bit_rate: Optional[int] = None - """Bit rate in bits per second (bps). + """Bit rate in bits per second (bps). Only applicable for compressed formats +(MP3, Opus).""" - Only applicable for compressed formats (MP3, Opus). - """ delivery: Optional[Literal["inline", "uri"]] = None """The delivery mode for the audio output.""" - mime_type: Optional[ - Literal["audio/mp3", "audio/ogg_opus", "audio/l16", "audio/wav", "audio/alaw", "audio/mulaw"] - ] = None + + mime_type: Optional[Literal["audio/mp3", "audio/ogg_opus", "audio/l16", "audio/wav", "audio/alaw", "audio/mulaw"]] = None """The MIME type of the audio output.""" + sample_rate: Optional[int] = None """Sample rate in Hz.""" + + + type: Literal["audio"] + diff --git a/google/genai/_interactions/types/audio_response_format_param.py b/google/genai/_interactions/types/audio_response_format_param.py index 0664d03c8..ce7465dff 100644 --- a/google/genai/_interactions/types/audio_response_format_param.py +++ b/google/genai/_interactions/types/audio_response_format_param.py @@ -11,33 +11,34 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Literal, TypedDict, Required __all__ = ["AudioResponseFormatParam"] class AudioResponseFormatParam(TypedDict, total=False): - """Configuration for audio output format.""" - - type: Required[Literal["audio"]] + """TypedDict parameter equivalent for AudioResponseFormat.""" bit_rate: int - """Bit rate in bits per second (bps). + """Bit rate in bits per second (bps). Only applicable for compressed formats +(MP3, Opus).""" - Only applicable for compressed formats (MP3, Opus). - """ delivery: Literal["inline", "uri"] """The delivery mode for the audio output.""" + mime_type: Literal["audio/mp3", "audio/ogg_opus", "audio/l16", "audio/wav", "audio/alaw", "audio/mulaw"] """The MIME type of the audio output.""" + sample_rate: int """Sample rate in Hz.""" + + + type: Required[Literal["audio"]] + diff --git a/google/genai/_interactions/types/code_execution_call_arguments.py b/google/genai/_interactions/types/code_execution_call_arguments.py index dce405296..625eba7bd 100644 --- a/google/genai/_interactions/types/code_execution_call_arguments.py +++ b/google/genai/_interactions/types/code_execution_call_arguments.py @@ -11,16 +11,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["CodeExecutionCallArguments"] +__all__ = ["CodeExecutionCallArguments", "Arguments"] class CodeExecutionCallArguments(BaseModel): @@ -29,5 +28,20 @@ class CodeExecutionCallArguments(BaseModel): code: Optional[str] = None """The code to be executed.""" + + language: Optional[Literal["python"]] = None + """Programming language of the `code`.""" + + + +class Arguments(BaseModel): + """The arguments to pass to the code execution.""" + + code: Optional[str] = None + """The code to be executed.""" + + language: Optional[Literal["python"]] = None """Programming language of the `code`.""" + + diff --git a/google/genai/_interactions/types/code_execution_call_arguments_param.py b/google/genai/_interactions/types/code_execution_call_arguments_param.py new file mode 100644 index 000000000..19c16350d --- /dev/null +++ b/google/genai/_interactions/types/code_execution_call_arguments_param.py @@ -0,0 +1,33 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing_extensions import Literal, TypedDict + +__all__ = ["Arguments"] + + +class Arguments(TypedDict, total=False): + """TypedDict parameter equivalent for CodeExecutionCallStepArguments.""" + + code: str + """The code to be executed.""" + + + language: Literal["python"] + """Programming language of the `code`.""" + + diff --git a/google/genai/_interactions/types/code_execution_call_step.py b/google/genai/_interactions/types/code_execution_call_step.py index 986940dea..75a237308 100644 --- a/google/genai/_interactions/types/code_execution_call_step.py +++ b/google/genai/_interactions/types/code_execution_call_step.py @@ -11,38 +11,33 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["CodeExecutionCallStep", "Arguments"] - - -class Arguments(BaseModel): - """Required. The arguments to pass to the code execution.""" +from .code_execution_call_arguments import Arguments - code: Optional[str] = None - """The code to be executed.""" - - language: Optional[Literal["python"]] = None - """Programming language of the `code`.""" +__all__ = ["CodeExecutionCallStep"] class CodeExecutionCallStep(BaseModel): """Code execution call step.""" - id: str - """Required. A unique ID for this specific tool call.""" - arguments: Arguments """Required. The arguments to pass to the code execution.""" - type: Literal["code_execution_call"] + + id: str + """Required. A unique ID for this specific tool call.""" + signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["code_execution_call"] + diff --git a/google/genai/_interactions/types/code_execution_call_step_param.py b/google/genai/_interactions/types/code_execution_call_step_param.py index eaa9f995e..0daded0e0 100644 --- a/google/genai/_interactions/types/code_execution_call_step_param.py +++ b/google/genai/_interactions/types/code_execution_call_step_param.py @@ -11,45 +11,31 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing_extensions import Literal, TypedDict, Required -from typing import Union -from typing_extensions import Literal, Required, Annotated, TypedDict +from .code_execution_call_arguments_param import Arguments -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config +__all__ = ["CodeExecutionCallStepParam"] -__all__ = ["CodeExecutionCallStepParam", "Arguments"] +class CodeExecutionCallStepParam(TypedDict, total=False): + """TypedDict parameter equivalent for CodeExecutionCallStep.""" -class Arguments(TypedDict, total=False): + arguments: Required[Arguments] """Required. The arguments to pass to the code execution.""" - code: str - """The code to be executed.""" - - language: Literal["python"] - """Programming language of the `code`.""" - - -class CodeExecutionCallStepParam(TypedDict, total=False): - """Code execution call step.""" id: Required[str] """Required. A unique ID for this specific tool call.""" - arguments: Required[Arguments] - """Required. The arguments to pass to the code execution.""" - - type: Required[Literal["code_execution_call"]] - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + signature: str """A signature hash for backend validation.""" -set_pydantic_config(CodeExecutionCallStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["code_execution_call"]] + diff --git a/google/genai/_interactions/types/code_execution_result_step.py b/google/genai/_interactions/types/code_execution_result_step.py index 611228db3..9a6f11909 100644 --- a/google/genai/_interactions/types/code_execution_result_step.py +++ b/google/genai/_interactions/types/code_execution_result_step.py @@ -11,13 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel __all__ = ["CodeExecutionResultStep"] @@ -29,13 +28,18 @@ class CodeExecutionResultStep(BaseModel): call_id: str """Required. ID to match the ID from the function call block.""" - result: str - """Required. The output of the code execution.""" - - type: Literal["code_execution_result"] is_error: Optional[bool] = None """Whether the code execution resulted in an error.""" + + result: str + """Required. The output of the code execution.""" + + signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["code_execution_result"] + diff --git a/google/genai/_interactions/types/code_execution_result_step_param.py b/google/genai/_interactions/types/code_execution_result_step_param.py index 51e40517f..edd1c1292 100644 --- a/google/genai/_interactions/types/code_execution_result_step_param.py +++ b/google/genai/_interactions/types/code_execution_result_step_param.py @@ -11,38 +11,33 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Union -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config +from typing_extensions import Literal, TypedDict, Required __all__ = ["CodeExecutionResultStepParam"] class CodeExecutionResultStepParam(TypedDict, total=False): - """Code execution result step.""" + """TypedDict parameter equivalent for CodeExecutionResultStep.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" - result: Required[str] - """Required. The output of the code execution.""" - - type: Required[Literal["code_execution_result"]] is_error: bool """Whether the code execution resulted in an error.""" - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + + result: Required[str] + """Required. The output of the code execution.""" + + + signature: str """A signature hash for backend validation.""" -set_pydantic_config(CodeExecutionResultStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["code_execution_result"]] + diff --git a/google/genai/_interactions/types/content.py b/google/genai/_interactions/types/content.py index c3852c413..5ce29714f 100644 --- a/google/genai/_interactions/types/content.py +++ b/google/genai/_interactions/types/content.py @@ -11,22 +11,23 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Union from typing_extensions import Annotated, TypeAlias - from .._utils import PropertyInfo -from .text_content import TextContent + from .audio_content import AudioContent +from .document_content import DocumentContent from .image_content import ImageContent +from .text_content import TextContent from .video_content import VideoContent -from .document_content import DocumentContent __all__ = ["Content"] + Content: TypeAlias = Annotated[ Union[TextContent, ImageContent, AudioContent, DocumentContent, VideoContent], PropertyInfo(discriminator="type") ] diff --git a/google/genai/_interactions/types/content_param.py b/google/genai/_interactions/types/content_param.py index 8300749d7..9786179fc 100644 --- a/google/genai/_interactions/types/content_param.py +++ b/google/genai/_interactions/types/content_param.py @@ -11,23 +11,20 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing import Union from typing_extensions import TypeAlias -from .text_content_param import TextContentParam from .audio_content_param import AudioContentParam +from .document_content_param import DocumentContentParam from .image_content_param import ImageContentParam +from .text_content_param import TextContentParam from .video_content_param import VideoContentParam -from .document_content_param import DocumentContentParam __all__ = ["ContentParam"] -ContentParam: TypeAlias = Union[ - TextContentParam, ImageContentParam, AudioContentParam, DocumentContentParam, VideoContentParam -] + +ContentParam: TypeAlias = Union[TextContentParam, ImageContentParam, AudioContentParam, DocumentContentParam, VideoContentParam] diff --git a/google/genai/_interactions/types/deep_research_agent_config.py b/google/genai/_interactions/types/deep_research_agent_config.py index cfe1b3289..6044d2d9b 100644 --- a/google/genai/_interactions/types/deep_research_agent_config.py +++ b/google/genai/_interactions/types/deep_research_agent_config.py @@ -11,13 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel __all__ = ["DeepResearchAgentConfig"] @@ -26,18 +25,20 @@ class DeepResearchAgentConfig(BaseModel): """Configuration for the Deep Research agent.""" - type: Literal["deep-research"] - collaborative_planning: Optional[bool] = None - """Enables human-in-the-loop planning for the Deep Research agent. + """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. +The agent will then proceed only if the user confirms the plan in the next +turn.""" - If set to true, the Deep Research agent will provide a research plan in its - response. The agent will then proceed only if the user confirms the plan in the - next turn. - """ thinking_summaries: Optional[Literal["auto", "none"]] = None """Whether to include thought summaries in the response.""" + + type: Literal["deep-research"] + visualization: Optional[Literal["off", "auto"]] = None """Whether to include visualizations in the response.""" + + diff --git a/google/genai/_interactions/types/deep_research_agent_config_param.py b/google/genai/_interactions/types/deep_research_agent_config_param.py index e4db3f6f7..607aa1cd7 100644 --- a/google/genai/_interactions/types/deep_research_agent_config_param.py +++ b/google/genai/_interactions/types/deep_research_agent_config_param.py @@ -11,32 +11,32 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Literal, TypedDict, Required __all__ = ["DeepResearchAgentConfigParam"] class DeepResearchAgentConfigParam(TypedDict, total=False): - """Configuration for the Deep Research agent.""" - - type: Required[Literal["deep-research"]] + """TypedDict parameter equivalent for DeepResearchAgentConfig.""" collaborative_planning: bool - """Enables human-in-the-loop planning for the Deep Research agent. + """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. +The agent will then proceed only if the user confirms the plan in the next +turn.""" - If set to true, the Deep Research agent will provide a research plan in its - response. The agent will then proceed only if the user confirms the plan in the - next turn. - """ thinking_summaries: Literal["auto", "none"] """Whether to include thought summaries in the response.""" + + type: Required[Literal["deep-research"]] + visualization: Literal["off", "auto"] """Whether to include visualizations in the response.""" + + diff --git a/google/genai/_interactions/types/document_content.py b/google/genai/_interactions/types/document_content.py index 846f7b568..faad52ccb 100644 --- a/google/genai/_interactions/types/document_content.py +++ b/google/genai/_interactions/types/document_content.py @@ -11,14 +11,16 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional -from typing_extensions import Literal +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations +from typing import Union, Optional +from typing_extensions import Literal, Annotated from .._models import BaseModel +from .._utils import PropertyInfo + +from google.genai._common import Base64FileInput __all__ = ["DocumentContent"] @@ -26,13 +28,17 @@ class DocumentContent(BaseModel): """A document content block.""" - type: Literal["document"] - - data: Optional[str] = None + data: Optional[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] = None """The document content.""" + mime_type: Optional[Literal["application/pdf"]] = None """The mime type of the document.""" + + type: Literal["document"] + uri: Optional[str] = None """The URI of the document.""" + + diff --git a/google/genai/_interactions/types/document_content_param.py b/google/genai/_interactions/types/document_content_param.py index f8b4c6cb9..545c8de08 100644 --- a/google/genai/_interactions/types/document_content_param.py +++ b/google/genai/_interactions/types/document_content_param.py @@ -11,35 +11,33 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing import Union -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput +from typing_extensions import Literal, Annotated, TypedDict, Required from .._utils import PropertyInfo -from .._models import set_pydantic_config + +from google.genai._common import Base64FileInput __all__ = ["DocumentContentParam"] class DocumentContentParam(TypedDict, total=False): - """A document content block.""" - - type: Required[Literal["document"]] + """TypedDict parameter equivalent for DocumentContent.""" data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] """The document content.""" + mime_type: Literal["application/pdf"] """The mime type of the document.""" + + type: Required[Literal["document"]] + uri: str """The URI of the document.""" -set_pydantic_config(DocumentContentParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/dynamic_agent_config.py b/google/genai/_interactions/types/dynamic_agent_config.py index e217d9df9..f2f4ea362 100644 --- a/google/genai/_interactions/types/dynamic_agent_config.py +++ b/google/genai/_interactions/types/dynamic_agent_config.py @@ -11,15 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. -from typing import TYPE_CHECKING, Dict +from __future__ import annotations from typing_extensions import Literal - -from pydantic import Field as FieldInfo - from .._models import BaseModel __all__ = ["DynamicAgentConfig"] @@ -30,14 +26,3 @@ class DynamicAgentConfig(BaseModel): type: Literal["dynamic"] - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] diff --git a/google/genai/_interactions/types/dynamic_agent_config_param.py b/google/genai/_interactions/types/dynamic_agent_config_param.py index bc7844e22..d141911f6 100644 --- a/google/genai/_interactions/types/dynamic_agent_config_param.py +++ b/google/genai/_interactions/types/dynamic_agent_config_param.py @@ -11,18 +11,17 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Literal, TypedDict, Required __all__ = ["DynamicAgentConfigParam"] -class DynamicAgentConfigParam(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] - """Configuration for dynamic agents.""" +class DynamicAgentConfigParam(TypedDict, total=False): + """TypedDict parameter equivalent for DynamicAgentConfig.""" type: Required[Literal["dynamic"]] + diff --git a/google/genai/_interactions/types/environment.py b/google/genai/_interactions/types/environment.py index bbce59d9d..6d49296c2 100644 --- a/google/genai/_interactions/types/environment.py +++ b/google/genai/_interactions/types/environment.py @@ -11,51 +11,44 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Dict, List, Union, Optional from typing_extensions import Literal, TypeAlias - from .._models import BaseModel -__all__ = ["Environment", "Network", "NetworkAllowlist", "NetworkAllowlistAllowlist", "Source"] +__all__ = ["NetworkAllowlistAllowlist", "NetworkAllowlist", "NetworkAllowlistAllowlist", "NetworkAllowlist", "Source"] class NetworkAllowlistAllowlist(BaseModel): """A single domain allowlist rule with optional header injection.""" domain: str - """Domain to allow outbound requests to. + """Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.""" - Supports wildcards (e.g. '_.googleapis.com'). Use '_' to allow all domains. - """ transform: Optional[List[Dict[str, str]]] = None - """Headers to inject on all outbound requests matching this domain. + """Headers to inject on all outbound requests matching this domain. Each entry is a flat {header_name: header_value} object. The egress proxy injects these automatically.""" - Each entry is a flat {header_name: header_value} object. The egress proxy - injects these automatically. - """ -class NetworkAllowlist(BaseModel): - """Outbound networking configuration for the sandbox. +NetworkAllowlist: TypeAlias = Union[object, Literal["disabled"]] + +class NetworkAllowlistAllowlist(BaseModel): + """A single domain allowlist rule with optional header injection.""" - When specified, restricts which external domains the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection. - """ + domain: str + """Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.""" - allowlist: Optional[List[NetworkAllowlistAllowlist]] = None - """List of allowed outbound domains. - Only requests to listed domains are permitted. Use [{'domain': '*'}] to allow - all domains while still injecting headers on specific ones. - """ + transform: Optional[List[Dict[str, str]]] = None + """Headers to inject on all outbound requests matching this domain. Each entry is a flat {header_name: header_value} object. The egress proxy injects these automatically.""" -Network: TypeAlias = Union[Literal["disabled"], NetworkAllowlist] +NetworkAllowlist: TypeAlias = Union[object, Literal["disabled"]] class Source(BaseModel): """A source to be mounted into the environment.""" @@ -63,27 +56,20 @@ class Source(BaseModel): content: Optional[str] = None """The inline content if `type` is `INLINE`.""" + encoding: Optional[str] = None """Optional encoding for inline content (e.g. `base64`).""" + source: Optional[str] = None - """ - The source of the environment. For GCS, this is the GCS path. For GitHub, this - is the GitHub path. - """ + """The source of the environment. +For GCS, this is the GCS path. +For GitHub, this is the GitHub path.""" + target: Optional[str] = None """Where the source should appear in the environment.""" - type: Optional[Literal["gcs", "inline", "repository", "skill_registry"]] = None - -class Environment(BaseModel): - """Configuration for a custom environment.""" - - type: Literal["remote"] - - network: Optional[Network] = None - """Network configuration for the environment.""" + type: Optional[Literal["gcs", "inline", "repository", "skill_registry"]] = None - sources: Optional[List[Source]] = None diff --git a/google/genai/_interactions/types/environment_param.py b/google/genai/_interactions/types/environment_param.py index 58d56e18d..8a274114c 100644 --- a/google/genai/_interactions/types/environment_param.py +++ b/google/genai/_interactions/types/environment_param.py @@ -11,79 +11,78 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing import Any, Dict, Union +from typing_extensions import Literal, TypeAlias, TypedDict, Required + +from google.genai._common import SequenceNotStr -from typing import Dict, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict +__all__ = ["NetworkAllowlistParam", "NetworkAllowlistAllowlistParam", "NetworkAllowlistAllowlistParam", "NetworkAllowlistParam", "SourceParam", "EnvironmentParam"] -__all__ = ["EnvironmentParam", "Network", "NetworkAllowlist", "NetworkAllowlistAllowlist", "Source"] +NetworkAllowlistParam: TypeAlias = Union[Any, Literal["disabled"]] -class NetworkAllowlistAllowlist(TypedDict, total=False): - """A single domain allowlist rule with optional header injection.""" +class NetworkAllowlistAllowlistParam(TypedDict, total=False): + """TypedDict parameter equivalent for AllowlistEntry.""" domain: Required[str] - """Domain to allow outbound requests to. + """Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.""" - Supports wildcards (e.g. '_.googleapis.com'). Use '_' to allow all domains. - """ - transform: Iterable[Dict[str, str]] - """Headers to inject on all outbound requests matching this domain. + transform: SequenceNotStr[Dict[str, str]] + """Headers to inject on all outbound requests matching this domain. Each entry is a flat {header_name: header_value} object. The egress proxy injects these automatically.""" - Each entry is a flat {header_name: header_value} object. The egress proxy - injects these automatically. - """ -class NetworkAllowlist(TypedDict, total=False): - """Outbound networking configuration for the sandbox. +class NetworkAllowlistAllowlistParam(TypedDict, total=False): + """TypedDict parameter equivalent for AllowlistEntry.""" - When specified, restricts which external domains the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection. - """ + domain: Required[str] + """Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.""" - allowlist: Iterable[NetworkAllowlistAllowlist] - """List of allowed outbound domains. - Only requests to listed domains are permitted. Use [{'domain': '*'}] to allow - all domains while still injecting headers on specific ones. - """ + transform: SequenceNotStr[Dict[str, str]] + """Headers to inject on all outbound requests matching this domain. Each entry is a flat {header_name: header_value} object. The egress proxy injects these automatically.""" -Network: TypeAlias = Union[Literal["disabled"], NetworkAllowlist] +NetworkAllowlistParam: TypeAlias = Union[Any, Literal["disabled"]] -class Source(TypedDict, total=False): - """A source to be mounted into the environment.""" +class SourceParam(TypedDict, total=False): + """TypedDict parameter equivalent for Source.""" content: str """The inline content if `type` is `INLINE`.""" + encoding: str """Optional encoding for inline content (e.g. `base64`).""" + source: str - """ - The source of the environment. For GCS, this is the GCS path. For GitHub, this - is the GitHub path. - """ + """The source of the environment. +For GCS, this is the GCS path. +For GitHub, this is the GitHub path.""" + target: str """Where the source should appear in the environment.""" + type: Literal["gcs", "inline", "repository", "skill_registry"] class EnvironmentParam(TypedDict, total=False): - """Configuration for a custom environment.""" + """TypedDict parameter equivalent for EnvironmentConfig.""" - type: Required[Literal["remote"]] - - network: Network + network: Union[NetworkAllowlistParam, Literal["disabled"]] """Network configuration for the environment.""" - sources: Iterable[Source] + + sources: SequenceNotStr[SourceParam] + + type: Required[Literal["remote"]] + diff --git a/google/genai/_interactions/types/error_event.py b/google/genai/_interactions/types/error_event.py index 8abf8ca3e..4e82e4194 100644 --- a/google/genai/_interactions/types/error_event.py +++ b/google/genai/_interactions/types/error_event.py @@ -11,16 +11,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["ErrorEvent", "Error"] +__all__ = ["Error", "ErrorEvent"] class Error(BaseModel): @@ -29,17 +28,19 @@ class Error(BaseModel): code: Optional[str] = None """A URI that identifies the error type.""" + message: Optional[str] = None """A human-readable error message.""" -class ErrorEvent(BaseModel): - event_type: Literal["error"] +class ErrorEvent(BaseModel): error: Optional[Error] = None - """Error message from an interaction.""" event_id: Optional[str] = None - """ - The event_id token to be used to resume the interaction stream, from this event. - """ + """The event_id token to be used to resume the interaction stream, from +this event.""" + + + event_type: Literal["error"] + diff --git a/google/genai/_interactions/types/file_citation.py b/google/genai/_interactions/types/file_citation.py index 5c06b04ca..fd283b05a 100644 --- a/google/genai/_interactions/types/file_citation.py +++ b/google/genai/_interactions/types/file_citation.py @@ -11,13 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. -from typing import Dict, Optional +from __future__ import annotations +from typing import Any, Dict, Optional from typing_extensions import Literal - from .._models import BaseModel __all__ = ["FileCitation"] @@ -26,31 +25,39 @@ class FileCitation(BaseModel): """A file citation annotation.""" - type: Literal["file_citation"] - - custom_metadata: Optional[Dict[str, object]] = None + custom_metadata: Optional[Dict[str, Any]] = None """User provided metadata about the retrieved context.""" + document_uri: Optional[str] = None """The URI of the file.""" + end_index: Optional[int] = None """End of the attributed segment, exclusive.""" + file_name: Optional[str] = None """The name of the file.""" + media_id: Optional[str] = None """Media ID in-case of image citations, if applicable.""" + page_number: Optional[int] = None """Page number of the cited document, if applicable.""" + source: Optional[str] = None """Source attributed for a portion of the text.""" + start_index: Optional[int] = None """Start of segment of the response that is attributed to this source. - Index indicates the start of the segment, measured in bytes. - """ +Index indicates the start of the segment, measured in bytes.""" + + + type: Literal["file_citation"] + diff --git a/google/genai/_interactions/types/file_citation_param.py b/google/genai/_interactions/types/file_citation_param.py index 2f4b5667d..3a185ed87 100644 --- a/google/genai/_interactions/types/file_citation_param.py +++ b/google/genai/_interactions/types/file_citation_param.py @@ -11,46 +11,52 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Dict -from typing_extensions import Literal, Required, TypedDict +from typing import Any, Dict +from typing_extensions import Literal, TypedDict, Required __all__ = ["FileCitationParam"] class FileCitationParam(TypedDict, total=False): - """A file citation annotation.""" - - type: Required[Literal["file_citation"]] + """TypedDict parameter equivalent for FileCitation.""" - custom_metadata: Dict[str, object] + custom_metadata: Dict[str, Any] """User provided metadata about the retrieved context.""" + document_uri: str """The URI of the file.""" + end_index: int """End of the attributed segment, exclusive.""" + file_name: str """The name of the file.""" + media_id: str """Media ID in-case of image citations, if applicable.""" + page_number: int """Page number of the cited document, if applicable.""" + source: str """Source attributed for a portion of the text.""" + start_index: int """Start of segment of the response that is attributed to this source. - Index indicates the start of the segment, measured in bytes. - """ +Index indicates the start of the segment, measured in bytes.""" + + + type: Required[Literal["file_citation"]] + diff --git a/google/genai/_interactions/types/file_search_call_step.py b/google/genai/_interactions/types/file_search_call_step.py index 478cf4cec..01bad43ce 100644 --- a/google/genai/_interactions/types/file_search_call_step.py +++ b/google/genai/_interactions/types/file_search_call_step.py @@ -11,13 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel __all__ = ["FileSearchCallStep"] @@ -29,7 +28,10 @@ class FileSearchCallStep(BaseModel): id: str """Required. A unique ID for this specific tool call.""" - type: Literal["file_search_call"] signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["file_search_call"] + diff --git a/google/genai/_interactions/types/file_search_call_step_param.py b/google/genai/_interactions/types/file_search_call_step_param.py index 0eb378501..1622fa8e7 100644 --- a/google/genai/_interactions/types/file_search_call_step_param.py +++ b/google/genai/_interactions/types/file_search_call_step_param.py @@ -11,32 +11,25 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Union -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config +from typing_extensions import Literal, TypedDict, Required __all__ = ["FileSearchCallStepParam"] class FileSearchCallStepParam(TypedDict, total=False): - """File Search call step.""" + """TypedDict parameter equivalent for FileSearchCallStep.""" id: Required[str] """Required. A unique ID for this specific tool call.""" - type: Required[Literal["file_search_call"]] - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + signature: str """A signature hash for backend validation.""" -set_pydantic_config(FileSearchCallStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["file_search_call"]] + diff --git a/google/genai/_interactions/types/file_search_result_step.py b/google/genai/_interactions/types/file_search_result_step.py index e7331caa3..8d81da1ce 100644 --- a/google/genai/_interactions/types/file_search_result_step.py +++ b/google/genai/_interactions/types/file_search_result_step.py @@ -11,16 +11,21 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["FileSearchResultStep"] +__all__ = ["FileSearchResult", "FileSearchResultStep"] + + +class FileSearchResult(BaseModel): + """The result of the File Search.""" + + pass class FileSearchResultStep(BaseModel): @@ -29,7 +34,10 @@ class FileSearchResultStep(BaseModel): call_id: str """Required. ID to match the ID from the function call block.""" - type: Literal["file_search_result"] signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["file_search_result"] + diff --git a/google/genai/_interactions/types/file_search_result_step_param.py b/google/genai/_interactions/types/file_search_result_step_param.py index e272ada54..b4c8eb7ca 100644 --- a/google/genai/_interactions/types/file_search_result_step_param.py +++ b/google/genai/_interactions/types/file_search_result_step_param.py @@ -11,32 +11,25 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Union -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config +from typing_extensions import Literal, TypedDict, Required __all__ = ["FileSearchResultStepParam"] class FileSearchResultStepParam(TypedDict, total=False): - """File Search result step.""" + """TypedDict parameter equivalent for FileSearchResultStep.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" - type: Required[Literal["file_search_result"]] - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + signature: str """A signature hash for backend validation.""" -set_pydantic_config(FileSearchResultStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["file_search_result"]] + diff --git a/google/genai/_interactions/types/function.py b/google/genai/_interactions/types/function.py index ce14b0414..039e7e23e 100644 --- a/google/genai/_interactions/types/function.py +++ b/google/genai/_interactions/types/function.py @@ -11,13 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. -from typing import Optional +from __future__ import annotations +from typing import Any, Optional from typing_extensions import Literal - from .._models import BaseModel __all__ = ["Function"] @@ -26,13 +25,17 @@ class Function(BaseModel): """A tool that can be used by the model.""" - type: Literal["function"] - description: Optional[str] = None """A description of the function.""" + name: Optional[str] = None """The name of the function.""" - parameters: Optional[object] = None + + parameters: Optional[Any] = None """The JSON Schema for the function's parameters.""" + + + type: Literal["function"] + diff --git a/google/genai/_interactions/types/function_call_step.py b/google/genai/_interactions/types/function_call_step.py index 5486603f1..f2ba7422b 100644 --- a/google/genai/_interactions/types/function_call_step.py +++ b/google/genai/_interactions/types/function_call_step.py @@ -11,13 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Dict, Optional from typing_extensions import Literal - from .._models import BaseModel __all__ = ["FunctionCallStep"] @@ -26,16 +25,21 @@ class FunctionCallStep(BaseModel): """A function tool call step.""" + arguments: Dict[str, object] + """Required. The arguments to pass to the function.""" + + id: str """Required. A unique ID for this specific tool call.""" - arguments: Dict[str, object] - """Required. The arguments to pass to the function.""" name: str """Required. The name of the tool to call.""" - type: Literal["function_call"] signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["function_call"] + diff --git a/google/genai/_interactions/types/function_call_step_param.py b/google/genai/_interactions/types/function_call_step_param.py index b6c487295..8ce72716d 100644 --- a/google/genai/_interactions/types/function_call_step_param.py +++ b/google/genai/_interactions/types/function_call_step_param.py @@ -11,38 +11,34 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Dict, Union -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config +from typing import Dict +from typing_extensions import Literal, TypedDict, Required __all__ = ["FunctionCallStepParam"] class FunctionCallStepParam(TypedDict, total=False): - """A function tool call step.""" + """TypedDict parameter equivalent for FunctionCallStep.""" + + arguments: Required[Dict[str, object]] + """Required. The arguments to pass to the function.""" + id: Required[str] """Required. A unique ID for this specific tool call.""" - arguments: Required[Dict[str, object]] - """Required. The arguments to pass to the function.""" name: Required[str] """Required. The name of the tool to call.""" - type: Required[Literal["function_call"]] - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + signature: str """A signature hash for backend validation.""" -set_pydantic_config(FunctionCallStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["function_call"]] + diff --git a/google/genai/_interactions/types/function_param.py b/google/genai/_interactions/types/function_param.py index 32da748bd..f0ad2d496 100644 --- a/google/genai/_interactions/types/function_param.py +++ b/google/genai/_interactions/types/function_param.py @@ -11,27 +11,30 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict +from typing import Any +from typing_extensions import Literal, TypedDict, Required __all__ = ["FunctionParam"] class FunctionParam(TypedDict, total=False): - """A tool that can be used by the model.""" - - type: Required[Literal["function"]] + """TypedDict parameter equivalent for Function.""" description: str """A description of the function.""" + name: str """The name of the function.""" - parameters: object + + parameters: Any """The JSON Schema for the function's parameters.""" + + + type: Required[Literal["function"]] + diff --git a/google/genai/_interactions/types/function_result_step.py b/google/genai/_interactions/types/function_result_step.py index cd56a6f83..b71ba29d3 100644 --- a/google/genai/_interactions/types/function_result_step.py +++ b/google/genai/_interactions/types/function_result_step.py @@ -11,23 +11,17 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Union, Optional -from typing_extensions import Literal, Annotated, TypeAlias - -from .._utils import PropertyInfo +from typing_extensions import Literal from .._models import BaseModel -from .text_content import TextContent -from .image_content import ImageContent -__all__ = ["FunctionResultStep", "ResultFunctionResultSubcontentList"] +from .mcp_server_tool_result_step import ResultFunctionResultSubcontentList -ResultFunctionResultSubcontentList: TypeAlias = Annotated[ - Union[TextContent, ImageContent], PropertyInfo(discriminator="type") -] +__all__ = ["FunctionResultStep"] class FunctionResultStep(BaseModel): @@ -36,16 +30,22 @@ class FunctionResultStep(BaseModel): call_id: str """Required. ID to match the ID from the function call block.""" - result: Union[List[ResultFunctionResultSubcontentList], str, object] - """The result of the tool call.""" - - type: Literal["function_result"] is_error: Optional[bool] = None """Whether the tool call resulted in an error.""" + name: Optional[str] = None """The name of the tool that was called.""" + + result: Union[List[ResultFunctionResultSubcontentList], str, object] + """The result of the tool call.""" + + signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["function_result"] + diff --git a/google/genai/_interactions/types/function_result_step_param.py b/google/genai/_interactions/types/function_result_step_param.py index aaf7e82a8..2263517d1 100644 --- a/google/genai/_interactions/types/function_result_step_param.py +++ b/google/genai/_interactions/types/function_result_step_param.py @@ -11,45 +11,41 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing import Any, Union +from typing_extensions import Literal, TypedDict, Required -from typing import Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict - -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config -from .text_content_param import TextContentParam -from .image_content_param import ImageContentParam +from .function_result_subcontent_param import ResultFunctionResultSubcontentList +from google.genai._common import SequenceNotStr -__all__ = ["FunctionResultStepParam", "ResultFunctionResultSubcontentList"] - -ResultFunctionResultSubcontentList: TypeAlias = Union[TextContentParam, ImageContentParam] +__all__ = ["FunctionResultStepParam"] class FunctionResultStepParam(TypedDict, total=False): - """Result of a function tool call.""" + """TypedDict parameter equivalent for FunctionResultStep.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" - result: Required[Union[Iterable[ResultFunctionResultSubcontentList], str, object]] - """The result of the tool call.""" - - type: Required[Literal["function_result"]] is_error: bool """Whether the tool call resulted in an error.""" + name: str """The name of the tool that was called.""" - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + + result: Required[Union[SequenceNotStr[ResultFunctionResultSubcontentList], str, Any]] + """The result of the tool call.""" + + + signature: str """A signature hash for backend validation.""" -set_pydantic_config(FunctionResultStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["function_result"]] + diff --git a/google/genai/_interactions/types/function_result_subcontent_param.py b/google/genai/_interactions/types/function_result_subcontent_param.py new file mode 100644 index 000000000..f5ba45d91 --- /dev/null +++ b/google/genai/_interactions/types/function_result_subcontent_param.py @@ -0,0 +1,27 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAlias + +from .image_content_param import ImageContentParam +from .text_content_param import TextContentParam + +__all__ = ["ResultFunctionResultSubcontentList"] + + +ResultFunctionResultSubcontentList: TypeAlias = Union[TextContentParam, ImageContentParam] diff --git a/google/genai/_interactions/types/generation_config.py b/google/genai/_interactions/types/generation_config.py index cf2b99c9a..3325f22d3 100644 --- a/google/genai/_interactions/types/generation_config.py +++ b/google/genai/_interactions/types/generation_config.py @@ -11,24 +11,24 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Union, Optional from typing_extensions import Literal, TypeAlias - from .._models import BaseModel + from .image_config import ImageConfig from .speech_config import SpeechConfig from .thinking_level import ThinkingLevel -from .tool_choice_type import ToolChoiceType from .tool_choice_config import ToolChoiceConfig +from .tool_choice_type import ToolChoiceType -__all__ = ["GenerationConfig", "ToolChoice"] +__all__ = ["ThinkingSummaries", "GenerationConfig", "ToolChoice"] -ToolChoice: TypeAlias = Union[ToolChoiceType, ToolChoiceConfig] +ThinkingSummaries: TypeAlias = Literal["auto", "none"] class GenerationConfig(BaseModel): """Configuration parameters for model interactions.""" @@ -36,29 +36,42 @@ class GenerationConfig(BaseModel): image_config: Optional[ImageConfig] = None """Configuration for image interaction.""" + max_output_tokens: Optional[int] = None """The maximum number of tokens to include in the response.""" + seed: Optional[int] = None """Seed used in decoding for reproducibility.""" + speech_config: Optional[List[SpeechConfig]] = None """Configuration for speech interaction.""" + stop_sequences: Optional[List[str]] = None """A list of character sequences that will stop output interaction.""" + temperature: Optional[float] = None """Controls the randomness of the output.""" + thinking_level: Optional[ThinkingLevel] = None """The level of thought tokens that the model should generate.""" + thinking_summaries: Optional[Literal["auto", "none"]] = None """Whether to include thought summaries in the response.""" - tool_choice: Optional[ToolChoice] = None + + tool_choice: Optional[Union[ToolChoiceType, ToolChoiceConfig]] = None """The tool choice configuration.""" + top_p: Optional[float] = None """The maximum cumulative probability of tokens to consider when sampling.""" + + + +ToolChoice: TypeAlias = Union[ToolChoiceType, ToolChoiceConfig] diff --git a/google/genai/_interactions/types/generation_config_param.py b/google/genai/_interactions/types/generation_config_param.py index 286df7766..30aa5ba7e 100644 --- a/google/genai/_interactions/types/generation_config_param.py +++ b/google/genai/_interactions/types/generation_config_param.py @@ -11,56 +11,67 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Union, Iterable +from typing import Union from typing_extensions import Literal, TypeAlias, TypedDict -from .._types import SequenceNotStr -from .thinking_level import ThinkingLevel -from .tool_choice_type import ToolChoiceType from .image_config_param import ImageConfigParam from .speech_config_param import SpeechConfigParam +from .thinking_level import ThinkingLevelParam from .tool_choice_config_param import ToolChoiceConfigParam +from .tool_choice_type_param import ToolChoiceTypeParam +from google.genai._common import SequenceNotStr -__all__ = ["GenerationConfigParam", "ToolChoice"] +__all__ = ["ThinkingSummariesParam", "GenerationConfigParam", "ToolChoiceParam"] -ToolChoice: TypeAlias = Union[ToolChoiceType, ToolChoiceConfigParam] +ThinkingSummariesParam: TypeAlias = Literal["auto", "none"] class GenerationConfigParam(TypedDict, total=False): - """Configuration parameters for model interactions.""" + """TypedDict parameter equivalent for GenerationConfig.""" image_config: ImageConfigParam """Configuration for image interaction.""" + max_output_tokens: int """The maximum number of tokens to include in the response.""" + seed: int """Seed used in decoding for reproducibility.""" - speech_config: Iterable[SpeechConfigParam] + + speech_config: SequenceNotStr[SpeechConfigParam] """Configuration for speech interaction.""" + stop_sequences: SequenceNotStr[str] """A list of character sequences that will stop output interaction.""" + temperature: float """Controls the randomness of the output.""" - thinking_level: ThinkingLevel + + thinking_level: ThinkingLevelParam """The level of thought tokens that the model should generate.""" + thinking_summaries: Literal["auto", "none"] """Whether to include thought summaries in the response.""" - tool_choice: ToolChoice + + tool_choice: Union[ToolChoiceTypeParam, ToolChoiceConfigParam] """The tool choice configuration.""" + top_p: float """The maximum cumulative probability of tokens to consider when sampling.""" + + + +ToolChoiceParam: TypeAlias = Union[ToolChoiceTypeParam, ToolChoiceConfigParam] diff --git a/google/genai/_interactions/types/google_maps_call_arguments.py b/google/genai/_interactions/types/google_maps_call_arguments.py index 3976e8779..cb027b1ef 100644 --- a/google/genai/_interactions/types/google_maps_call_arguments.py +++ b/google/genai/_interactions/types/google_maps_call_arguments.py @@ -11,12 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional - from .._models import BaseModel __all__ = ["GoogleMapsCallArguments"] @@ -27,3 +26,5 @@ class GoogleMapsCallArguments(BaseModel): queries: Optional[List[str]] = None """The queries to be executed.""" + + diff --git a/google/genai/_interactions/types/google_maps_call_arguments_param.py b/google/genai/_interactions/types/google_maps_call_arguments_param.py new file mode 100644 index 000000000..28c5fabda --- /dev/null +++ b/google/genai/_interactions/types/google_maps_call_arguments_param.py @@ -0,0 +1,30 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing import List +from typing_extensions import TypedDict + +__all__ = ["Arguments"] + + +class Arguments(TypedDict, total=False): + """TypedDict parameter equivalent for GoogleMapsCallStepArguments.""" + + queries: List[str] + """The queries to be executed.""" + + diff --git a/google/genai/_interactions/types/google_maps_call_step.py b/google/genai/_interactions/types/google_maps_call_step.py index a0b095a0b..74b58fa04 100644 --- a/google/genai/_interactions/types/google_maps_call_step.py +++ b/google/genai/_interactions/types/google_maps_call_step.py @@ -11,16 +11,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["GoogleMapsCallStep", "Arguments"] +__all__ = ["Arguments", "GoogleMapsCallStep"] class Arguments(BaseModel): @@ -30,16 +29,21 @@ class Arguments(BaseModel): """The queries to be executed.""" + class GoogleMapsCallStep(BaseModel): """Google Maps call step.""" + arguments: Optional[Arguments] = None + """The arguments to pass to the Google Maps tool.""" + + id: str """Required. A unique ID for this specific tool call.""" - type: Literal["google_maps_call"] - - arguments: Optional[Arguments] = None - """The arguments to pass to the Google Maps tool.""" signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["google_maps_call"] + diff --git a/google/genai/_interactions/types/google_maps_call_step_param.py b/google/genai/_interactions/types/google_maps_call_step_param.py index 09280564c..819621a5d 100644 --- a/google/genai/_interactions/types/google_maps_call_step_param.py +++ b/google/genai/_interactions/types/google_maps_call_step_param.py @@ -11,42 +11,31 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing_extensions import Literal, TypedDict, Required -from typing import Union -from typing_extensions import Literal, Required, Annotated, TypedDict +from .google_maps_call_arguments_param import Arguments -from .._types import SequenceNotStr, Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config +__all__ = ["GoogleMapsCallStepParam"] -__all__ = ["GoogleMapsCallStepParam", "Arguments"] +class GoogleMapsCallStepParam(TypedDict, total=False): + """TypedDict parameter equivalent for GoogleMapsCallStep.""" -class Arguments(TypedDict, total=False): + arguments: Arguments """The arguments to pass to the Google Maps tool.""" - queries: SequenceNotStr[str] - """The queries to be executed.""" - - -class GoogleMapsCallStepParam(TypedDict, total=False): - """Google Maps call step.""" id: Required[str] """Required. A unique ID for this specific tool call.""" - type: Required[Literal["google_maps_call"]] - - arguments: Arguments - """The arguments to pass to the Google Maps tool.""" - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + signature: str """A signature hash for backend validation.""" -set_pydantic_config(GoogleMapsCallStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["google_maps_call"]] + diff --git a/google/genai/_interactions/types/google_maps_result.py b/google/genai/_interactions/types/google_maps_result.py index bc2bc528b..0116c2dbd 100644 --- a/google/genai/_interactions/types/google_maps_result.py +++ b/google/genai/_interactions/types/google_maps_result.py @@ -11,55 +11,62 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional - from .._models import BaseModel -__all__ = ["GoogleMapsResult", "Place", "PlaceReviewSnippet"] - - -class PlaceReviewSnippet(BaseModel): - """ - Encapsulates a snippet of a user review that answers a question about - the features of a specific place in Google Maps. - """ - - review_id: Optional[str] = None - """The ID of the review snippet.""" - - title: Optional[str] = None - """Title of the review.""" +from .place_citation import PlaceReviewSnippet - url: Optional[str] = None - """A link that corresponds to the user review on Google Maps.""" +__all__ = ["Place", "GoogleMapsResult", "PlaceReviewSnippet"] class Place(BaseModel): name: Optional[str] = None """Title of the place.""" + place_id: Optional[str] = None """The ID of the place, in `places/{place_id}` format.""" + review_snippets: Optional[List[PlaceReviewSnippet]] = None - """ - Snippets of reviews that are used to generate answers about the features of a - given place in Google Maps. - """ + """Snippets of reviews that are used to generate answers about the +features of a given place in Google Maps.""" + url: Optional[str] = None """URI reference of the place.""" + class GoogleMapsResult(BaseModel): """The result of the Google Maps.""" places: Optional[List[Place]] = None """The places that were found.""" + widget_context_token: Optional[str] = None """Resource name of the Google Maps widget context token.""" + + + +class PlaceReviewSnippet(BaseModel): + """Encapsulates a snippet of a user review that answers a question about +the features of a specific place in Google Maps.""" + + review_id: Optional[str] = None + """The ID of the review snippet.""" + + + title: Optional[str] = None + """Title of the review.""" + + + url: Optional[str] = None + """A link that corresponds to the user review on Google Maps.""" + + diff --git a/google/genai/_interactions/types/google_maps_result_item_param.py b/google/genai/_interactions/types/google_maps_result_item_param.py new file mode 100644 index 000000000..f295e7f97 --- /dev/null +++ b/google/genai/_interactions/types/google_maps_result_item_param.py @@ -0,0 +1,32 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing import List +from typing_extensions import TypedDict + +from .google_maps_result_places_param import Place + +__all__ = ["ResultPlace"] + + +class ResultPlace(TypedDict, total=False): + """TypedDict parameter equivalent for GoogleMapsResultItem.""" + + places: List[Place] + + widget_context_token: str + diff --git a/google/genai/_interactions/types/google_maps_result_places_param.py b/google/genai/_interactions/types/google_maps_result_places_param.py new file mode 100644 index 000000000..819a9f4bc --- /dev/null +++ b/google/genai/_interactions/types/google_maps_result_places_param.py @@ -0,0 +1,36 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing import List +from typing_extensions import TypedDict + +from .review_snippet_param import PlaceReviewSnippet + +__all__ = ["Place"] + + +class Place(TypedDict, total=False): + """TypedDict parameter equivalent for GoogleMapsResultPlaces.""" + + name: str + + place_id: str + + review_snippets: List[PlaceReviewSnippet] + + url: str + diff --git a/google/genai/_interactions/types/google_maps_result_review_snippet_param.py b/google/genai/_interactions/types/google_maps_result_review_snippet_param.py new file mode 100644 index 000000000..88b70402c --- /dev/null +++ b/google/genai/_interactions/types/google_maps_result_review_snippet_param.py @@ -0,0 +1,37 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing_extensions import TypedDict + +__all__ = ["PlaceReviewSnippet"] + + +class PlaceReviewSnippet(TypedDict, total=False): + """TypedDict parameter equivalent for ReviewSnippet.""" + + review_id: str + """The ID of the review snippet.""" + + + title: str + """Title of the review.""" + + + url: str + """A link that corresponds to the user review on Google Maps.""" + + diff --git a/google/genai/_interactions/types/google_maps_result_step.py b/google/genai/_interactions/types/google_maps_result_step.py index 4d6427800..ac99ec169 100644 --- a/google/genai/_interactions/types/google_maps_result_step.py +++ b/google/genai/_interactions/types/google_maps_result_step.py @@ -11,48 +11,33 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["GoogleMapsResultStep", "Result", "ResultPlace", "ResultPlaceReviewSnippet"] - - -class ResultPlaceReviewSnippet(BaseModel): - """ - Encapsulates a snippet of a user review that answers a question about - the features of a specific place in Google Maps. - """ - - review_id: Optional[str] = None - """The ID of the review snippet.""" - - title: Optional[str] = None - """Title of the review.""" +from .place_citation import PlaceReviewSnippet - url: Optional[str] = None - """A link that corresponds to the user review on Google Maps.""" +__all__ = ["Place", "ResultPlace", "GoogleMapsResultStep", "ResultPlaceReviewSnippet"] -class ResultPlace(BaseModel): +class Place(BaseModel): name: Optional[str] = None place_id: Optional[str] = None - review_snippets: Optional[List[ResultPlaceReviewSnippet]] = None + review_snippets: Optional[List[PlaceReviewSnippet]] = None url: Optional[str] = None -class Result(BaseModel): +class ResultPlace(BaseModel): """The result of the Google Maps.""" - places: Optional[List[ResultPlace]] = None + places: Optional[List[Place]] = None widget_context_token: Optional[str] = None @@ -63,9 +48,29 @@ class GoogleMapsResultStep(BaseModel): call_id: str """Required. ID to match the ID from the function call block.""" - result: List[Result] - type: Literal["google_maps_result"] + result: List[ResultPlace] signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["google_maps_result"] + + +class ResultPlaceReviewSnippet(BaseModel): + """Encapsulates a snippet of a user review that answers a question about +the features of a specific place in Google Maps.""" + + review_id: Optional[str] = None + """The ID of the review snippet.""" + + + title: Optional[str] = None + """Title of the review.""" + + + url: Optional[str] = None + """A link that corresponds to the user review on Google Maps.""" + + diff --git a/google/genai/_interactions/types/google_maps_result_step_param.py b/google/genai/_interactions/types/google_maps_result_step_param.py index 28016ea12..460328ba9 100644 --- a/google/genai/_interactions/types/google_maps_result_step_param.py +++ b/google/genai/_interactions/types/google_maps_result_step_param.py @@ -11,68 +11,30 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing import Iterable +from typing_extensions import Literal, TypedDict, Required -from typing import Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config - -__all__ = ["GoogleMapsResultStepParam", "Result", "ResultPlace", "ResultPlaceReviewSnippet"] - - -class ResultPlaceReviewSnippet(TypedDict, total=False): - """ - Encapsulates a snippet of a user review that answers a question about - the features of a specific place in Google Maps. - """ - - review_id: str - """The ID of the review snippet.""" - - title: str - """Title of the review.""" - - url: str - """A link that corresponds to the user review on Google Maps.""" - - -class ResultPlace(TypedDict, total=False): - name: str +from .google_maps_result_item_param import ResultPlace - place_id: str - - review_snippets: Iterable[ResultPlaceReviewSnippet] - - url: str - - -class Result(TypedDict, total=False): - """The result of the Google Maps.""" - - places: Iterable[ResultPlace] - - widget_context_token: str +__all__ = ["GoogleMapsResultStepParam"] class GoogleMapsResultStepParam(TypedDict, total=False): - """Google Maps result step.""" + """TypedDict parameter equivalent for GoogleMapsResultStep.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" - result: Required[Iterable[Result]] - type: Required[Literal["google_maps_result"]] + result: Required[Iterable[ResultPlace]] - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + signature: str """A signature hash for backend validation.""" -set_pydantic_config(GoogleMapsResultStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["google_maps_result"]] + diff --git a/google/genai/_interactions/types/google_maps_result_step_review_snippet_param.py b/google/genai/_interactions/types/google_maps_result_step_review_snippet_param.py new file mode 100644 index 000000000..9e4952eaf --- /dev/null +++ b/google/genai/_interactions/types/google_maps_result_step_review_snippet_param.py @@ -0,0 +1,37 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing_extensions import TypedDict + +__all__ = ["ResultPlaceReviewSnippet"] + + +class ResultPlaceReviewSnippet(TypedDict, total=False): + """TypedDict parameter equivalent for ReviewSnippet.""" + + review_id: str + """The ID of the review snippet.""" + + + title: str + """Title of the review.""" + + + url: str + """A link that corresponds to the user review on Google Maps.""" + + diff --git a/google/genai/_interactions/types/google_search_call_arguments.py b/google/genai/_interactions/types/google_search_call_arguments.py index 9d93e71f2..e7f5a612a 100644 --- a/google/genai/_interactions/types/google_search_call_arguments.py +++ b/google/genai/_interactions/types/google_search_call_arguments.py @@ -11,12 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional - from .._models import BaseModel __all__ = ["GoogleSearchCallArguments"] @@ -27,3 +26,5 @@ class GoogleSearchCallArguments(BaseModel): queries: Optional[List[str]] = None """Web search queries for the following-up web search.""" + + diff --git a/google/genai/_interactions/types/google_search_call_arguments_param.py b/google/genai/_interactions/types/google_search_call_arguments_param.py new file mode 100644 index 000000000..41c3c3c1c --- /dev/null +++ b/google/genai/_interactions/types/google_search_call_arguments_param.py @@ -0,0 +1,30 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing import List +from typing_extensions import TypedDict + +__all__ = ["Arguments"] + + +class Arguments(TypedDict, total=False): + """TypedDict parameter equivalent for GoogleSearchCallStepArguments.""" + + queries: List[str] + """Web search queries for the following-up web search.""" + + diff --git a/google/genai/_interactions/types/google_search_call_step.py b/google/genai/_interactions/types/google_search_call_step.py index c36abfbcf..dce5290b3 100644 --- a/google/genai/_interactions/types/google_search_call_step.py +++ b/google/genai/_interactions/types/google_search_call_step.py @@ -11,38 +11,43 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["GoogleSearchCallStep", "Arguments"] +__all__ = ["Arguments", "GoogleSearchCallStep"] class Arguments(BaseModel): - """Required. The arguments to pass to Google Search.""" + """The arguments to pass to Google Search.""" queries: Optional[List[str]] = None """Web search queries for the following-up web search.""" + class GoogleSearchCallStep(BaseModel): """Google Search call step.""" - id: str - """Required. A unique ID for this specific tool call.""" - arguments: Arguments """Required. The arguments to pass to Google Search.""" - type: Literal["google_search_call"] + + id: str + """Required. A unique ID for this specific tool call.""" + search_type: Optional[Literal["web_search", "image_search", "enterprise_web_search"]] = None """The type of search grounding enabled.""" + signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["google_search_call"] + diff --git a/google/genai/_interactions/types/google_search_call_step_param.py b/google/genai/_interactions/types/google_search_call_step_param.py index c1f42b364..59d6c37f1 100644 --- a/google/genai/_interactions/types/google_search_call_step_param.py +++ b/google/genai/_interactions/types/google_search_call_step_param.py @@ -11,45 +11,35 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing_extensions import Literal, TypedDict, Required -from typing import Union -from typing_extensions import Literal, Required, Annotated, TypedDict +from .google_search_call_arguments_param import Arguments -from .._types import SequenceNotStr, Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config +__all__ = ["GoogleSearchCallStepParam"] -__all__ = ["GoogleSearchCallStepParam", "Arguments"] +class GoogleSearchCallStepParam(TypedDict, total=False): + """TypedDict parameter equivalent for GoogleSearchCallStep.""" -class Arguments(TypedDict, total=False): + arguments: Required[Arguments] """Required. The arguments to pass to Google Search.""" - queries: SequenceNotStr[str] - """Web search queries for the following-up web search.""" - - -class GoogleSearchCallStepParam(TypedDict, total=False): - """Google Search call step.""" id: Required[str] """Required. A unique ID for this specific tool call.""" - arguments: Required[Arguments] - """Required. The arguments to pass to Google Search.""" - - type: Required[Literal["google_search_call"]] search_type: Literal["web_search", "image_search", "enterprise_web_search"] """The type of search grounding enabled.""" - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + + signature: str """A signature hash for backend validation.""" -set_pydantic_config(GoogleSearchCallStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["google_search_call"]] + diff --git a/google/genai/_interactions/types/google_search_result.py b/google/genai/_interactions/types/google_search_result.py index 9691f5d40..0b7b4b1d0 100644 --- a/google/genai/_interactions/types/google_search_result.py +++ b/google/genai/_interactions/types/google_search_result.py @@ -11,12 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional - from .._models import BaseModel __all__ = ["GoogleSearchResult"] @@ -27,3 +26,5 @@ class GoogleSearchResult(BaseModel): search_suggestions: Optional[str] = None """Web content snippet that can be embedded in a web page or an app webview.""" + + diff --git a/google/genai/_interactions/types/google_search_result_item_param.py b/google/genai/_interactions/types/google_search_result_item_param.py new file mode 100644 index 000000000..5bd8351be --- /dev/null +++ b/google/genai/_interactions/types/google_search_result_item_param.py @@ -0,0 +1,29 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing_extensions import TypedDict + +__all__ = ["Result"] + + +class Result(TypedDict, total=False): + """TypedDict parameter equivalent for GoogleSearchResultItem.""" + + search_suggestions: str + """Web content snippet that can be embedded in a web page or an app webview.""" + + diff --git a/google/genai/_interactions/types/google_search_result_step.py b/google/genai/_interactions/types/google_search_result_step.py index 976b6cea1..7312d8203 100644 --- a/google/genai/_interactions/types/google_search_result_step.py +++ b/google/genai/_interactions/types/google_search_result_step.py @@ -11,16 +11,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["GoogleSearchResultStep", "Result"] +__all__ = ["Result", "GoogleSearchResultStep"] class Result(BaseModel): @@ -30,19 +29,25 @@ class Result(BaseModel): """Web content snippet that can be embedded in a web page or an app webview.""" + class GoogleSearchResultStep(BaseModel): """Google Search result step.""" call_id: str """Required. ID to match the ID from the function call block.""" - result: List[Result] - """Required. The results of the Google Search.""" - - type: Literal["google_search_result"] is_error: Optional[bool] = None """Whether the Google Search resulted in an error.""" + + result: List[Result] + """Required. The results of the Google Search.""" + + signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["google_search_result"] + diff --git a/google/genai/_interactions/types/google_search_result_step_param.py b/google/genai/_interactions/types/google_search_result_step_param.py index 160d87f96..529235ee8 100644 --- a/google/genai/_interactions/types/google_search_result_step_param.py +++ b/google/genai/_interactions/types/google_search_result_step_param.py @@ -11,45 +11,36 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing import Iterable +from typing_extensions import Literal, TypedDict, Required -from typing import Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config - -__all__ = ["GoogleSearchResultStepParam", "Result"] - +from .google_search_result_item_param import Result -class Result(TypedDict, total=False): - """The result of the Google Search.""" - - search_suggestions: str - """Web content snippet that can be embedded in a web page or an app webview.""" +__all__ = ["GoogleSearchResultStepParam"] class GoogleSearchResultStepParam(TypedDict, total=False): - """Google Search result step.""" + """TypedDict parameter equivalent for GoogleSearchResultStep.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" - result: Required[Iterable[Result]] - """Required. The results of the Google Search.""" - - type: Required[Literal["google_search_result"]] is_error: bool """Whether the Google Search resulted in an error.""" - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + + result: Required[Iterable[Result]] + """Required. The results of the Google Search.""" + + + signature: str """A signature hash for backend validation.""" -set_pydantic_config(GoogleSearchResultStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["google_search_result"]] + diff --git a/google/genai/_interactions/types/image_config.py b/google/genai/_interactions/types/image_config.py index a0d35b37a..ecd4ab00f 100644 --- a/google/genai/_interactions/types/image_config.py +++ b/google/genai/_interactions/types/image_config.py @@ -11,13 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional -from typing_extensions import Literal +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations +from typing import Any, Optional from .._models import BaseModel __all__ = ["ImageConfig"] @@ -26,8 +24,7 @@ class ImageConfig(BaseModel): """The configuration for image interaction.""" - aspect_ratio: Optional[ - Literal["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "1:8", "8:1", "1:4", "4:1"] - ] = None + aspect_ratio: Optional[Any] = None + + image_size: Optional[Any] = None - image_size: Optional[Literal["1K", "2K", "4K", "512"]] = None diff --git a/google/genai/_interactions/types/image_config_param.py b/google/genai/_interactions/types/image_config_param.py index d88dad869..0d42f5213 100644 --- a/google/genai/_interactions/types/image_config_param.py +++ b/google/genai/_interactions/types/image_config_param.py @@ -11,22 +11,20 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing_extensions import Literal, TypedDict +from typing import Any +from typing_extensions import TypedDict __all__ = ["ImageConfigParam"] class ImageConfigParam(TypedDict, total=False): - """The configuration for image interaction.""" + """TypedDict parameter equivalent for ImageConfig.""" + + aspect_ratio: Any - aspect_ratio: Literal[ - "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "1:8", "8:1", "1:4", "4:1" - ] + image_size: Any - image_size: Literal["1K", "2K", "4K", "512"] diff --git a/google/genai/_interactions/types/image_content.py b/google/genai/_interactions/types/image_content.py index c0c90ed63..6b7663491 100644 --- a/google/genai/_interactions/types/image_content.py +++ b/google/genai/_interactions/types/image_content.py @@ -11,14 +11,17 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional -from typing_extensions import Literal +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations +from typing import Union, Optional +from typing_extensions import Literal, Annotated from .._models import BaseModel +from .._utils import PropertyInfo + +from .usage import MediaResolution +from google.genai._common import Base64FileInput __all__ = ["ImageContent"] @@ -26,20 +29,21 @@ class ImageContent(BaseModel): """An image content block.""" - type: Literal["image"] - - data: Optional[str] = None + data: Optional[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] = None """The image content.""" - mime_type: Optional[ - Literal[ - "image/png", "image/jpeg", "image/webp", "image/heic", "image/heif", "image/gif", "image/bmp", "image/tiff" - ] - ] = None + + mime_type: Optional[Literal["image/png", "image/jpeg", "image/webp", "image/heic", "image/heif", "image/gif", "image/bmp", "image/tiff"]] = None """The mime type of the image.""" - resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None + + resolution: Optional[MediaResolution] = None """The resolution of the media.""" + + type: Literal["image"] + uri: Optional[str] = None """The URI of the image.""" + + diff --git a/google/genai/_interactions/types/image_content_param.py b/google/genai/_interactions/types/image_content_param.py index 7fd5456b2..50a049853 100644 --- a/google/genai/_interactions/types/image_content_param.py +++ b/google/genai/_interactions/types/image_content_param.py @@ -11,40 +11,38 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing import Union -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput +from typing_extensions import Literal, Annotated, TypedDict, Required from .._utils import PropertyInfo -from .._models import set_pydantic_config + +from .usage_param import MediaResolutionParam +from google.genai._common import Base64FileInput __all__ = ["ImageContentParam"] class ImageContentParam(TypedDict, total=False): - """An image content block.""" - - type: Required[Literal["image"]] + """TypedDict parameter equivalent for ImageContent.""" data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] """The image content.""" - mime_type: Literal[ - "image/png", "image/jpeg", "image/webp", "image/heic", "image/heif", "image/gif", "image/bmp", "image/tiff" - ] + + mime_type: Literal["image/png", "image/jpeg", "image/webp", "image/heic", "image/heif", "image/gif", "image/bmp", "image/tiff"] """The mime type of the image.""" - resolution: Literal["low", "medium", "high", "ultra_high"] + + resolution: MediaResolutionParam """The resolution of the media.""" + + type: Required[Literal["image"]] + uri: str """The URI of the image.""" -set_pydantic_config(ImageContentParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/image_response_format.py b/google/genai/_interactions/types/image_response_format.py index 27ce056fd..1be30f1e8 100644 --- a/google/genai/_interactions/types/image_response_format.py +++ b/google/genai/_interactions/types/image_response_format.py @@ -11,13 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel __all__ = ["ImageResponseFormat"] @@ -26,18 +25,21 @@ class ImageResponseFormat(BaseModel): """Configuration for image output format.""" - type: Literal["image"] - - aspect_ratio: Optional[ - Literal["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "1:8", "8:1", "1:4", "4:1"] - ] = None + aspect_ratio: Optional[Literal["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "1:8", "8:1", "1:4", "4:1"]] = None """The aspect ratio for the image output.""" + delivery: Optional[Literal["inline", "uri"]] = None """The delivery mode for the image output.""" + image_size: Optional[Literal["512", "1K", "2K", "4K"]] = None """The size of the image output.""" + mime_type: Optional[Literal["image/jpeg"]] = None """The MIME type of the image output.""" + + + type: Literal["image"] + diff --git a/google/genai/_interactions/types/image_response_format_param.py b/google/genai/_interactions/types/image_response_format_param.py index 149b6b582..1a1c1f71a 100644 --- a/google/genai/_interactions/types/image_response_format_param.py +++ b/google/genai/_interactions/types/image_response_format_param.py @@ -11,32 +11,33 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Literal, TypedDict, Required __all__ = ["ImageResponseFormatParam"] class ImageResponseFormatParam(TypedDict, total=False): - """Configuration for image output format.""" - - type: Required[Literal["image"]] + """TypedDict parameter equivalent for ImageResponseFormat.""" - aspect_ratio: Literal[ - "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "1:8", "8:1", "1:4", "4:1" - ] + aspect_ratio: Literal["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "1:8", "8:1", "1:4", "4:1"] """The aspect ratio for the image output.""" + delivery: Literal["inline", "uri"] """The delivery mode for the image output.""" + image_size: Literal["512", "1K", "2K", "4K"] """The size of the image output.""" + mime_type: Literal["image/jpeg"] """The MIME type of the image output.""" + + + type: Required[Literal["image"]] + diff --git a/google/genai/_interactions/types/interaction.py b/google/genai/_interactions/types/interaction.py index 505d1f63a..f00af0ae3 100644 --- a/google/genai/_interactions/types/interaction.py +++ b/google/genai/_interactions/types/interaction.py @@ -11,290 +11,211 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations -from typing import TYPE_CHECKING, Any, Set, Dict, List, Tuple, Union, Optional, cast from datetime import datetime -from typing_extensions import Literal, Annotated, TypeAlias, override +from typing import Any, List, Union, Optional +from typing_extensions import Literal, Annotated, TypeAlias, TypedDict, Required +from .._models import BaseModel +from .._utils import PropertyInfo -from . import environment +from .audio_response_format import AudioResponseFormat +from .audio_response_format_param import AudioResponseFormatParam +from .content import Content +from .content_param import ContentParam +from .deep_research_agent_config import DeepResearchAgentConfig +from .dynamic_agent_config import DynamicAgentConfig +from .error_event import Error +from .generation_config import GenerationConfig +from .image_response_format import ImageResponseFormat +from .image_response_format_param import ImageResponseFormatParam +from .interaction_create_params import Environment +from .interaction_create_params import InteractionsInput +from .interaction_create_params import ResponseFormat +from .interaction_create_params import ResponseFormatList +from .model import Model +from .response_modality import ResponseModality from .step import Step +from .step_param import StepParam +from .text_response_format import TextResponseFormat +from .text_response_format_param import TextResponseFormatParam from .tool import Tool -from .model import Model from .usage import Usage -from .._utils import PropertyInfo -from .content import Content -from .._compat import PYDANTIC_V1 -from .._models import BaseModel -from .text_content import TextContent -from .audio_content import AudioContent -from .image_content import ImageContent -from .video_content import VideoContent -from .._legacy_lyria import is_legacy_lyria_response_body from .webhook_config import WebhookConfig -from .user_input_step import UserInputStep -from .document_content import DocumentContent -from .model_output_step import ModelOutputStep -from .dynamic_agent_config import DynamicAgentConfig -from .text_response_format import TextResponseFormat -from .audio_response_format import AudioResponseFormat -from .image_response_format import ImageResponseFormat -from .deep_research_agent_config import DeepResearchAgentConfig +from datetime import datetime +from google.genai._common import SequenceNotStr + +__all__ = ["AgentConfig", "AgentOption", "AgentOptionParam", "CancelCancelInteractionByIdParams", "CancelCancelInteractionByIdResponse", "Input", "InputParam", "ServiceTier", "Interaction", "InteractionCreateResponse", "InteractionDeleteResponse", "InteractionEnvironment", "InteractionGetResponse", "InteractionResponseFormat", "InteractionsInputParam", "ResponseFormatListParam", "ResponseFormatParam", "ResponseFormatResponseFormatList", "ServiceTierParam", "Turn"] -__all__ = ["Interaction", "AgentConfig", "Environment", "Input", "ResponseFormat", "ResponseFormatResponseFormatList"] AgentConfig: TypeAlias = Annotated[ Union[DynamicAgentConfig, DeepResearchAgentConfig], PropertyInfo(discriminator="type") ] -Environment: TypeAlias = Union[str, environment.Environment] +AgentOption: TypeAlias = Union[str, Any, Any, Any] -Input: TypeAlias = Union[ - str, List[Step], List[Content], TextContent, ImageContent, AudioContent, DocumentContent, VideoContent -] +AgentOptionParam: TypeAlias = Union[str, Any, Any, Any] -ResponseFormatResponseFormatList: TypeAlias = Union[ - AudioResponseFormat, TextResponseFormat, ImageResponseFormat, object -] +class CancelCancelInteractionByIdParams(TypedDict, total=False): + """Parameters for CancelCancelInteractionByIdParams""" -ResponseFormat: TypeAlias = Union[ - List[ResponseFormatResponseFormatList], AudioResponseFormat, TextResponseFormat, ImageResponseFormat, object -] + id: Required[str] + """The unique identifier of the interaction to cancel.""" -class Interaction(BaseModel): - """The Interaction resource.""" + api_version: str + """Which version of the API to use.""" - id: str - """Required. Output only. A unique identifier for the interaction completion.""" - created: datetime - """Required. - Output only. The time at which the response was created in ISO 8601 format - (YYYY-MM-DDThh:mm:ssZ). - """ +class CancelCancelInteractionByIdResponse(BaseModel): + error: Optional[Error] = None - status: Literal[ - "in_progress", "requires_action", "completed", "failed", "cancelled", "incomplete", "budget_exceeded" - ] - """Required. Output only. The status of the interaction.""" - steps: List[Step] - """Required. Output only. The steps that make up the interaction.""" +Input: TypeAlias = Union[str, List[Step], List[Content], Content] - updated: datetime - """Required. - - Output only. The time at which the response was last updated in ISO 8601 format - (YYYY-MM-DDThh:mm:ssZ). - """ - - agent: Union[ - Literal[ - "deep-research-pro-preview-12-2025", "deep-research-preview-04-2026", "deep-research-max-preview-04-2026" - ], - str, - None, - ] = None +InputParam: TypeAlias = Union[str, SequenceNotStr[StepParam], SequenceNotStr[ContentParam], ContentParam] + +ServiceTier: TypeAlias = Literal["flex", "standard", "priority"] + +class Interaction(BaseModel): + """The Interaction resource.""" + + model: Optional[Model] = None + """The name of the `Model` used for generating the interaction.""" + + + agent: Optional[Union[Literal["deep-research-pro-preview-12-2025", "deep-research-preview-04-2026", "deep-research-max-preview-04-2026"], str]] = None """The name of the `Agent` used for generating the interaction.""" - agent_config: Optional[AgentConfig] = None - """Configuration parameters for the agent interaction.""" - environment: Optional[Environment] = None - """The environment configuration for the interaction. + created: datetime + """Required. Output only. The time at which the response was created in ISO 8601 format +(YYYY-MM-DDThh:mm:ssZ).""" + + + environment: Optional[Union[str, Environment]] = None + """The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" - Can be an object specifying remote environment sources or a string referencing - an existing environment ID. - """ environment_id: Optional[str] = None - """Output only. + """Output only. The environment ID for the interaction. Only populated if environment +config is set in the request.""" - The environment ID for the interaction. Only populated if environment config is - set in the request. - """ - input: Optional[Input] = None - """The input for the interaction.""" + id: str + """Required. Output only. A unique identifier for the interaction completion.""" - model: Optional[Model] = None - """The name of the `Model` used for generating the interaction.""" + + input: Optional[InteractionsInput] = None previous_interaction_id: Optional[str] = None """The ID of the previous interaction, if any.""" - response_format: Optional[ResponseFormat] = None - """ - Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - """ + + response_format: Optional[Union[ResponseFormatList, ResponseFormat]] = None + """Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + response_mime_type: Optional[str] = None """The mime type of the response. This is required if response_format is set.""" - response_modalities: Optional[List[Literal["text", "image", "audio", "video", "document"]]] = None + + response_modalities: Optional[List[ResponseModality]] = None """The requested modalities of the response (TEXT, IMAGE, AUDIO).""" + role: Optional[str] = None """Output only. The role of the interaction.""" - service_tier: Optional[Literal["flex", "standard", "priority"]] = None + + service_tier: Optional[ServiceTier] = None """The service tier for the interaction.""" + + status: Literal["in_progress", "requires_action", "completed", "failed", "cancelled", "incomplete", "budget_exceeded"] + """Required. Output only. The status of the interaction.""" + + + steps: List[Step] + """Required. Output only. The steps that make up the interaction.""" + + system_instruction: Optional[str] = None """System instruction for the interaction.""" + tools: Optional[List[Tool]] = None """A list of tool declarations the model may call during interaction.""" + + updated: datetime + """Required. Output only. The time at which the response was last updated in ISO 8601 format +(YYYY-MM-DDThh:mm:ssZ).""" + + usage: Optional[Usage] = None """Output only. Statistics on the interaction request's token usage.""" + webhook_config: Optional[WebhookConfig] = None - """Optional. - - Webhook configuration for receiving notifications when the interaction - completes. - """ - - @classmethod - def _maybe_coerce_outputs(cls, data: Any) -> Tuple[Any, bool]: - """Rewrite legacy vertex `outputs` payloads into the modern `steps` shape. - - Returns `(data, did_rewrite)` so callers (notably the `construct` - override below) can react to whether the rewrite actually fired - without relying on object identity. - - Triggers only when the response body identifies itself as a legacy- - lyria payload via its top-level `model` field. The model field is - present on every Interaction body produced by `create()`, `get()`, - and any deferred parse via `with_raw_response.parse()`, including - the nested `interaction` bodies inside `interaction.created` / - `interaction.completed` SSE events. - - Skips the rewrite if `outputs` isn't a list (e.g. server emits an - explicit `null`) so the divergence surfaces in `__pydantic_extra__` - instead of being silently coerced into an empty step. - - On rewrite, the original `outputs` field is popped so it doesn't - land on the parsed model as a redundant extra. - """ - if not isinstance(data, dict): - return data, False - typed_data: Dict[str, Any] = cast("Dict[str, Any]", data) - if not is_legacy_lyria_response_body(typed_data): - return typed_data, False - if "outputs" not in typed_data or "steps" in typed_data: - return typed_data, False - outputs = typed_data["outputs"] - if not isinstance(outputs, list): - return typed_data, False - - new_data: Dict[str, Any] = {**typed_data} - new_data.pop("outputs") - new_data["steps"] = [{"type": "model_output", "content": outputs}] - return new_data, True - - @classmethod - @override - def construct( # pyright: ignore[reportIncompatibleMethodOverride] - cls, - _fields_set: Optional[Set[str]] = None, - **values: Any, - ) -> "Interaction": - coerced, rewrote = cls._maybe_coerce_outputs(values) - # If we rewrote `outputs` -> `steps` and the caller passed an explicit - # _fields_set including `outputs`, swap the field name so - # `model_dump(exclude_unset=True)` and friends report `steps` as set - # rather than the field that no longer exists on the model. - if rewrote and _fields_set is not None and "outputs" in _fields_set: - _fields_set = (set(_fields_set) - {"outputs"}) | {"steps"} - return super().construct(_fields_set=_fields_set, **coerced) # type: ignore[return-value] - - if not TYPE_CHECKING: - model_construct = construct - - if PYDANTIC_V1: - from pydantic import root_validator - - @root_validator(pre=True) - def _coerce_outputs_to_steps(cls, values: Any) -> Any: - coerced, _ = cls._maybe_coerce_outputs(values) - return coerced - else: - from pydantic import model_validator - - @model_validator(mode="before") - @classmethod - def _coerce_outputs_to_steps(cls, data: Any) -> Any: - coerced, _ = cls._maybe_coerce_outputs(data) - return coerced - - @property - def output_text(self) -> str: - """The last consecutive run of text from the trailing model output steps. - - Scans backwards through the steps (stopping at any UserInputStep) and - skips non-text content until the first text item is found, then - continues collecting text until a non-text item is encountered. - Returns an empty string when no text content is present. - """ - parts: List[str] = [] - collecting = False - for step in reversed(self.steps or []): - if isinstance(step, UserInputStep): - break - if not isinstance(step, ModelOutputStep) or not step.content: - if collecting: - break - continue - for content in reversed(step.content): - if isinstance(content, TextContent): - collecting = True - parts.append(content.text) - elif collecting: - # Hit a non-text barrier after we started collecting. - parts.reverse() - return "".join(parts) - parts.reverse() - return "".join(parts) - - @property - def output_image(self) -> Optional[ImageContent]: - """The last image generated by the model in response to the current request.""" - for step in reversed(self.steps): - if isinstance(step, UserInputStep): - break - if isinstance(step, ModelOutputStep) and step.content: - for content in reversed(step.content): - if isinstance(content, ImageContent): - return content - return None - - @property - def output_audio(self) -> Optional[AudioContent]: - """The last audio generated by the model in response to the current request.""" - for step in reversed(self.steps): - if isinstance(step, UserInputStep): - break - if isinstance(step, ModelOutputStep) and step.content: - for content in reversed(step.content): - if isinstance(content, AudioContent): - return content - return None - - @property - def output_video(self) -> Optional[VideoContent]: - """The last video generated by the model in response to the current request.""" - for step in reversed(self.steps): - if isinstance(step, UserInputStep): - break - if isinstance(step, ModelOutputStep) and step.content: - for content in reversed(step.content): - if isinstance(content, VideoContent): - return content - return None + """Optional. Webhook configuration for receiving notifications when the +interaction completes.""" + + + generation_config: Optional[GenerationConfig] = None + """Input only. Configuration parameters for the model interaction.""" + + + agent_config: Optional[Union[DynamicAgentConfig, DeepResearchAgentConfig]] = None + """Configuration parameters for the agent interaction.""" + + + +class InteractionCreateResponse(BaseModel): + error: Optional[Error] = None + + +class InteractionDeleteResponse(BaseModel): + error: Optional[Error] = None + + +InteractionEnvironment: TypeAlias = Union[str, Environment] + +class InteractionGetResponse(BaseModel): + error: Optional[Error] = None + + +ResponseFormat: TypeAlias = Union[ + List[ResponseFormatResponseFormatList], + AudioResponseFormat, + TextResponseFormat, + ImageResponseFormat, + object, +] + +InteractionsInputParam: TypeAlias = Union[str, SequenceNotStr[StepParam], SequenceNotStr[ContentParam], ContentParam] + +ResponseFormatListParam: TypeAlias = SequenceNotStr[ResponseFormat] + +ResponseFormatParam: TypeAlias = Union[AudioResponseFormatParam, TextResponseFormatParam, ImageResponseFormatParam, Any] + +class ResponseFormatResponseFormatList(BaseModel): + """The ResponseFormatResponseFormatList resource.""" + + pass + + +ServiceTierParam: TypeAlias = Literal["flex", "standard", "priority"] + +class Turn(BaseModel): + content: Optional[Union[List[Content], str]] = None + + role: Optional[str] = None + """The originator of this turn. Must be user for input or model for +model output.""" + + diff --git a/google/genai/_interactions/types/interaction_completed_event.py b/google/genai/_interactions/types/interaction_completed_event.py index f19bcc50e..86874c526 100644 --- a/google/genai/_interactions/types/interaction_completed_event.py +++ b/google/genai/_interactions/types/interaction_completed_event.py @@ -11,30 +11,29 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel + from .interaction import Interaction __all__ = ["InteractionCompletedEvent"] class InteractionCompletedEvent(BaseModel): + event_id: Optional[str] = None + """The event_id token to be used to resume the interaction stream, from +this event.""" + + event_type: Literal["interaction.completed"] interaction: Interaction - """Required. + """Required. The completed interaction with empty outputs to reduce the payload size. +Use the preceding ContentDelta events for the actual output.""" - The completed interaction with empty outputs to reduce the payload size. Use the - preceding ContentDelta events for the actual output. - """ - event_id: Optional[str] = None - """ - The event_id token to be used to resume the interaction stream, from this event. - """ diff --git a/google/genai/_interactions/types/interaction_create_params.py b/google/genai/_interactions/types/interaction_create_params.py index 61a7761a5..b64d5f6f2 100644 --- a/google/genai/_interactions/types/interaction_create_params.py +++ b/google/genai/_interactions/types/interaction_create_params.py @@ -11,223 +11,250 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing import List, Union, Optional, Iterable +from typing_extensions import Literal, TypeAlias, TypedDict, Required +from .._models import BaseModel -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -from .step_param import StepParam -from .tool_param import ToolParam -from .model_param import ModelParam -from .content_param import ContentParam -from .environment_param import EnvironmentParam -from .text_content_param import TextContentParam -from .audio_content_param import AudioContentParam -from .image_content_param import ImageContentParam -from .video_content_param import VideoContentParam -from .webhook_config_param import WebhookConfigParam -from .document_content_param import DocumentContentParam -from .generation_config_param import GenerationConfigParam -from .dynamic_agent_config_param import DynamicAgentConfigParam -from .text_response_format_param import TextResponseFormatParam -from .audio_response_format_param import AudioResponseFormatParam -from .image_response_format_param import ImageResponseFormatParam -from .deep_research_agent_config_param import DeepResearchAgentConfigParam - -__all__ = [ - "BaseCreateModelInteractionParams", - "Input", - "Environment", - "ResponseFormat", - "ResponseFormatResponseFormatList", - "BaseCreateAgentInteractionParams", - "AgentConfig", - "CreateModelInteractionParamsNonStreaming", - "CreateModelInteractionParamsStreaming", - "CreateAgentInteractionParamsNonStreaming", - "CreateAgentInteractionParamsStreaming", -] - - -class BaseCreateModelInteractionParams(TypedDict, total=False): - api_version: str +from .audio_response_format import AudioResponseFormat +from .content import Content +from .deep_research_agent_config import DeepResearchAgentConfig +from .dynamic_agent_config import DynamicAgentConfig +from .environment import NetworkAllowlist +from .environment import Source +from .generation_config import GenerationConfig +from .image_response_format import ImageResponseFormat +from .interaction import AgentOption +from .interaction import ServiceTier +from .model import Model +from .response_modality import ResponseModality +from .step import Step +from .text_response_format import TextResponseFormat +from .tool import Tool +from .usage import Usage +from .webhook_config import WebhookConfig +from google.genai._common import SequenceNotStr - input: Required[Input] - """The input for the interaction.""" +__all__ = ["Environment", "InteractionsInput", "ResponseFormat", "ResponseFormatList", "CreateAgentInteractionParams", "CreateModelInteractionParams", "InteractionCreateParams"] + + +class Environment(BaseModel): + """Configuration for a custom environment.""" + + network: Optional[Union[NetworkAllowlist, Literal["disabled"]]] = None + """Network configuration for the environment.""" + + + sources: Optional[List[Source]] = None + + type: Literal["remote"] + + +InteractionsInput: TypeAlias = Union[str, List[Step], List[Content], Content] + +ResponseFormat: TypeAlias = Union[AudioResponseFormat, TextResponseFormat, ImageResponseFormat, object] + +class ResponseFormatList(BaseModel): + """The ResponseFormatList resource.""" + + pass + + +class CreateAgentInteractionParams(TypedDict, total=False): + """Parameters for creating agent interactions""" + + agent: Required[AgentOption] + """The name of the `Agent` used for generating the interaction.""" - model: Required[ModelParam] - """The name of the `Model` used for generating the interaction.""" background: bool """Input only. Whether to run the model interaction in the background.""" - environment: Environment - """The environment configuration for the interaction. - Can be an object specifying remote environment sources or a string referencing - an existing environment ID. - """ + store: bool + """Input only. Whether to store the response and request for later retrieval.""" - generation_config: GenerationConfigParam - """Input only. Configuration parameters for the model interaction.""" + + stream: bool + """Input only. Whether the interaction will be streamed.""" + + + created: str + """Required. Output only. The time at which the response was created in ISO 8601 format +(YYYY-MM-DDThh:mm:ssZ).""" + + + environment: Union[str, Environment] + """The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" + + + environment_id: str + """Output only. The environment ID for the interaction. Only populated if environment +config is set in the request.""" + + + id: str + """Required. Output only. A unique identifier for the interaction completion.""" + + + input: Required[InteractionsInput] previous_interaction_id: str """The ID of the previous interaction, if any.""" - response_format: ResponseFormat - """ - Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - """ + + response_format: Union[ResponseFormatList, ResponseFormat] + """Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + response_mime_type: str """The mime type of the response. This is required if response_format is set.""" - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] + + response_modalities: SequenceNotStr[ResponseModality] """The requested modalities of the response (TEXT, IMAGE, AUDIO).""" - service_tier: Literal["flex", "standard", "priority"] + + role: str + """Output only. The role of the interaction.""" + + + service_tier: ServiceTier """The service tier for the interaction.""" - store: bool - """Input only. Whether to store the response and request for later retrieval.""" + + status: Literal["in_progress", "requires_action", "completed", "failed", "cancelled", "incomplete", "budget_exceeded"] + """Required. Output only. The status of the interaction.""" + system_instruction: str """System instruction for the interaction.""" - tools: Iterable[ToolParam] + + tools: Iterable[Tool] """A list of tool declarations the model may call during interaction.""" - webhook_config: WebhookConfigParam - """Optional. - Webhook configuration for receiving notifications when the interaction - completes. - """ + updated: str + """Required. Output only. The time at which the response was last updated in ISO 8601 format +(YYYY-MM-DDThh:mm:ssZ).""" -Input: TypeAlias = Union[ - str, - Iterable[StepParam], - Iterable[ContentParam], - TextContentParam, - ImageContentParam, - AudioContentParam, - DocumentContentParam, - VideoContentParam, -] + usage: Usage + """Output only. Statistics on the interaction request's token usage.""" -Environment: TypeAlias = Union[str, EnvironmentParam] -ResponseFormatResponseFormatList: TypeAlias = Union[ - AudioResponseFormatParam, TextResponseFormatParam, ImageResponseFormatParam, object -] + webhook_config: WebhookConfig + """Optional. Webhook configuration for receiving notifications when the +interaction completes.""" -ResponseFormat: TypeAlias = Union[ - Iterable[ResponseFormatResponseFormatList], - AudioResponseFormatParam, - TextResponseFormatParam, - ImageResponseFormatParam, - object, -] + agent_config: Union[DynamicAgentConfig, DeepResearchAgentConfig] + """Configuration parameters for the agent interaction.""" -class BaseCreateAgentInteractionParams(TypedDict, total=False): - api_version: str - agent: Required[ - Union[ - Literal[ - "deep-research-pro-preview-12-2025", - "deep-research-preview-04-2026", - "deep-research-max-preview-04-2026", - ], - str, - ] - ] - """The name of the `Agent` used for generating the interaction.""" - input: Required[Input] - """The input for the interaction.""" +class CreateModelInteractionParams(TypedDict, total=False): + """Parameters for creating model interactions""" + + model: Required[Model] + """The name of the `Model` used for generating the interaction.""" - agent_config: AgentConfig - """Configuration parameters for the agent interaction.""" background: bool """Input only. Whether to run the model interaction in the background.""" - environment: Environment - """The environment configuration for the interaction. - Can be an object specifying remote environment sources or a string referencing - an existing environment ID. - """ + store: bool + """Input only. Whether to store the response and request for later retrieval.""" + + + stream: bool + """Input only. Whether the interaction will be streamed.""" + + + created: str + """Required. Output only. The time at which the response was created in ISO 8601 format +(YYYY-MM-DDThh:mm:ssZ).""" + + + environment: Union[str, Environment] + """The environment configuration for the interaction. Can be an object specifying remote environment sources or a string referencing an existing environment ID.""" + + + environment_id: str + """Output only. The environment ID for the interaction. Only populated if environment +config is set in the request.""" + + + id: str + """Required. Output only. A unique identifier for the interaction completion.""" + + + input: Required[InteractionsInput] previous_interaction_id: str """The ID of the previous interaction, if any.""" - response_format: ResponseFormat - """ - Enforces that the generated response is a JSON object that complies with the - JSON schema specified in this field. - """ + + response_format: Union[ResponseFormatList, ResponseFormat] + """Enforces that the generated response is a JSON object that complies with the JSON schema specified in this field.""" + response_mime_type: str """The mime type of the response. This is required if response_format is set.""" - response_modalities: List[Literal["text", "image", "audio", "video", "document"]] + + response_modalities: SequenceNotStr[ResponseModality] """The requested modalities of the response (TEXT, IMAGE, AUDIO).""" - service_tier: Literal["flex", "standard", "priority"] + + role: str + """Output only. The role of the interaction.""" + + + service_tier: ServiceTier """The service tier for the interaction.""" - store: bool - """Input only. Whether to store the response and request for later retrieval.""" + + status: Literal["in_progress", "requires_action", "completed", "failed", "cancelled", "incomplete", "budget_exceeded"] + """Required. Output only. The status of the interaction.""" + system_instruction: str """System instruction for the interaction.""" - tools: Iterable[ToolParam] + + tools: Iterable[Tool] """A list of tool declarations the model may call during interaction.""" - webhook_config: WebhookConfigParam - """Optional. - Webhook configuration for receiving notifications when the interaction - completes. - """ + updated: str + """Required. Output only. The time at which the response was last updated in ISO 8601 format +(YYYY-MM-DDThh:mm:ssZ).""" -AgentConfig: TypeAlias = Union[DynamicAgentConfigParam, DeepResearchAgentConfigParam] + usage: Usage + """Output only. Statistics on the interaction request's token usage.""" -class CreateModelInteractionParamsNonStreaming(BaseCreateModelInteractionParams, total=False): - stream: Literal[False] - """Input only. Whether the interaction will be streamed.""" + webhook_config: WebhookConfig + """Optional. Webhook configuration for receiving notifications when the +interaction completes.""" -class CreateModelInteractionParamsStreaming(BaseCreateModelInteractionParams): - stream: Required[Literal[True]] - """Input only. Whether the interaction will be streamed.""" + generation_config: GenerationConfig + """Input only. Configuration parameters for the model interaction.""" -class CreateAgentInteractionParamsNonStreaming(BaseCreateAgentInteractionParams, total=False): - stream: Literal[False] - """Input only. Whether the interaction will be streamed.""" +class InteractionCreateParams(TypedDict, total=False): + """Parameters for InteractionCreateParams""" -class CreateAgentInteractionParamsStreaming(BaseCreateAgentInteractionParams): - stream: Required[Literal[True]] - """Input only. Whether the interaction will be streamed.""" + api_version: str + """Which version of the API to use.""" -InteractionCreateParams = Union[ - CreateModelInteractionParamsNonStreaming, - CreateModelInteractionParamsStreaming, - CreateAgentInteractionParamsNonStreaming, - CreateAgentInteractionParamsStreaming, -] diff --git a/google/genai/_interactions/types/interaction_created_event.py b/google/genai/_interactions/types/interaction_created_event.py index 826ac3232..4221469f7 100644 --- a/google/genai/_interactions/types/interaction_created_event.py +++ b/google/genai/_interactions/types/interaction_created_event.py @@ -11,26 +11,26 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel + from .interaction import Interaction __all__ = ["InteractionCreatedEvent"] class InteractionCreatedEvent(BaseModel): + event_id: Optional[str] = None + """The event_id token to be used to resume the interaction stream, from +this event.""" + + event_type: Literal["interaction.created"] interaction: Interaction - """The Interaction resource.""" - event_id: Optional[str] = None - """ - The event_id token to be used to resume the interaction stream, from this event. - """ diff --git a/google/genai/_interactions/types/interaction_get_params.py b/google/genai/_interactions/types/interaction_get_params.py index d3802bf76..2b4485352 100644 --- a/google/genai/_interactions/types/interaction_get_params.py +++ b/google/genai/_interactions/types/interaction_get_params.py @@ -11,40 +11,35 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing_extensions import TypedDict, Required -from typing import Union -from typing_extensions import Literal, Required, TypedDict +__all__ = ["InteractionGetParams"] -__all__ = ["InteractionGetParamsBase", "InteractionGetParamsNonStreaming", "InteractionGetParamsStreaming"] +class InteractionGetParams(TypedDict, total=False): + """Parameters for InteractionGetParams""" -class InteractionGetParamsBase(TypedDict, total=False): - api_version: str + id: Required[str] + """The unique identifier of the interaction to retrieve.""" - include_input: bool - """If set to true, includes the input in the response.""" - last_event_id: str - """Optional. + stream: bool + """If set to true, the generated content will be streamed incrementally.""" - If set, resumes the interaction stream from the next chunk after the event - marked by the event id. Can only be used if `stream` is true. - """ + last_event_id: str + """Optional. If set, resumes the interaction stream from the next chunk after the event marked by the event id. Can only be used if `stream` is true.""" -class InteractionGetParamsNonStreaming(InteractionGetParamsBase, total=False): - stream: Literal[False] - """If set to true, the generated content will be streamed incrementally.""" + + include_input: bool + """If set to true, includes the input in the response.""" -class InteractionGetParamsStreaming(InteractionGetParamsBase): - stream: Required[Literal[True]] - """If set to true, the generated content will be streamed incrementally.""" + api_version: str + """Which version of the API to use.""" -InteractionGetParams = Union[InteractionGetParamsNonStreaming, InteractionGetParamsStreaming] diff --git a/google/genai/_interactions/types/interaction_sse_event.py b/google/genai/_interactions/types/interaction_sse_event.py index 152e5832b..3ce3f0aa2 100644 --- a/google/genai/_interactions/types/interaction_sse_event.py +++ b/google/genai/_interactions/types/interaction_sse_event.py @@ -11,33 +11,25 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Union from typing_extensions import Annotated, TypeAlias - from .._utils import PropertyInfo -from .step_stop import StepStop -from .step_delta import StepDelta -from .step_start import StepStart + from .error_event import ErrorEvent +from .interaction_completed_event import InteractionCompletedEvent from .interaction_created_event import InteractionCreatedEvent from .interaction_status_update import InteractionStatusUpdate -from .interaction_completed_event import InteractionCompletedEvent +from .step_delta import StepDelta +from .step_start import StepStart +from .step_stop import StepStop + +__all__ = ["InteractionSseEvent"] -__all__ = ["InteractionSSEEvent"] -InteractionSSEEvent: TypeAlias = Annotated[ - Union[ - InteractionCreatedEvent, - InteractionCompletedEvent, - InteractionStatusUpdate, - ErrorEvent, - StepStart, - StepDelta, - StepStop, - ], - PropertyInfo(discriminator="event_type"), +InteractionSseEvent: TypeAlias = Annotated[ + Union[InteractionCreatedEvent, InteractionCompletedEvent, InteractionStatusUpdate, ErrorEvent, StepStart, StepDelta, StepStop], PropertyInfo(discriminator="event_type") ] diff --git a/google/genai/_interactions/types/interaction_status_update.py b/google/genai/_interactions/types/interaction_status_update.py index 877514285..811155986 100644 --- a/google/genai/_interactions/types/interaction_status_update.py +++ b/google/genai/_interactions/types/interaction_status_update.py @@ -11,28 +11,26 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel __all__ = ["InteractionStatusUpdate"] class InteractionStatusUpdate(BaseModel): + event_id: Optional[str] = None + """The event_id token to be used to resume the interaction stream, from +this event.""" + + event_type: Literal["interaction.status_update"] interaction_id: str - status: Literal[ - "in_progress", "requires_action", "completed", "failed", "cancelled", "incomplete", "budget_exceeded" - ] + status: Literal["in_progress", "requires_action", "completed", "failed", "cancelled", "incomplete", "budget_exceeded"] - event_id: Optional[str] = None - """ - The event_id token to be used to resume the interaction stream, from this event. - """ diff --git a/google/genai/_interactions/types/mcp_server_tool_call_step.py b/google/genai/_interactions/types/mcp_server_tool_call_step.py index 18907faeb..12c6f3f67 100644 --- a/google/genai/_interactions/types/mcp_server_tool_call_step.py +++ b/google/genai/_interactions/types/mcp_server_tool_call_step.py @@ -11,13 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Dict, Optional from typing_extensions import Literal - from .._models import BaseModel __all__ = ["MCPServerToolCallStep"] @@ -26,19 +25,25 @@ class MCPServerToolCallStep(BaseModel): """MCPServer tool call step.""" + arguments: Dict[str, object] + """Required. The JSON object of arguments for the function.""" + + id: str """Required. A unique ID for this specific tool call.""" - arguments: Dict[str, object] - """Required. The JSON object of arguments for the function.""" name: str """Required. The name of the tool which was called.""" + server_name: str """Required. The name of the used MCP server.""" - type: Literal["mcp_server_tool_call"] signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["mcp_server_tool_call"] + diff --git a/google/genai/_interactions/types/mcp_server_tool_call_step_param.py b/google/genai/_interactions/types/mcp_server_tool_call_step_param.py index b59c5fbf9..97c454fbf 100644 --- a/google/genai/_interactions/types/mcp_server_tool_call_step_param.py +++ b/google/genai/_interactions/types/mcp_server_tool_call_step_param.py @@ -11,41 +11,38 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Dict, Union -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config +from typing import Dict +from typing_extensions import Literal, TypedDict, Required __all__ = ["MCPServerToolCallStepParam"] class MCPServerToolCallStepParam(TypedDict, total=False): - """MCPServer tool call step.""" + """TypedDict parameter equivalent for McpServerToolCallStep.""" + + arguments: Required[Dict[str, object]] + """Required. The JSON object of arguments for the function.""" + id: Required[str] """Required. A unique ID for this specific tool call.""" - arguments: Required[Dict[str, object]] - """Required. The JSON object of arguments for the function.""" name: Required[str] """Required. The name of the tool which was called.""" + server_name: Required[str] """Required. The name of the used MCP server.""" - type: Required[Literal["mcp_server_tool_call"]] - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + signature: str """A signature hash for backend validation.""" -set_pydantic_config(MCPServerToolCallStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["mcp_server_tool_call"]] + diff --git a/google/genai/_interactions/types/mcp_server_tool_result_step.py b/google/genai/_interactions/types/mcp_server_tool_result_step.py index 49c75250e..43868fdd3 100644 --- a/google/genai/_interactions/types/mcp_server_tool_result_step.py +++ b/google/genai/_interactions/types/mcp_server_tool_result_step.py @@ -11,41 +11,47 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias - -from .._utils import PropertyInfo from .._models import BaseModel -from .text_content import TextContent +from .._utils import PropertyInfo + from .image_content import ImageContent +from .text_content import TextContent + +__all__ = ["ResultFunctionResultSubcontentList", "MCPServerToolResultStep"] -__all__ = ["MCPServerToolResultStep", "ResultFunctionResultSubcontentList"] ResultFunctionResultSubcontentList: TypeAlias = Annotated[ Union[TextContent, ImageContent], PropertyInfo(discriminator="type") ] - class MCPServerToolResultStep(BaseModel): """MCPServer tool result step.""" call_id: str """Required. ID to match the ID from the function call block.""" - result: Union[str, List[ResultFunctionResultSubcontentList], object] - """The output from the MCP server call. Can be simple text or rich content.""" - - type: Literal["mcp_server_tool_result"] name: Optional[str] = None """Name of the tool which is called for this specific tool call.""" + + result: Union[List[ResultFunctionResultSubcontentList], str, object] + """The output from the MCP server call. Can be simple text or rich content.""" + + server_name: Optional[str] = None """The name of the used MCP server.""" + signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["mcp_server_tool_result"] + diff --git a/google/genai/_interactions/types/mcp_server_tool_result_step_param.py b/google/genai/_interactions/types/mcp_server_tool_result_step_param.py index b8073d9d9..1b0df5741 100644 --- a/google/genai/_interactions/types/mcp_server_tool_result_step_param.py +++ b/google/genai/_interactions/types/mcp_server_tool_result_step_param.py @@ -11,45 +11,41 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing import Any, Union +from typing_extensions import Literal, TypedDict, Required -from typing import Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict - -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config -from .text_content_param import TextContentParam -from .image_content_param import ImageContentParam +from .function_result_subcontent_param import ResultFunctionResultSubcontentList +from google.genai._common import SequenceNotStr -__all__ = ["MCPServerToolResultStepParam", "ResultFunctionResultSubcontentList"] - -ResultFunctionResultSubcontentList: TypeAlias = Union[TextContentParam, ImageContentParam] +__all__ = ["MCPServerToolResultStepParam"] class MCPServerToolResultStepParam(TypedDict, total=False): - """MCPServer tool result step.""" + """TypedDict parameter equivalent for McpServerToolResultStep.""" call_id: Required[str] """Required. ID to match the ID from the function call block.""" - result: Required[Union[str, Iterable[ResultFunctionResultSubcontentList], object]] - """The output from the MCP server call. Can be simple text or rich content.""" - - type: Required[Literal["mcp_server_tool_result"]] name: str """Name of the tool which is called for this specific tool call.""" + + result: Required[Union[SequenceNotStr[ResultFunctionResultSubcontentList], str, Any]] + """The output from the MCP server call. Can be simple text or rich content.""" + + server_name: str """The name of the used MCP server.""" - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + + signature: str """A signature hash for backend validation.""" -set_pydantic_config(MCPServerToolResultStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["mcp_server_tool_result"]] + diff --git a/google/genai/_interactions/types/model.py b/google/genai/_interactions/types/model.py index 9b77dcb01..443bd7dcb 100644 --- a/google/genai/_interactions/types/model.py +++ b/google/genai/_interactions/types/model.py @@ -11,38 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Union from typing_extensions import Literal, TypeAlias __all__ = ["Model"] -Model: TypeAlias = Union[ - Literal[ - "gemini-2.5-computer-use-preview-10-2025", - "gemini-2.5-flash", - "gemini-2.5-flash-image", - "gemini-2.5-flash-lite", - "gemini-2.5-flash-lite-preview-09-2025", - "gemini-2.5-flash-native-audio-preview-12-2025", - "gemini-2.5-flash-preview-09-2025", - "gemini-2.5-flash-preview-tts", - "gemini-2.5-pro", - "gemini-2.5-pro-preview-tts", - "gemini-3-flash-preview", - "gemini-3-pro-image-preview", - "gemini-3-pro-preview", - "gemini-3.1-pro-preview", - "gemini-3.1-flash-image-preview", - "gemini-3.1-flash-lite", - "gemini-3.1-flash-lite-preview", - "gemini-3.1-flash-tts-preview", - "lyria-3-clip-preview", - "lyria-3-pro-preview", - "gemini-3.5-flash", - ], - str, -] + +Model: TypeAlias = Union[Literal["gemini-2.5-computer-use-preview-10-2025", "gemini-2.5-flash", "gemini-2.5-flash-image", "gemini-2.5-flash-lite", "gemini-2.5-flash-lite-preview-09-2025", "gemini-2.5-flash-native-audio-preview-12-2025", "gemini-2.5-flash-preview-09-2025", "gemini-2.5-flash-preview-tts", "gemini-2.5-pro", "gemini-2.5-pro-preview-tts", "gemini-3-flash-preview", "gemini-3-pro-image-preview", "gemini-3-pro-preview", "gemini-3.1-pro-preview", "gemini-3.1-flash-image-preview", "gemini-3.1-flash-lite", "gemini-3.1-flash-lite-preview", "gemini-3.1-flash-tts-preview", "lyria-3-clip-preview", "lyria-3-pro-preview"], str] diff --git a/google/genai/_interactions/types/model_output_step.py b/google/genai/_interactions/types/model_output_step.py index 1796268d3..d43ccac4a 100644 --- a/google/genai/_interactions/types/model_output_step.py +++ b/google/genai/_interactions/types/model_output_step.py @@ -11,15 +11,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional from typing_extensions import Literal +from .._models import BaseModel from .content import Content -from .._models import BaseModel __all__ = ["ModelOutputStep"] @@ -27,6 +27,7 @@ class ModelOutputStep(BaseModel): """Output generated by the model.""" + content: Optional[List[Content]] = None + type: Literal["model_output"] - content: Optional[List[Content]] = None diff --git a/google/genai/_interactions/types/model_output_step_param.py b/google/genai/_interactions/types/model_output_step_param.py index 44d4d8a43..e540880c0 100644 --- a/google/genai/_interactions/types/model_output_step_param.py +++ b/google/genai/_interactions/types/model_output_step_param.py @@ -11,23 +11,22 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Iterable -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Literal, TypedDict, Required from .content_param import ContentParam +from google.genai._common import SequenceNotStr __all__ = ["ModelOutputStepParam"] class ModelOutputStepParam(TypedDict, total=False): - """Output generated by the model.""" + """TypedDict parameter equivalent for ModelOutputStep.""" + + content: SequenceNotStr[ContentParam] type: Required[Literal["model_output"]] - content: Iterable[ContentParam] diff --git a/google/genai/_interactions/types/model_param.py b/google/genai/_interactions/types/model_param.py index 888acc333..f111980ac 100644 --- a/google/genai/_interactions/types/model_param.py +++ b/google/genai/_interactions/types/model_param.py @@ -11,40 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing import Union from typing_extensions import Literal, TypeAlias __all__ = ["ModelParam"] -ModelParam: TypeAlias = Union[ - Literal[ - "gemini-2.5-computer-use-preview-10-2025", - "gemini-2.5-flash", - "gemini-2.5-flash-image", - "gemini-2.5-flash-lite", - "gemini-2.5-flash-lite-preview-09-2025", - "gemini-2.5-flash-native-audio-preview-12-2025", - "gemini-2.5-flash-preview-09-2025", - "gemini-2.5-flash-preview-tts", - "gemini-2.5-pro", - "gemini-2.5-pro-preview-tts", - "gemini-3-flash-preview", - "gemini-3-pro-image-preview", - "gemini-3-pro-preview", - "gemini-3.1-pro-preview", - "gemini-3.1-flash-image-preview", - "gemini-3.1-flash-lite", - "gemini-3.1-flash-lite-preview", - "gemini-3.1-flash-tts-preview", - "lyria-3-clip-preview", - "lyria-3-pro-preview", - "gemini-3.5-flash", - ], - str, -] + +ModelParam: TypeAlias = Union[Literal["gemini-2.5-computer-use-preview-10-2025", "gemini-2.5-flash", "gemini-2.5-flash-image", "gemini-2.5-flash-lite", "gemini-2.5-flash-lite-preview-09-2025", "gemini-2.5-flash-native-audio-preview-12-2025", "gemini-2.5-flash-preview-09-2025", "gemini-2.5-flash-preview-tts", "gemini-2.5-pro", "gemini-2.5-pro-preview-tts", "gemini-3-flash-preview", "gemini-3-pro-image-preview", "gemini-3-pro-preview", "gemini-3.1-pro-preview", "gemini-3.1-flash-image-preview", "gemini-3.1-flash-lite", "gemini-3.1-flash-lite-preview", "gemini-3.1-flash-tts-preview", "lyria-3-clip-preview", "lyria-3-pro-preview"], str] diff --git a/google/genai/_interactions/types/place_citation.py b/google/genai/_interactions/types/place_citation.py index af65c0416..c32313070 100644 --- a/google/genai/_interactions/types/place_citation.py +++ b/google/genai/_interactions/types/place_citation.py @@ -11,59 +11,63 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["PlaceCitation", "ReviewSnippet"] +__all__ = ["PlaceReviewSnippet", "PlaceCitation"] -class ReviewSnippet(BaseModel): - """ - Encapsulates a snippet of a user review that answers a question about - the features of a specific place in Google Maps. - """ +class PlaceReviewSnippet(BaseModel): + """Encapsulates a snippet of a user review that answers a question about +the features of a specific place in Google Maps.""" review_id: Optional[str] = None """The ID of the review snippet.""" + title: Optional[str] = None """Title of the review.""" + url: Optional[str] = None """A link that corresponds to the user review on Google Maps.""" + class PlaceCitation(BaseModel): """A place citation annotation.""" - type: Literal["place_citation"] - end_index: Optional[int] = None """End of the attributed segment, exclusive.""" + name: Optional[str] = None """Title of the place.""" + place_id: Optional[str] = None """The ID of the place, in `places/{place_id}` format.""" - review_snippets: Optional[List[ReviewSnippet]] = None - """ - Snippets of reviews that are used to generate answers about the features of a - given place in Google Maps. - """ + + review_snippets: Optional[List[PlaceReviewSnippet]] = None + """Snippets of reviews that are used to generate answers about the +features of a given place in Google Maps.""" + start_index: Optional[int] = None """Start of segment of the response that is attributed to this source. - Index indicates the start of the segment, measured in bytes. - """ +Index indicates the start of the segment, measured in bytes.""" + + + type: Literal["place_citation"] url: Optional[str] = None """URI reference of the place.""" + + diff --git a/google/genai/_interactions/types/place_citation_param.py b/google/genai/_interactions/types/place_citation_param.py index 78de5ed60..513d4f207 100644 --- a/google/genai/_interactions/types/place_citation_param.py +++ b/google/genai/_interactions/types/place_citation_param.py @@ -11,59 +11,47 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing import Iterable -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["PlaceCitationParam", "ReviewSnippet"] +from typing_extensions import Literal, TypedDict, Required +from .review_snippet_param import PlaceReviewSnippet -class ReviewSnippet(TypedDict, total=False): - """ - Encapsulates a snippet of a user review that answers a question about - the features of a specific place in Google Maps. - """ - - review_id: str - """The ID of the review snippet.""" - - title: str - """Title of the review.""" - - url: str - """A link that corresponds to the user review on Google Maps.""" +__all__ = ["PlaceCitationParam"] class PlaceCitationParam(TypedDict, total=False): - """A place citation annotation.""" - - type: Required[Literal["place_citation"]] + """TypedDict parameter equivalent for PlaceCitation.""" end_index: int """End of the attributed segment, exclusive.""" + name: str """Title of the place.""" + place_id: str """The ID of the place, in `places/{place_id}` format.""" - review_snippets: Iterable[ReviewSnippet] - """ - Snippets of reviews that are used to generate answers about the features of a - given place in Google Maps. - """ + + review_snippets: Iterable[PlaceReviewSnippet] + """Snippets of reviews that are used to generate answers about the +features of a given place in Google Maps.""" + start_index: int """Start of segment of the response that is attributed to this source. - Index indicates the start of the segment, measured in bytes. - """ +Index indicates the start of the segment, measured in bytes.""" + + + type: Required[Literal["place_citation"]] url: str """URI reference of the place.""" + + diff --git a/google/genai/_interactions/types/response_modality.py b/google/genai/_interactions/types/response_modality.py new file mode 100644 index 000000000..2f0ee9493 --- /dev/null +++ b/google/genai/_interactions/types/response_modality.py @@ -0,0 +1,23 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing_extensions import Literal, TypeAlias + +__all__ = ["ResponseModality"] + + +ResponseModality: TypeAlias = Literal["text", "image", "audio", "video", "document"] diff --git a/google/genai/_interactions/types/response_modality_param.py b/google/genai/_interactions/types/response_modality_param.py new file mode 100644 index 000000000..a0725c18d --- /dev/null +++ b/google/genai/_interactions/types/response_modality_param.py @@ -0,0 +1,23 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing_extensions import Literal, TypeAlias + +__all__ = ["ResponseModalityParam"] + + +ResponseModalityParam: TypeAlias = Literal["text", "image", "audio", "video", "document"] diff --git a/google/genai/_interactions/types/review_snippet_param.py b/google/genai/_interactions/types/review_snippet_param.py new file mode 100644 index 000000000..88b70402c --- /dev/null +++ b/google/genai/_interactions/types/review_snippet_param.py @@ -0,0 +1,37 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing_extensions import TypedDict + +__all__ = ["PlaceReviewSnippet"] + + +class PlaceReviewSnippet(TypedDict, total=False): + """TypedDict parameter equivalent for ReviewSnippet.""" + + review_id: str + """The ID of the review snippet.""" + + + title: str + """Title of the review.""" + + + url: str + """A link that corresponds to the user review on Google Maps.""" + + diff --git a/google/genai/_interactions/types/signing_secret.py b/google/genai/_interactions/types/signing_secret.py index 81742069a..513c44e3b 100644 --- a/google/genai/_interactions/types/signing_secret.py +++ b/google/genai/_interactions/types/signing_secret.py @@ -11,15 +11,17 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. -from typing import Optional -from datetime import datetime +from __future__ import annotations +from datetime import datetime +from typing import Optional from .._models import BaseModel +from datetime import datetime + __all__ = ["SigningSecret"] @@ -29,5 +31,8 @@ class SigningSecret(BaseModel): expire_time: Optional[datetime] = None """Output only. The expiration date of the signing secret.""" + truncated_secret: Optional[str] = None """Output only. The truncated version of the signing secret.""" + + diff --git a/google/genai/_interactions/types/speech_config.py b/google/genai/_interactions/types/speech_config.py index 5dca5abe2..970021a91 100644 --- a/google/genai/_interactions/types/speech_config.py +++ b/google/genai/_interactions/types/speech_config.py @@ -11,12 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional - from .._models import BaseModel __all__ = ["SpeechConfig"] @@ -28,8 +27,12 @@ class SpeechConfig(BaseModel): language: Optional[str] = None """The language of the speech.""" + speaker: Optional[str] = None """The speaker's name, it should match the speaker name given in the prompt.""" + voice: Optional[str] = None """The voice of the speaker.""" + + diff --git a/google/genai/_interactions/types/speech_config_param.py b/google/genai/_interactions/types/speech_config_param.py index 972095125..3ba354b7d 100644 --- a/google/genai/_interactions/types/speech_config_param.py +++ b/google/genai/_interactions/types/speech_config_param.py @@ -11,25 +11,27 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing_extensions import TypedDict __all__ = ["SpeechConfigParam"] class SpeechConfigParam(TypedDict, total=False): - """The configuration for speech interaction.""" + """TypedDict parameter equivalent for SpeechConfig.""" language: str """The language of the speech.""" + speaker: str """The speaker's name, it should match the speaker name given in the prompt.""" + voice: str """The voice of the speaker.""" + + diff --git a/google/genai/_interactions/types/step.py b/google/genai/_interactions/types/step.py index 1d2586bb4..f1ad3c405 100644 --- a/google/genai/_interactions/types/step.py +++ b/google/genai/_interactions/types/step.py @@ -11,53 +11,35 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Union from typing_extensions import Annotated, TypeAlias - from .._utils import PropertyInfo -from .thought_step import ThoughtStep -from .user_input_step import UserInputStep -from .model_output_step import ModelOutputStep + +from .code_execution_call_step import CodeExecutionCallStep +from .code_execution_result_step import CodeExecutionResultStep +from .file_search_call_step import FileSearchCallStep +from .file_search_result_step import FileSearchResultStep from .function_call_step import FunctionCallStep from .function_result_step import FunctionResultStep -from .file_search_call_step import FileSearchCallStep from .google_maps_call_step import GoogleMapsCallStep -from .url_context_call_step import URLContextCallStep -from .file_search_result_step import FileSearchResultStep from .google_maps_result_step import GoogleMapsResultStep from .google_search_call_step import GoogleSearchCallStep -from .url_context_result_step import URLContextResultStep -from .code_execution_call_step import CodeExecutionCallStep from .google_search_result_step import GoogleSearchResultStep from .mcp_server_tool_call_step import MCPServerToolCallStep -from .code_execution_result_step import CodeExecutionResultStep from .mcp_server_tool_result_step import MCPServerToolResultStep +from .model_output_step import ModelOutputStep +from .thought_step import ThoughtStep +from .url_context_call_step import URLContextCallStep +from .url_context_result_step import UrlContextResultStep +from .user_input_step import UserInputStep __all__ = ["Step"] + Step: TypeAlias = Annotated[ - Union[ - UserInputStep, - ModelOutputStep, - ThoughtStep, - FunctionCallStep, - CodeExecutionCallStep, - URLContextCallStep, - MCPServerToolCallStep, - GoogleSearchCallStep, - FileSearchCallStep, - GoogleMapsCallStep, - FunctionResultStep, - CodeExecutionResultStep, - URLContextResultStep, - GoogleSearchResultStep, - MCPServerToolResultStep, - FileSearchResultStep, - GoogleMapsResultStep, - ], - PropertyInfo(discriminator="type"), + Union[UserInputStep, ModelOutputStep, ThoughtStep, FunctionCallStep, CodeExecutionCallStep, URLContextCallStep, MCPServerToolCallStep, GoogleSearchCallStep, FileSearchCallStep, GoogleMapsCallStep, FunctionResultStep, CodeExecutionResultStep, UrlContextResultStep, GoogleSearchResultStep, MCPServerToolResultStep, FileSearchResultStep, GoogleMapsResultStep], PropertyInfo(discriminator="type") ] diff --git a/google/genai/_interactions/types/step_delta.py b/google/genai/_interactions/types/step_delta.py index 5d3f65cb0..d8b28e6d4 100644 --- a/google/genai/_interactions/types/step_delta.py +++ b/google/genai/_interactions/types/step_delta.py @@ -11,209 +11,200 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias - -from .._utils import PropertyInfo from .._models import BaseModel +from .._utils import PropertyInfo + from .annotation import Annotation -from .text_content import TextContent -from .image_content import ImageContent -from .google_maps_result import GoogleMapsResult -from .url_context_result import URLContextResult -from .google_search_result import GoogleSearchResult +from .code_execution_call_arguments import CodeExecutionCallArguments +from .file_search_result_step import FileSearchResult from .google_maps_call_arguments import GoogleMapsCallArguments -from .url_context_call_arguments import URLContextCallArguments +from .google_maps_result import GoogleMapsResult from .google_search_call_arguments import GoogleSearchCallArguments -from .code_execution_call_arguments import CodeExecutionCallArguments - -__all__ = [ - "StepDelta", - "Delta", - "DeltaText", - "DeltaImage", - "DeltaAudio", - "DeltaDocument", - "DeltaVideo", - "DeltaThoughtSummary", - "DeltaThoughtSummaryContent", - "DeltaThoughtSignature", - "DeltaTextAnnotationDelta", - "DeltaArgumentsDelta", - "DeltaCodeExecutionCall", - "DeltaURLContextCall", - "DeltaGoogleSearchCall", - "DeltaMCPServerToolCall", - "DeltaFileSearchCall", - "DeltaGoogleMapsCall", - "DeltaCodeExecutionResult", - "DeltaURLContextResult", - "DeltaGoogleSearchResult", - "DeltaMCPServerToolResult", - "DeltaMCPServerToolResultResultFunctionResultSubcontentList", - "DeltaFileSearchResult", - "DeltaGoogleMapsResult", - "DeltaFunctionResult", - "DeltaFunctionResultResultFunctionResultSubcontentList", -] - - -class DeltaText(BaseModel): - text: str - - type: Literal["text"] - - -class DeltaImage(BaseModel): - type: Literal["image"] +from .google_search_result import GoogleSearchResult +from .mcp_server_tool_result_step import ResultFunctionResultSubcontentList +from .thought_step import Summary +from .url_context_call_arguments import UrlContextCallArguments +from .url_context_result import UrlContextResult +from .usage import MediaResolution +from google.genai._common import Base64FileInput - data: Optional[str] = None +__all__ = ["DeltaArgumentsDelta", "DeltaAudio", "DeltaCodeExecutionCall", "DeltaCodeExecutionResult", "DeltaDocument", "DeltaFileSearchCall", "DeltaFileSearchResult", "FunctionCallDelta", "DeltaFunctionResult", "DeltaGoogleMapsCall", "DeltaGoogleMapsResult", "DeltaGoogleSearchCall", "DeltaGoogleSearchResult", "DeltaImage", "DeltaMCPServerToolCall", "DeltaMCPServerToolResult", "DeltaTextAnnotationDelta", "DeltaText", "DeltaThoughtSignature", "DeltaThoughtSummary", "DeltaURLContextCall", "DeltaURLContextResult", "DeltaVideo", "ContentDeltaData", "ContentDelta", "Delta", "StepDelta"] - mime_type: Optional[ - Literal[ - "image/png", "image/jpeg", "image/webp", "image/heic", "image/heif", "image/gif", "image/bmp", "image/tiff" - ] - ] = None - resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None - """The resolution of the media.""" +class DeltaArgumentsDelta(BaseModel): + arguments: Optional[str] = None - uri: Optional[str] = None + type: Literal["arguments_delta"] class DeltaAudio(BaseModel): - type: Literal["audio"] - channels: Optional[int] = None """The number of audio channels.""" - data: Optional[str] = None - - mime_type: Optional[ - Literal[ - "audio/wav", - "audio/mp3", - "audio/aiff", - "audio/aac", - "audio/ogg", - "audio/flac", - "audio/mpeg", - "audio/m4a", - "audio/l16", - "audio/opus", - "audio/alaw", - "audio/mulaw", - ] - ] = None + + data: Optional[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] = None + + mime_type: Optional[Literal["audio/wav", "audio/mp3", "audio/aiff", "audio/aac", "audio/ogg", "audio/flac", "audio/mpeg", "audio/m4a", "audio/l16", "audio/opus", "audio/alaw", "audio/mulaw"]] = None rate: Optional[int] = None """Deprecated. Use sample_rate instead. The value is ignored.""" + sample_rate: Optional[int] = None """The sample rate of the audio.""" + + type: Literal["audio"] + uri: Optional[str] = None -class DeltaDocument(BaseModel): - type: Literal["document"] +class DeltaCodeExecutionCall(BaseModel): + arguments: CodeExecutionCallArguments + + signature: Optional[str] = None + """A signature hash for backend validation.""" + + + type: Literal["code_execution_call"] + + +class DeltaCodeExecutionResult(BaseModel): + is_error: Optional[bool] = None + + result: str + + signature: Optional[str] = None + """A signature hash for backend validation.""" + + + type: Literal["code_execution_result"] - data: Optional[str] = None + +class DeltaDocument(BaseModel): + data: Optional[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] = None mime_type: Optional[Literal["application/pdf"]] = None + type: Literal["document"] + uri: Optional[str] = None -class DeltaVideo(BaseModel): - type: Literal["video"] +class DeltaFileSearchCall(BaseModel): + signature: Optional[str] = None + """A signature hash for backend validation.""" - data: Optional[str] = None - - mime_type: Optional[ - Literal[ - "video/mp4", - "video/mpeg", - "video/mpg", - "video/mov", - "video/avi", - "video/x-flv", - "video/webm", - "video/wmv", - "video/3gpp", - ] - ] = None - - resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None - """The resolution of the media.""" - uri: Optional[str] = None + type: Literal["file_search_call"] -DeltaThoughtSummaryContent: TypeAlias = Annotated[Union[TextContent, ImageContent], PropertyInfo(discriminator="type")] +class DeltaFileSearchResult(BaseModel): + result: List[FileSearchResult] + signature: Optional[str] = None + """A signature hash for backend validation.""" -class DeltaThoughtSummary(BaseModel): - type: Literal["thought_summary"] - content: Optional[DeltaThoughtSummaryContent] = None - """A new summary item to be added to the thought.""" + type: Literal["file_search_result"] -class DeltaThoughtSignature(BaseModel): - type: Literal["thought_signature"] +class FunctionCallDelta(BaseModel): + arguments: Dict[str, object] + + id: str + """Required. A unique ID for this specific tool call.""" + + + name: str signature: Optional[str] = None - """Signature to match the backend source to be part of the generation.""" + """A signature hash for backend validation.""" -class DeltaTextAnnotationDelta(BaseModel): - type: Literal["text_annotation_delta"] + type: Literal["function_call"] - annotations: Optional[List[Annotation]] = None - """Citation information for model-generated content.""" +class DeltaFunctionResult(BaseModel): + call_id: str + """Required. ID to match the ID from the function call block.""" -class DeltaArgumentsDelta(BaseModel): - type: Literal["arguments_delta"] - arguments: Optional[str] = None + is_error: Optional[bool] = None + name: Optional[str] = None -class DeltaCodeExecutionCall(BaseModel): - arguments: CodeExecutionCallArguments - """The arguments to pass to the code execution.""" + result: Union[List[ResultFunctionResultSubcontentList], str, object] + + type: Literal["function_result"] + + +class DeltaGoogleMapsCall(BaseModel): + arguments: Optional[GoogleMapsCallArguments] = None + """The arguments to pass to the Google Maps tool.""" - type: Literal["code_execution_call"] signature: Optional[str] = None """A signature hash for backend validation.""" -class DeltaURLContextCall(BaseModel): - arguments: URLContextCallArguments - """The arguments to pass to the URL context.""" + type: Literal["google_maps_call"] + + +class DeltaGoogleMapsResult(BaseModel): + result: Optional[List[GoogleMapsResult]] = None + """The results of the Google Maps.""" - type: Literal["url_context_call"] signature: Optional[str] = None """A signature hash for backend validation.""" + type: Literal["google_maps_result"] + + class DeltaGoogleSearchCall(BaseModel): arguments: GoogleSearchCallArguments - """The arguments to pass to Google Search.""" + + signature: Optional[str] = None + """A signature hash for backend validation.""" + type: Literal["google_search_call"] + +class DeltaGoogleSearchResult(BaseModel): + is_error: Optional[bool] = None + + result: List[GoogleSearchResult] + signature: Optional[str] = None """A signature hash for backend validation.""" + type: Literal["google_search_result"] + + +class DeltaImage(BaseModel): + data: Optional[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] = None + + mime_type: Optional[Literal["image/png", "image/jpeg", "image/webp", "image/heic", "image/heif", "image/gif", "image/bmp", "image/tiff"]] = None + + resolution: Optional[MediaResolution] = None + """The resolution of the media.""" + + + type: Literal["image"] + + uri: Optional[str] = None + + class DeltaMCPServerToolCall(BaseModel): arguments: Dict[str, object] @@ -221,154 +212,123 @@ class DeltaMCPServerToolCall(BaseModel): server_name: str - type: Literal["mcp_server_tool_call"] - signature: Optional[str] = None """A signature hash for backend validation.""" -class DeltaFileSearchCall(BaseModel): - type: Literal["file_search_call"] + type: Literal["mcp_server_tool_call"] - signature: Optional[str] = None - """A signature hash for backend validation.""" +class DeltaMCPServerToolResult(BaseModel): + name: Optional[str] = None -class DeltaGoogleMapsCall(BaseModel): - type: Literal["google_maps_call"] + result: Union[List[ResultFunctionResultSubcontentList], str, object] - arguments: Optional[GoogleMapsCallArguments] = None - """The arguments to pass to the Google Maps tool.""" + server_name: Optional[str] = None signature: Optional[str] = None """A signature hash for backend validation.""" -class DeltaCodeExecutionResult(BaseModel): - result: str + type: Literal["mcp_server_tool_result"] - type: Literal["code_execution_result"] - is_error: Optional[bool] = None +class DeltaTextAnnotationDelta(BaseModel): + annotations: Optional[List[Annotation]] = None + """Citation information for model-generated content.""" - signature: Optional[str] = None - """A signature hash for backend validation.""" + type: Literal["text_annotation_delta"] -class DeltaURLContextResult(BaseModel): - result: List[URLContextResult] - type: Literal["url_context_result"] +class DeltaText(BaseModel): + text: str - is_error: Optional[bool] = None + type: Literal["text"] + +class DeltaThoughtSignature(BaseModel): signature: Optional[str] = None - """A signature hash for backend validation.""" + """Signature to match the backend source to be part of the generation.""" -class DeltaGoogleSearchResult(BaseModel): - result: List[GoogleSearchResult] + type: Literal["thought_signature"] - type: Literal["google_search_result"] - is_error: Optional[bool] = None +class DeltaThoughtSummary(BaseModel): + content: Optional[Summary] = None + """A new summary item to be added to the thought.""" - signature: Optional[str] = None - """A signature hash for backend validation.""" + type: Literal["thought_summary"] -DeltaMCPServerToolResultResultFunctionResultSubcontentList: TypeAlias = Annotated[ - Union[TextContent, ImageContent], PropertyInfo(discriminator="type") -] +class DeltaURLContextCall(BaseModel): + arguments: UrlContextCallArguments -class DeltaMCPServerToolResult(BaseModel): - result: Union[List[DeltaMCPServerToolResultResultFunctionResultSubcontentList], str, object] + signature: Optional[str] = None + """A signature hash for backend validation.""" - type: Literal["mcp_server_tool_result"] - name: Optional[str] = None + type: Literal["url_context_call"] - server_name: Optional[str] = None + +class DeltaURLContextResult(BaseModel): + is_error: Optional[bool] = None + + result: List[UrlContextResult] signature: Optional[str] = None """A signature hash for backend validation.""" -class DeltaFileSearchResult(BaseModel): - result: List[object] + type: Literal["url_context_result"] - type: Literal["file_search_result"] - signature: Optional[str] = None - """A signature hash for backend validation.""" +class DeltaVideo(BaseModel): + data: Optional[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] = None + mime_type: Optional[Literal["video/mp4", "video/mpeg", "video/mpg", "video/mov", "video/avi", "video/x-flv", "video/webm", "video/wmv", "video/3gpp"]] = None -class DeltaGoogleMapsResult(BaseModel): - type: Literal["google_maps_result"] + resolution: Optional[MediaResolution] = None + """The resolution of the media.""" - result: Optional[List[GoogleMapsResult]] = None - """The results of the Google Maps.""" - signature: Optional[str] = None - """A signature hash for backend validation.""" + type: Literal["video"] + uri: Optional[str] = None -DeltaFunctionResultResultFunctionResultSubcontentList: TypeAlias = Annotated[ - Union[TextContent, ImageContent], PropertyInfo(discriminator="type") -] +ContentDeltaData: TypeAlias = Annotated[ + Union[DeltaText, DeltaImage, DeltaAudio, DeltaDocument, DeltaVideo, DeltaThoughtSummary, DeltaThoughtSignature, FunctionCallDelta, DeltaCodeExecutionCall, DeltaURLContextCall, DeltaGoogleSearchCall, DeltaMCPServerToolCall, DeltaFileSearchCall, DeltaGoogleMapsCall, DeltaFunctionResult, DeltaCodeExecutionResult, DeltaURLContextResult, DeltaGoogleSearchResult, DeltaMCPServerToolResult, DeltaFileSearchResult, DeltaGoogleMapsResult, DeltaTextAnnotationDelta], PropertyInfo(discriminator="type") +] -class DeltaFunctionResult(BaseModel): - call_id: str - """Required. ID to match the ID from the function call block.""" +class ContentDelta(BaseModel): + delta: ContentDeltaData - result: Union[List[DeltaFunctionResultResultFunctionResultSubcontentList], str, object] + event_id: Optional[str] = None + """The event_id token to be used to resume the interaction stream, from +this event.""" - type: Literal["function_result"] - is_error: Optional[bool] = None + event_type: Literal["content.delta"] - name: Optional[str] = None + index: int Delta: TypeAlias = Annotated[ - Union[ - DeltaText, - DeltaImage, - DeltaAudio, - DeltaDocument, - DeltaVideo, - DeltaThoughtSummary, - DeltaThoughtSignature, - DeltaTextAnnotationDelta, - DeltaArgumentsDelta, - DeltaCodeExecutionCall, - DeltaURLContextCall, - DeltaGoogleSearchCall, - DeltaMCPServerToolCall, - DeltaFileSearchCall, - DeltaGoogleMapsCall, - DeltaCodeExecutionResult, - DeltaURLContextResult, - DeltaGoogleSearchResult, - DeltaMCPServerToolResult, - DeltaFileSearchResult, - DeltaGoogleMapsResult, - DeltaFunctionResult, - ], - PropertyInfo(discriminator="type"), + Union[DeltaText, DeltaImage, DeltaAudio, DeltaDocument, DeltaVideo, DeltaThoughtSummary, DeltaThoughtSignature, DeltaTextAnnotationDelta, DeltaArgumentsDelta, DeltaCodeExecutionCall, DeltaURLContextCall, DeltaGoogleSearchCall, DeltaMCPServerToolCall, DeltaFileSearchCall, DeltaGoogleMapsCall, DeltaCodeExecutionResult, DeltaURLContextResult, DeltaGoogleSearchResult, DeltaMCPServerToolResult, DeltaFileSearchResult, DeltaGoogleMapsResult, DeltaFunctionResult], PropertyInfo(discriminator="type") ] - class StepDelta(BaseModel): delta: Delta + event_id: Optional[str] = None + """The event_id token to be used to resume the interaction stream, from +this event.""" + + event_type: Literal["step.delta"] index: int - event_id: Optional[str] = None - """ - The event_id token to be used to resume the interaction stream, from this event. - """ diff --git a/google/genai/_interactions/types/step_param.py b/google/genai/_interactions/types/step_param.py index f49ab3445..a265962d4 100644 --- a/google/genai/_interactions/types/step_param.py +++ b/google/genai/_interactions/types/step_param.py @@ -11,51 +11,32 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing import Union from typing_extensions import TypeAlias -from .thought_step_param import ThoughtStepParam -from .user_input_step_param import UserInputStepParam -from .model_output_step_param import ModelOutputStepParam +from .code_execution_call_step_param import CodeExecutionCallStepParam +from .code_execution_result_step_param import CodeExecutionResultStepParam +from .file_search_call_step_param import FileSearchCallStepParam +from .file_search_result_step_param import FileSearchResultStepParam from .function_call_step_param import FunctionCallStepParam from .function_result_step_param import FunctionResultStepParam -from .file_search_call_step_param import FileSearchCallStepParam from .google_maps_call_step_param import GoogleMapsCallStepParam -from .url_context_call_step_param import URLContextCallStepParam -from .file_search_result_step_param import FileSearchResultStepParam from .google_maps_result_step_param import GoogleMapsResultStepParam from .google_search_call_step_param import GoogleSearchCallStepParam -from .url_context_result_step_param import URLContextResultStepParam -from .code_execution_call_step_param import CodeExecutionCallStepParam from .google_search_result_step_param import GoogleSearchResultStepParam from .mcp_server_tool_call_step_param import MCPServerToolCallStepParam -from .code_execution_result_step_param import CodeExecutionResultStepParam from .mcp_server_tool_result_step_param import MCPServerToolResultStepParam +from .model_output_step_param import ModelOutputStepParam +from .thought_step_param import ThoughtStepParam +from .url_context_call_step_param import URLContextCallStepParam +from .url_context_result_step_param import UrlContextResultStepParam +from .user_input_step_param import UserInputStepParam __all__ = ["StepParam"] -StepParam: TypeAlias = Union[ - UserInputStepParam, - ModelOutputStepParam, - ThoughtStepParam, - FunctionCallStepParam, - CodeExecutionCallStepParam, - URLContextCallStepParam, - MCPServerToolCallStepParam, - GoogleSearchCallStepParam, - FileSearchCallStepParam, - GoogleMapsCallStepParam, - FunctionResultStepParam, - CodeExecutionResultStepParam, - URLContextResultStepParam, - GoogleSearchResultStepParam, - MCPServerToolResultStepParam, - FileSearchResultStepParam, - GoogleMapsResultStepParam, -] + +StepParam: TypeAlias = Union[UserInputStepParam, ModelOutputStepParam, ThoughtStepParam, FunctionCallStepParam, CodeExecutionCallStepParam, URLContextCallStepParam, MCPServerToolCallStepParam, GoogleSearchCallStepParam, FileSearchCallStepParam, GoogleMapsCallStepParam, FunctionResultStepParam, CodeExecutionResultStepParam, UrlContextResultStepParam, GoogleSearchResultStepParam, MCPServerToolResultStepParam, FileSearchResultStepParam, GoogleMapsResultStepParam] diff --git a/google/genai/_interactions/types/step_start.py b/google/genai/_interactions/types/step_start.py index e82fa0e8f..d94237910 100644 --- a/google/genai/_interactions/types/step_start.py +++ b/google/genai/_interactions/types/step_start.py @@ -11,28 +11,42 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal +from .._models import BaseModel +from .content import Content from .step import Step -from .._models import BaseModel -__all__ = ["StepStart"] +__all__ = ["ContentStart", "StepStart"] + + +class ContentStart(BaseModel): + content: Content + + event_id: Optional[str] = None + """The event_id token to be used to resume the interaction stream, from +this event.""" + + + event_type: Literal["content.start"] + + index: int class StepStart(BaseModel): + event_id: Optional[str] = None + """The event_id token to be used to resume the interaction stream, from +this event.""" + + event_type: Literal["step.start"] index: int step: Step - """A step in the interaction.""" - event_id: Optional[str] = None - """ - The event_id token to be used to resume the interaction stream, from this event. - """ diff --git a/google/genai/_interactions/types/step_stop.py b/google/genai/_interactions/types/step_stop.py index b0c49d7a8..28e43acfc 100644 --- a/google/genai/_interactions/types/step_stop.py +++ b/google/genai/_interactions/types/step_stop.py @@ -11,24 +11,35 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["StepStop"] +__all__ = ["ContentStop", "StepStop"] + + +class ContentStop(BaseModel): + event_id: Optional[str] = None + """The event_id token to be used to resume the interaction stream, from +this event.""" + + + event_type: Literal["content.stop"] + + index: int class StepStop(BaseModel): + event_id: Optional[str] = None + """The event_id token to be used to resume the interaction stream, from +this event.""" + + event_type: Literal["step.stop"] index: int - event_id: Optional[str] = None - """ - The event_id token to be used to resume the interaction stream, from this event. - """ diff --git a/google/genai/_interactions/types/text_content.py b/google/genai/_interactions/types/text_content.py index b753059e6..505d82d20 100644 --- a/google/genai/_interactions/types/text_content.py +++ b/google/genai/_interactions/types/text_content.py @@ -11,14 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional from typing_extensions import Literal - from .._models import BaseModel + from .annotation import Annotation __all__ = ["TextContent"] @@ -27,10 +27,13 @@ class TextContent(BaseModel): """A text content block.""" + annotations: Optional[List[Annotation]] = None + """Citation information for model-generated content.""" + + text: str """Required. The text content.""" + type: Literal["text"] - annotations: Optional[List[Annotation]] = None - """Citation information for model-generated content.""" diff --git a/google/genai/_interactions/types/text_content_param.py b/google/genai/_interactions/types/text_content_param.py index 97eb9ebd7..d7b053624 100644 --- a/google/genai/_interactions/types/text_content_param.py +++ b/google/genai/_interactions/types/text_content_param.py @@ -11,14 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing import Iterable -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Literal, TypedDict, Required from .annotation_param import AnnotationParam @@ -26,12 +24,15 @@ class TextContentParam(TypedDict, total=False): - """A text content block.""" + """TypedDict parameter equivalent for TextContent.""" + + annotations: Iterable[AnnotationParam] + """Citation information for model-generated content.""" + text: Required[str] """Required. The text content.""" + type: Required[Literal["text"]] - annotations: Iterable[AnnotationParam] - """Citation information for model-generated content.""" diff --git a/google/genai/_interactions/types/text_response_format.py b/google/genai/_interactions/types/text_response_format.py index 8db1038d4..a2734a41d 100644 --- a/google/genai/_interactions/types/text_response_format.py +++ b/google/genai/_interactions/types/text_response_format.py @@ -11,15 +11,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Optional -from typing_extensions import Literal +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations +from typing import Any, Dict, Optional from pydantic import Field as FieldInfo - +from typing_extensions import Literal from .._models import BaseModel __all__ = ["TextResponseFormat"] @@ -28,13 +26,14 @@ class TextResponseFormat(BaseModel): """Configuration for text output format.""" - type: Literal["text"] - mime_type: Optional[Literal["application/json", "text/plain"]] = None """The MIME type of the text output.""" - schema_: Optional[Dict[str, object]] = FieldInfo(alias="schema", default=None) - """The JSON schema that the output should conform to. - Only applicable when mime_type is application/json. - """ + schema_: Optional[Dict[str, Any]] = FieldInfo(alias="schema", default=None) + """The JSON schema that the output should conform to. Only applicable when +mime_type is application/json.""" + + + type: Literal["text"] + diff --git a/google/genai/_interactions/types/text_response_format_param.py b/google/genai/_interactions/types/text_response_format_param.py index 5eb5303e6..82d49e40b 100644 --- a/google/genai/_interactions/types/text_response_format_param.py +++ b/google/genai/_interactions/types/text_response_format_param.py @@ -11,28 +11,27 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Dict -from typing_extensions import Literal, Required, TypedDict +from typing import Any, Dict +from typing_extensions import Literal, TypedDict, Required __all__ = ["TextResponseFormatParam"] class TextResponseFormatParam(TypedDict, total=False): - """Configuration for text output format.""" - - type: Required[Literal["text"]] + """TypedDict parameter equivalent for TextResponseFormat.""" mime_type: Literal["application/json", "text/plain"] """The MIME type of the text output.""" - schema: Dict[str, object] - """The JSON schema that the output should conform to. - Only applicable when mime_type is application/json. - """ + schema: Dict[str, Any] + """The JSON schema that the output should conform to. Only applicable when +mime_type is application/json.""" + + + type: Required[Literal["text"]] + diff --git a/google/genai/_interactions/types/thinking_level.py b/google/genai/_interactions/types/thinking_level.py index f824adb6c..45ebb801c 100644 --- a/google/genai/_interactions/types/thinking_level.py +++ b/google/genai/_interactions/types/thinking_level.py @@ -11,12 +11,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing_extensions import Literal, TypeAlias -__all__ = ["ThinkingLevel"] +__all__ = ["ThinkingLevel", "ThinkingLevelParam"] + ThinkingLevel: TypeAlias = Literal["minimal", "low", "medium", "high"] + +ThinkingLevelParam: TypeAlias = Literal["minimal", "low", "medium", "high"] diff --git a/google/genai/_interactions/types/thought_step.py b/google/genai/_interactions/types/thought_step.py index 582a130ab..d9d7cf0c6 100644 --- a/google/genai/_interactions/types/thought_step.py +++ b/google/genai/_interactions/types/thought_step.py @@ -11,30 +11,49 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias - -from .._utils import PropertyInfo from .._models import BaseModel -from .text_content import TextContent +from .._utils import PropertyInfo + from .image_content import ImageContent +from .text_content import TextContent -__all__ = ["ThoughtStep", "Summary"] +__all__ = ["Summary", "ThoughtContent", "ThoughtStep"] -Summary: TypeAlias = Annotated[Union[TextContent, ImageContent], PropertyInfo(discriminator="type")] +Summary: TypeAlias = Annotated[ + Union[TextContent, ImageContent], PropertyInfo(discriminator="type") +] + +class ThoughtContent(BaseModel): + """A thought content block.""" + + signature: Optional[str] = None + """Signature to match the backend source to be part of the generation.""" + + + summary: Optional[List[Summary]] = None + """A summary of the thought.""" -class ThoughtStep(BaseModel): - """A thought step.""" type: Literal["thought"] + +class ThoughtStep(BaseModel): + """A thought step.""" + signature: Optional[str] = None """A signature hash for backend validation.""" + summary: Optional[List[Summary]] = None """A summary of the thought.""" + + + type: Literal["thought"] + diff --git a/google/genai/_interactions/types/thought_step_param.py b/google/genai/_interactions/types/thought_step_param.py index 439853c2a..9e7871813 100644 --- a/google/genai/_interactions/types/thought_step_param.py +++ b/google/genai/_interactions/types/thought_step_param.py @@ -11,36 +11,28 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing_extensions import Literal, TypedDict, Required -from typing import Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict - -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config -from .text_content_param import TextContentParam -from .image_content_param import ImageContentParam +from .thought_summary_content_param import Summary +from google.genai._common import SequenceNotStr -__all__ = ["ThoughtStepParam", "Summary"] - -Summary: TypeAlias = Union[TextContentParam, ImageContentParam] +__all__ = ["ThoughtStepParam"] class ThoughtStepParam(TypedDict, total=False): - """A thought step.""" - - type: Required[Literal["thought"]] + """TypedDict parameter equivalent for ThoughtStep.""" - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + signature: str """A signature hash for backend validation.""" - summary: Iterable[Summary] + + summary: SequenceNotStr[Summary] """A summary of the thought.""" -set_pydantic_config(ThoughtStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["thought"]] + diff --git a/google/genai/_interactions/types/thought_summary_content_param.py b/google/genai/_interactions/types/thought_summary_content_param.py new file mode 100644 index 000000000..817c3c255 --- /dev/null +++ b/google/genai/_interactions/types/thought_summary_content_param.py @@ -0,0 +1,27 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing import Union +from typing_extensions import TypeAlias + +from .image_content_param import ImageContentParam +from .text_content_param import TextContentParam + +__all__ = ["Summary"] + + +Summary: TypeAlias = Union[TextContentParam, ImageContentParam] diff --git a/google/genai/_interactions/types/tool.py b/google/genai/_interactions/types/tool.py index 66d412597..f46e2c1bf 100644 --- a/google/genai/_interactions/types/tool.py +++ b/google/genai/_interactions/types/tool.py @@ -11,30 +11,19 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Dict, List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias - -from .._utils import PropertyInfo from .._models import BaseModel -from .function import Function +from .._utils import PropertyInfo + from .allowed_tools import AllowedTools +from .function import Function -__all__ = [ - "Tool", - "CodeExecution", - "URLContext", - "ComputerUse", - "MCPServer", - "GoogleSearch", - "FileSearch", - "GoogleMaps", - "Retrieval", - "RetrievalVertexAISearchConfig", -] +__all__ = ["CodeExecution", "GoogleSearch", "McpServer", "UrlContext", "Tool", "ComputerUse", "FileSearch", "GoogleMaps", "RetrievalVertexAISearchConfig", "Retrieval", "Tool"] class CodeExecution(BaseModel): @@ -43,107 +32,126 @@ class CodeExecution(BaseModel): type: Literal["code_execution"] -class URLContext(BaseModel): - """A tool that can be used by the model to fetch URL context.""" - - type: Literal["url_context"] - +class GoogleSearch(BaseModel): + """A tool that can be used by the model to search Google.""" -class ComputerUse(BaseModel): - """A tool that can be used by the model to interact with the computer.""" + search_types: Optional[List[Literal["web_search", "image_search", "enterprise_web_search"]]] = None + """The types of search grounding to enable.""" - type: Literal["computer_use"] - environment: Optional[Literal["browser"]] = None - """The environment being operated.""" - - excluded_predefined_functions: Optional[List[str]] = None - """The list of predefined functions that are excluded from the model call.""" + type: Literal["google_search"] -class MCPServer(BaseModel): +class McpServer(BaseModel): """A MCPServer is a server that can be called by the model to perform actions.""" - type: Literal["mcp_server"] - allowed_tools: Optional[List[AllowedTools]] = None """The allowed tools.""" + headers: Optional[Dict[str, str]] = None """Optional: Fields for authentication headers, timeouts, etc., if needed.""" + name: Optional[str] = None """The name of the MCPServer.""" + + type: Literal["mcp_server"] + url: Optional[str] = None - """The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp" """ + """The full URL for the MCPServer endpoint. +Example: "https://api.example.com/mcp" """ -class GoogleSearch(BaseModel): - """A tool that can be used by the model to search Google.""" - type: Literal["google_search"] +class UrlContext(BaseModel): + """A tool that can be used by the model to fetch URL context.""" - search_types: Optional[List[Literal["web_search", "image_search", "enterprise_web_search"]]] = None - """The types of search grounding to enable.""" + type: Literal["url_context"] + + +Tool: TypeAlias = Annotated[ + Union[CodeExecution, GoogleSearch, UrlContext, McpServer], PropertyInfo(discriminator="type") +] + +class ComputerUse(BaseModel): + """A tool that can be used by the model to interact with the computer.""" + + environment: Optional[Literal["browser"]] = None + """The environment being operated.""" + + + excluded_predefined_functions: Optional[List[str]] = None + """The list of predefined functions that are excluded from the model call.""" + + + type: Literal["computer_use"] class FileSearch(BaseModel): """A tool that can be used by the model to search files.""" - type: Literal["file_search"] - file_search_store_names: Optional[List[str]] = None """The file search store names to search.""" + metadata_filter: Optional[str] = None """Metadata filter to apply to the semantic retrieval documents and chunks.""" + top_k: Optional[int] = None """The number of semantic retrieval chunks to retrieve.""" + type: Literal["file_search"] + + class GoogleMaps(BaseModel): """A tool that can be used by the model to call Google Maps.""" - type: Literal["google_maps"] - enable_widget: Optional[bool] = None - """ - Whether to return a widget context token in the tool call result of the - response. - """ + """Whether to return a widget context token in the tool call result of the +response.""" + latitude: Optional[float] = None """The latitude of the user's location.""" + longitude: Optional[float] = None """The longitude of the user's location.""" + type: Literal["google_maps"] + + class RetrievalVertexAISearchConfig(BaseModel): """Used to specify configuration for VertexAISearch.""" datastores: Optional[List[str]] = None """Optional. Used to specify Vertex AI Search datastores.""" + engine: Optional[str] = None """Optional. Used to specify Vertex AI Search engine.""" + class Retrieval(BaseModel): """A tool that can be used by the model to retrieve files.""" - type: Literal["retrieval"] - retrieval_types: Optional[List[Literal["vertex_ai_search"]]] = None """The types of file retrieval to enable.""" + + type: Literal["retrieval"] + vertex_ai_search_config: Optional[RetrievalVertexAISearchConfig] = None """Used to specify configuration for VertexAISearch.""" + Tool: TypeAlias = Annotated[ - Union[Function, CodeExecution, URLContext, ComputerUse, MCPServer, GoogleSearch, FileSearch, GoogleMaps, Retrieval], - PropertyInfo(discriminator="type"), + Union[Function, CodeExecution, UrlContext, ComputerUse, McpServer, GoogleSearch, FileSearch, GoogleMaps, Retrieval], PropertyInfo(discriminator="type") ] diff --git a/google/genai/_interactions/types/tool_choice_config.py b/google/genai/_interactions/types/tool_choice_config.py index 19305e7db..e43389ebe 100644 --- a/google/genai/_interactions/types/tool_choice_config.py +++ b/google/genai/_interactions/types/tool_choice_config.py @@ -11,13 +11,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional - from .._models import BaseModel + from .allowed_tools import AllowedTools __all__ = ["ToolChoiceConfig"] @@ -28,3 +28,5 @@ class ToolChoiceConfig(BaseModel): allowed_tools: Optional[AllowedTools] = None """The allowed tools.""" + + diff --git a/google/genai/_interactions/types/tool_choice_config_param.py b/google/genai/_interactions/types/tool_choice_config_param.py index 187f57d5c..ecedcfc19 100644 --- a/google/genai/_interactions/types/tool_choice_config_param.py +++ b/google/genai/_interactions/types/tool_choice_config_param.py @@ -11,12 +11,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing_extensions import TypedDict from .allowed_tools_param import AllowedToolsParam @@ -25,7 +23,9 @@ class ToolChoiceConfigParam(TypedDict, total=False): - """The tool choice configuration containing allowed tools.""" + """TypedDict parameter equivalent for ToolChoiceConfig.""" allowed_tools: AllowedToolsParam """The allowed tools.""" + + diff --git a/google/genai/_interactions/types/tool_choice_type.py b/google/genai/_interactions/types/tool_choice_type.py index aa4b8849c..9e86cfe38 100644 --- a/google/genai/_interactions/types/tool_choice_type.py +++ b/google/genai/_interactions/types/tool_choice_type.py @@ -11,12 +11,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing_extensions import Literal, TypeAlias __all__ = ["ToolChoiceType"] + ToolChoiceType: TypeAlias = Literal["auto", "any", "none", "validated"] diff --git a/google/genai/_interactions/types/tool_choice_type_param.py b/google/genai/_interactions/types/tool_choice_type_param.py new file mode 100644 index 000000000..17834be3d --- /dev/null +++ b/google/genai/_interactions/types/tool_choice_type_param.py @@ -0,0 +1,23 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing_extensions import Literal, TypeAlias + +__all__ = ["ToolChoiceTypeParam"] + + +ToolChoiceTypeParam: TypeAlias = Literal["auto", "any", "none", "validated"] diff --git a/google/genai/_interactions/types/tool_param.py b/google/genai/_interactions/types/tool_param.py index bc0463000..89a6a97c3 100644 --- a/google/genai/_interactions/types/tool_param.py +++ b/google/genai/_interactions/types/tool_param.py @@ -11,139 +11,142 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing import Dict, List, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing_extensions import Literal, TypeAlias, TypedDict, Required -from .._types import SequenceNotStr -from .function_param import FunctionParam from .allowed_tools_param import AllowedToolsParam +from .function_param import FunctionParam +from google.genai._common import SequenceNotStr -__all__ = [ - "ToolParam", - "CodeExecution", - "URLContext", - "ComputerUse", - "MCPServer", - "GoogleSearch", - "FileSearch", - "GoogleMaps", - "Retrieval", - "RetrievalVertexAISearchConfig", -] +__all__ = ["CodeExecutionParam", "GoogleSearchParam", "McpServerParam", "UrlContextParam", "ToolParam", "ComputerUseParam", "FileSearchParam", "GoogleMapsParam", "RetrievalVertexAISearchConfig", "RetrievalParam", "ToolParam"] -class CodeExecution(TypedDict, total=False): - """A tool that can be used by the model to execute code.""" +class CodeExecutionParam(TypedDict, total=False): + """TypedDict parameter equivalent for CodeExecution.""" type: Required[Literal["code_execution"]] -class URLContext(TypedDict, total=False): - """A tool that can be used by the model to fetch URL context.""" - - type: Required[Literal["url_context"]] - - -class ComputerUse(TypedDict, total=False): - """A tool that can be used by the model to interact with the computer.""" - - type: Required[Literal["computer_use"]] +class GoogleSearchParam(TypedDict, total=False): + """TypedDict parameter equivalent for GoogleSearch.""" - environment: Literal["browser"] - """The environment being operated.""" + search_types: SequenceNotStr[Literal["web_search", "image_search", "enterprise_web_search"]] + """The types of search grounding to enable.""" - excluded_predefined_functions: SequenceNotStr[str] - """The list of predefined functions that are excluded from the model call.""" + type: Required[Literal["google_search"]] -class MCPServer(TypedDict, total=False): - """A MCPServer is a server that can be called by the model to perform actions.""" - type: Required[Literal["mcp_server"]] +class McpServerParam(TypedDict, total=False): + """TypedDict parameter equivalent for McpServer.""" allowed_tools: Iterable[AllowedToolsParam] """The allowed tools.""" + headers: Dict[str, str] """Optional: Fields for authentication headers, timeouts, etc., if needed.""" + name: str """The name of the MCPServer.""" + + type: Required[Literal["mcp_server"]] + url: str - """The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp" """ + """The full URL for the MCPServer endpoint. +Example: "https://api.example.com/mcp" """ -class GoogleSearch(TypedDict, total=False): - """A tool that can be used by the model to search Google.""" - type: Required[Literal["google_search"]] +class UrlContextParam(TypedDict, total=False): + """TypedDict parameter equivalent for UrlContext.""" - search_types: List[Literal["web_search", "image_search", "enterprise_web_search"]] - """The types of search grounding to enable.""" + type: Required[Literal["url_context"]] -class FileSearch(TypedDict, total=False): - """A tool that can be used by the model to search files.""" +ToolParam: TypeAlias = Union[CodeExecutionParam, GoogleSearchParam, UrlContextParam, McpServerParam] - type: Required[Literal["file_search"]] +class ComputerUseParam(TypedDict, total=False): + """TypedDict parameter equivalent for ComputerUse.""" + + environment: Literal["browser"] + """The environment being operated.""" + + + excluded_predefined_functions: SequenceNotStr[str] + """The list of predefined functions that are excluded from the model call.""" + + + type: Required[Literal["computer_use"]] + + +class FileSearchParam(TypedDict, total=False): + """TypedDict parameter equivalent for FileSearch.""" file_search_store_names: SequenceNotStr[str] """The file search store names to search.""" + metadata_filter: str """Metadata filter to apply to the semantic retrieval documents and chunks.""" + top_k: int """The number of semantic retrieval chunks to retrieve.""" -class GoogleMaps(TypedDict, total=False): - """A tool that can be used by the model to call Google Maps.""" + type: Required[Literal["file_search"]] - type: Required[Literal["google_maps"]] + +class GoogleMapsParam(TypedDict, total=False): + """TypedDict parameter equivalent for GoogleMaps.""" enable_widget: bool - """ - Whether to return a widget context token in the tool call result of the - response. - """ + """Whether to return a widget context token in the tool call result of the +response.""" + latitude: float """The latitude of the user's location.""" + longitude: float """The longitude of the user's location.""" + type: Required[Literal["google_maps"]] + + class RetrievalVertexAISearchConfig(TypedDict, total=False): - """Used to specify configuration for VertexAISearch.""" + """TypedDict parameter equivalent for VertexAISearchConfig.""" - datastores: SequenceNotStr[str] + datastores: List[str] """Optional. Used to specify Vertex AI Search datastores.""" + engine: str """Optional. Used to specify Vertex AI Search engine.""" -class Retrieval(TypedDict, total=False): - """A tool that can be used by the model to retrieve files.""" - type: Required[Literal["retrieval"]] +class RetrievalParam(TypedDict, total=False): + """TypedDict parameter equivalent for Retrieval.""" - retrieval_types: List[Literal["vertex_ai_search"]] + retrieval_types: SequenceNotStr[Literal["vertex_ai_search"]] """The types of file retrieval to enable.""" + + type: Required[Literal["retrieval"]] + vertex_ai_search_config: RetrievalVertexAISearchConfig """Used to specify configuration for VertexAISearch.""" -ToolParam: TypeAlias = Union[ - FunctionParam, CodeExecution, URLContext, ComputerUse, MCPServer, GoogleSearch, FileSearch, GoogleMaps, Retrieval -] + +ToolParam: TypeAlias = Union[FunctionParam, CodeExecutionParam, UrlContextParam, ComputerUseParam, McpServerParam, GoogleSearchParam, FileSearchParam, GoogleMapsParam, RetrievalParam] diff --git a/google/genai/_interactions/types/url_citation.py b/google/genai/_interactions/types/url_citation.py index 818ce5bf5..90423838a 100644 --- a/google/genai/_interactions/types/url_citation.py +++ b/google/genai/_interactions/types/url_citation.py @@ -11,34 +11,37 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["URLCitation"] +__all__ = ["UrlCitation"] -class URLCitation(BaseModel): +class UrlCitation(BaseModel): """A URL citation annotation.""" - type: Literal["url_citation"] - end_index: Optional[int] = None """End of the attributed segment, exclusive.""" + start_index: Optional[int] = None """Start of segment of the response that is attributed to this source. - Index indicates the start of the segment, measured in bytes. - """ +Index indicates the start of the segment, measured in bytes.""" + title: Optional[str] = None """The title of the URL.""" + + type: Literal["url_citation"] + url: Optional[str] = None """The URL.""" + + diff --git a/google/genai/_interactions/types/url_citation_param.py b/google/genai/_interactions/types/url_citation_param.py index 1f57b5736..57ede1b69 100644 --- a/google/genai/_interactions/types/url_citation_param.py +++ b/google/genai/_interactions/types/url_citation_param.py @@ -11,33 +11,35 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing_extensions import Literal, TypedDict, Required -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["URLCitationParam"] - +__all__ = ["UrlCitationParam"] -class URLCitationParam(TypedDict, total=False): - """A URL citation annotation.""" - type: Required[Literal["url_citation"]] +class UrlCitationParam(TypedDict, total=False): + """TypedDict parameter equivalent for UrlCitation.""" end_index: int """End of the attributed segment, exclusive.""" + start_index: int """Start of segment of the response that is attributed to this source. - Index indicates the start of the segment, measured in bytes. - """ +Index indicates the start of the segment, measured in bytes.""" + title: str """The title of the URL.""" + + type: Required[Literal["url_citation"]] + url: str """The URL.""" + + diff --git a/google/genai/_interactions/types/url_context_call_arguments.py b/google/genai/_interactions/types/url_context_call_arguments.py index f1a1aca39..17e97dd3f 100644 --- a/google/genai/_interactions/types/url_context_call_arguments.py +++ b/google/genai/_interactions/types/url_context_call_arguments.py @@ -11,19 +11,20 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional - from .._models import BaseModel -__all__ = ["URLContextCallArguments"] +__all__ = ["UrlContextCallArguments"] -class URLContextCallArguments(BaseModel): +class UrlContextCallArguments(BaseModel): """The arguments to pass to the URL context.""" urls: Optional[List[str]] = None """The URLs to fetch.""" + + diff --git a/google/genai/_interactions/types/url_context_call_arguments_param.py b/google/genai/_interactions/types/url_context_call_arguments_param.py new file mode 100644 index 000000000..5288ccace --- /dev/null +++ b/google/genai/_interactions/types/url_context_call_arguments_param.py @@ -0,0 +1,30 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing import List +from typing_extensions import TypedDict + +__all__ = ["Arguments"] + + +class Arguments(TypedDict, total=False): + """TypedDict parameter equivalent for UrlContextCallStepArguments.""" + + urls: List[str] + """The URLs to fetch.""" + + diff --git a/google/genai/_interactions/types/url_context_call_step.py b/google/genai/_interactions/types/url_context_call_step.py index 009154cc2..25f117c88 100644 --- a/google/genai/_interactions/types/url_context_call_step.py +++ b/google/genai/_interactions/types/url_context_call_step.py @@ -11,35 +11,39 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["URLContextCallStep", "Arguments"] +__all__ = ["Arguments", "URLContextCallStep"] class Arguments(BaseModel): - """Required. The arguments to pass to the URL context.""" + """The arguments to pass to the URL context.""" urls: Optional[List[str]] = None """The URLs to fetch.""" + class URLContextCallStep(BaseModel): """URL context call step.""" - id: str - """Required. A unique ID for this specific tool call.""" - arguments: Arguments """Required. The arguments to pass to the URL context.""" - type: Literal["url_context_call"] + + id: str + """Required. A unique ID for this specific tool call.""" + signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["url_context_call"] + diff --git a/google/genai/_interactions/types/url_context_call_step_param.py b/google/genai/_interactions/types/url_context_call_step_param.py index 03ca81164..bb265a978 100644 --- a/google/genai/_interactions/types/url_context_call_step_param.py +++ b/google/genai/_interactions/types/url_context_call_step_param.py @@ -11,42 +11,31 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing_extensions import Literal, TypedDict, Required -from typing import Union -from typing_extensions import Literal, Required, Annotated, TypedDict +from .url_context_call_arguments_param import Arguments -from .._types import SequenceNotStr, Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config +__all__ = ["URLContextCallStepParam"] -__all__ = ["URLContextCallStepParam", "Arguments"] +class URLContextCallStepParam(TypedDict, total=False): + """TypedDict parameter equivalent for UrlContextCallStep.""" -class Arguments(TypedDict, total=False): + arguments: Required[Arguments] """Required. The arguments to pass to the URL context.""" - urls: SequenceNotStr[str] - """The URLs to fetch.""" - - -class URLContextCallStepParam(TypedDict, total=False): - """URL context call step.""" id: Required[str] """Required. A unique ID for this specific tool call.""" - arguments: Required[Arguments] - """Required. The arguments to pass to the URL context.""" - - type: Required[Literal["url_context_call"]] - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + signature: str """A signature hash for backend validation.""" -set_pydantic_config(URLContextCallStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["url_context_call"]] + diff --git a/google/genai/_interactions/types/url_context_result.py b/google/genai/_interactions/types/url_context_result.py index 996f43c56..6a0e2588e 100644 --- a/google/genai/_interactions/types/url_context_result.py +++ b/google/genai/_interactions/types/url_context_result.py @@ -11,23 +11,25 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["URLContextResult"] +__all__ = ["UrlContextResult"] -class URLContextResult(BaseModel): +class UrlContextResult(BaseModel): """The result of the URL context.""" status: Optional[Literal["success", "error", "paywall", "unsafe"]] = None """The status of the URL retrieval.""" + url: Optional[str] = None """The URL that was fetched.""" + + diff --git a/google/genai/_interactions/types/url_context_result_item_param.py b/google/genai/_interactions/types/url_context_result_item_param.py new file mode 100644 index 000000000..4ec905d71 --- /dev/null +++ b/google/genai/_interactions/types/url_context_result_item_param.py @@ -0,0 +1,33 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing_extensions import Literal, TypedDict + +__all__ = ["Result"] + + +class Result(TypedDict, total=False): + """TypedDict parameter equivalent for UrlContextResultItem.""" + + status: Literal["success", "error", "paywall", "unsafe"] + """The status of the URL retrieval.""" + + + url: str + """The URL that was fetched.""" + + diff --git a/google/genai/_interactions/types/url_context_result_step.py b/google/genai/_interactions/types/url_context_result_step.py index e9dd41ed5..a4f0f62ca 100644 --- a/google/genai/_interactions/types/url_context_result_step.py +++ b/google/genai/_interactions/types/url_context_result_step.py @@ -11,16 +11,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional from typing_extensions import Literal - from .._models import BaseModel -__all__ = ["URLContextResultStep", "Result"] +__all__ = ["Result", "UrlContextResultStep"] class Result(BaseModel): @@ -29,23 +28,30 @@ class Result(BaseModel): status: Optional[Literal["success", "error", "paywall", "unsafe"]] = None """The status of the URL retrieval.""" + url: Optional[str] = None """The URL that was fetched.""" -class URLContextResultStep(BaseModel): + +class UrlContextResultStep(BaseModel): """URL context result step.""" call_id: str """Required. ID to match the ID from the function call block.""" - result: List[Result] - """Required. The results of the URL context.""" - - type: Literal["url_context_result"] is_error: Optional[bool] = None """Whether the URL context resulted in an error.""" + + result: List[Result] + """Required. The results of the URL context.""" + + signature: Optional[str] = None """A signature hash for backend validation.""" + + + type: Literal["url_context_result"] + diff --git a/google/genai/_interactions/types/url_context_result_step_param.py b/google/genai/_interactions/types/url_context_result_step_param.py index c181bf8c2..2a844a14f 100644 --- a/google/genai/_interactions/types/url_context_result_step_param.py +++ b/google/genai/_interactions/types/url_context_result_step_param.py @@ -11,48 +11,36 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing import Iterable +from typing_extensions import Literal, TypedDict, Required -from typing import Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput -from .._utils import PropertyInfo -from .._models import set_pydantic_config +from .url_context_result_item_param import Result -__all__ = ["URLContextResultStepParam", "Result"] +__all__ = ["UrlContextResultStepParam"] -class Result(TypedDict, total=False): - """The result of the URL context.""" +class UrlContextResultStepParam(TypedDict, total=False): + """TypedDict parameter equivalent for UrlContextResultStep.""" - status: Literal["success", "error", "paywall", "unsafe"] - """The status of the URL retrieval.""" + call_id: Required[str] + """Required. ID to match the ID from the function call block.""" - url: str - """The URL that was fetched.""" + is_error: bool + """Whether the URL context resulted in an error.""" -class URLContextResultStepParam(TypedDict, total=False): - """URL context result step.""" - - call_id: Required[str] - """Required. ID to match the ID from the function call block.""" result: Required[Iterable[Result]] """Required. The results of the URL context.""" - type: Required[Literal["url_context_result"]] - is_error: bool - """Whether the URL context resulted in an error.""" - - signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] + signature: str """A signature hash for backend validation.""" -set_pydantic_config(URLContextResultStepParam, {"arbitrary_types_allowed": True}) + type: Required[Literal["url_context_result"]] + diff --git a/google/genai/_interactions/types/usage.py b/google/genai/_interactions/types/usage.py index c10bf3a9e..375283f1a 100644 --- a/google/genai/_interactions/types/usage.py +++ b/google/genai/_interactions/types/usage.py @@ -11,33 +11,17 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional -from typing_extensions import Literal - +from typing_extensions import Literal, TypeAlias from .._models import BaseModel -__all__ = [ - "Usage", - "CachedTokensByModality", - "GroundingToolCount", - "InputTokensByModality", - "OutputTokensByModality", - "ToolUseTokensByModality", -] - - -class CachedTokensByModality(BaseModel): - """The token count for a single response modality.""" - - modality: Optional[Literal["text", "image", "audio", "video", "document"]] = None - """The modality associated with the token count.""" +from .response_modality import ResponseModality - tokens: Optional[int] = None - """Number of tokens for the modality.""" +__all__ = ["GroundingToolCount", "MediaResolution", "CachedTokensByModality", "Usage"] class GroundingToolCount(BaseModel): @@ -46,75 +30,71 @@ class GroundingToolCount(BaseModel): count: Optional[int] = None """The number of grounding tool counts.""" + type: Optional[Literal["google_search", "google_maps", "retrieval"]] = None """The grounding tool type associated with the count.""" -class InputTokensByModality(BaseModel): - """The token count for a single response modality.""" - modality: Optional[Literal["text", "image", "audio", "video", "document"]] = None - """The modality associated with the token count.""" +MediaResolution: TypeAlias = Literal["low", "medium", "high", "ultra_high"] - tokens: Optional[int] = None - """Number of tokens for the modality.""" - - -class OutputTokensByModality(BaseModel): +class CachedTokensByModality(BaseModel): """The token count for a single response modality.""" - modality: Optional[Literal["text", "image", "audio", "video", "document"]] = None + modality: Optional[ResponseModality] = None """The modality associated with the token count.""" - tokens: Optional[int] = None - """Number of tokens for the modality.""" - - -class ToolUseTokensByModality(BaseModel): - """The token count for a single response modality.""" - - modality: Optional[Literal["text", "image", "audio", "video", "document"]] = None - """The modality associated with the token count.""" tokens: Optional[int] = None """Number of tokens for the modality.""" + class Usage(BaseModel): """Statistics on the interaction request's token usage.""" cached_tokens_by_modality: Optional[List[CachedTokensByModality]] = None """A breakdown of cached token usage by modality.""" + grounding_tool_count: Optional[List[GroundingToolCount]] = None """Grounding tool count.""" - input_tokens_by_modality: Optional[List[InputTokensByModality]] = None + + input_tokens_by_modality: Optional[List[CachedTokensByModality]] = None """A breakdown of input token usage by modality.""" - output_tokens_by_modality: Optional[List[OutputTokensByModality]] = None + + output_tokens_by_modality: Optional[List[CachedTokensByModality]] = None """A breakdown of output token usage by modality.""" - tool_use_tokens_by_modality: Optional[List[ToolUseTokensByModality]] = None + + tool_use_tokens_by_modality: Optional[List[CachedTokensByModality]] = None """A breakdown of tool-use token usage by modality.""" + total_cached_tokens: Optional[int] = None """Number of tokens in the cached part of the prompt (the cached content).""" + total_input_tokens: Optional[int] = None """Number of tokens in the prompt (context).""" + total_output_tokens: Optional[int] = None """Total number of tokens across all the generated responses.""" + total_thought_tokens: Optional[int] = None """Number of tokens of thoughts for thinking models.""" + total_tokens: Optional[int] = None - """ - Total token count for the interaction request (prompt + responses + other - internal tokens). - """ + """Total token count for the interaction request (prompt + responses + other +internal tokens).""" + total_tool_use_tokens: Optional[int] = None """Number of tokens present in tool-use prompt(s).""" + + diff --git a/google/genai/_interactions/types/usage_param.py b/google/genai/_interactions/types/usage_param.py index 7f20157eb..372a7ec86 100644 --- a/google/genai/_interactions/types/usage_param.py +++ b/google/genai/_interactions/types/usage_param.py @@ -11,110 +11,89 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing_extensions import Literal, TypeAlias, TypedDict -from typing import Iterable -from typing_extensions import Literal, TypedDict - -__all__ = [ - "UsageParam", - "CachedTokensByModality", - "GroundingToolCount", - "InputTokensByModality", - "OutputTokensByModality", - "ToolUseTokensByModality", -] - - -class CachedTokensByModality(TypedDict, total=False): - """The token count for a single response modality.""" +from .response_modality_param import ResponseModalityParam +from google.genai._common import SequenceNotStr - modality: Literal["text", "image", "audio", "video", "document"] - """The modality associated with the token count.""" - - tokens: int - """Number of tokens for the modality.""" +__all__ = ["GroundingToolCountParam", "MediaResolutionParam", "CachedTokensByModality", "UsageParam"] -class GroundingToolCount(TypedDict, total=False): - """The number of grounding tool counts.""" +class GroundingToolCountParam(TypedDict, total=False): + """TypedDict parameter equivalent for GroundingToolCount.""" count: int """The number of grounding tool counts.""" + type: Literal["google_search", "google_maps", "retrieval"] """The grounding tool type associated with the count.""" -class InputTokensByModality(TypedDict, total=False): - """The token count for a single response modality.""" - modality: Literal["text", "image", "audio", "video", "document"] - """The modality associated with the token count.""" +MediaResolutionParam: TypeAlias = Literal["low", "medium", "high", "ultra_high"] - tokens: int - """Number of tokens for the modality.""" - - -class OutputTokensByModality(TypedDict, total=False): - """The token count for a single response modality.""" +class CachedTokensByModality(TypedDict, total=False): + """TypedDict parameter equivalent for ModalityTokens.""" - modality: Literal["text", "image", "audio", "video", "document"] + modality: ResponseModalityParam """The modality associated with the token count.""" - tokens: int - """Number of tokens for the modality.""" - - -class ToolUseTokensByModality(TypedDict, total=False): - """The token count for a single response modality.""" - - modality: Literal["text", "image", "audio", "video", "document"] - """The modality associated with the token count.""" tokens: int """Number of tokens for the modality.""" + class UsageParam(TypedDict, total=False): - """Statistics on the interaction request's token usage.""" + """TypedDict parameter equivalent for Usage.""" - cached_tokens_by_modality: Iterable[CachedTokensByModality] + cached_tokens_by_modality: SequenceNotStr[CachedTokensByModality] """A breakdown of cached token usage by modality.""" - grounding_tool_count: Iterable[GroundingToolCount] + + grounding_tool_count: SequenceNotStr[GroundingToolCountParam] """Grounding tool count.""" - input_tokens_by_modality: Iterable[InputTokensByModality] + + input_tokens_by_modality: SequenceNotStr[CachedTokensByModality] """A breakdown of input token usage by modality.""" - output_tokens_by_modality: Iterable[OutputTokensByModality] + + output_tokens_by_modality: SequenceNotStr[CachedTokensByModality] """A breakdown of output token usage by modality.""" - tool_use_tokens_by_modality: Iterable[ToolUseTokensByModality] + + tool_use_tokens_by_modality: SequenceNotStr[CachedTokensByModality] """A breakdown of tool-use token usage by modality.""" + total_cached_tokens: int """Number of tokens in the cached part of the prompt (the cached content).""" + total_input_tokens: int """Number of tokens in the prompt (context).""" + total_output_tokens: int """Total number of tokens across all the generated responses.""" + total_thought_tokens: int """Number of tokens of thoughts for thinking models.""" + total_tokens: int - """ - Total token count for the interaction request (prompt + responses + other - internal tokens). - """ + """Total token count for the interaction request (prompt + responses + other +internal tokens).""" + total_tool_use_tokens: int """Number of tokens present in tool-use prompt(s).""" + + diff --git a/google/genai/_interactions/types/user_input_step.py b/google/genai/_interactions/types/user_input_step.py index 292b079dc..d042441ac 100644 --- a/google/genai/_interactions/types/user_input_step.py +++ b/google/genai/_interactions/types/user_input_step.py @@ -11,15 +11,15 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional from typing_extensions import Literal +from .._models import BaseModel from .content import Content -from .._models import BaseModel __all__ = ["UserInputStep"] @@ -27,6 +27,7 @@ class UserInputStep(BaseModel): """Input provided by the user.""" + content: Optional[List[Content]] = None + type: Literal["user_input"] - content: Optional[List[Content]] = None diff --git a/google/genai/_interactions/types/user_input_step_param.py b/google/genai/_interactions/types/user_input_step_param.py index 46a54c062..697b062e2 100644 --- a/google/genai/_interactions/types/user_input_step_param.py +++ b/google/genai/_interactions/types/user_input_step_param.py @@ -11,23 +11,22 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Iterable -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Literal, TypedDict, Required from .content_param import ContentParam +from google.genai._common import SequenceNotStr __all__ = ["UserInputStepParam"] class UserInputStepParam(TypedDict, total=False): - """Input provided by the user.""" + """TypedDict parameter equivalent for UserInputStep.""" + + content: SequenceNotStr[ContentParam] type: Required[Literal["user_input"]] - content: Iterable[ContentParam] diff --git a/google/genai/_interactions/types/video_content.py b/google/genai/_interactions/types/video_content.py index 03c65b452..a5da32494 100644 --- a/google/genai/_interactions/types/video_content.py +++ b/google/genai/_interactions/types/video_content.py @@ -11,14 +11,17 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional -from typing_extensions import Literal +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations +from typing import Union, Optional +from typing_extensions import Literal, Annotated from .._models import BaseModel +from .._utils import PropertyInfo + +from .usage import MediaResolution +from google.genai._common import Base64FileInput __all__ = ["VideoContent"] @@ -26,28 +29,21 @@ class VideoContent(BaseModel): """A video content block.""" - type: Literal["video"] - - data: Optional[str] = None + data: Optional[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] = None """The video content.""" - mime_type: Optional[ - Literal[ - "video/mp4", - "video/mpeg", - "video/mpg", - "video/mov", - "video/avi", - "video/x-flv", - "video/webm", - "video/wmv", - "video/3gpp", - ] - ] = None + + mime_type: Optional[Literal["video/mp4", "video/mpeg", "video/mpg", "video/mov", "video/avi", "video/x-flv", "video/webm", "video/wmv", "video/3gpp"]] = None """The mime type of the video.""" - resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None + + resolution: Optional[MediaResolution] = None """The resolution of the media.""" + + type: Literal["video"] + uri: Optional[str] = None """The URI of the video.""" + + diff --git a/google/genai/_interactions/types/video_content_param.py b/google/genai/_interactions/types/video_content_param.py index df03cdaa8..2f183cf08 100644 --- a/google/genai/_interactions/types/video_content_param.py +++ b/google/genai/_interactions/types/video_content_param.py @@ -11,48 +11,38 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing import Union -from typing_extensions import Literal, Required, Annotated, TypedDict - -from .._types import Base64FileInput +from typing_extensions import Literal, Annotated, TypedDict, Required from .._utils import PropertyInfo -from .._models import set_pydantic_config + +from .usage_param import MediaResolutionParam +from google.genai._common import Base64FileInput __all__ = ["VideoContentParam"] class VideoContentParam(TypedDict, total=False): - """A video content block.""" - - type: Required[Literal["video"]] + """TypedDict parameter equivalent for VideoContent.""" data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")] """The video content.""" - mime_type: Literal[ - "video/mp4", - "video/mpeg", - "video/mpg", - "video/mov", - "video/avi", - "video/x-flv", - "video/webm", - "video/wmv", - "video/3gpp", - ] + + mime_type: Literal["video/mp4", "video/mpeg", "video/mpg", "video/mov", "video/avi", "video/x-flv", "video/webm", "video/wmv", "video/3gpp"] """The mime type of the video.""" - resolution: Literal["low", "medium", "high", "ultra_high"] + + resolution: MediaResolutionParam """The resolution of the media.""" + + type: Required[Literal["video"]] + uri: str """The URI of the video.""" -set_pydantic_config(VideoContentParam, {"arbitrary_types_allowed": True}) diff --git a/google/genai/_interactions/types/webhook.py b/google/genai/_interactions/types/webhook.py index 6ae7e2cd1..37e8bd6b9 100644 --- a/google/genai/_interactions/types/webhook.py +++ b/google/genai/_interactions/types/webhook.py @@ -11,68 +11,115 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal +from __future__ import annotations +from datetime import datetime +from typing import Any, List, Union, Optional +from typing_extensions import Literal, TypedDict, Required from .._models import BaseModel + from .signing_secret import SigningSecret +from datetime import datetime +from google.genai._common import SequenceNotStr -__all__ = ["Webhook"] +__all__ = ["Webhook", "WebhookParam"] class Webhook(BaseModel): """A Webhook resource.""" - subscribed_events: List[ - Union[ - Literal[ - "batch.succeeded", - "batch.expired", - "batch.failed", - "interaction.requires_action", - "interaction.completed", - "interaction.failed", - "video.generated", - ], - str, - ] - ] - """Required. The events that the webhook is subscribed to. Available events: - - - batch.succeeded - - batch.expired - - batch.failed - - interaction.requires_action - - interaction.completed - - interaction.failed - - video.generated - """ + create_time: Optional[datetime] = None + """Output only. The timestamp when the webhook was created.""" - uri: str - """Required. The URI to which webhook events will be sent.""" id: Optional[str] = None """Output only. The ID of the webhook.""" - create_time: Optional[datetime] = None - """Output only. The timestamp when the webhook was created.""" name: Optional[str] = None """Optional. The user-provided name of the webhook.""" + new_signing_secret: Optional[str] = None """Output only. The new signing secret for the webhook. Only populated on create.""" + signing_secrets: Optional[List[SigningSecret]] = None """Output only. The signing secrets associated with this webhook.""" + state: Optional[Literal["enabled", "disabled", "disabled_due_to_failed_deliveries"]] = None """Output only. The state of the webhook.""" + + subscribed_events: List[Union[str, Any, Any, Any, Any, Any, Any, Any]] + """Required. The events that the webhook is subscribed to. +Available events: +- batch.succeeded +- batch.expired +- batch.failed +- interaction.requires_action +- interaction.completed +- interaction.failed +- video.generated""" + + update_time: Optional[datetime] = None """Output only. The timestamp when the webhook was last updated.""" + + + uri: str + """Required. The URI to which webhook events will be sent.""" + + + +class WebhookParam(TypedDict, total=False): + """TypedDict parameter equivalent for Webhook.""" + + create_time: str + """Output only. The timestamp when the webhook was created.""" + + + id: str + """Output only. The ID of the webhook.""" + + + name: str + """Optional. The user-provided name of the webhook.""" + + + new_signing_secret: str + """Output only. The new signing secret for the webhook. Only populated on create.""" + + + signing_secrets: SequenceNotStr[SigningSecretParam] + """Output only. The signing secrets associated with this webhook.""" + + + state: Literal["enabled", "disabled", "disabled_due_to_failed_deliveries"] + """Output only. The state of the webhook.""" + + + subscribed_events: Required[SequenceNotStr[Union[str, Any, Any, Any, Any, Any, Any, Any]]] + """Required. The events that the webhook is subscribed to. +Available events: +- batch.succeeded +- batch.expired +- batch.failed +- interaction.requires_action +- interaction.completed +- interaction.failed +- video.generated""" + + + update_time: str + """Output only. The timestamp when the webhook was last updated.""" + + + uri: Required[str] + """Required. The URI to which webhook events will be sent.""" + + diff --git a/google/genai/_interactions/types/webhook_config.py b/google/genai/_interactions/types/webhook_config.py index b6a16eb7c..e02e98f95 100644 --- a/google/genai/_interactions/types/webhook_config.py +++ b/google/genai/_interactions/types/webhook_config.py @@ -11,12 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations +from typing import Any, Dict, List, Optional from .._models import BaseModel __all__ = ["WebhookConfig"] @@ -26,14 +25,12 @@ class WebhookConfig(BaseModel): """Message for configuring webhook events for a request.""" uris: Optional[List[str]] = None - """Optional. + """Optional. If set, these webhook URIs will be used for webhook events instead of the +registered webhooks.""" + - If set, these webhook URIs will be used for webhook events instead of the - registered webhooks. - """ + user_metadata: Optional[Dict[str, Any]] = None + """Optional. The user metadata that will be returned on each event emission to the +webhooks.""" - user_metadata: Optional[Dict[str, object]] = None - """Optional. - The user metadata that will be returned on each event emission to the webhooks. - """ diff --git a/google/genai/_interactions/types/webhook_config_param.py b/google/genai/_interactions/types/webhook_config_param.py index c7dd38238..ecdee305e 100644 --- a/google/genai/_interactions/types/webhook_config_param.py +++ b/google/genai/_interactions/types/webhook_config_param.py @@ -11,32 +11,28 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing import Dict +from typing import Any, Dict from typing_extensions import TypedDict -from .._types import SequenceNotStr +from google.genai._common import SequenceNotStr __all__ = ["WebhookConfigParam"] class WebhookConfigParam(TypedDict, total=False): - """Message for configuring webhook events for a request.""" + """TypedDict parameter equivalent for WebhookConfig.""" uris: SequenceNotStr[str] - """Optional. + """Optional. If set, these webhook URIs will be used for webhook events instead of the +registered webhooks.""" + - If set, these webhook URIs will be used for webhook events instead of the - registered webhooks. - """ + user_metadata: Dict[str, Any] + """Optional. The user metadata that will be returned on each event emission to the +webhooks.""" - user_metadata: Dict[str, object] - """Optional. - The user metadata that will be returned on each event emission to the webhooks. - """ diff --git a/google/genai/_interactions/types/webhook_create_params.py b/google/genai/_interactions/types/webhook_create_params.py index 4d9a67f30..ff015c213 100644 --- a/google/genai/_interactions/types/webhook_create_params.py +++ b/google/genai/_interactions/types/webhook_create_params.py @@ -11,50 +11,66 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing import Any, Union +from typing_extensions import Literal, TypedDict, Required -from typing import List, Union -from typing_extensions import Literal, Required, TypedDict +from google.genai._common import SequenceNotStr __all__ = ["WebhookCreateParams"] class WebhookCreateParams(TypedDict, total=False): - api_version: str + """A Webhook resource.""" - subscribed_events: Required[ - List[ - Union[ - Literal[ - "batch.succeeded", - "batch.expired", - "batch.failed", - "interaction.requires_action", - "interaction.completed", - "interaction.failed", - "video.generated", - ], - str, - ] - ] - ] - """Required. The events that the webhook is subscribed to. Available events: - - - batch.succeeded - - batch.expired - - batch.failed - - interaction.requires_action - - interaction.completed - - interaction.failed - - video.generated - """ + create_time: str + """Output only. The timestamp when the webhook was created.""" + + + id: str + """Output only. The ID of the webhook.""" - uri: Required[str] - """Required. The URI to which webhook events will be sent.""" name: str """Optional. The user-provided name of the webhook.""" + + + new_signing_secret: str + """Output only. The new signing secret for the webhook. Only populated on create.""" + + + signing_secrets: SequenceNotStr[SigningSecretParam] + """Output only. The signing secrets associated with this webhook.""" + + + state: Literal["enabled", "disabled", "disabled_due_to_failed_deliveries"] + """Output only. The state of the webhook.""" + + + subscribed_events: Required[SequenceNotStr[Union[str, Any, Any, Any, Any, Any, Any, Any]]] + """Required. The events that the webhook is subscribed to. +Available events: +- batch.succeeded +- batch.expired +- batch.failed +- interaction.requires_action +- interaction.completed +- interaction.failed +- video.generated""" + + + update_time: str + """Output only. The timestamp when the webhook was last updated.""" + + + uri: Required[str] + """Required. The URI to which webhook events will be sent.""" + + + api_version: str + """Which version of the API to use.""" + + diff --git a/google/genai/_interactions/types/webhook_delete_response.py b/google/genai/_interactions/types/webhook_delete_response.py index 1d50ba0bd..fb37e4ea6 100644 --- a/google/genai/_interactions/types/webhook_delete_response.py +++ b/google/genai/_interactions/types/webhook_delete_response.py @@ -11,24 +11,23 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from .._models import BaseModel __all__ = ["WebhookDeleteResponse"] class WebhookDeleteResponse(BaseModel): - """ - A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to use it as the request - or the response type of an API method. For instance: + """A generic empty message that you can re-use to avoid defining duplicated +empty messages in your APIs. A typical example is to use it as the request +or the response type of an API method. For instance: - service Foo { - rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - } - """ + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + }""" pass + diff --git a/google/genai/_interactions/types/webhook_get_params.py b/google/genai/_interactions/types/webhook_get_params.py new file mode 100644 index 000000000..89afa3e00 --- /dev/null +++ b/google/genai/_interactions/types/webhook_get_params.py @@ -0,0 +1,33 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Code generated by the in-house datatype generator DO NOT EDIT. + +from __future__ import annotations +from typing_extensions import TypedDict, Required + +__all__ = ["WebhookGetParams"] + + +class WebhookGetParams(TypedDict, total=False): + """Parameters for WebhookGetParams""" + + id: Required[str] + """Required. The ID of the webhook to retrieve.""" + + + api_version: str + """Which version of the API to use.""" + + diff --git a/google/genai/_interactions/types/webhook_list_params.py b/google/genai/_interactions/types/webhook_list_params.py index aa35c3ee5..f5c48fd16 100644 --- a/google/genai/_interactions/types/webhook_list_params.py +++ b/google/genai/_interactions/types/webhook_list_params.py @@ -11,31 +11,30 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - from typing_extensions import TypedDict __all__ = ["WebhookListParams"] class WebhookListParams(TypedDict, total=False): + """Parameters for WebhookListParams""" + api_version: str + """Which version of the API to use.""" + page_size: int - """Optional. + """Optional. The maximum number of webhooks to return. The service may return fewer than +this value. If unspecified, at most 50 webhooks will be returned. +The maximum value is 1000.""" - The maximum number of webhooks to return. The service may return fewer than this - value. If unspecified, at most 50 webhooks will be returned. The maximum value - is 1000. - """ page_token: str - """Optional. + """Optional. A page token, received from a previous `ListWebhooks` call. +Provide this to retrieve the subsequent page.""" + - A page token, received from a previous `ListWebhooks` call. Provide this to - retrieve the subsequent page. - """ diff --git a/google/genai/_interactions/types/webhook_list_response.py b/google/genai/_interactions/types/webhook_list_response.py index a102ade3a..58d155d0a 100644 --- a/google/genai/_interactions/types/webhook_list_response.py +++ b/google/genai/_interactions/types/webhook_list_response.py @@ -11,14 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import List, Optional +from .._models import BaseModel from .webhook import Webhook -from .._models import BaseModel __all__ = ["WebhookListResponse"] @@ -27,10 +27,11 @@ class WebhookListResponse(BaseModel): """Response message for WebhookService.ListWebhooks.""" next_page_token: Optional[str] = None - """ - A token, which can be sent as `page_token` to retrieve the next page. If this - field is omitted, there are no subsequent pages. - """ + """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 """The webhooks.""" + + diff --git a/google/genai/_interactions/types/webhook_ping_params.py b/google/genai/_interactions/types/webhook_ping_params.py index 30ded197f..398ee7501 100644 --- a/google/genai/_interactions/types/webhook_ping_params.py +++ b/google/genai/_interactions/types/webhook_ping_params.py @@ -11,25 +11,55 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing_extensions import TypedDict, Required +from .._models import BaseModel -from typing_extensions import TypedDict +__all__ = ["Body", "BodyParam", "Empty", "EmptyParam", "WebhookPingParams"] -__all__ = ["WebhookPingParams", "Body"] +class Body(TypedDict, total=False): + pass -class WebhookPingParams(TypedDict, total=False): - api_version: str - body: Body - """Request message for WebhookService.PingWebhook.""" +class BodyParam(TypedDict, total=False): + """TypedDict parameter equivalent for Body.""" + pass -class Body(TypedDict, total=False): - """Request message for WebhookService.PingWebhook.""" + +class Empty(BaseModel): + """A generic empty message that you can re-use to avoid defining duplicated +empty messages in your APIs. A typical example is to use it as the request +or the response type of an API method. For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + }""" + + pass + + +class EmptyParam(TypedDict, total=False): + """TypedDict parameter equivalent for Empty.""" pass + + +class WebhookPingParams(TypedDict, total=False): + """Request message for WebhookService.PingWebhook.""" + + id: Required[str] + """Required. The ID of the webhook to ping. +Format: `{webhook_id}`""" + + + api_version: str + """Which version of the API to use.""" + + + body: Body + diff --git a/google/genai/_interactions/types/webhook_ping_response.py b/google/genai/_interactions/types/webhook_ping_response.py index d2f4d474c..02e5df004 100644 --- a/google/genai/_interactions/types/webhook_ping_response.py +++ b/google/genai/_interactions/types/webhook_ping_response.py @@ -11,10 +11,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from .._models import BaseModel __all__ = ["WebhookPingResponse"] @@ -24,3 +24,4 @@ class WebhookPingResponse(BaseModel): """Response message for WebhookService.PingWebhook.""" pass + diff --git a/google/genai/_interactions/types/webhook_rotate_signing_secret_params.py b/google/genai/_interactions/types/webhook_rotate_signing_secret_params.py index e01940837..4d8a89233 100644 --- a/google/genai/_interactions/types/webhook_rotate_signing_secret_params.py +++ b/google/genai/_interactions/types/webhook_rotate_signing_secret_params.py @@ -11,19 +11,28 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations - -from typing_extensions import Literal, TypedDict +from typing_extensions import Literal, TypedDict, Required __all__ = ["WebhookRotateSigningSecretParams"] class WebhookRotateSigningSecretParams(TypedDict, total=False): - api_version: str + """Request message for WebhookService.RotateSigningSecret.""" revocation_behavior: Literal["revoke_previous_secrets_after_h24", "revoke_previous_secrets_immediately"] """Optional. The revocation behavior for previous signing secrets.""" + + + id: Required[str] + """Required. The ID of the webhook for which to generate a signing secret. +Format: `{webhook_id}`""" + + + api_version: str + """Which version of the API to use.""" + + diff --git a/google/genai/_interactions/types/webhook_rotate_signing_secret_response.py b/google/genai/_interactions/types/webhook_rotate_signing_secret_response.py index b8270592e..24382908a 100644 --- a/google/genai/_interactions/types/webhook_rotate_signing_secret_response.py +++ b/google/genai/_interactions/types/webhook_rotate_signing_secret_response.py @@ -11,12 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. +from __future__ import annotations from typing import Optional - from .._models import BaseModel __all__ = ["WebhookRotateSigningSecretResponse"] @@ -27,3 +26,5 @@ class WebhookRotateSigningSecretResponse(BaseModel): secret: Optional[str] = None """Output only. The newly generated signing secret.""" + + diff --git a/google/genai/_interactions/types/webhook_update_params.py b/google/genai/_interactions/types/webhook_update_params.py index 6d163ffcf..e794458f1 100644 --- a/google/genai/_interactions/types/webhook_update_params.py +++ b/google/genai/_interactions/types/webhook_update_params.py @@ -11,54 +11,109 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +# Code generated by the in-house datatype generator DO NOT EDIT. from __future__ import annotations +from typing import Any, List, Union, Optional +from typing_extensions import Literal, TypedDict, Required +from .._models import BaseModel -from typing import List, Union -from typing_extensions import Literal, TypedDict +from google.genai._common import SequenceNotStr -__all__ = ["WebhookUpdateParams"] +__all__ = ["WebhookUpdate", "WebhookUpdateParam", "WebhookUpdateParams"] -class WebhookUpdateParams(TypedDict, total=False): - api_version: str +class WebhookUpdate(BaseModel): + name: Optional[str] = None + """Optional. The user-provided name of the webhook.""" + + + state: Optional[Literal["enabled", "disabled", "disabled_due_to_failed_deliveries"]] = None + """Optional. The state of the webhook.""" + + + subscribed_events: Optional[List[Union[str, Any, Any, Any, Any, Any, Any, Any]]] = None + """Optional. The events that the webhook is subscribed to. +Available events: +- batch.succeeded +- batch.expired +- batch.failed +- interaction.requires_action +- interaction.completed +- interaction.failed +- video.generated""" + + + uri: Optional[str] = None + """Optional. The URI to which webhook events will be sent.""" + - update_mask: str - """Optional. The list of fields to update.""" + +class WebhookUpdateParam(TypedDict, total=False): + """TypedDict parameter equivalent for WebhookUpdate.""" name: str """Optional. The user-provided name of the webhook.""" + state: Literal["enabled", "disabled", "disabled_due_to_failed_deliveries"] """Optional. The state of the webhook.""" - subscribed_events: List[ - Union[ - Literal[ - "batch.succeeded", - "batch.expired", - "batch.failed", - "interaction.requires_action", - "interaction.completed", - "interaction.failed", - "video.generated", - ], - str, - ] - ] - """Optional. The events that the webhook is subscribed to. Available events: - - - batch.succeeded - - batch.expired - - batch.failed - - interaction.requires_action - - interaction.completed - - interaction.failed - - video.generated - """ + + subscribed_events: SequenceNotStr[Union[str, Any, Any, Any, Any, Any, Any, Any]] + """Optional. The events that the webhook is subscribed to. +Available events: +- batch.succeeded +- batch.expired +- batch.failed +- interaction.requires_action +- interaction.completed +- interaction.failed +- video.generated""" + uri: str """Optional. The URI to which webhook events will be sent.""" + + + +class WebhookUpdateParams(TypedDict, total=False): + """Parameters for WebhookUpdateParams""" + + name: str + """Optional. The user-provided name of the webhook.""" + + + state: Literal["enabled", "disabled", "disabled_due_to_failed_deliveries"] + """Optional. The state of the webhook.""" + + + subscribed_events: SequenceNotStr[Union[str, Any, Any, Any, Any, Any, Any, Any]] + """Optional. The events that the webhook is subscribed to. +Available events: +- batch.succeeded +- batch.expired +- batch.failed +- interaction.requires_action +- interaction.completed +- interaction.failed +- video.generated""" + + + uri: str + """Optional. The URI to which webhook events will be sent.""" + + + id: Required[str] + """Required. The ID of the webhook to update.""" + + + api_version: str + """Which version of the API to use.""" + + + update_mask: str + """Optional. The list of fields to update.""" + +