Skip to content

Commit a0cecfd

Browse files
Annhiluccopybara-github
authored andcommitted
feat: Add and update 'signature' fields for tool call/result content types.
PiperOrigin-RevId: 883491507
1 parent 68f247c commit a0cecfd

22 files changed

Lines changed: 190 additions & 29 deletions

google/genai/_interactions/types/code_execution_call_content.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1717

18+
from typing import Optional
1819
from typing_extensions import Literal
1920

2021
from .._models import BaseModel
@@ -33,3 +34,6 @@ class CodeExecutionCallContent(BaseModel):
3334
"""The arguments to pass to the code execution."""
3435

3536
type: Literal["code_execution_call"]
37+
38+
signature: Optional[str] = None
39+
"""A signature hash for backend validation."""

google/genai/_interactions/types/code_execution_call_content_param.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717

1818
from __future__ import annotations
1919

20-
from typing_extensions import Literal, Required, TypedDict
20+
from typing import Union
21+
from typing_extensions import Literal, Required, Annotated, TypedDict
2122

23+
from .._types import Base64FileInput
24+
from .._utils import PropertyInfo
25+
from .._models import set_pydantic_config
2226
from .code_execution_call_arguments_param import CodeExecutionCallArgumentsParam
2327

2428
__all__ = ["CodeExecutionCallContentParam"]
@@ -34,3 +38,9 @@ class CodeExecutionCallContentParam(TypedDict, total=False):
3438
"""The arguments to pass to the code execution."""
3539

3640
type: Required[Literal["code_execution_call"]]
41+
42+
signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
43+
"""A signature hash for backend validation."""
44+
45+
46+
set_pydantic_config(CodeExecutionCallContentParam, {"arbitrary_types_allowed": True})

google/genai/_interactions/types/code_execution_result_content_param.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
from __future__ import annotations
1919

20-
from typing_extensions import Literal, Required, TypedDict
20+
from typing import Union
21+
from typing_extensions import Literal, Required, Annotated, TypedDict
22+
23+
from .._types import Base64FileInput
24+
from .._utils import PropertyInfo
25+
from .._models import set_pydantic_config
2126

2227
__all__ = ["CodeExecutionResultContentParam"]
2328

@@ -36,5 +41,8 @@ class CodeExecutionResultContentParam(TypedDict, total=False):
3641
is_error: bool
3742
"""Whether the code execution resulted in an error."""
3843

39-
signature: str
44+
signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
4045
"""A signature hash for backend validation."""
46+
47+
48+
set_pydantic_config(CodeExecutionResultContentParam, {"arbitrary_types_allowed": True})

google/genai/_interactions/types/content_delta.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ class DeltaFunctionCall(BaseModel):
160160

161161
type: Literal["function_call"]
162162

163+
signature: Optional[str] = None
164+
"""A signature hash for backend validation."""
165+
163166

164167
DeltaFunctionResultResultItemsItem: TypeAlias = Union[TextContent, ImageContent]
165168

@@ -197,6 +200,9 @@ class DeltaCodeExecutionCall(BaseModel):
197200

198201
type: Literal["code_execution_call"]
199202

203+
signature: Optional[str] = None
204+
"""A signature hash for backend validation."""
205+
200206

201207
class DeltaCodeExecutionResult(BaseModel):
202208
call_id: str
@@ -221,6 +227,9 @@ class DeltaURLContextCall(BaseModel):
221227

222228
type: Literal["url_context_call"]
223229

230+
signature: Optional[str] = None
231+
"""A signature hash for backend validation."""
232+
224233

225234
class DeltaURLContextResult(BaseModel):
226235
call_id: str
@@ -245,6 +254,9 @@ class DeltaGoogleSearchCall(BaseModel):
245254

246255
type: Literal["google_search_call"]
247256

257+
signature: Optional[str] = None
258+
"""A signature hash for backend validation."""
259+
248260

249261
class DeltaGoogleSearchResult(BaseModel):
250262
call_id: str
@@ -272,6 +284,9 @@ class DeltaMCPServerToolCall(BaseModel):
272284

273285
type: Literal["mcp_server_tool_call"]
274286

287+
signature: Optional[str] = None
288+
"""A signature hash for backend validation."""
289+
275290

276291
DeltaMCPServerToolResultResultItemsItem: TypeAlias = Union[TextContent, ImageContent]
277292

@@ -306,6 +321,9 @@ class DeltaFileSearchCall(BaseModel):
306321

307322
type: Literal["file_search_call"]
308323

324+
signature: Optional[str] = None
325+
"""A signature hash for backend validation."""
326+
309327

