openai.resources.beta
The beta modules provides a unified interface for accessing beta features of the API, encapsulating synchronous and asynchronous access to resources in beta.
The module aggregates the beta functionalities related to features like yet considered generally available (GA), offering a simplified entry point for interacting with these resources. It is designed to facilitate easy access to the cutting-edge features still under development, enabling developers to experiment with and leverage new capabilities before they become GA.
Modules:
| Name | Description | 
|---|---|
| assistants |  | 
| beta | The  The module aggregates the beta functionalities related to features like yet considered generally available (GA), offering a simplified entry point for interacting with these resources. It is designed to facilitate easy access to the cutting-edge features still under development, enabling developers to experiment with and leverage new capabilities before they become GA. | 
| threads |  | 
Classes:
Assistants(client: OpenAI)
Methods:
| Name | Description | 
|---|---|
| create | Create an assistant with a model and instructions. | 
| delete | Delete an assistant. | 
| files |  | 
| list | Returns a list of assistants. | 
| retrieve | Retrieves an assistant. | 
| update | Modifies an assistant. | 
| with_raw_response |  | 
| with_streaming_response |  | 
create(
    *,
    model: str,
    description: Optional[str] | NotGiven = NOT_GIVEN,
    file_ids: List[str] | NotGiven = NOT_GIVEN,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    name: Optional[str] | NotGiven = NOT_GIVEN,
    tools: (
        Iterable[AssistantToolParam] | NotGiven
    ) = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Assistant
Create an assistant with a model and instructions.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| model | str | ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them. | required | 
| description | Optional[str] | NotGiven | The description of the assistant. The maximum length is 512 characters. | NOT_GIVEN | 
| file_ids | List[str] | NotGiven | A list of file IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. | NOT_GIVEN | 
| instructions | Optional[str] | NotGiven | The system instructions that the assistant uses. The maximum length is 32768 characters. | NOT_GIVEN | 
| metadata | Optional[object] | NotGiven | Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. | NOT_GIVEN | 
| name | Optional[str] | NotGiven | The name of the assistant. The maximum length is 256 characters. | NOT_GIVEN | 
| tools | Iterable[AssistantToolParam] | NotGiven | A list of tool enabled on the assistant. There can be a maximum of 128 tools per
  assistant. Tools can be of types  | NOT_GIVEN | 
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
delete(
    assistant_id: str,
    *,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> AssistantDeleted
Delete an assistant.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
list(
    *,
    after: str | NotGiven = NOT_GIVEN,
    before: str | NotGiven = NOT_GIVEN,
    limit: int | NotGiven = NOT_GIVEN,
    order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> SyncCursorPage[Assistant]
Returns a list of assistants.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| after | str | NotGiven | A cursor for use in pagination. | NOT_GIVEN | 
after is an object ID that defines your place
      in the list. For instance, if you make a list request and receive 100 objects,
      ending with obj_foo, your subsequent call can include after=obj_foo in order to
      fetch the next page of the list.
before: A cursor for use in pagination. before is an object ID that defines your place
      in the list. For instance, if you make a list request and receive 100 objects,
      ending with obj_foo, your subsequent call can include before=obj_foo in order to
      fetch the previous page of the list.
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
order: Sort order by the created_at timestamp of the objects. asc for ascending
      order and desc for descending order.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
retrieve(
    assistant_id: str,
    *,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Assistant
Retrieves an assistant.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
update(
    assistant_id: str,
    *,
    description: Optional[str] | NotGiven = NOT_GIVEN,
    file_ids: List[str] | NotGiven = NOT_GIVEN,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: str | NotGiven = NOT_GIVEN,
    name: Optional[str] | NotGiven = NOT_GIVEN,
    tools: (
        Iterable[AssistantToolParam] | NotGiven
    ) = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Assistant
Modifies an assistant.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| description | Optional[str] | NotGiven | The description of the assistant. | NOT_GIVEN | 
The maximum length is 512 characters.
file_ids: A list of File IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. If a file was previously attached to the list but does not show up in the list, it will be deleted from the assistant.
instructions: The system instructions that the assistant uses. The maximum length is 32768 characters.
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.
model: ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.
name: The name of the assistant. The maximum length is 256 characters.
tools: A list of tool enabled on the assistant. There can be a maximum of 128 tools per
      assistant. Tools can be of types code_interpreter, retrieval, or function.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
AssistantsWithRawResponse(assistants: Assistants)
AssistantsWithStreamingResponse(assistants: Assistants)
AsyncAssistants(client: AsyncOpenAI)
Methods:
| Name | Description | 
|---|---|
| create | Create an assistant with a model and instructions. | 
| delete | Delete an assistant. | 
| files |  | 
| list | Returns a list of assistants. | 
| retrieve | Retrieves an assistant. | 
| update | Modifies an assistant. | 
| with_raw_response |  | 
| with_streaming_response |  | 
async
  
create(
    *,
    model: str,
    description: Optional[str] | NotGiven = NOT_GIVEN,
    file_ids: List[str] | NotGiven = NOT_GIVEN,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    name: Optional[str] | NotGiven = NOT_GIVEN,
    tools: (
        Iterable[AssistantToolParam] | NotGiven
    ) = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Assistant
Create an assistant with a model and instructions.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| model | str | ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them. | required | 
| description | Optional[str] | NotGiven | The description of the assistant. The maximum length is 512 characters. | NOT_GIVEN | 
| file_ids | List[str] | NotGiven | A list of file IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. | NOT_GIVEN | 
| instructions | Optional[str] | NotGiven | The system instructions that the assistant uses. The maximum length is 32768 characters. | NOT_GIVEN | 
| metadata | Optional[object] | NotGiven | Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. | NOT_GIVEN | 
| name | Optional[str] | NotGiven | The name of the assistant. The maximum length is 256 characters. | NOT_GIVEN | 
| tools | Iterable[AssistantToolParam] | NotGiven | A list of tool enabled on the assistant. There can be a maximum of 128 tools per
  assistant. Tools can be of types  | NOT_GIVEN | 
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
async
  
delete(
    assistant_id: str,
    *,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> AssistantDeleted
Delete an assistant.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
list(
    *,
    after: str | NotGiven = NOT_GIVEN,
    before: str | NotGiven = NOT_GIVEN,
    limit: int | NotGiven = NOT_GIVEN,
    order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> AsyncPaginator[Assistant, AsyncCursorPage[Assistant]]
Returns a list of assistants.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| after | str | NotGiven | A cursor for use in pagination. | NOT_GIVEN | 
after is an object ID that defines your place
      in the list. For instance, if you make a list request and receive 100 objects,
      ending with obj_foo, your subsequent call can include after=obj_foo in order to
      fetch the next page of the list.
before: A cursor for use in pagination. before is an object ID that defines your place
      in the list. For instance, if you make a list request and receive 100 objects,
      ending with obj_foo, your subsequent call can include before=obj_foo in order to
      fetch the previous page of the list.
limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
order: Sort order by the created_at timestamp of the objects. asc for ascending
      order and desc for descending order.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
async
  
retrieve(
    assistant_id: str,
    *,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Assistant
Retrieves an assistant.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
async
  
update(
    assistant_id: str,
    *,
    description: Optional[str] | NotGiven = NOT_GIVEN,
    file_ids: List[str] | NotGiven = NOT_GIVEN,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: str | NotGiven = NOT_GIVEN,
    name: Optional[str] | NotGiven = NOT_GIVEN,
    tools: (
        Iterable[AssistantToolParam] | NotGiven
    ) = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Assistant
Modifies an assistant.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| description | Optional[str] | NotGiven | The description of the assistant. | NOT_GIVEN | 
The maximum length is 512 characters.
file_ids: A list of File IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. If a file was previously attached to the list but does not show up in the list, it will be deleted from the assistant.
instructions: The system instructions that the assistant uses. The maximum length is 32768 characters.
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.
model: ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.
name: The name of the assistant. The maximum length is 256 characters.
tools: A list of tool enabled on the assistant. There can be a maximum of 128 tools per
      assistant. Tools can be of types code_interpreter, retrieval, or function.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
AsyncAssistantsWithRawResponse(assistants: AsyncAssistants)
AsyncAssistantsWithStreamingResponse(
    assistants: AsyncAssistants,
)
AsyncBeta(client: AsyncOpenAI)
AsyncBetaWithRawResponse(beta: AsyncBeta)
AsyncBetaWithStreamingResponse(beta: AsyncBeta)
AsyncThreads(client: AsyncOpenAI)
Methods:
| Name | Description | 
|---|---|
| create | Create a thread. | 
| create_and_run |  | 
| create_and_run_stream | Create a thread and stream the run back | 
| delete | Delete a thread. | 
| messages |  | 
| retrieve | Retrieves a thread. | 
| runs |  | 
| update | Modifies a thread. | 
| with_raw_response |  | 
| with_streaming_response |  | 
async
  
create(
    *,
    messages: Iterable[Message] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Thread
Create a thread.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| messages | Iterable[Message] | NotGiven | A list of messages to start the thread with. | NOT_GIVEN | 
| metadata | Optional[object] | NotGiven | Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. | NOT_GIVEN | 
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
async
  
        create_and_run(
    *,
    assistant_id: str,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Run
create_and_run(
    *,
    assistant_id: str,
    stream: Literal[True],
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> AsyncStream[AssistantStreamEvent]
create_and_run(
    *,
    assistant_id: str,
    stream: bool,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Run | AsyncStream[AssistantStreamEvent]
create_and_run(
    *,
    assistant_id: str,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    stream: (
        Optional[Literal[False]] | Literal[True] | NotGiven
    ) = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Run | AsyncStream[AssistantStreamEvent]
        create_and_run_stream(
    *,
    assistant_id: str,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> AsyncAssistantStreamManager[
    AsyncAssistantEventHandler
]
create_and_run_stream(
    *,
    assistant_id: str,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    event_handler: AsyncAssistantEventHandlerT,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> AsyncAssistantStreamManager[
    AsyncAssistantEventHandlerT
]
create_and_run_stream(
    *,
    assistant_id: str,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    event_handler: (
        AsyncAssistantEventHandlerT | None
    ) = None,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> (
    AsyncAssistantStreamManager[AsyncAssistantEventHandler]
    | AsyncAssistantStreamManager[
        AsyncAssistantEventHandlerT
    ]
)
Create a thread and stream the run back
async
  
delete(
    thread_id: str,
    *,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> ThreadDeleted
Delete a thread.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
async
  
retrieve(
    thread_id: str,
    *,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Thread
Retrieves a thread.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
async
  
update(
    thread_id: str,
    *,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Thread
Modifies a thread.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| metadata | Optional[object] | NotGiven | Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. | NOT_GIVEN | 
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
AsyncThreadsWithRawResponse(threads: AsyncThreads)
AsyncThreadsWithStreamingResponse(threads: AsyncThreads)
Beta(client: OpenAI)
BetaWithStreamingResponse(beta: Beta)
Threads(client: OpenAI)
Methods:
| Name | Description | 
|---|---|
| create | Create a thread. | 
| create_and_run |  | 
| create_and_run_stream | Create a thread and stream the run back | 
| delete | Delete a thread. | 
| messages |  | 
| retrieve | Retrieves a thread. | 
| runs |  | 
| update | Modifies a thread. | 
| with_raw_response |  | 
| with_streaming_response |  | 
create(
    *,
    messages: Iterable[Message] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Thread
Create a thread.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| messages | Iterable[Message] | NotGiven | A list of messages to start the thread with. | NOT_GIVEN | 
| metadata | Optional[object] | NotGiven | Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. | NOT_GIVEN | 
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
        create_and_run(
    *,
    assistant_id: str,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Run
create_and_run(
    *,
    assistant_id: str,
    stream: Literal[True],
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Stream[AssistantStreamEvent]
create_and_run(
    *,
    assistant_id: str,
    stream: bool,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Run | Stream[AssistantStreamEvent]
create_and_run(
    *,
    assistant_id: str,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    stream: (
        Optional[Literal[False]] | Literal[True] | NotGiven
    ) = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Run | Stream[AssistantStreamEvent]
        create_and_run_stream(
    *,
    assistant_id: str,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> AssistantStreamManager[AssistantEventHandler]
create_and_run_stream(
    *,
    assistant_id: str,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    event_handler: AssistantEventHandlerT,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> AssistantStreamManager[AssistantEventHandlerT]
create_and_run_stream(
    *,
    assistant_id: str,
    instructions: Optional[str] | NotGiven = NOT_GIVEN,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    model: Optional[str] | NotGiven = NOT_GIVEN,
    thread: Thread | NotGiven = NOT_GIVEN,
    tools: Optional[Iterable[Tool]] | NotGiven = NOT_GIVEN,
    event_handler: AssistantEventHandlerT | None = None,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> (
    AssistantStreamManager[AssistantEventHandler]
    | AssistantStreamManager[AssistantEventHandlerT]
)
Create a thread and stream the run back
delete(
    thread_id: str,
    *,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> ThreadDeleted
Delete a thread.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
retrieve(
    thread_id: str,
    *,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Thread
Retrieves a thread.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
update(
    thread_id: str,
    *,
    metadata: Optional[object] | NotGiven = NOT_GIVEN,
    extra_headers: Headers | None = None,
    extra_query: Query | None = None,
    extra_body: Body | None = None,
    timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> Thread
Modifies a thread.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| metadata | Optional[object] | NotGiven | Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. | NOT_GIVEN | 
| extra_headers | Headers | None | Send extra headers | None | 
| extra_query | Query | None | Add additional query parameters to the request | None | 
| extra_body | Body | None | Add additional JSON properties to the request | None | 
| timeout | float | Timeout | None | NotGiven | Override the client-level default timeout for this request, in seconds | NOT_GIVEN | 
ThreadsWithRawResponse(threads: Threads)