View Source OpenaiEx.Files (openai_ex v0.8.6)

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.

Summary

Functions

Calls the file retrieve_content endpoint.

Calls the file upload endpoint.

Calls the file delete 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

content(openai, file_id)

content!(openai, file_id)

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

create(openai, upload)

create!(openai, upload)

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

delete(openai, file_id)

delete!(openai, file_id)

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

list(openai)

list!(openai)

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

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

new(args)

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.

new_upload(args)

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.

retrieve(openai, file_id)

retrieve!(openai, file_id)

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