Commit f73996b7

Stainless Bot <107565488+stainless-bot@users.noreply.github.com>
2024-04-20 01:43:01
fix(api): correct types for message attachment tools (#1348)
1 parent 10dde6d
src/openai/types/beta/threads/message.py
@@ -1,19 +1,24 @@
 # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
 
-from typing import List, Optional
+from typing import List, Union, Optional
 from typing_extensions import Literal
 
 from ...._models import BaseModel
 from .message_content import MessageContent
+from ..file_search_tool import FileSearchTool
+from ..code_interpreter_tool import CodeInterpreterTool
 
-__all__ = ["Message", "Attachment", "IncompleteDetails"]
+__all__ = ["Message", "Attachment", "AttachmentTool", "IncompleteDetails"]
+
+AttachmentTool = Union[CodeInterpreterTool, FileSearchTool]
 
 
 class Attachment(BaseModel):
     file_id: Optional[str] = None
     """The ID of the file to attach to the message."""
 
-    tools: Optional[List[Literal["file_search", "code_interpreter"]]] = None
+    tools: Optional[List[AttachmentTool]] = None
+    """The tools to add this file to."""
 
 
 class IncompleteDetails(BaseModel):
src/openai/types/beta/threads/message_create_params.py
@@ -2,10 +2,13 @@
 
 from __future__ import annotations
 
-from typing import List, Iterable, Optional
+from typing import Union, Iterable, Optional
 from typing_extensions import Literal, Required, TypedDict
 
-__all__ = ["MessageCreateParams", "Attachment"]
+from ..file_search_tool_param import FileSearchToolParam
+from ..code_interpreter_tool_param import CodeInterpreterToolParam
+
+__all__ = ["MessageCreateParams", "Attachment", "AttachmentTool"]
 
 
 class MessageCreateParams(TypedDict, total=False):
@@ -33,8 +36,12 @@ class MessageCreateParams(TypedDict, total=False):
     """
 
 
+AttachmentTool = Union[CodeInterpreterToolParam, FileSearchToolParam]
+
+
 class Attachment(TypedDict, total=False):
     file_id: str
     """The ID of the file to attach to the message."""
 
-    tools: List[Literal["file_search", "code_interpreter"]]
+    tools: Iterable[AttachmentTool]
+    """The tools to add this file to."""
src/openai/types/beta/threads/run_create_params.py
@@ -2,10 +2,12 @@
 
 from __future__ import annotations
 
-from typing import List, Union, Iterable, Optional
+from typing import Union, Iterable, Optional
 from typing_extensions import Literal, Required, TypedDict
 
 from ..assistant_tool_param import AssistantToolParam
+from ..file_search_tool_param import FileSearchToolParam
+from ..code_interpreter_tool_param import CodeInterpreterToolParam
 from ..assistant_tool_choice_option_param import AssistantToolChoiceOptionParam
 from ..assistant_response_format_option_param import AssistantResponseFormatOptionParam
 
@@ -13,6 +15,7 @@ __all__ = [
     "RunCreateParamsBase",
     "AdditionalMessage",
     "AdditionalMessageAttachment",
+    "AdditionalMessageAttachmentTool",
     "TruncationStrategy",
     "RunCreateParamsNonStreaming",
     "RunCreateParamsStreaming",
@@ -159,11 +162,15 @@ class RunCreateParamsBase(TypedDict, total=False):
     """
 
 
+AdditionalMessageAttachmentTool = Union[CodeInterpreterToolParam, FileSearchToolParam]
+
+
 class AdditionalMessageAttachment(TypedDict, total=False):
     file_id: str
     """The ID of the file to attach to the message."""
 
-    tools: List[Literal["file_search", "code_interpreter"]]
+    tools: Iterable[AdditionalMessageAttachmentTool]
+    """The tools to add this file to."""
 
 
 class AdditionalMessage(TypedDict, total=False):
src/openai/types/beta/thread_create_and_run_params.py
@@ -16,6 +16,7 @@ __all__ = [
     "Thread",
     "ThreadMessage",
     "ThreadMessageAttachment",
+    "ThreadMessageAttachmentTool",
     "ThreadToolResources",
     "ThreadToolResourcesCodeInterpreter",
     "ThreadToolResourcesFileSearch",
@@ -170,11 +171,15 @@ class ThreadCreateAndRunParamsBase(TypedDict, total=False):
     """
 
 
+ThreadMessageAttachmentTool = Union[CodeInterpreterToolParam, FileSearchToolParam]
+
+
 class ThreadMessageAttachment(TypedDict, total=False):
     file_id: str
     """The ID of the file to attach to the message."""
 
-    tools: List[Literal["file_search", "code_interpreter"]]
+    tools: Iterable[ThreadMessageAttachmentTool]
+    """The tools to add this file to."""
 
 
 class ThreadMessage(TypedDict, total=False):
src/openai/types/beta/thread_create_params.py
@@ -2,13 +2,17 @@
 
 from __future__ import annotations
 
-from typing import List, Iterable, Optional
+from typing import List, Union, Iterable, Optional
 from typing_extensions import Literal, Required, TypedDict
 
+from .file_search_tool_param import FileSearchToolParam
+from .code_interpreter_tool_param import CodeInterpreterToolParam
+
 __all__ = [
     "ThreadCreateParams",
     "Message",
     "MessageAttachment",
+    "MessageAttachmentTool",
     "ToolResources",
     "ToolResourcesCodeInterpreter",
     "ToolResourcesFileSearch",
@@ -40,11 +44,15 @@ class ThreadCreateParams(TypedDict, total=False):
     """
 
 
+MessageAttachmentTool = Union[CodeInterpreterToolParam, FileSearchToolParam]
+
+
 class MessageAttachment(TypedDict, total=False):
     file_id: str
     """The ID of the file to attach to the message."""
 
-    tools: List[Literal["file_search", "code_interpreter"]]
+    tools: Iterable[MessageAttachmentTool]
+    """The tools to add this file to."""
 
 
 class Message(TypedDict, total=False):
tests/api_resources/beta/threads/test_messages.py
@@ -36,15 +36,15 @@ class TestMessages:
             attachments=[
                 {
                     "file_id": "string",
-                    "tools": ["file_search", "code_interpreter"],
+                    "tools": [{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}],
                 },
                 {
                     "file_id": "string",
-                    "tools": ["file_search", "code_interpreter"],
+                    "tools": [{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}],
                 },
                 {
                     "file_id": "string",
-                    "tools": ["file_search", "code_interpreter"],
+                    "tools": [{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}],
                 },
             ],
             metadata={},
@@ -265,15 +265,15 @@ class TestAsyncMessages:
             attachments=[
                 {
                     "file_id": "string",
-                    "tools": ["file_search", "code_interpreter"],
+                    "tools": [{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}],
                 },
                 {
                     "file_id": "string",
-                    "tools": ["file_search", "code_interpreter"],
+                    "tools": [{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}],
                 },
                 {
                     "file_id": "string",
-                    "tools": ["file_search", "code_interpreter"],
+                    "tools": [{"type": "code_interpreter"}, {"type": "code_interpreter"}, {"type": "code_interpreter"}],
                 },
             ],
             metadata={},
tests/api_resources/beta/threads/test_runs.py
@@ -43,15 +43,27 @@ class TestRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -62,15 +74,27 @@ class TestRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -81,15 +105,27 @@ class TestRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -170,15 +206,27 @@ class TestRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -189,15 +237,27 @@ class TestRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -208,15 +268,27 @@ class TestRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -635,15 +707,27 @@ class TestAsyncRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -654,15 +738,27 @@ class TestAsyncRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -673,15 +769,27 @@ class TestAsyncRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -762,15 +870,27 @@ class TestAsyncRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -781,15 +901,27 @@ class TestAsyncRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -800,15 +932,27 @@ class TestAsyncRuns:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
tests/api_resources/beta/test_threads.py
@@ -36,15 +36,27 @@ class TestThreads:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -55,15 +67,27 @@ class TestThreads:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -74,15 +98,27 @@ class TestThreads:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -277,15 +313,27 @@ class TestThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},
@@ -296,15 +344,27 @@ class TestThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},
@@ -315,15 +375,27 @@ class TestThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},
@@ -409,15 +481,27 @@ class TestThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},
@@ -428,15 +512,27 @@ class TestThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},
@@ -447,15 +543,27 @@ class TestThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},
@@ -533,15 +641,27 @@ class TestAsyncThreads:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -552,15 +672,27 @@ class TestAsyncThreads:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -571,15 +703,27 @@ class TestAsyncThreads:
                     "attachments": [
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                         {
                             "file_id": "string",
-                            "tools": ["file_search", "code_interpreter"],
+                            "tools": [
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                                {"type": "code_interpreter"},
+                            ],
                         },
                     ],
                     "metadata": {},
@@ -774,15 +918,27 @@ class TestAsyncThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},
@@ -793,15 +949,27 @@ class TestAsyncThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},
@@ -812,15 +980,27 @@ class TestAsyncThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},
@@ -906,15 +1086,27 @@ class TestAsyncThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},
@@ -925,15 +1117,27 @@ class TestAsyncThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},
@@ -944,15 +1148,27 @@ class TestAsyncThreads:
                         "attachments": [
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                             {
                                 "file_id": "string",
-                                "tools": ["file_search", "code_interpreter"],
+                                "tools": [
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                    {"type": "code_interpreter"},
+                                ],
                             },
                         ],
                         "metadata": {},