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

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

API Fields

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

  • :messages
  • :metadata

Summary

Functions

Calls the thread create endpoint.

Calls the thread delete endpoint.

Creates a new threads request with the given arguments.

Calls the thread retrieve endpoint.

Calls the thread update endpoint.

Functions

Link to this function

create(openai, params \\ %{})

View Source

Calls the thread create endpoint.

Arguments

  • openai: The OpenAI configuration.
  • params: A map containing the fields of the thread create request.

Returns

A map containing the fields of the created thread object.

https://platform.openai.com/docs/api-reference/threads/createThread

Link to this function

delete(openai, thread_id)

View Source

Calls the thread delete endpoint.

Arguments

  • openai: The OpenAI configuration.
  • params: A map containing the fields of the thread delete request.

Returns

A map containing the fields of the thread delete response.

https://platform.openai.com/docs/api-reference/threads/deleteThread

Creates a new threads request with the given arguments.

Arguments

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

Returns

A map containing the fields of the threads request.

Link to this function

retrieve(openai, thread_id)

View Source

Calls the thread retrieve endpoint.

Arguments

  • openai: The OpenAI configuration.
  • thread_id: The ID of the thread to retrieve.

Returns

A map containing the fields of the specificied thread object.

https://platform.openai.com/docs/api-reference/threads/getThread

Link to this function

update(openai, thread_id, params)

View Source

Calls the thread update endpoint.

Arguments

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

Returns

A map containing the fields of the modified thread.

https://platform.openai.com/docs/api-reference/threads/modifyThread