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
40 changes: 39 additions & 1 deletion google/genai/_interactions/resources/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@

import httpx

from ..types import interaction_get_params, interaction_create_params
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
Expand All @@ -48,6 +51,7 @@
from ..types.webhook_config_param import WebhookConfigParam
from ..types.interaction_sse_event import InteractionSSEEvent
from ..types.generation_config_param import GenerationConfigParam
from ..types.model_armor_config_param import ModelArmorConfigParam

__all__ = ["InteractionsResource", "AsyncInteractionsResource"]

Expand Down Expand Up @@ -81,6 +85,7 @@ def create(
model: ModelParam,
background: bool | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -110,6 +115,8 @@ def create(

generation_config: Input only. Configuration parameters for the model interaction.

model_armor_config: Settings for prompt and response sanitization using the Model Armor service.

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
Expand Down Expand Up @@ -152,6 +159,7 @@ def create(
stream: Literal[True],
background: bool | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -182,6 +190,8 @@ def create(

generation_config: Input only. Configuration parameters for the model interaction.

model_armor_config: Settings for prompt and response sanitization using the Model Armor service.

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
Expand Down Expand Up @@ -228,6 +238,7 @@ def create(
input: interaction_create_params.Input,
agent_config: interaction_create_params.AgentConfig | Omit = omit,
background: bool | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -257,6 +268,8 @@ def create(

background: Input only. Whether to run the model interaction in the background.

model_armor_config: Settings for prompt and response sanitization using the Model Armor service.

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
Expand Down Expand Up @@ -306,6 +319,7 @@ def create(
stream: Literal[True],
agent_config: interaction_create_params.AgentConfig | Omit = omit,
background: bool | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -336,6 +350,8 @@ def create(

background: Input only. Whether to run the model interaction in the background.

model_armor_config: Settings for prompt and response sanitization using the Model Armor service.

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
Expand Down Expand Up @@ -376,6 +392,7 @@ def create(
stream: bool,
background: bool | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -406,6 +423,8 @@ def create(

generation_config: Input only. Configuration parameters for the model interaction.

model_armor_config: Settings for prompt and response sanitization using the Model Armor service.

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
Expand Down Expand Up @@ -445,6 +464,7 @@ def create(
model: ModelParam | Omit = omit,
background: bool | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -499,6 +519,7 @@ def create(
"model": model,
"background": background,
"generation_config": generation_config,
"model_armor_config": model_armor_config,
"previous_interaction_id": previous_interaction_id,
"response_format": response_format,
"response_mime_type": response_mime_type,
Expand Down Expand Up @@ -799,6 +820,7 @@ async def create(
model: ModelParam,
background: bool | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -828,6 +850,8 @@ async def create(

generation_config: Input only. Configuration parameters for the model interaction.

model_armor_config: Settings for prompt and response sanitization using the Model Armor service.

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
Expand Down Expand Up @@ -870,6 +894,7 @@ async def create(
stream: Literal[True],
background: bool | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -900,6 +925,8 @@ async def create(

generation_config: Input only. Configuration parameters for the model interaction.

model_armor_config: Settings for prompt and response sanitization using the Model Armor service.

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
Expand Down Expand Up @@ -946,6 +973,7 @@ async def create(
input: interaction_create_params.Input,
agent_config: interaction_create_params.AgentConfig | Omit = omit,
background: bool | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -975,6 +1003,8 @@ async def create(

background: Input only. Whether to run the model interaction in the background.

model_armor_config: Settings for prompt and response sanitization using the Model Armor service.

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
Expand Down Expand Up @@ -1024,6 +1054,7 @@ async def create(
stream: Literal[True],
agent_config: interaction_create_params.AgentConfig | Omit = omit,
background: bool | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -1054,6 +1085,8 @@ async def create(

background: Input only. Whether to run the model interaction in the background.

model_armor_config: Settings for prompt and response sanitization using the Model Armor service.

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
Expand Down Expand Up @@ -1094,6 +1127,7 @@ async def create(
stream: bool,
background: bool | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -1124,6 +1158,8 @@ async def create(

generation_config: Input only. Configuration parameters for the model interaction.

model_armor_config: Settings for prompt and response sanitization using the Model Armor service.

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
Expand Down Expand Up @@ -1163,6 +1199,7 @@ async def create(
model: ModelParam | Omit = omit,
background: bool | Omit = omit,
generation_config: GenerationConfigParam | Omit = omit,
model_armor_config: ModelArmorConfigParam | Omit = omit,
previous_interaction_id: str | Omit = omit,
response_format: interaction_create_params.ResponseFormat | Omit = omit,
response_mime_type: str | Omit = omit,
Expand Down Expand Up @@ -1213,6 +1250,7 @@ async def create(
"model": model,
"background": background,
"generation_config": generation_config,
"model_armor_config": model_armor_config,
"previous_interaction_id": previous_interaction_id,
"response_format": response_format,
"response_mime_type": response_mime_type,
Expand Down
2 changes: 2 additions & 0 deletions google/genai/_interactions/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
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 .model_armor_config import ModelArmorConfig as ModelArmorConfig
from .text_content_param import TextContentParam as TextContentParam
from .thought_step_param import ThoughtStepParam as ThoughtStepParam
from .tool_choice_config import ToolChoiceConfig as ToolChoiceConfig
Expand Down Expand Up @@ -100,6 +101,7 @@
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 .model_armor_config_param import ModelArmorConfigParam as ModelArmorConfigParam
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
Expand Down
6 changes: 6 additions & 0 deletions google/genai/_interactions/types/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from datetime import datetime
from typing_extensions import Literal, Annotated, TypeAlias, override

from pydantic import Field as FieldInfo

from .step import Step
from .tool import Tool
from .model import Model
Expand All @@ -34,6 +36,7 @@
from .._legacy_lyria import is_legacy_lyria_response_body
from .webhook_config import WebhookConfig
from .document_content import DocumentContent
from .model_armor_config import ModelArmorConfig
from .dynamic_agent_config import DynamicAgentConfig
from .text_response_format import TextResponseFormat
from .audio_response_format import AudioResponseFormat
Expand Down Expand Up @@ -103,6 +106,9 @@ class Interaction(BaseModel):
model: Optional[Model] = None
"""The name of the `Model` used for generating the interaction."""

api_model_armor_config: Optional[ModelArmorConfig] = FieldInfo(alias="model_armor_config", default=None)
"""Settings for prompt and response sanitization using the Model Armor service."""

previous_interaction_id: Optional[str] = None
"""The ID of the previous interaction, if any."""

Expand Down
7 changes: 7 additions & 0 deletions google/genai/_interactions/types/interaction_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from .webhook_config_param import WebhookConfigParam
from .document_content_param import DocumentContentParam
from .generation_config_param import GenerationConfigParam
from .model_armor_config_param import ModelArmorConfigParam
from .dynamic_agent_config_param import DynamicAgentConfigParam
from .text_response_format_param import TextResponseFormatParam
from .audio_response_format_param import AudioResponseFormatParam
Expand Down Expand Up @@ -66,6 +67,9 @@ class BaseCreateModelInteractionParams(TypedDict, total=False):
generation_config: GenerationConfigParam
"""Input only. Configuration parameters for the model interaction."""

model_armor_config: ModelArmorConfigParam
"""Settings for prompt and response sanitization using the Model Armor service."""

previous_interaction_id: str
"""The ID of the previous interaction, if any."""

Expand Down Expand Up @@ -149,6 +153,9 @@ class BaseCreateAgentInteractionParams(TypedDict, total=False):
background: bool
"""Input only. Whether to run the model interaction in the background."""

model_armor_config: ModelArmorConfigParam
"""Settings for prompt and response sanitization using the Model Armor service."""

previous_interaction_id: str
"""The ID of the previous interaction, if any."""

Expand Down
Loading