Skip to content

files

Classes:

Name Description
AsyncFiles
AsyncFilesWithRawResponse
AsyncFilesWithStreamingResponse
Files
FilesWithRawResponse
FilesWithStreamingResponse

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

with_raw_response

with_raw_response() -> AsyncFilesWithRawResponse

with_streaming_response

with_streaming_response() -> (
    AsyncFilesWithStreamingResponse
)

AsyncFilesWithRawResponse

AsyncFilesWithRawResponse(files: AsyncFiles)

Attributes:

Name Type Description
list
retrieve

list instance-attribute

list = async_to_raw_response_wrapper(list)

retrieve instance-attribute

retrieve = async_to_raw_response_wrapper(retrieve)

AsyncFilesWithStreamingResponse

AsyncFilesWithStreamingResponse(files: AsyncFiles)

Attributes:

Name Type Description
list
retrieve

list instance-attribute

list = async_to_streamed_response_wrapper(list)

retrieve instance-attribute

retrieve = async_to_streamed_response_wrapper(retrieve)

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

with_raw_response

with_raw_response() -> FilesWithRawResponse

with_streaming_response

with_streaming_response() -> FilesWithStreamingResponse

FilesWithRawResponse

FilesWithRawResponse(files: Files)

Attributes:

Name Type Description
list
retrieve

list instance-attribute

list = to_raw_response_wrapper(list)

retrieve instance-attribute

retrieve = to_raw_response_wrapper(retrieve)

FilesWithStreamingResponse

FilesWithStreamingResponse(files: Files)

Attributes:

Name Type Description
list
retrieve

list instance-attribute

list = to_streamed_response_wrapper(list)

retrieve instance-attribute

retrieve = to_streamed_response_wrapper(retrieve)