diff --git a/google/genai/_gaos/resources/interactions/__init__.py b/google/genai/_gaos/resources/interactions/__init__.py index 05f44f3a0..b0275cf63 100644 --- a/google/genai/_gaos/resources/interactions/__init__.py +++ b/google/genai/_gaos/resources/interactions/__init__.py @@ -76,6 +76,9 @@ from ...types.interactions.model import Model from ...types.interactions.modeloutputstep import ModelOutputStep from ...types.interactions.placecitation import PlaceCitation +from ...types.interactions.retrievalcallarguments import RetrievalCallArguments +from ...types.interactions.retrievalcalldelta import RetrievalCallDelta +from ...types.interactions.retrievalresultdelta import RetrievalResultDelta from ...types.interactions.speechconfig import SpeechConfig from ...types.interactions.step import Step from ...types.interactions.stepdelta import StepDelta @@ -112,6 +115,7 @@ from . import interactionstatusupdate from . import modeloutputstep from . import placecitation +from . import retrievalcalldelta from . import stepdelta from . import stepstart from . import stepstop @@ -173,6 +177,9 @@ "Model", "ModelOutputStep", "PlaceCitation", + "RetrievalCallArguments", + "RetrievalCallDelta", + "RetrievalResultDelta", "SpeechConfig", "Step", "StepDelta", @@ -209,6 +216,7 @@ "interactionstatusupdate", "modeloutputstep", "placecitation", + "retrievalcalldelta", "stepdelta", "stepstart", "stepstop", diff --git a/google/genai/_gaos/resources/interactions/retrievalcalldelta/__init__.py b/google/genai/_gaos/resources/interactions/retrievalcalldelta/__init__.py new file mode 100644 index 000000000..4acb4a917 --- /dev/null +++ b/google/genai/_gaos/resources/interactions/retrievalcalldelta/__init__.py @@ -0,0 +1,23 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from ....types.interactions.retrievalcallarguments import ( + RetrievalCallArguments as Arguments, +) + +__all__ = ["Arguments"] diff --git a/google/genai/_gaos/resources/interactions/urlcontextcallstep/__init__.py b/google/genai/_gaos/resources/interactions/urlcontextcallstep/__init__.py index e393f77e6..58edddb58 100644 --- a/google/genai/_gaos/resources/interactions/urlcontextcallstep/__init__.py +++ b/google/genai/_gaos/resources/interactions/urlcontextcallstep/__init__.py @@ -16,6 +16,8 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" -from ....types.interactions.urlcontextcallstep import Arguments +from ....types.interactions.urlcontextcallarguments import ( + URLContextCallArguments as Arguments, +) __all__ = ["Arguments"] diff --git a/google/genai/_gaos/types/interactions/__init__.py b/google/genai/_gaos/types/interactions/__init__.py index e66a6e8bd..b0fb93dda 100644 --- a/google/genai/_gaos/types/interactions/__init__.py +++ b/google/genai/_gaos/types/interactions/__init__.py @@ -291,7 +291,20 @@ from .ranking import Ranking, RankingParam from .responseformat import ResponseFormat, ResponseFormatParam from .responsemodality import ResponseModality - from .retrieval import Retrieval, RetrievalParam, RetrievalType + from .retrieval import Retrieval, RetrievalParam, RetrievalRetrievalType + from .retrievalcallarguments import ( + RetrievalCallArguments, + RetrievalCallArgumentsTypedDict, + ) + from .retrievalcalldelta import ( + RetrievalCallDelta, + RetrievalCallDeltaRetrievalType, + RetrievalCallDeltaTypedDict, + ) + from .retrievalresultdelta import ( + RetrievalResultDelta, + RetrievalResultDeltaTypedDict, + ) from .reviewsnippet import ReviewSnippet, ReviewSnippetParam from .servicetier import ServiceTier from .source import Source, SourceParam, SourceType @@ -337,15 +350,10 @@ from .urlcontext import URLContext, URLContextParam from .urlcontextcallarguments import ( URLContextCallArguments, - URLContextCallArgumentsTypedDict, + URLContextCallArgumentsParam, ) from .urlcontextcalldelta import URLContextCallDelta, URLContextCallDeltaTypedDict - from .urlcontextcallstep import ( - Arguments, - ArgumentsParam, - URLContextCallStep, - URLContextCallStepParam, - ) + from .urlcontextcallstep import URLContextCallStep, URLContextCallStepParam from .urlcontextresult import ( URLContextResult, URLContextResultParam, @@ -380,10 +388,8 @@ "AllowlistParam", "Annotation", "AnnotationParam", - "Arguments", "ArgumentsDelta", "ArgumentsDeltaTypedDict", - "ArgumentsParam", "AudioContent", "AudioContentMimeType", "AudioContentParam", @@ -607,8 +613,15 @@ "ResponseFormatParam", "ResponseModality", "Retrieval", + "RetrievalCallArguments", + "RetrievalCallArgumentsTypedDict", + "RetrievalCallDelta", + "RetrievalCallDeltaRetrievalType", + "RetrievalCallDeltaTypedDict", "RetrievalParam", - "RetrievalType", + "RetrievalResultDelta", + "RetrievalResultDeltaTypedDict", + "RetrievalRetrievalType", "ReviewSnippet", "ReviewSnippetParam", "ServiceTier", @@ -668,7 +681,7 @@ "URLCitationParam", "URLContext", "URLContextCallArguments", - "URLContextCallArgumentsTypedDict", + "URLContextCallArgumentsParam", "URLContextCallDelta", "URLContextCallDeltaTypedDict", "URLContextCallStep", @@ -957,7 +970,14 @@ "ResponseModality": ".responsemodality", "Retrieval": ".retrieval", "RetrievalParam": ".retrieval", - "RetrievalType": ".retrieval", + "RetrievalRetrievalType": ".retrieval", + "RetrievalCallArguments": ".retrievalcallarguments", + "RetrievalCallArgumentsTypedDict": ".retrievalcallarguments", + "RetrievalCallDelta": ".retrievalcalldelta", + "RetrievalCallDeltaRetrievalType": ".retrievalcalldelta", + "RetrievalCallDeltaTypedDict": ".retrievalcalldelta", + "RetrievalResultDelta": ".retrievalresultdelta", + "RetrievalResultDeltaTypedDict": ".retrievalresultdelta", "ReviewSnippet": ".reviewsnippet", "ReviewSnippetParam": ".reviewsnippet", "ServiceTier": ".servicetier", @@ -1019,11 +1039,9 @@ "URLContext": ".urlcontext", "URLContextParam": ".urlcontext", "URLContextCallArguments": ".urlcontextcallarguments", - "URLContextCallArgumentsTypedDict": ".urlcontextcallarguments", + "URLContextCallArgumentsParam": ".urlcontextcallarguments", "URLContextCallDelta": ".urlcontextcalldelta", "URLContextCallDeltaTypedDict": ".urlcontextcalldelta", - "Arguments": ".urlcontextcallstep", - "ArgumentsParam": ".urlcontextcallstep", "URLContextCallStep": ".urlcontextcallstep", "URLContextCallStepParam": ".urlcontextcallstep", "URLContextResult": ".urlcontextresult", diff --git a/google/genai/_gaos/types/interactions/retrieval.py b/google/genai/_gaos/types/interactions/retrieval.py index b29c91ddd..4cf7d48aa 100644 --- a/google/genai/_gaos/types/interactions/retrieval.py +++ b/google/genai/_gaos/types/interactions/retrieval.py @@ -30,7 +30,7 @@ from typing_extensions import Annotated, NotRequired, TypedDict -RetrievalType = Union[ +RetrievalRetrievalType = Union[ Literal[ "vertex_ai_search", "rag_store", @@ -45,7 +45,7 @@ class RetrievalParam(TypedDict): r"""A tool that can be used by the model to retrieve files.""" type: Literal["retrieval"] - retrieval_types: NotRequired[List[RetrievalType]] + retrieval_types: NotRequired[List[RetrievalRetrievalType]] r"""The types of file retrieval to enable.""" vertex_ai_search_config: NotRequired[VertexAISearchConfigParam] r"""Used to specify configuration for VertexAISearch.""" @@ -65,7 +65,7 @@ class Retrieval(BaseModel): pydantic.Field(alias="type"), ] = "retrieval" - retrieval_types: Optional[List[RetrievalType]] = None + retrieval_types: Optional[List[RetrievalRetrievalType]] = None r"""The types of file retrieval to enable.""" vertex_ai_search_config: Optional[VertexAISearchConfig] = None diff --git a/google/genai/_gaos/types/interactions/retrievalcallarguments.py b/google/genai/_gaos/types/interactions/retrievalcallarguments.py new file mode 100644 index 000000000..9746017e0 --- /dev/null +++ b/google/genai/_gaos/types/interactions/retrievalcallarguments.py @@ -0,0 +1,53 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .. import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class RetrievalCallArgumentsTypedDict(TypedDict): + r"""The arguments to pass to Retrieval tools.""" + + queries: NotRequired[List[str]] + r"""Queries for Retrieval information.""" + + +class RetrievalCallArguments(BaseModel): + r"""The arguments to pass to Retrieval tools.""" + + queries: Optional[List[str]] = None + r"""Queries for Retrieval information.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["queries"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/google/genai/_gaos/types/interactions/retrievalcalldelta.py b/google/genai/_gaos/types/interactions/retrievalcalldelta.py new file mode 100644 index 000000000..f2b6d6b30 --- /dev/null +++ b/google/genai/_gaos/types/interactions/retrievalcalldelta.py @@ -0,0 +1,100 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from ...utils import validate_const +from .retrievalcallarguments import ( + RetrievalCallArguments, + RetrievalCallArgumentsTypedDict, +) +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import AfterValidator +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +RetrievalCallDeltaRetrievalType = Union[ + Literal[ + "vertex_ai_search", + "rag_store", + "exa_ai_search", + "parallel_ai_search", + ], + UnrecognizedStr, +] +r"""The type of retrieval tools.""" + + +class RetrievalCallDeltaTypedDict(TypedDict): + r"""Used by Vertex Retrieval tools such as Parallel AI, Exa AI, Vertex AI Search, + etc. RetrievalType decides which tool is used. + """ + + arguments: RetrievalCallArgumentsTypedDict + r"""The arguments to pass to Retrieval tools.""" + type: Literal["retrieval_call"] + retrieval_type: NotRequired[RetrievalCallDeltaRetrievalType] + r"""The type of retrieval tools.""" + signature: NotRequired[str] + r"""A signature hash for backend validation.""" + + +class RetrievalCallDelta(BaseModel): + r"""Used by Vertex Retrieval tools such as Parallel AI, Exa AI, Vertex AI Search, + etc. RetrievalType decides which tool is used. + """ + + arguments: RetrievalCallArguments + r"""The arguments to pass to Retrieval tools.""" + + type: Annotated[ + Annotated[ + Literal["retrieval_call"], AfterValidator(validate_const("retrieval_call")) + ], + pydantic.Field(alias="type"), + ] = "retrieval_call" + + retrieval_type: Optional[RetrievalCallDeltaRetrievalType] = None + r"""The type of retrieval tools.""" + + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["retrieval_type", "signature"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +try: + RetrievalCallDelta.model_rebuild() +except NameError: + pass diff --git a/google/genai/_gaos/types/interactions/retrievalresultdelta.py b/google/genai/_gaos/types/interactions/retrievalresultdelta.py new file mode 100644 index 000000000..c67ad8033 --- /dev/null +++ b/google/genai/_gaos/types/interactions/retrievalresultdelta.py @@ -0,0 +1,80 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import AfterValidator +from typing import Literal, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class RetrievalResultDeltaTypedDict(TypedDict): + r"""Used by Vertex Retrieval tools such as Parallel AI, Exa AI, Vertex AI Search, + etc. + """ + + type: Literal["retrieval_result"] + is_error: NotRequired[bool] + r"""Whether the retrieval resulted in an error.""" + signature: NotRequired[str] + r"""A signature hash for backend validation.""" + + +class RetrievalResultDelta(BaseModel): + r"""Used by Vertex Retrieval tools such as Parallel AI, Exa AI, Vertex AI Search, + etc. + """ + + type: Annotated[ + Annotated[ + Literal["retrieval_result"], + AfterValidator(validate_const("retrieval_result")), + ], + pydantic.Field(alias="type"), + ] = "retrieval_result" + + is_error: Optional[bool] = None + r"""Whether the retrieval resulted in an error.""" + + signature: Optional[str] = None + r"""A signature hash for backend validation.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["is_error", "signature"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +try: + RetrievalResultDelta.model_rebuild() +except NameError: + pass diff --git a/google/genai/_gaos/types/interactions/stepdeltadata.py b/google/genai/_gaos/types/interactions/stepdeltadata.py index 6f64d7062..576cfac4f 100644 --- a/google/genai/_gaos/types/interactions/stepdeltadata.py +++ b/google/genai/_gaos/types/interactions/stepdeltadata.py @@ -49,6 +49,8 @@ MCPServerToolResultDelta, MCPServerToolResultDeltaTypedDict, ) +from .retrievalcalldelta import RetrievalCallDelta, RetrievalCallDeltaTypedDict +from .retrievalresultdelta import RetrievalResultDelta, RetrievalResultDeltaTypedDict from .textannotationdelta import TextAnnotationDelta, TextAnnotationDeltaTypedDict from .textdelta import TextDelta, TextDeltaTypedDict from .thoughtsignaturedelta import ThoughtSignatureDelta, ThoughtSignatureDeltaTypedDict @@ -67,25 +69,27 @@ "StepDeltaDataTypedDict", Union[ ThoughtSignatureDeltaTypedDict, - FileSearchCallDeltaTypedDict, TextDeltaTypedDict, ArgumentsDeltaTypedDict, + FileSearchCallDeltaTypedDict, TextAnnotationDeltaTypedDict, ThoughtSummaryDeltaTypedDict, - URLContextCallDeltaTypedDict, - CodeExecutionCallDeltaTypedDict, - GoogleMapsResultDeltaTypedDict, - GoogleSearchCallDeltaTypedDict, FileSearchResultDeltaTypedDict, GoogleMapsCallDeltaTypedDict, - MCPServerToolResultDeltaTypedDict, - DocumentDeltaTypedDict, + GoogleMapsResultDeltaTypedDict, + CodeExecutionCallDeltaTypedDict, + URLContextCallDeltaTypedDict, + GoogleSearchCallDeltaTypedDict, + RetrievalResultDeltaTypedDict, MCPServerToolCallDeltaTypedDict, + RetrievalCallDeltaTypedDict, CodeExecutionResultDeltaTypedDict, URLContextResultDeltaTypedDict, GoogleSearchResultDeltaTypedDict, - ImageDeltaTypedDict, + MCPServerToolResultDeltaTypedDict, + DocumentDeltaTypedDict, VideoDeltaTypedDict, + ImageDeltaTypedDict, FunctionResultDeltaTypedDict, AudioDeltaTypedDict, ], @@ -118,12 +122,14 @@ class UnknownStepDeltaData(BaseModel): "mcp_server_tool_call": MCPServerToolCallDelta, "file_search_call": FileSearchCallDelta, "google_maps_call": GoogleMapsCallDelta, + "retrieval_call": RetrievalCallDelta, "code_execution_result": CodeExecutionResultDelta, "url_context_result": URLContextResultDelta, "google_search_result": GoogleSearchResultDelta, "mcp_server_tool_result": MCPServerToolResultDelta, "file_search_result": FileSearchResultDelta, "google_maps_result": GoogleMapsResultDelta, + "retrieval_result": RetrievalResultDelta, "function_result": FunctionResultDelta, } @@ -145,12 +151,14 @@ class UnknownStepDeltaData(BaseModel): MCPServerToolCallDelta, FileSearchCallDelta, GoogleMapsCallDelta, + RetrievalCallDelta, CodeExecutionResultDelta, URLContextResultDelta, GoogleSearchResultDelta, MCPServerToolResultDelta, FileSearchResultDelta, GoogleMapsResultDelta, + RetrievalResultDelta, FunctionResultDelta, UnknownStepDeltaData, ], diff --git a/google/genai/_gaos/types/interactions/urlcontextcallarguments.py b/google/genai/_gaos/types/interactions/urlcontextcallarguments.py index afeefa382..6fce0335a 100644 --- a/google/genai/_gaos/types/interactions/urlcontextcallarguments.py +++ b/google/genai/_gaos/types/interactions/urlcontextcallarguments.py @@ -23,7 +23,7 @@ from typing_extensions import NotRequired, TypedDict -class URLContextCallArgumentsTypedDict(TypedDict): +class URLContextCallArgumentsParam(TypedDict): r"""The arguments to pass to the URL context.""" urls: NotRequired[List[str]] diff --git a/google/genai/_gaos/types/interactions/urlcontextcalldelta.py b/google/genai/_gaos/types/interactions/urlcontextcalldelta.py index 568e88fe2..f24362835 100644 --- a/google/genai/_gaos/types/interactions/urlcontextcalldelta.py +++ b/google/genai/_gaos/types/interactions/urlcontextcalldelta.py @@ -21,7 +21,7 @@ from ...utils import validate_const from .urlcontextcallarguments import ( URLContextCallArguments, - URLContextCallArgumentsTypedDict, + URLContextCallArgumentsParam, ) import pydantic from pydantic import model_serializer @@ -31,7 +31,7 @@ class URLContextCallDeltaTypedDict(TypedDict): - arguments: URLContextCallArgumentsTypedDict + arguments: URLContextCallArgumentsParam r"""The arguments to pass to the URL context.""" type: Literal["url_context_call"] signature: NotRequired[str] diff --git a/google/genai/_gaos/types/interactions/urlcontextcallstep.py b/google/genai/_gaos/types/interactions/urlcontextcallstep.py index 5c6a68648..68393121d 100644 --- a/google/genai/_gaos/types/interactions/urlcontextcallstep.py +++ b/google/genai/_gaos/types/interactions/urlcontextcallstep.py @@ -19,50 +19,24 @@ from __future__ import annotations from .. import Base64EncodedString, Base64FileInput, BaseModel, UNSET_SENTINEL from ...utils import validate_const +from .urlcontextcallarguments import ( + URLContextCallArguments, + URLContextCallArgumentsParam, +) import pydantic from pydantic import model_serializer from pydantic.functional_validators import AfterValidator -from typing import List, Literal, Optional, Union +from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict -class ArgumentsParam(TypedDict): - r"""The arguments to pass to the URL context.""" - - urls: NotRequired[List[str]] - r"""The URLs to fetch.""" - - -class Arguments(BaseModel): - r"""The arguments to pass to the URL context.""" - - urls: Optional[List[str]] = None - r"""The URLs to fetch.""" - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = set(["urls"]) - serialized = handler(self) - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k, serialized.get(n)) - - if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: - m[k] = val - - return m - - class URLContextCallStepParam(TypedDict): r"""URL context call step.""" + arguments: URLContextCallArgumentsParam + r"""The arguments to pass to the URL context.""" id: str r"""Required. A unique ID for this specific tool call.""" - arguments: ArgumentsParam - r"""The arguments to pass to the URL context.""" type: Literal["url_context_call"] signature: NotRequired[Union[str, Base64FileInput]] r"""A signature hash for backend validation.""" @@ -71,12 +45,12 @@ class URLContextCallStepParam(TypedDict): class URLContextCallStep(BaseModel): r"""URL context call step.""" + arguments: URLContextCallArguments + r"""The arguments to pass to the URL context.""" + id: str r"""Required. A unique ID for this specific tool call.""" - arguments: Arguments - r"""The arguments to pass to the URL context.""" - type: Annotated[ Annotated[ Literal["url_context_call"],