diff --git a/google/genai/_interactions/resources/interactions.py b/google/genai/_interactions/resources/interactions.py index f169aa8c5..d9ddb9a8f 100644 --- a/google/genai/_interactions/resources/interactions.py +++ b/google/genai/_interactions/resources/interactions.py @@ -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 @@ -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"] @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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, @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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 @@ -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, @@ -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, diff --git a/google/genai/_interactions/types/__init__.py b/google/genai/_interactions/types/__init__.py index f756897bd..6aff63ecb 100644 --- a/google/genai/_interactions/types/__init__.py +++ b/google/genai/_interactions/types/__init__.py @@ -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 @@ -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 diff --git a/google/genai/_interactions/types/interaction.py b/google/genai/_interactions/types/interaction.py index 3fe883f92..76233cb0b 100644 --- a/google/genai/_interactions/types/interaction.py +++ b/google/genai/_interactions/types/interaction.py @@ -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 @@ -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 @@ -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.""" diff --git a/google/genai/_interactions/types/interaction_create_params.py b/google/genai/_interactions/types/interaction_create_params.py index ae4d4d78d..3b1515d42 100644 --- a/google/genai/_interactions/types/interaction_create_params.py +++ b/google/genai/_interactions/types/interaction_create_params.py @@ -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 @@ -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.""" @@ -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."""