google-genai 1.55.0__py3-none-any.whl → 1.57.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. google/genai/_api_client.py +37 -18
  2. google/genai/_interactions/_base_client.py +8 -2
  3. google/genai/_interactions/resources/interactions.py +6 -6
  4. google/genai/_interactions/types/__init__.py +4 -0
  5. google/genai/_interactions/types/audio_content.py +0 -1
  6. google/genai/_interactions/types/audio_content_param.py +0 -1
  7. google/genai/_interactions/types/code_execution_call_content.py +0 -1
  8. google/genai/_interactions/types/code_execution_call_content_param.py +0 -1
  9. google/genai/_interactions/types/code_execution_result_content.py +0 -1
  10. google/genai/_interactions/types/code_execution_result_content_param.py +0 -1
  11. google/genai/_interactions/types/content.py +63 -0
  12. google/genai/_interactions/types/content_delta.py +7 -23
  13. google/genai/_interactions/types/content_param.py +61 -0
  14. google/genai/_interactions/types/content_start.py +4 -44
  15. google/genai/_interactions/types/deep_research_agent_config.py +0 -1
  16. google/genai/_interactions/types/deep_research_agent_config_param.py +0 -1
  17. google/genai/_interactions/types/document_content.py +3 -2
  18. google/genai/_interactions/types/document_content_param.py +3 -2
  19. google/genai/_interactions/types/document_mime_type.py +23 -0
  20. google/genai/_interactions/types/document_mime_type_param.py +25 -0
  21. google/genai/_interactions/types/dynamic_agent_config.py +0 -1
  22. google/genai/_interactions/types/dynamic_agent_config_param.py +0 -1
  23. google/genai/_interactions/types/file_search_result_content.py +0 -1
  24. google/genai/_interactions/types/file_search_result_content_param.py +0 -1
  25. google/genai/_interactions/types/function_call_content.py +0 -1
  26. google/genai/_interactions/types/function_call_content_param.py +0 -1
  27. google/genai/_interactions/types/function_result_content.py +1 -2
  28. google/genai/_interactions/types/function_result_content_param.py +1 -2
  29. google/genai/_interactions/types/google_search_call_content.py +0 -1
  30. google/genai/_interactions/types/google_search_call_content_param.py +0 -1
  31. google/genai/_interactions/types/google_search_result_content.py +0 -1
  32. google/genai/_interactions/types/google_search_result_content_param.py +0 -1
  33. google/genai/_interactions/types/image_content.py +1 -2
  34. google/genai/_interactions/types/image_content_param.py +1 -2
  35. google/genai/_interactions/types/interaction.py +4 -52
  36. google/genai/_interactions/types/interaction_create_params.py +2 -22
  37. google/genai/_interactions/types/mcp_server_tool_call_content.py +0 -1
  38. google/genai/_interactions/types/mcp_server_tool_call_content_param.py +0 -1
  39. google/genai/_interactions/types/mcp_server_tool_result_content.py +1 -2
  40. google/genai/_interactions/types/mcp_server_tool_result_content_param.py +1 -2
  41. google/genai/_interactions/types/model.py +1 -0
  42. google/genai/_interactions/types/model_param.py +1 -0
  43. google/genai/_interactions/types/text_content.py +0 -1
  44. google/genai/_interactions/types/text_content_param.py +0 -1
  45. google/genai/_interactions/types/thinking_level.py +1 -1
  46. google/genai/_interactions/types/thought_content.py +0 -1
  47. google/genai/_interactions/types/thought_content_param.py +0 -1
  48. google/genai/_interactions/types/turn.py +3 -44
  49. google/genai/_interactions/types/turn_param.py +4 -40
  50. google/genai/_interactions/types/url_context_call_content.py +0 -1
  51. google/genai/_interactions/types/url_context_call_content_param.py +0 -1
  52. google/genai/_interactions/types/url_context_result_content.py +0 -1
  53. google/genai/_interactions/types/url_context_result_content_param.py +0 -1
  54. google/genai/_interactions/types/usage.py +1 -1
  55. google/genai/_interactions/types/usage_param.py +1 -1
  56. google/genai/_interactions/types/video_content.py +1 -2
  57. google/genai/_interactions/types/video_content_param.py +1 -2
  58. google/genai/_live_converters.py +36 -64
  59. google/genai/_local_tokenizer_loader.py +1 -0
  60. google/genai/_tokens_converters.py +14 -14
  61. google/genai/batches.py +27 -22
  62. google/genai/caches.py +42 -42
  63. google/genai/chats.py +0 -2
  64. google/genai/client.py +3 -1
  65. google/genai/files.py +224 -0
  66. google/genai/models.py +57 -72
  67. google/genai/tests/chats/test_get_history.py +9 -8
  68. google/genai/tests/chats/test_validate_response.py +1 -1
  69. google/genai/tests/client/test_client_requests.py +1 -135
  70. google/genai/tests/files/test_register.py +272 -0
  71. google/genai/tests/files/test_register_table.py +70 -0
  72. google/genai/tests/interactions/test_auth.py +479 -0
  73. google/genai/tests/interactions/test_integration.py +2 -0
  74. google/genai/tests/interactions/test_paths.py +105 -0
  75. google/genai/tests/live/test_live.py +2 -36
  76. google/genai/tests/local_tokenizer/test_local_tokenizer.py +1 -1
  77. google/genai/tests/models/test_function_call_streaming.py +90 -90
  78. google/genai/tests/models/test_generate_content.py +1 -2
  79. google/genai/tests/models/test_recontext_image.py +1 -1
  80. google/genai/tests/pytest_helper.py +17 -0
  81. google/genai/tunings.py +1 -27
  82. google/genai/types.py +603 -518
  83. google/genai/version.py +1 -1
  84. {google_genai-1.55.0.dist-info → google_genai-1.57.0.dist-info}/METADATA +224 -22
  85. {google_genai-1.55.0.dist-info → google_genai-1.57.0.dist-info}/RECORD +88 -80
  86. {google_genai-1.55.0.dist-info → google_genai-1.57.0.dist-info}/WHEEL +0 -0
  87. {google_genai-1.55.0.dist-info → google_genai-1.57.0.dist-info}/licenses/LICENSE +0 -0
  88. {google_genai-1.55.0.dist-info → google_genai-1.57.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,23 @@
1
+ # Copyright 2025 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+
16
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17
+
18
+ from typing import Union
19
+ from typing_extensions import Literal, TypeAlias
20
+
21
+ __all__ = ["DocumentMimeType"]
22
+
23
+ DocumentMimeType: TypeAlias = Union[str, Literal["application/pdf"]]
@@ -0,0 +1,25 @@
1
+ # Copyright 2025 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+
16
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17
+
18
+ from __future__ import annotations
19
+
20
+ from typing import Union
21
+ from typing_extensions import Literal, TypeAlias
22
+
23
+ __all__ = ["DocumentMimeTypeParam"]
24
+
25
+ DocumentMimeTypeParam: TypeAlias = Union[str, Literal["application/pdf"]]
@@ -29,7 +29,6 @@ class DynamicAgentConfig(BaseModel):
29
29
  """Configuration for dynamic agents."""
30
30
 
31
31
  type: Optional[Literal["dynamic"]] = None
32
- """Used as the OpenAPI type discriminator for the content oneof."""
33
32
 
34
33
  if TYPE_CHECKING:
35
34
  # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
@@ -27,7 +27,6 @@ class DynamicAgentConfigParamTyped(TypedDict, total=False):
27
27
  """Configuration for dynamic agents."""
28
28
 
29
29
  type: Literal["dynamic"]
30
- """Used as the OpenAPI type discriminator for the content oneof."""
31
30
 
32
31
 
33
32
  DynamicAgentConfigParam: TypeAlias = Union[DynamicAgentConfigParamTyped, Dict[str, object]]
@@ -40,7 +40,6 @@ class FileSearchResultContent(BaseModel):
40
40
  """File Search result content."""
41
41
 
42
42
  type: Literal["file_search_result"]
43
- """Used as the OpenAPI type discriminator for the content oneof."""
44
43
 
45
44
  result: Optional[List[Result]] = None
46
45
  """The results of the File Search."""
@@ -40,7 +40,6 @@ class FileSearchResultContentParam(TypedDict, total=False):
40
40
  """File Search result content."""
41
41
 
42
42
  type: Required[Literal["file_search_result"]]
43
- """Used as the OpenAPI type discriminator for the content oneof."""
44
43
 
45
44
  result: Iterable[Result]
46
45
  """The results of the File Search."""
@@ -36,4 +36,3 @@ class FunctionCallContent(BaseModel):
36
36
  """The name of the tool to call."""
37
37
 
38
38
  type: Literal["function_call"]
39
- """Used as the OpenAPI type discriminator for the content oneof."""
@@ -36,4 +36,3 @@ class FunctionCallContentParam(TypedDict, total=False):
36
36
  """The name of the tool to call."""
37
37
 
38
38
  type: Required[Literal["function_call"]]
39
- """Used as the OpenAPI type discriminator for the content oneof."""
@@ -23,7 +23,7 @@ from .image_content import ImageContent
23
23
 
24
24
  __all__ = ["FunctionResultContent", "Result", "ResultItems", "ResultItemsItem"]
25
25
 
26
- ResultItemsItem: TypeAlias = Union[str, ImageContent]
26
+ ResultItemsItem: TypeAlias = Union[str, ImageContent, object]
27
27
 
28
28
 
29
29
  class ResultItems(BaseModel):
@@ -43,7 +43,6 @@ class FunctionResultContent(BaseModel):
43
43
  """The result of the tool call."""
44
44
 
45
45
  type: Literal["function_result"]
46
- """Used as the OpenAPI type discriminator for the content oneof."""
47
46
 
48
47
  is_error: Optional[bool] = None
49
48
  """Whether the tool call resulted in an error."""
@@ -25,7 +25,7 @@ from .image_content_param import ImageContentParam
25
25
 
26
26
  __all__ = ["FunctionResultContentParam", "Result", "ResultItems", "ResultItemsItem"]
27
27
 
28
- ResultItemsItem: TypeAlias = Union[str, ImageContentParam]
28
+ ResultItemsItem: TypeAlias = Union[str, ImageContentParam, object]
29
29
 
30
30
 
31
31
  class ResultItems(TypedDict, total=False):
@@ -45,7 +45,6 @@ class FunctionResultContentParam(TypedDict, total=False):
45
45
  """The result of the tool call."""
46
46
 
47
47
  type: Required[Literal["function_result"]]
48
- """Used as the OpenAPI type discriminator for the content oneof."""
49
48
 
50
49
  is_error: bool
51
50
  """Whether the tool call resulted in an error."""
@@ -28,7 +28,6 @@ class GoogleSearchCallContent(BaseModel):
28
28
  """Google Search content."""
29
29
 
30
30
  type: Literal["google_search_call"]
31
- """Used as the OpenAPI type discriminator for the content oneof."""
32
31
 
33
32
  id: Optional[str] = None
34
33
  """A unique ID for this specific tool call."""
@@ -28,7 +28,6 @@ class GoogleSearchCallContentParam(TypedDict, total=False):
28
28
  """Google Search content."""
29
29
 
30
30
  type: Required[Literal["google_search_call"]]
31
- """Used as the OpenAPI type discriminator for the content oneof."""
32
31
 
33
32
  id: str
34
33
  """A unique ID for this specific tool call."""
@@ -28,7 +28,6 @@ class GoogleSearchResultContent(BaseModel):
28
28
  """Google Search result content."""
29
29
 
30
30
  type: Literal["google_search_result"]
31
- """Used as the OpenAPI type discriminator for the content oneof."""
32
31
 
33
32
  call_id: Optional[str] = None
34
33
  """ID to match the ID from the google search call block."""
@@ -29,7 +29,6 @@ class GoogleSearchResultContentParam(TypedDict, total=False):
29
29
  """Google Search result content."""
30
30
 
31
31
  type: Required[Literal["google_search_result"]]
32
- """Used as the OpenAPI type discriminator for the content oneof."""
33
32
 
34
33
  call_id: str
35
34
  """ID to match the ID from the google search call block."""
@@ -28,14 +28,13 @@ class ImageContent(BaseModel):
28
28
  """An image content block."""
29
29
 
30
30
  type: Literal["image"]
31
- """Used as the OpenAPI type discriminator for the content oneof."""
32
31
 
33
32
  data: Optional[str] = None
34
33
 
35
34
  mime_type: Optional[ImageMimeType] = None
36
35
  """The mime type of the image."""
37
36
 
38
- resolution: Optional[Literal["low", "medium", "high"]] = None
37
+ resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None
39
38
  """The resolution of the media."""
40
39
 
41
40
  uri: Optional[str] = None
@@ -32,14 +32,13 @@ class ImageContentParam(TypedDict, total=False):
32
32
  """An image content block."""
33
33
 
34
34
  type: Required[Literal["image"]]
35
- """Used as the OpenAPI type discriminator for the content oneof."""
36
35
 
37
36
  data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
38
37
 
39
38
  mime_type: ImageMimeTypeParam
40
39
  """The mime type of the image."""
41
40
 
42
- resolution: Literal["low", "medium", "high"]
41
+ resolution: Literal["low", "medium", "high", "ultra_high"]
43
42
  """The resolution of the media."""
44
43
 
45
44
  uri: str
@@ -23,6 +23,7 @@ from .turn import Turn
23
23
  from .model import Model
24
24
  from .usage import Usage
25
25
  from .._utils import PropertyInfo
26
+ from .content import Content
26
27
  from .._models import BaseModel
27
28
  from .text_content import TextContent
28
29
  from .audio_content import AudioContent
@@ -44,38 +45,15 @@ from .mcp_server_tool_call_content import MCPServerToolCallContent
44
45
  from .code_execution_result_content import CodeExecutionResultContent
45
46
  from .mcp_server_tool_result_content import MCPServerToolResultContent
46
47
 
47
- __all__ = ["Interaction", "AgentConfig", "Input", "InputContentList", "Output"]
48
+ __all__ = ["Interaction", "AgentConfig", "Input"]
48
49
 
49
50
  AgentConfig: TypeAlias = Annotated[
50
51
  Union[DynamicAgentConfig, DeepResearchAgentConfig], PropertyInfo(discriminator="type")
51
52
  ]
52
53
 
53
- InputContentList: TypeAlias = Annotated[
54
- Union[
55
- TextContent,
56
- ImageContent,
57
- AudioContent,
58
- DocumentContent,
59
- VideoContent,
60
- ThoughtContent,
61
- FunctionCallContent,
62
- FunctionResultContent,
63
- CodeExecutionCallContent,
64
- CodeExecutionResultContent,
65
- URLContextCallContent,
66
- URLContextResultContent,
67
- GoogleSearchCallContent,
68
- GoogleSearchResultContent,
69
- MCPServerToolCallContent,
70
- MCPServerToolResultContent,
71
- FileSearchResultContent,
72
- ],
73
- PropertyInfo(discriminator="type"),
74
- ]
75
-
76
54
  Input: TypeAlias = Union[
77
55
  str,
78
- List[InputContentList],
56
+ List[Content],
79
57
  List[Turn],
80
58
  TextContent,
81
59
  ImageContent,
@@ -96,29 +74,6 @@ Input: TypeAlias = Union[
96
74
  FileSearchResultContent,
97
75
  ]
98
76
 
99
- Output: TypeAlias = Annotated[
100
- Union[
101
- TextContent,
102
- ImageContent,
103
- AudioContent,
104
- DocumentContent,
105
- VideoContent,
106
- ThoughtContent,
107
- FunctionCallContent,
108
- FunctionResultContent,
109
- CodeExecutionCallContent,
110
- CodeExecutionResultContent,
111
- URLContextCallContent,
112
- URLContextResultContent,
113
- GoogleSearchCallContent,
114
- GoogleSearchResultContent,
115
- MCPServerToolCallContent,
116
- MCPServerToolResultContent,
117
- FileSearchResultContent,
118
- ],
119
- PropertyInfo(discriminator="type"),
120
- ]
121
-
122
77
 
123
78
  class Interaction(BaseModel):
124
79
  """The Interaction resource."""
@@ -142,10 +97,7 @@ class Interaction(BaseModel):
142
97
  model: Optional[Model] = None
143
98
  """The name of the `Model` used for generating the interaction."""
144
99
 
145
- object: Optional[Literal["interaction"]] = None
146
- """Output only. The object type of the interaction. Always set to `interaction`."""
147
-
148
- outputs: Optional[List[Output]] = None
100
+ outputs: Optional[List[Content]] = None
149
101
  """Output only. Responses from the model."""
150
102
 
151
103
  previous_interaction_id: Optional[str] = None
@@ -23,6 +23,7 @@ from typing_extensions import Literal, Required, TypeAlias, TypedDict
23
23
  from .tool_param import ToolParam
24
24
  from .turn_param import TurnParam
25
25
  from .model_param import ModelParam
26
+ from .content_param import ContentParam
26
27
  from .text_content_param import TextContentParam
27
28
  from .audio_content_param import AudioContentParam
28
29
  from .image_content_param import ImageContentParam
@@ -47,7 +48,6 @@ from .mcp_server_tool_result_content_param import MCPServerToolResultContentPara
47
48
  __all__ = [
48
49
  "BaseCreateModelInteractionParams",
49
50
  "Input",
50
- "ContentList",
51
51
  "BaseCreateAgentInteractionParams",
52
52
  "AgentConfig",
53
53
  "CreateModelInteractionParamsNonStreaming",
@@ -97,29 +97,9 @@ class BaseCreateModelInteractionParams(TypedDict, total=False):
97
97
  """A list of tool declarations the model may call during interaction."""
98
98
 
99
99
 
100
- ContentList: TypeAlias = Union[
101
- TextContentParam,
102
- ImageContentParam,
103
- AudioContentParam,
104
- DocumentContentParam,
105
- VideoContentParam,
106
- ThoughtContentParam,
107
- FunctionCallContentParam,
108
- FunctionResultContentParam,
109
- CodeExecutionCallContentParam,
110
- CodeExecutionResultContentParam,
111
- URLContextCallContentParam,
112
- URLContextResultContentParam,
113
- GoogleSearchCallContentParam,
114
- GoogleSearchResultContentParam,
115
- MCPServerToolCallContentParam,
116
- MCPServerToolResultContentParam,
117
- FileSearchResultContentParam,
118
- ]
119
-
120
100
  Input: TypeAlias = Union[
121
101
  str,
122
- Iterable[ContentList],
102
+ Iterable[ContentParam],
123
103
  Iterable[TurnParam],
124
104
  TextContentParam,
125
105
  ImageContentParam,
@@ -39,4 +39,3 @@ class MCPServerToolCallContent(BaseModel):
39
39
  """The name of the used MCP server."""
40
40
 
41
41
  type: Literal["mcp_server_tool_call"]
42
- """Used as the OpenAPI type discriminator for the content oneof."""
@@ -39,4 +39,3 @@ class MCPServerToolCallContentParam(TypedDict, total=False):
39
39
  """The name of the used MCP server."""
40
40
 
41
41
  type: Required[Literal["mcp_server_tool_call"]]
42
- """Used as the OpenAPI type discriminator for the content oneof."""
@@ -23,7 +23,7 @@ from .image_content import ImageContent
23
23
 
24
24
  __all__ = ["MCPServerToolResultContent", "Result", "ResultItems", "ResultItemsItem"]
25
25
 
26
- ResultItemsItem: TypeAlias = Union[str, ImageContent]
26
+ ResultItemsItem: TypeAlias = Union[str, ImageContent, object]
27
27
 
28
28
 
29
29
  class ResultItems(BaseModel):
@@ -43,7 +43,6 @@ class MCPServerToolResultContent(BaseModel):
43
43
  """The result of the tool call."""
44
44
 
45
45
  type: Literal["mcp_server_tool_result"]
46
- """Used as the OpenAPI type discriminator for the content oneof."""
47
46
 
48
47
  name: Optional[str] = None
49
48
  """Name of the tool which is called for this specific tool call."""
@@ -25,7 +25,7 @@ from .image_content_param import ImageContentParam
25
25
 
26
26
  __all__ = ["MCPServerToolResultContentParam", "Result", "ResultItems", "ResultItemsItem"]
27
27
 
28
- ResultItemsItem: TypeAlias = Union[str, ImageContentParam]
28
+ ResultItemsItem: TypeAlias = Union[str, ImageContentParam, object]
29
29
 
30
30
 
31
31
  class ResultItems(TypedDict, total=False):
@@ -45,7 +45,6 @@ class MCPServerToolResultContentParam(TypedDict, total=False):
45
45
  """The result of the tool call."""
46
46
 
47
47
  type: Required[Literal["mcp_server_tool_result"]]
48
- """Used as the OpenAPI type discriminator for the content oneof."""
49
48
 
50
49
  name: str
51
50
  """Name of the tool which is called for this specific tool call."""
@@ -31,6 +31,7 @@ Model: TypeAlias = Union[
31
31
  "gemini-2.5-flash-image-preview",
32
32
  "gemini-2.5-pro-preview-tts",
33
33
  "gemini-3-pro-preview",
34
+ "gemini-3-flash-preview",
34
35
  ],
35
36
  str,
36
37
  ]
@@ -33,6 +33,7 @@ ModelParam: TypeAlias = Union[
33
33
  "gemini-2.5-flash-image-preview",
34
34
  "gemini-2.5-pro-preview-tts",
35
35
  "gemini-3-pro-preview",
36
+ "gemini-3-flash-preview",
36
37
  ],
37
38
  str,
38
39
  ]
@@ -28,7 +28,6 @@ class TextContent(BaseModel):
28
28
  """A text content block."""
29
29
 
30
30
  type: Literal["text"]
31
- """Used as the OpenAPI type discriminator for the content oneof."""
32
31
 
33
32
  annotations: Optional[List[Annotation]] = None
34
33
  """Citation information for model-generated content."""
@@ -29,7 +29,6 @@ class TextContentParam(TypedDict, total=False):
29
29
  """A text content block."""
30
30
 
31
31
  type: Required[Literal["text"]]
32
- """Used as the OpenAPI type discriminator for the content oneof."""
33
32
 
34
33
  annotations: Iterable[AnnotationParam]
35
34
  """Citation information for model-generated content."""
@@ -19,4 +19,4 @@ from typing_extensions import Literal, TypeAlias
19
19
 
20
20
  __all__ = ["ThinkingLevel"]
21
21
 
22
- ThinkingLevel: TypeAlias = Literal["low", "high"]
22
+ ThinkingLevel: TypeAlias = Literal["minimal", "low", "medium", "high"]
@@ -32,7 +32,6 @@ class ThoughtContent(BaseModel):
32
32
  """A thought content block."""
33
33
 
34
34
  type: Literal["thought"]
35
- """Used as the OpenAPI type discriminator for the content oneof."""
36
35
 
37
36
  signature: Optional[str] = None
38
37
  """Signature to match the backend source to be part of the generation."""
@@ -35,7 +35,6 @@ class ThoughtContentParam(TypedDict, total=False):
35
35
  """A thought content block."""
36
36
 
37
37
  type: Required[Literal["thought"]]
38
- """Used as the OpenAPI type discriminator for the content oneof."""
39
38
 
40
39
  signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
41
40
  """Signature to match the backend source to be part of the generation."""
@@ -16,56 +16,15 @@
16
16
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
17
17
 
18
18
  from typing import List, Union, Optional
19
- from typing_extensions import Annotated, TypeAlias
20
19
 
21
- from .._utils import PropertyInfo
20
+ from .content import Content
22
21
  from .._models import BaseModel
23
- from .text_content import TextContent
24
- from .audio_content import AudioContent
25
- from .image_content import ImageContent
26
- from .video_content import VideoContent
27
- from .thought_content import ThoughtContent
28
- from .document_content import DocumentContent
29
- from .function_call_content import FunctionCallContent
30
- from .function_result_content import FunctionResultContent
31
- from .url_context_call_content import URLContextCallContent
32
- from .file_search_result_content import FileSearchResultContent
33
- from .google_search_call_content import GoogleSearchCallContent
34
- from .url_context_result_content import URLContextResultContent
35
- from .code_execution_call_content import CodeExecutionCallContent
36
- from .google_search_result_content import GoogleSearchResultContent
37
- from .mcp_server_tool_call_content import MCPServerToolCallContent
38
- from .code_execution_result_content import CodeExecutionResultContent
39
- from .mcp_server_tool_result_content import MCPServerToolResultContent
40
22
 
41
- __all__ = ["Turn", "ContentUnionMember1"]
42
-
43
- ContentUnionMember1: TypeAlias = Annotated[
44
- Union[
45
- TextContent,
46
- ImageContent,
47
- AudioContent,
48
- DocumentContent,
49
- VideoContent,
50
- ThoughtContent,
51
- FunctionCallContent,
52
- FunctionResultContent,
53
- CodeExecutionCallContent,
54
- CodeExecutionResultContent,
55
- URLContextCallContent,
56
- URLContextResultContent,
57
- GoogleSearchCallContent,
58
- GoogleSearchResultContent,
59
- MCPServerToolCallContent,
60
- MCPServerToolResultContent,
61
- FileSearchResultContent,
62
- ],
63
- PropertyInfo(discriminator="type"),
64
- ]
23
+ __all__ = ["Turn"]
65
24
 
66
25
 
67
26
  class Turn(BaseModel):
68
- content: Union[str, List[ContentUnionMember1], None] = None
27
+ content: Union[str, List[Content], None] = None
69
28
  """The content of the turn."""
70
29
 
71
30
  role: Optional[str] = None
@@ -18,51 +18,15 @@
18
18
  from __future__ import annotations
19
19
 
20
20
  from typing import Union, Iterable
21
- from typing_extensions import TypeAlias, TypedDict
21
+ from typing_extensions import TypedDict
22
22
 
23
- from .text_content_param import TextContentParam
24
- from .audio_content_param import AudioContentParam
25
- from .image_content_param import ImageContentParam
26
- from .video_content_param import VideoContentParam
27
- from .thought_content_param import ThoughtContentParam
28
- from .document_content_param import DocumentContentParam
29
- from .function_call_content_param import FunctionCallContentParam
30
- from .function_result_content_param import FunctionResultContentParam
31
- from .url_context_call_content_param import URLContextCallContentParam
32
- from .file_search_result_content_param import FileSearchResultContentParam
33
- from .google_search_call_content_param import GoogleSearchCallContentParam
34
- from .url_context_result_content_param import URLContextResultContentParam
35
- from .code_execution_call_content_param import CodeExecutionCallContentParam
36
- from .google_search_result_content_param import GoogleSearchResultContentParam
37
- from .mcp_server_tool_call_content_param import MCPServerToolCallContentParam
38
- from .code_execution_result_content_param import CodeExecutionResultContentParam
39
- from .mcp_server_tool_result_content_param import MCPServerToolResultContentParam
23
+ from .content_param import ContentParam
40
24
 
41
- __all__ = ["TurnParam", "ContentUnionMember1"]
42
-
43
- ContentUnionMember1: TypeAlias = Union[
44
- TextContentParam,
45
- ImageContentParam,
46
- AudioContentParam,
47
- DocumentContentParam,
48
- VideoContentParam,
49
- ThoughtContentParam,
50
- FunctionCallContentParam,
51
- FunctionResultContentParam,
52
- CodeExecutionCallContentParam,
53
- CodeExecutionResultContentParam,
54
- URLContextCallContentParam,
55
- URLContextResultContentParam,
56
- GoogleSearchCallContentParam,
57
- GoogleSearchResultContentParam,
58
- MCPServerToolCallContentParam,
59
- MCPServerToolResultContentParam,
60
- FileSearchResultContentParam,
61
- ]
25
+ __all__ = ["TurnParam"]
62
26
 
63
27
 
64
28
  class TurnParam(TypedDict, total=False):
65
- content: Union[str, Iterable[ContentUnionMember1]]
29
+ content: Union[str, Iterable[ContentParam]]
66
30
  """The content of the turn."""
67
31
 
68
32
  role: str
@@ -28,7 +28,6 @@ class URLContextCallContent(BaseModel):
28
28
  """URL context content."""
29
29
 
30
30
  type: Literal["url_context_call"]
31
- """Used as the OpenAPI type discriminator for the content oneof."""
32
31
 
33
32
  id: Optional[str] = None
34
33
  """A unique ID for this specific tool call."""
@@ -28,7 +28,6 @@ class URLContextCallContentParam(TypedDict, total=False):
28
28
  """URL context content."""
29
29
 
30
30
  type: Required[Literal["url_context_call"]]
31
- """Used as the OpenAPI type discriminator for the content oneof."""
32
31
 
33
32
  id: str
34
33
  """A unique ID for this specific tool call."""
@@ -28,7 +28,6 @@ class URLContextResultContent(BaseModel):
28
28
  """URL context result content."""
29
29
 
30
30
  type: Literal["url_context_result"]
31
- """Used as the OpenAPI type discriminator for the content oneof."""
32
31
 
33
32
  call_id: Optional[str] = None
34
33
  """ID to match the ID from the url context call block."""
@@ -29,7 +29,6 @@ class URLContextResultContentParam(TypedDict, total=False):
29
29
  """URL context result content."""
30
30
 
31
31
  type: Required[Literal["url_context_result"]]
32
- """Used as the OpenAPI type discriminator for the content oneof."""
33
32
 
34
33
  call_id: str
35
34
  """ID to match the ID from the url context call block."""
@@ -93,7 +93,7 @@ class Usage(BaseModel):
93
93
  total_output_tokens: Optional[int] = None
94
94
  """Total number of tokens across all the generated responses."""
95
95
 
96
- total_reasoning_tokens: Optional[int] = None
96
+ total_thought_tokens: Optional[int] = None
97
97
  """Number of tokens of thoughts for thinking models."""
98
98
 
99
99
  total_tokens: Optional[int] = None
@@ -93,7 +93,7 @@ class UsageParam(TypedDict, total=False):
93
93
  total_output_tokens: int
94
94
  """Total number of tokens across all the generated responses."""
95
95
 
96
- total_reasoning_tokens: int
96
+ total_thought_tokens: int
97
97
  """Number of tokens of thoughts for thinking models."""
98
98
 
99
99
  total_tokens: int
@@ -28,14 +28,13 @@ class VideoContent(BaseModel):
28
28
  """A video content block."""
29
29
 
30
30
  type: Literal["video"]
31
- """Used as the OpenAPI type discriminator for the content oneof."""
32
31
 
33
32
  data: Optional[str] = None
34
33
 
35
34
  mime_type: Optional[VideoMimeType] = None
36
35
  """The mime type of the video."""
37
36
 
38
- resolution: Optional[Literal["low", "medium", "high"]] = None
37
+ resolution: Optional[Literal["low", "medium", "high", "ultra_high"]] = None
39
38
  """The resolution of the media."""
40
39
 
41
40
  uri: Optional[str] = None