Index
Modules:
Name | Description |
---|---|
files |
|
messages |
|
Classes:
AsyncFiles
AsyncFiles(client: AsyncOpenAI)
Methods:
Name | Description |
---|---|
list |
Returns a list of message files. |
retrieve |
Retrieves a message file. |
with_raw_response |
|
with_streaming_response |
|
list
list(
message_id: str,
*,
thread_id: str,
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[
MessageFile, AsyncCursorPage[MessageFile]
]
Returns a list of message files.
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(
file_id: str,
*,
thread_id: str,
message_id: str,
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> MessageFile
Retrieves a message file.
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
|
AsyncFilesWithRawResponse
AsyncFilesWithRawResponse(files: AsyncFiles)
AsyncFilesWithStreamingResponse
AsyncFilesWithStreamingResponse(files: AsyncFiles)
AsyncMessages
AsyncMessages(client: AsyncOpenAI)
Methods:
Name | Description |
---|---|
create |
Create a message. |
files |
|
list |
Returns a list of messages for a given thread. |
retrieve |
Retrieve a message. |
update |
Modifies a message. |
with_raw_response |
|
with_streaming_response |
|
create
async
create(
thread_id: str,
*,
content: str,
role: Literal["user"],
file_ids: List[str] | 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
) -> Message
Create a message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content
|
str
|
The content of the message. |
required |
role
|
Literal['user']
|
The role of the entity that is creating the message. Currently only |
required |
file_ids
|
List[str] | NotGiven
|
A list of File IDs that
the message should use. There can be a maximum of 10 files attached to a
message. Useful for tools like |
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
|
list
list(
thread_id: str,
*,
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[Message, AsyncCursorPage[Message]]
Returns a list of messages for a given thread.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
after
|
str | NotGiven
|
A cursor for use in pagination. |
NOT_GIVEN
|
before
|
str | NotGiven
|
A cursor for use in pagination. |
NOT_GIVEN
|
limit
|
int | NotGiven
|
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. |
NOT_GIVEN
|
order
|
Literal['asc', 'desc'] | NotGiven
|
Sort order by the |
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
|
retrieve
async
retrieve(
message_id: str,
*,
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
) -> Message
Retrieve a message.
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(
message_id: str,
*,
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
) -> Message
Modifies a message.
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
|
AsyncMessagesWithRawResponse
AsyncMessagesWithRawResponse(messages: AsyncMessages)
AsyncMessagesWithStreamingResponse
AsyncMessagesWithStreamingResponse(messages: AsyncMessages)
Files
Files(client: OpenAI)
Methods:
Name | Description |
---|---|
list |
Returns a list of message files. |
retrieve |
Retrieves a message file. |
with_raw_response |
|
with_streaming_response |
|
list
list(
message_id: str,
*,
thread_id: str,
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[MessageFile]
Returns a list of message files.
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(
file_id: str,
*,
thread_id: str,
message_id: str,
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN
) -> MessageFile
Retrieves a message file.
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
|
FilesWithRawResponse
FilesWithRawResponse(files: Files)
FilesWithStreamingResponse
FilesWithStreamingResponse(files: Files)
Messages
Messages(client: OpenAI)
Methods:
Name | Description |
---|---|
create |
Create a message. |
files |
|
list |
Returns a list of messages for a given thread. |
retrieve |
Retrieve a message. |
update |
Modifies a message. |
with_raw_response |
|
with_streaming_response |
|
create
create(
thread_id: str,
*,
content: str,
role: Literal["user"],
file_ids: List[str] | 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
) -> Message
Create a message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content
|
str
|
The content of the message. |
required |
role
|
Literal['user']
|
The role of the entity that is creating the message. Currently only |
required |
file_ids
|
List[str] | NotGiven
|
A list of File IDs that
the message should use. There can be a maximum of 10 files attached to a
message. Useful for tools like |
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
|
list
list(
thread_id: str,
*,
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[Message]
Returns a list of messages for a given thread.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
after
|
str | NotGiven
|
A cursor for use in pagination. |
NOT_GIVEN
|
before
|
str | NotGiven
|
A cursor for use in pagination. |
NOT_GIVEN
|
limit
|
int | NotGiven
|
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. |
NOT_GIVEN
|
order
|
Literal['asc', 'desc'] | NotGiven
|
Sort order by the |
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
|
retrieve
retrieve(
message_id: str,
*,
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
) -> Message
Retrieve a message.
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(
message_id: str,
*,
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
) -> Message
Modifies a message.
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
|
MessagesWithRawResponse
MessagesWithRawResponse(messages: Messages)