OpenAi.Files (OpenAI REST API Client v0.2.1)
Provides API endpoints related to files
Summary
Functions
Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB.
Delete a file.
Returns the contents of the specified file.
Returns a list of files that belong to the user's organization.
Returns information about a specific file.
Functions
create_file(body, opts \\ [])
@spec create_file( OpenAi.File.CreateRequest.t(), keyword() ) :: {:ok, OpenAi.File.t()} | {:error, OpenAi.Error.error()}
Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 100 GB.
The Assistants API supports files up to 2 million tokens and of specific file types. See the Assistants Tools guide for details.
The Fine-tuning API only supports .jsonl
files. The input also has certain required formats for fine-tuning chat or completions models.
The Batch API only supports .jsonl
files up to 100 MB in size. The input also has a specific required format.
Please contact us if you need to increase these storage limits.
delete_file(file_id, opts \\ [])
@spec delete_file( String.t(), keyword() ) :: {:ok, OpenAi.File.DeleteResponse.t()} | {:error, OpenAi.Error.error()}
Delete a file.
download_file(file_id, opts \\ [])
@spec download_file( String.t(), keyword() ) :: {:ok, String.t()} | {:error, OpenAi.Error.error()}
Returns the contents of the specified file.
list_files(opts \\ [])
@spec list_files(keyword()) :: {:ok, OpenAi.File.ListResponse.t()} | {:error, OpenAi.Error.error()}
Returns a list of files that belong to the user's organization.
Options
purpose
: Only return files with the given purpose.
retrieve_file(file_id, opts \\ [])
@spec retrieve_file( String.t(), keyword() ) :: {:ok, OpenAi.File.t()} | {:error, OpenAi.Error.error()}
Returns information about a specific file.