310328
class DeltaFileSearchResultResult(BaseModel):
311329
"""The result of the File Search."""
@@ -341,6 +359,9 @@ class DeltaGoogleMapsCall(BaseModel):
341359
arguments: Optional[GoogleMapsCallArguments] = None
342360
"""The arguments to pass to the Google Maps tool."""
343361

362+
signature: Optional[str] = None
363+
"""A signature hash for backend validation."""
364+
344365

345366
class DeltaGoogleMapsResult(BaseModel):
346367
call_id: str

google/genai/_interactions/types/file_search_call_content.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1717

18+
from typing import Optional
1819
from typing_extensions import Literal
1920

2021
from .._models import BaseModel
@@ -29,3 +30,6 @@ class FileSearchCallContent(BaseModel):
2930
"""A unique ID for this specific tool call."""
3031

3132
type: Literal["file_search_call"]
33+
34+
signature: Optional[str] = None
35+
"""A signature hash for backend validation."""

google/genai/_interactions/types/file_search_call_content_param.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
from __future__ import annotations
1919

20-
from typing_extensions import Literal, Required, TypedDict
20+
from typing import Union
21+
from typing_extensions import Literal, Required, Annotated, TypedDict
22+
23+
from .._types import Base64FileInput
24+
from .._utils import PropertyInfo
25+
from .._models import set_pydantic_config
2126

2227
__all__ = ["FileSearchCallContentParam"]
2328

@@ -29,3 +34,9 @@ class FileSearchCallContentParam(TypedDict, total=False):
2934
"""A unique ID for this specific tool call."""
3035

3136
type: Required[Literal["file_search_call"]]
37+
38+
signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
39+
"""A signature hash for backend validation."""
40+
41+
42+
set_pydantic_config(FileSearchCallContentParam, {"arbitrary_types_allowed": True})

google/genai/_interactions/types/file_search_result_content_param.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717

1818
from __future__ import annotations
1919

20-
from typing import Iterable
21-
from typing_extensions import Literal, Required, TypedDict
20+
from typing import Union, Iterable
21+
from typing_extensions import Literal, Required, Annotated, TypedDict
22+
23+
from .._types import Base64FileInput
24+
from .._utils import PropertyInfo
25+
from .._models import set_pydantic_config
2226

2327
__all__ = ["FileSearchResultContentParam", "Result"]
2428

@@ -47,5 +51,8 @@ class FileSearchResultContentParam(TypedDict, total=False):
4751
result: Iterable[Result]
4852
"""The results of the File Search."""
4953

50-
signature: str
54+
signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
5155
"""A signature hash for backend validation."""
56+
57+
58+
set_pydantic_config(FileSearchResultContentParam, {"arbitrary_types_allowed": True})

google/genai/_interactions/types/function_call_content.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1717

18-
from typing import Dict
18+
from typing import Dict, Optional
1919
from typing_extensions import Literal
2020

2121
from .._models import BaseModel
@@ -36,3 +36,6 @@ class FunctionCallContent(BaseModel):
3636
"""The name of the tool to call."""
3737

3838
type: Literal["function_call"]
39+
40+
signature: Optional[str] = None
41+
"""A signature hash for backend validation."""

google/genai/_interactions/types/function_call_content_param.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717

1818
from __future__ import annotations
1919

20-
from typing import Dict
21-
from typing_extensions import Literal, Required, TypedDict
20+
from typing import Dict, Union
21+
from typing_extensions import Literal, Required, Annotated, TypedDict
22+
23+
from .._types import Base64FileInput
24+
from .._utils import PropertyInfo
25+
from .._models import set_pydantic_config
2226

2327
__all__ = ["FunctionCallContentParam"]
2428

@@ -36,3 +40,9 @@ class FunctionCallContentParam(TypedDict, total=False):
3640
"""The name of the tool to call."""
3741

3842
type: Required[Literal["function_call"]]
43+
44+
signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
45+
"""A signature hash for backend validation."""
46+
47+
48+
set_pydantic_config(FunctionCallContentParam, {"arbitrary_types_allowed": True})

google/genai/_interactions/types/function_result_content_param.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
from __future__ import annotations
1919

2020
from typing import Union, Iterable
21-
from typing_extensions import Literal, Required, TypeAlias, TypedDict
21+
from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict
2222

23+
from .._types import Base64FileInput
24+
from .._utils import PropertyInfo
25+
from .._models import set_pydantic_config
2326
from .text_content_param import TextContentParam
2427
from .image_content_param import ImageContentParam
2528

@@ -45,5 +48,8 @@ class FunctionResultContentParam(TypedDict, total=False):
4548
name: str
4649
"""The name of the tool that was called."""
4750

48-
signature: str
51+
signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
4952
"""A signature hash for backend validation."""
53+
54+
55+
set_pydantic_config(FunctionResultContentParam, {"arbitrary_types_allowed": True})

0 commit comments

Comments
 (0)