ExOpenAI.Files (ex_openai.ex v1.0.4) View Source
Modules for interacting with the files
group of OpenAI APIs
API Reference: https://platform.openai.com/docs/api-reference/files
Link to this section Summary
Functions
Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.
Delete a file.
Returns the contents of the specified file
Link to this section Functions
Specs
create_file(bitstring(), String.t(), []) :: {:ok, ExOpenAI.Components.OpenAIFile.t()} | {:error, any()}
Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.
Endpoint: https://api.openai.com/v1/files
Method: POST
Docs: https://platform.openai.com/docs/api-reference/files
Required Arguments:
file
: Name of the JSON Lines file to be uploaded.
If the purpose
is set to "fine-tune", each line is a JSON record with "prompt" and "completion" fields representing your training examples.
purpose
: The intended purpose of the uploaded documents.
Use "fine-tune" for Fine-tuning. This allows us to validate the format of the uploaded file.
Optional Arguments:
Specs
delete_file(String.t(), []) :: {:ok, ExOpenAI.Components.DeleteFileResponse.t()} | {:error, any()}
Delete a file.
Endpoint: https://api.openai.com/v1/files/{file_id}
Method: DELETE
Docs: https://platform.openai.com/docs/api-reference/files
Required Arguments:
file_id
Optional Arguments:
Specs
Returns the contents of the specified file
Endpoint: https://api.openai.com/v1/files/{file_id}/content
Method: GET
Docs: https://platform.openai.com/docs/api-reference/files
Required Arguments:
file_id