View Source OpenaiEx.Beta.Thread.Run (openai_ex v0.5.4)

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

API Fields

The following fields can be used as parameters for the messages API:

  • :assistant_id
  • :model
  • :instructions
  • :tools
  • :metadata

Summary

Functions

Calls the run create endpoint.

Returns a list of runs objects.

Creates a new run request with the given arguments.

Creates a new list runs request with the given arguments.

Calls the run retrieve endpoint.

Calls the run update endpoint.

Functions

Calls the run create endpoint.

Arguments

  • openai: The OpenAI configuration.
  • run: The run 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/runs/createRun for more information.

Link to this function

create_and_run(openai, params)

View Source
Link to this function

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

View Source

Returns a list of runs objects.

https://platform.openai.com/docs/api-reference/runs/listRuns

Creates a new run request with the given arguments.

Arguments

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

Returns

A map containing the fields of the run request.

The :thread_id and :assistant_id fields are required.

Example usage:

iex> _request = OpenaiEx.Beta.Thread.Run.new(thread_id: "thread_foo", assistant_id: "assistant_bar")
%{assistant_id: "assistant_bar", thread_id: "thread_foo"}

Creates a new list runs request with the given arguments.

Arguments

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

Returns

A map containing the fields of the list runs request.

Calls the run retrieve endpoint.

Arguments

  • openai: The OpenAI configuration.
  • params: Specification of the run to retrieve.

Returns

A map containing the fields of the run retrieve response.

https://platform.openai.com/docs/api-reference/runs/getRun

Link to this function

submit_tool_outputs(openai, map)

View Source

Calls the run update endpoint.

Arguments

  • openai: The OpenAI configuration.
  • params: run to update and new field values.

Returns

A map containing the API response.

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