Skip to content

Commit 41d8e5b

Browse files
wanlin31copybara-github
authored andcommitted
feat: add steps for interactions
PiperOrigin-RevId: 910942141
1 parent d3020fd commit 41d8e5b

50 files changed

Lines changed: 724 additions & 509 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

google/genai/_interactions/_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ def auth_headers(self) -> dict[str, str]:
166166
def default_headers(self) -> dict[str, str | Omit]:
167167
return {
168168
**super().default_headers,
169+
"Api-Revision": "2026-05-20",
169170
**self._custom_headers,
170171
}
171172

@@ -393,6 +394,7 @@ def auth_headers(self) -> dict[str, str]:
393394
def default_headers(self) -> dict[str, str | Omit]:
394395
return {
395396
**super().default_headers,
397+
"Api-Revision": "2026-05-20",
396398
**self._custom_headers,
397399
}
398400

google/genai/_interactions/types/__init__.py

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,27 @@
1717

1818
from __future__ import annotations
1919

20+
from .step import Step as Step
2021
from .tool import Tool as Tool
21-
from .turn import Turn as Turn
2222
from .model import Model as Model
2323
from .usage import Usage as Usage
2424
from .content import Content as Content
2525
from .webhook import Webhook as Webhook
2626
from .function import Function as Function
27+
from .step_stop import StepStop as StepStop
2728
from .annotation import Annotation as Annotation
29+
from .step_delta import StepDelta as StepDelta
30+
from .step_param import StepParam as StepParam
31+
from .step_start import StepStart as StepStart
2832
from .tool_param import ToolParam as ToolParam
29-
from .turn_param import TurnParam as TurnParam
3033
from .error_event import ErrorEvent as ErrorEvent
3134
from .interaction import Interaction as Interaction
3235
from .model_param import ModelParam as ModelParam
3336
from .usage_param import UsageParam as UsageParam
3437
from .content_stop import ContentStop as ContentStop
3538
from .image_config import ImageConfig as ImageConfig
3639
from .text_content import TextContent as TextContent
40+
from .thought_step import ThoughtStep as ThoughtStep
3741
from .url_citation import URLCitation as URLCitation
3842
from .allowed_tools import AllowedTools as AllowedTools
3943
from .audio_content import AudioContent as AudioContent
@@ -49,14 +53,17 @@
4953
from .signing_secret import SigningSecret as SigningSecret
5054
from .thinking_level import ThinkingLevel as ThinkingLevel
5155
from .webhook_config import WebhookConfig as WebhookConfig
52-
from .thought_content import ThoughtContent as ThoughtContent
56+
from .user_input_step import UserInputStep as UserInputStep
5357
from .annotation_param import AnnotationParam as AnnotationParam
5458
from .document_content import DocumentContent as DocumentContent
5559
from .tool_choice_type import ToolChoiceType as ToolChoiceType
5660
from .generation_config import GenerationConfig as GenerationConfig
61+
from .model_output_step import ModelOutputStep as ModelOutputStep
62+
from .function_call_step import FunctionCallStep as FunctionCallStep
5763
from .google_maps_result import GoogleMapsResult as GoogleMapsResult
5864
from .image_config_param import ImageConfigParam as ImageConfigParam
5965
from .text_content_param import TextContentParam as TextContentParam
66+
from .thought_step_param import ThoughtStepParam as ThoughtStepParam
6067
from .tool_choice_config import ToolChoiceConfig as ToolChoiceConfig
6168
from .url_citation_param import URLCitationParam as URLCitationParam
6269
from .url_context_result import URLContextResult as URLContextResult
@@ -69,66 +76,59 @@
6976
from .webhook_list_params import WebhookListParams as WebhookListParams
7077
from .webhook_ping_params import WebhookPingParams as WebhookPingParams
7178
from .dynamic_agent_config import DynamicAgentConfig as DynamicAgentConfig
79+
from .function_result_step import FunctionResultStep as FunctionResultStep
7280
from .google_search_result import GoogleSearchResult as GoogleSearchResult
7381
from .place_citation_param import PlaceCitationParam as PlaceCitationParam
7482
from .webhook_config_param import WebhookConfigParam as WebhookConfigParam
75-
from .function_call_content import FunctionCallContent as FunctionCallContent
83+
from .file_search_call_step import FileSearchCallStep as FileSearchCallStep
84+
from .google_maps_call_step import GoogleMapsCallStep as GoogleMapsCallStep
7685
from .interaction_sse_event import InteractionSSEEvent as InteractionSSEEvent
77-
from .thought_content_param import ThoughtContentParam as ThoughtContentParam
86+
from .url_context_call_step import URLContextCallStep as URLContextCallStep
87+
from .user_input_step_param import UserInputStepParam as UserInputStepParam
7888
from .webhook_create_params import WebhookCreateParams as WebhookCreateParams
7989
from .webhook_list_response import WebhookListResponse as WebhookListResponse
8090
from .webhook_ping_response import WebhookPingResponse as WebhookPingResponse
8191
from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams
8292
from .document_content_param import DocumentContentParam as DocumentContentParam
8393
from .interaction_get_params import InteractionGetParams as InteractionGetParams
84-
from .function_result_content import FunctionResultContent as FunctionResultContent
94+
from .file_search_result_step import FileSearchResultStep as FileSearchResultStep
8595
from .generation_config_param import GenerationConfigParam as GenerationConfigParam
96+
from .google_maps_result_step import GoogleMapsResultStep as GoogleMapsResultStep
97+
from .google_search_call_step import GoogleSearchCallStep as GoogleSearchCallStep
8698
from .interaction_start_event import InteractionStartEvent as InteractionStartEvent
99+
from .model_output_step_param import ModelOutputStepParam as ModelOutputStepParam
100+
from .url_context_result_step import URLContextResultStep as URLContextResultStep
87101
from .webhook_delete_response import WebhookDeleteResponse as WebhookDeleteResponse
88-
from .file_search_call_content import FileSearchCallContent as FileSearchCallContent
89-
from .google_maps_call_content import GoogleMapsCallContent as GoogleMapsCallContent
90-
from .google_maps_result_param import GoogleMapsResultParam as GoogleMapsResultParam
102+
from .code_execution_call_step import CodeExecutionCallStep as CodeExecutionCallStep
103+
from .function_call_step_param import FunctionCallStepParam as FunctionCallStepParam
91104
from .tool_choice_config_param import ToolChoiceConfigParam as ToolChoiceConfigParam
92-
from .url_context_call_content import URLContextCallContent as URLContextCallContent
93-
from .url_context_result_param import URLContextResultParam as URLContextResultParam
105+
from .google_search_result_step import GoogleSearchResultStep as GoogleSearchResultStep
94106
from .interaction_create_params import InteractionCreateParams as InteractionCreateParams
95107
from .interaction_status_update import InteractionStatusUpdate as InteractionStatusUpdate
108+
from .mcp_server_tool_call_step import MCPServerToolCallStep as MCPServerToolCallStep
109+
from .code_execution_result_step import CodeExecutionResultStep as CodeExecutionResultStep
96110
from .deep_research_agent_config import DeepResearchAgentConfig as DeepResearchAgentConfig
97111
from .dynamic_agent_config_param import DynamicAgentConfigParam as DynamicAgentConfigParam
98-
from .file_search_result_content import FileSearchResultContent as FileSearchResultContent
112+
from .function_result_step_param import FunctionResultStepParam as FunctionResultStepParam
99113
from .google_maps_call_arguments import GoogleMapsCallArguments as GoogleMapsCallArguments
100-
from .google_maps_result_content import GoogleMapsResultContent as GoogleMapsResultContent
101-
from .google_search_call_content import GoogleSearchCallContent as GoogleSearchCallContent
102-
from .google_search_result_param import GoogleSearchResultParam as GoogleSearchResultParam
103114
from .interaction_complete_event import InteractionCompleteEvent as InteractionCompleteEvent
104115
from .url_context_call_arguments import URLContextCallArguments as URLContextCallArguments
105-
from .url_context_result_content import URLContextResultContent as URLContextResultContent
106-
from .code_execution_call_content import CodeExecutionCallContent as CodeExecutionCallContent
107-
from .function_call_content_param import FunctionCallContentParam as FunctionCallContentParam
116+
from .file_search_call_step_param import FileSearchCallStepParam as FileSearchCallStepParam
117+
from .google_maps_call_step_param import GoogleMapsCallStepParam as GoogleMapsCallStepParam
118+
from .mcp_server_tool_result_step import MCPServerToolResultStep as MCPServerToolResultStep
119+
from .url_context_call_step_param import URLContextCallStepParam as URLContextCallStepParam
108120
from .google_search_call_arguments import GoogleSearchCallArguments as GoogleSearchCallArguments
109-
from .google_search_result_content import GoogleSearchResultContent as GoogleSearchResultContent
110-
from .mcp_server_tool_call_content import MCPServerToolCallContent as MCPServerToolCallContent
111121
from .code_execution_call_arguments import CodeExecutionCallArguments as CodeExecutionCallArguments
112-
from .code_execution_result_content import CodeExecutionResultContent as CodeExecutionResultContent
113-
from .function_result_content_param import FunctionResultContentParam as FunctionResultContentParam
114-
from .file_search_call_content_param import FileSearchCallContentParam as FileSearchCallContentParam
115-
from .google_maps_call_content_param import GoogleMapsCallContentParam as GoogleMapsCallContentParam
116-
from .mcp_server_tool_result_content import MCPServerToolResultContent as MCPServerToolResultContent
117-
from .url_context_call_content_param import URLContextCallContentParam as URLContextCallContentParam
122+
from .file_search_result_step_param import FileSearchResultStepParam as FileSearchResultStepParam
123+
from .google_maps_result_step_param import GoogleMapsResultStepParam as GoogleMapsResultStepParam
124+
from .google_search_call_step_param import GoogleSearchCallStepParam as GoogleSearchCallStepParam
125+
from .url_context_result_step_param import URLContextResultStepParam as URLContextResultStepParam
126+
from .code_execution_call_step_param import CodeExecutionCallStepParam as CodeExecutionCallStepParam
127+
from .google_search_result_step_param import GoogleSearchResultStepParam as GoogleSearchResultStepParam
128+
from .mcp_server_tool_call_step_param import MCPServerToolCallStepParam as MCPServerToolCallStepParam
129+
from .code_execution_result_step_param import CodeExecutionResultStepParam as CodeExecutionResultStepParam
118130
from .deep_research_agent_config_param import DeepResearchAgentConfigParam as DeepResearchAgentConfigParam
119-
from .file_search_result_content_param import FileSearchResultContentParam as FileSearchResultContentParam
120-
from .google_maps_call_arguments_param import GoogleMapsCallArgumentsParam as GoogleMapsCallArgumentsParam
121-
from .google_maps_result_content_param import GoogleMapsResultContentParam as GoogleMapsResultContentParam
122-
from .google_search_call_content_param import GoogleSearchCallContentParam as GoogleSearchCallContentParam
123-
from .url_context_call_arguments_param import URLContextCallArgumentsParam as URLContextCallArgumentsParam
124-
from .url_context_result_content_param import URLContextResultContentParam as URLContextResultContentParam
125-
from .code_execution_call_content_param import CodeExecutionCallContentParam as CodeExecutionCallContentParam
126-
from .google_search_call_arguments_param import GoogleSearchCallArgumentsParam as GoogleSearchCallArgumentsParam
127-
from .google_search_result_content_param import GoogleSearchResultContentParam as GoogleSearchResultContentParam
128-
from .mcp_server_tool_call_content_param import MCPServerToolCallContentParam as MCPServerToolCallContentParam
129-
from .code_execution_call_arguments_param import CodeExecutionCallArgumentsParam as CodeExecutionCallArgumentsParam
130-
from .code_execution_result_content_param import CodeExecutionResultContentParam as CodeExecutionResultContentParam
131-
from .mcp_server_tool_result_content_param import MCPServerToolResultContentParam as MCPServerToolResultContentParam
131+
from .mcp_server_tool_result_step_param import MCPServerToolResultStepParam as MCPServerToolResultStepParam
132132
from .webhook_rotate_signing_secret_params import WebhookRotateSigningSecretParams as WebhookRotateSigningSecretParams
133133
from .webhook_rotate_signing_secret_response import (
134134
WebhookRotateSigningSecretResponse as WebhookRotateSigningSecretResponse,

google/genai/_interactions/types/code_execution_call_arguments_param.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

google/genai/_interactions/types/code_execution_call_content.py renamed to google/genai/_interactions/types/code_execution_call_step.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,27 @@
1919
from typing_extensions import Literal
2020

2121
from .._models import BaseModel
22-
from .code_execution_call_arguments import CodeExecutionCallArguments
2322

24-
__all__ = ["CodeExecutionCallContent"]
23+
__all__ = ["CodeExecutionCallStep", "Arguments"]
2524

2625

27-
class CodeExecutionCallContent(BaseModel):
28-
"""Code execution content."""
26+
class Arguments(BaseModel):
27+
"""Required. The arguments to pass to the code execution."""
28+
29+
code: Optional[str] = None
30+
"""The code to be executed."""
31+
32+
language: Optional[Literal["python"]] = None
33+
"""Programming language of the `code`."""
34+
35+
36+
class CodeExecutionCallStep(BaseModel):
37+
"""Code execution call step."""
2938

3039
id: str
3140
"""Required. A unique ID for this specific tool call."""
3241

33-
arguments: CodeExecutionCallArguments
42+
arguments: Arguments
3443
"""Required. The arguments to pass to the code execution."""
3544

3645
type: Literal["code_execution_call"]

google/genai/_interactions/types/code_execution_call_content_param.py renamed to google/genai/_interactions/types/code_execution_call_step_param.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,27 @@
2323
from .._types import Base64FileInput
2424
from .._utils import PropertyInfo
2525
from .._models import set_pydantic_config
26-
from .code_execution_call_arguments_param import CodeExecutionCallArgumentsParam
2726

28-
__all__ = ["CodeExecutionCallContentParam"]
27+
__all__ = ["CodeExecutionCallStepParam", "Arguments"]
2928

3029

31-
class CodeExecutionCallContentParam(TypedDict, total=False):
32-
"""Code execution content."""
30+
class Arguments(TypedDict, total=False):
31+
"""Required. The arguments to pass to the code execution."""
32+
33+
code: str
34+
"""The code to be executed."""
35+
36+
language: Literal["python"]
37+
"""Programming language of the `code`."""
38+
39+
40+
class CodeExecutionCallStepParam(TypedDict, total=False):
41+
"""Code execution call step."""
3342

3443
id: Required[str]
3544
"""Required. A unique ID for this specific tool call."""
3645

37-
arguments: Required[CodeExecutionCallArgumentsParam]
46+
arguments: Required[Arguments]
3847
"""Required. The arguments to pass to the code execution."""
3948

4049
type: Required[Literal["code_execution_call"]]
@@ -43,4 +52,4 @@ class CodeExecutionCallContentParam(TypedDict, total=False):
4352
"""A signature hash for backend validation."""
4453

4554

46-
set_pydantic_config(CodeExecutionCallContentParam, {"arbitrary_types_allowed": True})
55+
set_pydantic_config(CodeExecutionCallStepParam, {"arbitrary_types_allowed": True})

google/genai/_interactions/types/code_execution_result_content.py renamed to google/genai/_interactions/types/code_execution_result_step.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020

2121
from .._models import BaseModel
2222

23-
__all__ = ["CodeExecutionResultContent"]
23+
__all__ = ["CodeExecutionResultStep"]
2424

2525

26-
class CodeExecutionResultContent(BaseModel):
27-
"""Code execution result content."""
26+
class CodeExecutionResultStep(BaseModel):
27+
"""Code execution result step."""
2828

2929
call_id: str
3030
"""Required. ID to match the ID from the function call block."""

google/genai/_interactions/types/code_execution_result_content_param.py renamed to google/genai/_interactions/types/code_execution_result_step_param.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
from .._utils import PropertyInfo
2525
from .._models import set_pydantic_config
2626

27-
__all__ = ["CodeExecutionResultContentParam"]
27+
__all__ = ["CodeExecutionResultStepParam"]
2828

2929

30-
class CodeExecutionResultContentParam(TypedDict, total=False):
31-
"""Code execution result content."""
30+
class CodeExecutionResultStepParam(TypedDict, total=False):
31+
"""Code execution result step."""
3232

3333
call_id: Required[str]
3434
"""Required. ID to match the ID from the function call block."""
@@ -45,4 +45,4 @@ class CodeExecutionResultContentParam(TypedDict, total=False):
4545
"""A signature hash for backend validation."""
4646

4747

48-
set_pydantic_config(CodeExecutionResultContentParam, {"arbitrary_types_allowed": True})
48+
set_pydantic_config(CodeExecutionResultStepParam, {"arbitrary_types_allowed": True})

google/genai/_interactions/types/content.py

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -23,47 +23,10 @@
2323
from .audio_content import AudioContent
2424
from .image_content import ImageContent
2525
from .video_content import VideoContent
26-
from .thought_content import ThoughtContent
2726
from .document_content import DocumentContent
28-
from .function_call_content import FunctionCallContent
29-
from .function_result_content import FunctionResultContent
30-
from .file_search_call_content import FileSearchCallContent
31-
from .google_maps_call_content import GoogleMapsCallContent
32-
from .url_context_call_content import URLContextCallContent
33-
from .file_search_result_content import FileSearchResultContent
34-
from .google_maps_result_content import GoogleMapsResultContent
35-
from .google_search_call_content import GoogleSearchCallContent
36-
from .url_context_result_content import URLContextResultContent
37-
from .code_execution_call_content import CodeExecutionCallContent
38-
from .google_search_result_content import GoogleSearchResultContent
39-
from .mcp_server_tool_call_content import MCPServerToolCallContent
40-
from .code_execution_result_content import CodeExecutionResultContent
41-
from .mcp_server_tool_result_content import MCPServerToolResultContent
4227

4328
__all__ = ["Content"]
4429

4530
Content: TypeAlias = Annotated[
46-
Union[
47-
TextContent,
48-
ImageContent,
49-
AudioContent,
50-
DocumentContent,
51-
VideoContent,
52-
ThoughtContent,
53-
FunctionCallContent,
54-
CodeExecutionCallContent,
55-
URLContextCallContent,
56-
MCPServerToolCallContent,
57-
GoogleSearchCallContent,
58-
FileSearchCallContent,
59-
GoogleMapsCallContent,
60-
FunctionResultContent,
61-
CodeExecutionResultContent,
62-
URLContextResultContent,
63-
GoogleSearchResultContent,
64-
MCPServerToolResultContent,
65-
FileSearchResultContent,
66-
GoogleMapsResultContent,
67-
],
68-
PropertyInfo(discriminator="type"),
31+
Union[TextContent, ImageContent, AudioContent, DocumentContent, VideoContent], PropertyInfo(discriminator="type")
6932
]

google/genai/_interactions/types/content_delta.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"DeltaMCPServerToolResultResultFunctionResultSubcontentList",
5959
"DeltaFileSearchResult",
6060
"DeltaGoogleMapsResult",
61-
"DeltaTextAnnotation",
61+
"DeltaTextAnnotationDelta",
6262
]
6363

6464

@@ -372,8 +372,8 @@ class DeltaGoogleMapsResult(BaseModel):
372372
"""A signature hash for backend validation."""
373373

374374

375-
class DeltaTextAnnotation(BaseModel):
376-
type: Literal["text_annotation"]
375+
class DeltaTextAnnotationDelta(BaseModel):
376+
type: Literal["text_annotation_delta"]
377377

378378
annotations: Optional[List[Annotation]] = None
379379
"""Citation information for model-generated content."""
@@ -402,7 +402,7 @@ class DeltaTextAnnotation(BaseModel):
402402
DeltaMCPServerToolResult,
403403
DeltaFileSearchResult,
404404
DeltaGoogleMapsResult,
405-
DeltaTextAnnotation,
405+
DeltaTextAnnotationDelta,
406406
],
407407
PropertyInfo(discriminator="type"),
408408
]

0 commit comments

Comments
 (0)