View Source OpenaiEx.Beta.Assistants (openai_ex v0.8.6)

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

Summary

Functions

Calls the assistant 'create' endpoint.

Calls the assistant delete endpoint.

Returns a list of assistant objects.

Creates a new assistants request with the given arguments.

Creates a new list assistants request with the given arguments.

Calls the assistant retrieve endpoint.

Calls the assistant update endpoint.

Functions

create(openai, assistant)

create!(openai, assistant)

Calls the assistant 'create' endpoint.

Arguments

  • openai: The OpenAI configuration.
  • assistant: The assistant request, as a map with keys corresponding to the API fields.

Returns

A map containing the API response.

See https://platform.openai.com/docs/api-reference/assistants/createAssistant for more information.

delete(openai, assistant_id)

delete!(openai, assistant_id)

Calls the assistant delete endpoint.

Arguments

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

Returns

A map containing the fields of the assistant delete response.

https://platform.openai.com/docs/api-reference/assistants/deleteAssistant

list(openai, params \\ %{})

list!(openai, params \\ %{})

Returns a list of assistant objects.

https://platform.openai.com/docs/api-reference/assistants/listAssistants

new(args)

Creates a new assistants request with the given arguments.

Arguments

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

Returns

A map containing the fields of the assistant request.

The :model field is required.

Example usage:

iex> _request = OpenaiEx.Beta.Assistants.new(model: "gpt-4-turbo")
%{model: "gpt-4-turbo"}

new_list(args)

Creates a new list assistants request with the given arguments.

Arguments

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

Returns

A map containing the fields of the list assistants request.

retrieve(openai, assistant_id)

retrieve!(openai, assistant_id)

Calls the assistant retrieve endpoint.

Arguments

  • openai: The OpenAI configuration.
  • assistant_id: The ID of the assistant to retrieve.

Returns

A map containing the fields of the file retrieve response.

https://platform.openai.com/docs/api-reference/assistants/getAssistant

update(openai, assistant_id, assistant)

update!(openai, assistant_id, assistant)

Calls the assistant update endpoint.

Arguments

  • openai: The OpenAI configuration.
  • assistant_id: The ID of the assistant to update.
  • assistant: The assistant request, as a map with keys corresponding to the API fields.

Returns

A map containing the API response.

See https://platform.openai.com/docs/api-reference/assistants/modifyAssistant for more information.