View Source OpenaiEx.File (openai_ex v0.5.4)

This module provides an implementation of the OpenAI files API. The API reference can be found at https://platform.openai.com/docs/api-reference/files.

API Fields

The following fields can be used as parameters for various endpoints of the API:

  • :file

  • :purpose

  • :file_id

Summary

Functions

Calls the file upload endpoint.

Calls the file delete endpoint.

Calls the file retrieve_content endpoint.

Lists the files that belong to the user's organization.

Creates a new file retrieve / deletion / retrieve_content request with the given arguments.

Creates a new file upload request with the given arguments.

Calls the file retrieve endpoint.

Functions

Calls the file upload endpoint.

Arguments

  • openai: The OpenAI configuration.
  • upload: A map containing the fields of the file upload request.

Returns

A map containing the fields of the file upload response.

https://platform.openai.com/docs/api-reference/files/upload

Calls the file delete endpoint.

Arguments

  • openai: The OpenAI configuration.
  • file_id: The ID of the file to delete.

Returns

A map containing the fields of the file delete response.

https://platform.openai.com/docs/api-reference/files/delete

Link to this function

download(openai, file_id)

View Source

Calls the file retrieve_content endpoint.

Arguments

  • openai: The OpenAI configuration.
  • file_id: The ID of the file to retrieve the content of.

Returns

A map containing the fields of the file retrieve_content response.

https://platform.openai.com/docs/api-reference/files/retrieve-content

Lists the files that belong to the user's organization.

https://platform.openai.com/docs/api-reference/files/list

Creates a new file retrieve / deletion / retrieve_content request with the given arguments.

Arguments

  • args: A list of key-value pairs, or a map, representing the fields of the file retrieve / deletion / retrieve_content request.

Returns

A map containing the fields of the file retrieve / deletion / retrieve_content request.

The :file_id field is required.

Creates a new file upload request with the given arguments.

Arguments

  • args: A list of key-value pairs, or a map, representing the fields of the file upload request.

Returns

A map containing the fields of the file upload request.

The :file and :purpose fields are required.

Link to this function

retrieve(openai, file_id)

View Source

Calls the file retrieve endpoint.

Arguments

  • openai: The OpenAI configuration.
  • file_id: The ID of the file to retrieve.

Returns

A map containing the fields of the file retrieve response.

https://platform.openai.com/docs/api-reference/files/retrieve