From ba641aa335476b612b3c08c010d8955ac52e81f5 Mon Sep 17 00:00:00 2001 From: Wanlin Du Date: Tue, 9 Jun 2026 17:56:39 -0700 Subject: [PATCH] chore: internal structure change PiperOrigin-RevId: 929505643 --- google/genai/_interactions/types/__init__.py | 4 + .../genai/_interactions/types/find_request.py | 92 ++++++++++ .../_interactions/types/find_request_param.py | 92 ++++++++++ .../genai/_interactions/types/fix_request.py | 94 ++++++++++ .../_interactions/types/fix_request_param.py | 94 ++++++++++ .../genai/_interactions/types/interaction.py | 162 +----------------- .../types/interaction_create_params.py | 152 +--------------- 7 files changed, 383 insertions(+), 307 deletions(-) create mode 100644 google/genai/_interactions/types/find_request.py create mode 100644 google/genai/_interactions/types/find_request_param.py create mode 100644 google/genai/_interactions/types/fix_request.py create mode 100644 google/genai/_interactions/types/fix_request_param.py diff --git a/google/genai/_interactions/types/__init__.py b/google/genai/_interactions/types/__init__.py index 9a1f90467..febf7adb3 100644 --- a/google/genai/_interactions/types/__init__.py +++ b/google/genai/_interactions/types/__init__.py @@ -33,9 +33,11 @@ from .tool_param import ToolParam as ToolParam from .environment import Environment as Environment from .error_event import ErrorEvent as ErrorEvent +from .fix_request import FixRequest as FixRequest from .interaction import Interaction as Interaction from .model_param import ModelParam as ModelParam from .usage_param import UsageParam as UsageParam +from .find_request import FindRequest as FindRequest from .image_config import ImageConfig as ImageConfig from .text_content import TextContent as TextContent from .thought_step import ThoughtStep as ThoughtStep @@ -58,8 +60,10 @@ from .tool_choice_type import ToolChoiceType as ToolChoiceType from .agent_list_params import AgentListParams as AgentListParams from .environment_param import EnvironmentParam as EnvironmentParam +from .fix_request_param import FixRequestParam as FixRequestParam from .generation_config import GenerationConfig as GenerationConfig from .model_output_step import ModelOutputStep as ModelOutputStep +from .find_request_param import FindRequestParam as FindRequestParam from .function_call_step import FunctionCallStep as FunctionCallStep from .google_maps_result import GoogleMapsResult as GoogleMapsResult from .image_config_param import ImageConfigParam as ImageConfigParam diff --git a/google/genai/_interactions/types/find_request.py b/google/genai/_interactions/types/find_request.py new file mode 100644 index 000000000..9b8a4b106 --- /dev/null +++ b/google/genai/_interactions/types/find_request.py @@ -0,0 +1,92 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["FindRequest", "SessionConfig", "SourceFile"] + + +class SessionConfig(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 SourceFile(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 FindRequest(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. + """ + + session_config: Optional[SessionConfig] = 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[SourceFile]] = None + """A list of source files to provide as context for the scan.""" diff --git a/google/genai/_interactions/types/find_request_param.py b/google/genai/_interactions/types/find_request_param.py new file mode 100644 index 000000000..c381ebc66 --- /dev/null +++ b/google/genai/_interactions/types/find_request_param.py @@ -0,0 +1,92 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["FindRequestParam", "SessionConfig", "SourceFile"] + + +class SessionConfig(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 SourceFile(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 FindRequestParam(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. + """ + + session_config: SessionConfig + """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[SourceFile] + """A list of source files to provide as context for the scan.""" diff --git a/google/genai/_interactions/types/fix_request.py b/google/genai/_interactions/types/fix_request.py new file mode 100644 index 000000000..0f7cdcbf4 --- /dev/null +++ b/google/genai/_interactions/types/fix_request.py @@ -0,0 +1,94 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["FixRequest", "SessionConfig", "SourceFile"] + + +class SessionConfig(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 SourceFile(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 FixRequest(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. + """ + + session_config: Optional[SessionConfig] = 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[SourceFile]] = None + """A list of source files providing context for the remediation. + + These files are typically the ones containing the identified vulnerability. + """ diff --git a/google/genai/_interactions/types/fix_request_param.py b/google/genai/_interactions/types/fix_request_param.py new file mode 100644 index 000000000..1f5eede07 --- /dev/null +++ b/google/genai/_interactions/types/fix_request_param.py @@ -0,0 +1,94 @@ +# Copyright 2025 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. +# + +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["FixRequestParam", "SessionConfig", "SourceFile"] + + +class SessionConfig(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 SourceFile(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 FixRequestParam(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. + """ + + session_config: SessionConfig + """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[SourceFile] + """A list of source files providing context for the remediation. + + These files are typically the ones containing the identified vulnerability. + """ diff --git a/google/genai/_interactions/types/interaction.py b/google/genai/_interactions/types/interaction.py index 41c241f2b..ab7dbd20d 100644 --- a/google/genai/_interactions/types/interaction.py +++ b/google/genai/_interactions/types/interaction.py @@ -27,6 +27,8 @@ from .content import Content from .._compat import PYDANTIC_V1 from .._models import BaseModel +from .fix_request import FixRequest +from .find_request import FindRequest from .text_content import TextContent from .audio_content import AudioContent from .image_content import ImageContent @@ -42,165 +44,9 @@ 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.""" +__all__ = ["Interaction", "AgentConfig", "Environment", "Input", "ResponseFormat", "ResponseFormatResponseFormatList"] - -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. - """ - - 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. - """ - - 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. - """ - - -AgentConfig: TypeAlias = Union[ - DeepResearchAgentConfig, DynamicAgentConfig, AgentConfigFindRequest, AgentConfigFixRequest -] +AgentConfig: TypeAlias = Union[DeepResearchAgentConfig, DynamicAgentConfig, FindRequest, FixRequest] 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 12d35cc51..d25e017fd 100644 --- a/google/genai/_interactions/types/interaction_create_params.py +++ b/google/genai/_interactions/types/interaction_create_params.py @@ -25,6 +25,8 @@ from .model_param import ModelParam from .content_param import ContentParam from .environment_param import EnvironmentParam +from .fix_request_param import FixRequestParam +from .find_request_param import FindRequestParam from .text_content_param import TextContentParam from .audio_content_param import AudioContentParam from .image_content_param import ImageContentParam @@ -46,12 +48,6 @@ "ResponseFormatResponseFormatList", "BaseCreateAgentInteractionParams", "AgentConfig", - "AgentConfigFindRequest", - "AgentConfigFindRequestSessionConfig", - "AgentConfigFindRequestSourceFile", - "AgentConfigFixRequest", - "AgentConfigFixRequestSessionConfig", - "AgentConfigFixRequestSourceFile", "CreateModelInteractionParamsNonStreaming", "CreateModelInteractionParamsStreaming", "CreateAgentInteractionParamsNonStreaming", @@ -217,149 +213,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. - """ - - 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. - """ - - 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, FindRequestParam, FixRequestParam] class CreateModelInteractionParamsNonStreaming(BaseCreateModelInteractionParams, total=False):