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
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
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
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
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
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
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
AssistantsWithRawResponse(assistants: Assistants)
AssistantsWithStreamingResponse
AssistantsWithStreamingResponse(assistants: Assistants)
AsyncAssistants
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 |
|
create
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
|
delete
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
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
retrieve
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
|
update
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
AsyncAssistantsWithRawResponse(assistants: AsyncAssistants)
AsyncAssistantsWithStreamingResponse
AsyncAssistantsWithStreamingResponse(
assistants: AsyncAssistants,
)
AsyncBeta
AsyncBeta(client: AsyncOpenAI)
AsyncBetaWithRawResponse
AsyncBetaWithRawResponse(beta: AsyncBeta)
AsyncBetaWithStreamingResponse
AsyncBetaWithStreamingResponse(beta: AsyncBeta)
AsyncThreads
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 |
|
create
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
|
create_and_run
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
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
delete
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
|
retrieve
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
|
update
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
AsyncThreadsWithRawResponse(threads: AsyncThreads)
AsyncThreadsWithStreamingResponse
AsyncThreadsWithStreamingResponse(threads: AsyncThreads)
Beta
Beta(client: OpenAI)
BetaWithStreamingResponse
BetaWithStreamingResponse(beta: Beta)
Threads
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
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
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
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
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
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
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
ThreadsWithRawResponse(threads: Threads)