View Source OpenaiEx.Beta.Assistant (openai_ex v0.5.4)

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.

API Fields

The following fields can be used as parameters when creating a new assistant:

  • :model
  • :name
  • :description
  • :instructions
  • :tools
  • :file_ids
  • :metadata

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

Link to this function

create(openai, assistant)

View Source

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.

Link to this function

delete(openai, assistant_id)

View Source

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

Link to this function

list(openai, params \\ %{})

View Source

Returns a list of assistant objects.

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

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.Assistant.new(model: "gpt-4-turbo")
%{model: "gpt-4-turbo"}

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.

Link to this function

retrieve(openai, assistant_id)

View Source

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

Link to this function

update(openai, assistant_id, assistant)

View Source

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.