From fce2387a3a132320c476f55b1090f66c1837e553 Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Mon, 15 Jun 2026 10:49:28 -0700 Subject: [PATCH] No public description PiperOrigin-RevId: 932550510 --- .../genai/_interactions/types/interaction.py | 175 +----------------- .../types/interaction_create_params.py | 162 +--------------- 2 files changed, 6 insertions(+), 331 deletions(-) diff --git a/google/genai/_interactions/types/interaction.py b/google/genai/_interactions/types/interaction.py index 725d88e72..ec73d4a3c 100644 --- a/google/genai/_interactions/types/interaction.py +++ b/google/genai/_interactions/types/interaction.py @@ -17,13 +17,14 @@ from typing import TYPE_CHECKING, Any, Set, Dict, List, Tuple, Union, Optional, cast from datetime import datetime -from typing_extensions import Literal, TypeAlias, override +from typing_extensions import Literal, Annotated, TypeAlias, override from . import environment from .step import Step 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 @@ -42,176 +43,10 @@ from .image_response_format import ImageResponseFormat from .deep_research_agent_config import DeepResearchAgentConfig -__all__ = [ - "Interaction", - "AgentConfig", - "AgentConfigFindRequest", - "AgentConfigFindRequestSessionConfig", - "AgentConfigFindRequestSourceFile", - "AgentConfigFixRequest", - "AgentConfigFixRequestSessionConfig", - "AgentConfigFixRequestSourceFile", - "Environment", - "Input", - "ResponseFormat", - "ResponseFormatResponseFormatList", -] - - -class AgentConfigFindRequestSessionConfig(BaseModel): - """ - Optional session-specific configurations to override default agent - behavior. - """ - - max_rounds: Optional[int] = None - """ - The maximum number of interaction rounds the agent is allowed to perform before - reaching a timeout. - """ - - pipeline_mode: Optional[Literal["scan", "verify"]] = None - """The pipeline mode of a CodeMender session. - - It can only be used for a find session. - """ - - topology: Optional[str] = None - """The cognitive architecture or "thinking" topology used by the agent (e.g. - - "default", "deep"). - """ - - -class AgentConfigFindRequestSourceFile(BaseModel): - """Content of a single file in the codebase.""" - - content: Optional[str] = None - """The UTF-8 encoded text content of the file.""" - - path: Optional[str] = None - """The relative path of the file from the project root.""" - - -class AgentConfigFindRequest(BaseModel): - """ - Request parameters specific to FIND sessions, used for discovering - vulnerabilities in a codebase. - """ - - request: Literal["find_request"] - - description: Optional[str] = None - """ - Additional context or custom instructions provided by the user to guide the - vulnerability analysis. - """ - - finding_id: Optional[str] = None - """The identifier of a specific finding to verify. - - This is primarily used in VERIFY mode to focus the agent's execution-based - validation on a single vulnerability. - """ - - model: Optional[str] = None - """The name of the model to use for the CodeMender agent. - - One CodeMender session will only use one model. - """ - - session_config: Optional[AgentConfigFindRequestSessionConfig] = None - """Optional session-specific configurations to override default agent behavior.""" - - session_id: Optional[str] = None - """ - Parameter for grouping multiple interactions that belong to the same CodeMender - session. - """ - - source_files: Optional[List[AgentConfigFindRequestSourceFile]] = None - """A list of source files to provide as context for the scan.""" - - -class AgentConfigFixRequestSessionConfig(BaseModel): - """ - Optional session-specific configurations to override default agent - behavior. - """ - - max_rounds: Optional[int] = None - """ - The maximum number of interaction rounds the agent is allowed to perform before - reaching a timeout. - """ - - pipeline_mode: Optional[Literal["scan", "verify"]] = None - """The pipeline mode of a CodeMender session. - - It can only be used for a find session. - """ - - topology: Optional[str] = None - """The cognitive architecture or "thinking" topology used by the agent (e.g. - - "default", "deep"). - """ - - -class AgentConfigFixRequestSourceFile(BaseModel): - """Content of a single file in the codebase.""" - - content: Optional[str] = None - """The UTF-8 encoded text content of the file.""" - - path: Optional[str] = None - """The relative path of the file from the project root.""" - - -class AgentConfigFixRequest(BaseModel): - """ - Request parameters specific to FIX sessions, used for generating and - validating security patches. - """ - - request: Literal["fix_request"] - - description: Optional[str] = None - """ - Additional context or custom instructions provided by the user to guide the - patch generation process. - """ - - finding_id: Optional[str] = None - """The identifier of the specific security finding to be remediated. - - This ID maps to a previously discovered vulnerability. - """ - - model: Optional[str] = None - """The name of the model to use for the CodeMender agent. - - One CodeMender session will only use one model. - """ - - session_config: Optional[AgentConfigFixRequestSessionConfig] = None - """Optional session-specific configurations to override default agent behavior.""" - - session_id: Optional[str] = None - """ - Parameter for grouping multiple interactions that belong to the same CodeMender - session. - """ - - source_files: Optional[List[AgentConfigFixRequestSourceFile]] = None - """A list of source files providing context for the remediation. - - These files are typically the ones containing the identified vulnerability. - """ - +__all__ = ["Interaction", "AgentConfig", "Environment", "Input", "ResponseFormat", "ResponseFormatResponseFormatList"] -AgentConfig: TypeAlias = Union[ - DeepResearchAgentConfig, DynamicAgentConfig, AgentConfigFindRequest, AgentConfigFixRequest +AgentConfig: TypeAlias = Annotated[ + Union[DeepResearchAgentConfig, DynamicAgentConfig], PropertyInfo(discriminator="type") ] Environment: TypeAlias = Union[str, environment.Environment] diff --git a/google/genai/_interactions/types/interaction_create_params.py b/google/genai/_interactions/types/interaction_create_params.py index c82396355..ffaf93ac3 100644 --- a/google/genai/_interactions/types/interaction_create_params.py +++ b/google/genai/_interactions/types/interaction_create_params.py @@ -46,12 +46,6 @@ "ResponseFormatResponseFormatList", "BaseCreateAgentInteractionParams", "AgentConfig", - "AgentConfigFindRequest", - "AgentConfigFindRequestSessionConfig", - "AgentConfigFindRequestSourceFile", - "AgentConfigFixRequest", - "AgentConfigFixRequestSessionConfig", - "AgentConfigFixRequestSourceFile", "CreateModelInteractionParamsNonStreaming", "CreateModelInteractionParamsStreaming", "CreateAgentInteractionParamsNonStreaming", @@ -217,161 +211,7 @@ class BaseCreateAgentInteractionParams(TypedDict, total=False): """ -class AgentConfigFindRequestSessionConfig(TypedDict, total=False): - """ - Optional session-specific configurations to override default agent - behavior. - """ - - max_rounds: int - """ - The maximum number of interaction rounds the agent is allowed to perform before - reaching a timeout. - """ - - pipeline_mode: Literal["scan", "verify"] - """The pipeline mode of a CodeMender session. - - It can only be used for a find session. - """ - - topology: str - """The cognitive architecture or "thinking" topology used by the agent (e.g. - - "default", "deep"). - """ - - -class AgentConfigFindRequestSourceFile(TypedDict, total=False): - """Content of a single file in the codebase.""" - - content: str - """The UTF-8 encoded text content of the file.""" - - path: str - """The relative path of the file from the project root.""" - - -class AgentConfigFindRequest(TypedDict, total=False): - """ - Request parameters specific to FIND sessions, used for discovering - vulnerabilities in a codebase. - """ - - request: Required[Literal["find_request"]] - - description: str - """ - Additional context or custom instructions provided by the user to guide the - vulnerability analysis. - """ - - finding_id: str - """The identifier of a specific finding to verify. - - This is primarily used in VERIFY mode to focus the agent's execution-based - validation on a single vulnerability. - """ - - model: str - """The name of the model to use for the CodeMender agent. - - One CodeMender session will only use one model. - """ - - session_config: AgentConfigFindRequestSessionConfig - """Optional session-specific configurations to override default agent behavior.""" - - session_id: str - """ - Parameter for grouping multiple interactions that belong to the same CodeMender - session. - """ - - source_files: Iterable[AgentConfigFindRequestSourceFile] - """A list of source files to provide as context for the scan.""" - - -class AgentConfigFixRequestSessionConfig(TypedDict, total=False): - """ - Optional session-specific configurations to override default agent - behavior. - """ - - max_rounds: int - """ - The maximum number of interaction rounds the agent is allowed to perform before - reaching a timeout. - """ - - pipeline_mode: Literal["scan", "verify"] - """The pipeline mode of a CodeMender session. - - It can only be used for a find session. - """ - - topology: str - """The cognitive architecture or "thinking" topology used by the agent (e.g. - - "default", "deep"). - """ - - -class AgentConfigFixRequestSourceFile(TypedDict, total=False): - """Content of a single file in the codebase.""" - - content: str - """The UTF-8 encoded text content of the file.""" - - path: str - """The relative path of the file from the project root.""" - - -class AgentConfigFixRequest(TypedDict, total=False): - """ - Request parameters specific to FIX sessions, used for generating and - validating security patches. - """ - - request: Required[Literal["fix_request"]] - - description: str - """ - Additional context or custom instructions provided by the user to guide the - patch generation process. - """ - - finding_id: str - """The identifier of the specific security finding to be remediated. - - This ID maps to a previously discovered vulnerability. - """ - - model: str - """The name of the model to use for the CodeMender agent. - - One CodeMender session will only use one model. - """ - - session_config: AgentConfigFixRequestSessionConfig - """Optional session-specific configurations to override default agent behavior.""" - - session_id: str - """ - Parameter for grouping multiple interactions that belong to the same CodeMender - session. - """ - - source_files: Iterable[AgentConfigFixRequestSourceFile] - """A list of source files providing context for the remediation. - - These files are typically the ones containing the identified vulnerability. - """ - - -AgentConfig: TypeAlias = Union[ - DeepResearchAgentConfigParam, DynamicAgentConfigParam, AgentConfigFindRequest, AgentConfigFixRequest -] +AgentConfig: TypeAlias = Union[DeepResearchAgentConfigParam, DynamicAgentConfigParam] class CreateModelInteractionParamsNonStreaming(BaseCreateModelInteractionParams, total=False):