Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion google/genai/_gaos/types/interactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,11 @@
from .ragstoreconfig import RagStoreConfig, RagStoreConfigParam
from .ranking import Ranking, RankingParam
from .rankservice import RankService, RankServiceParam
from .responseformat import ResponseFormat, ResponseFormatParam
from .responseformat import (
ResponseFormat,
ResponseFormatParam,
UnknownResponseFormat,
)
from .responsemodality import ResponseModality
from .retrieval import Retrieval, RetrievalParam, RetrievalRetrievalType
from .retrievalcallarguments import (
Expand Down Expand Up @@ -822,6 +826,7 @@
"UnknownFunctionResultSubcontent",
"UnknownInteractionAgentConfig",
"UnknownInteractionSSEEvent",
"UnknownResponseFormat",
"UnknownStep",
"UnknownStepDeltaData",
"UnknownThoughtSummaryContent",
Expand Down Expand Up @@ -1127,6 +1132,7 @@
"RankServiceParam": ".rankservice",
"ResponseFormat": ".responseformat",
"ResponseFormatParam": ".responseformat",
"UnknownResponseFormat": ".responseformat",
"ResponseModality": ".responsemodality",
"Retrieval": ".retrieval",
"RetrievalParam": ".retrieval",
Expand Down
13 changes: 12 additions & 1 deletion google/genai/_gaos/types/interactions/createagentinteraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from __future__ import annotations
from .. import BaseModel, UNSET_SENTINEL, current_exclude_none, serialize_with_info
from ...utils.unions import dispatch_open_union_members
from ..basemodel import current_filtered_dump
from .agentoption import AgentOption
from .antigravityagentconfig import AntigravityAgentConfig, AntigravityAgentConfigParam
Expand All @@ -36,6 +37,7 @@
from .servicetier import ServiceTier
from .tool import Tool, ToolParam
from .webhookconfig import WebhookConfig, WebhookConfigParam
from functools import partial
import pydantic
from pydantic import Field, model_serializer
from typing import Dict, List, Optional, Union
Expand Down Expand Up @@ -94,7 +96,16 @@


CreateAgentInteractionResponseFormat = TypeAliasType(
"CreateAgentInteractionResponseFormat", Union[ResponseFormat, List[ResponseFormat]]
"CreateAgentInteractionResponseFormat",
Annotated[
Union[ResponseFormat, List[ResponseFormat]],
pydantic.WrapValidator(
partial(
dispatch_open_union_members,
members=(ResponseFormat, List[ResponseFormat]),
)
),
],
)
r"""Enforces that the generated response is a JSON object that complies with
the JSON schema specified in this field.
Expand Down
13 changes: 12 additions & 1 deletion google/genai/_gaos/types/interactions/createmodelinteraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from __future__ import annotations
from .. import BaseModel, UNSET_SENTINEL, current_exclude_none, serialize_with_info
from ...utils.unions import dispatch_open_union_members
from ..basemodel import current_filtered_dump
from .environment import Environment, EnvironmentParam
from .generationconfig import GenerationConfig, GenerationConfigParam
Expand All @@ -30,6 +31,7 @@
from .servicetier import ServiceTier
from .tool import Tool, ToolParam
from .webhookconfig import WebhookConfig, WebhookConfigParam
from functools import partial
import pydantic
from pydantic import model_serializer
from typing import Dict, List, Optional, Union
Expand Down Expand Up @@ -64,7 +66,16 @@


CreateModelInteractionResponseFormat = TypeAliasType(
"CreateModelInteractionResponseFormat", Union[ResponseFormat, List[ResponseFormat]]
"CreateModelInteractionResponseFormat",
Annotated[
Union[ResponseFormat, List[ResponseFormat]],
pydantic.WrapValidator(
partial(
dispatch_open_union_members,
members=(ResponseFormat, List[ResponseFormat]),
)
),
],
)
r"""Enforces that the generated response is a JSON object that complies with
the JSON schema specified in this field.
Expand Down
13 changes: 11 additions & 2 deletions google/genai/_gaos/types/interactions/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
current_exclude_none,
serialize_with_info,
)
from ...utils.unions import parse_open_union
from ...utils.unions import dispatch_open_union_members, parse_open_union
from ..basemodel import current_filtered_dump
from .agentoption import AgentOption
from .antigravityagentconfig import AntigravityAgentConfig, AntigravityAgentConfigParam
Expand Down Expand Up @@ -139,7 +139,16 @@ class UnknownInteractionAgentConfig(BaseModel):


InteractionResponseFormat = TypeAliasType(
"InteractionResponseFormat", Union[ResponseFormat, List[ResponseFormat]]
"InteractionResponseFormat",
Annotated[
Union[ResponseFormat, List[ResponseFormat]],
pydantic.WrapValidator(
partial(
dispatch_open_union_members,
members=(ResponseFormat, List[ResponseFormat]),
)
),
],
)
r"""Enforces that the generated response is a JSON object that complies with
the JSON schema specified in this field.
Expand Down
47 changes: 39 additions & 8 deletions google/genai/_gaos/types/interactions/responseformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .. import BaseModel
from ...utils.unions import parse_open_union
from .audioresponseformat import AudioResponseFormat, AudioResponseFormatParam
from .imageresponseformat import ImageResponseFormat, ImageResponseFormatParam
from .textresponseformat import TextResponseFormat, TextResponseFormatParam
from .videoresponseformat import VideoResponseFormat, VideoResponseFormatParam
from typing import Any, Dict, Union
from typing_extensions import TypeAliasType
from functools import partial
from pydantic import ConfigDict
from pydantic.functional_validators import BeforeValidator
from typing import Any, Literal, Union
from typing_extensions import Annotated, TypeAliasType


ResponseFormatParam = TypeAliasType(
Expand All @@ -33,18 +38,44 @@
AudioResponseFormatParam,
ImageResponseFormatParam,
VideoResponseFormatParam,
Dict[str, Any],
],
)


ResponseFormat = TypeAliasType(
"ResponseFormat",
class UnknownResponseFormat(BaseModel):
r"""A ResponseFormat variant the SDK doesn't recognize. Preserves the raw payload."""

type: Literal["UNKNOWN"] = "UNKNOWN"
raw: Any
is_unknown: Literal[True] = True

model_config = ConfigDict(frozen=True)


_RESPONSE_FORMAT_VARIANTS: dict[str, Any] = {
"audio": AudioResponseFormat,
"image": ImageResponseFormat,
"text": TextResponseFormat,
"video": VideoResponseFormat,
}


ResponseFormat = Annotated[
Union[
TextResponseFormat,
AudioResponseFormat,
ImageResponseFormat,
TextResponseFormat,
VideoResponseFormat,
Dict[str, Any],
UnknownResponseFormat,
],
)
BeforeValidator(
partial(
parse_open_union,
disc_key="type",
variants=_RESPONSE_FORMAT_VARIANTS,
unknown_cls=UnknownResponseFormat,
union_name="ResponseFormat",
lenient=True,
)
),
]
Loading