OpenaiEx.Conversations (openai_ex v0.9.22)

Copy Markdown View Source

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

Summary

Functions

Creates a new conversation.

Deletes a conversation.

Creates a new conversation request with the given arguments.

Retrieves a specific conversation by ID.

Updates a conversation's metadata.

Functions

create(openai, request \\ %{})

create!(openai, request \\ %{})

Creates a new conversation.

See https://platform.openai.com/docs/api-reference/conversations/create

delete(openai, conversation_id)

delete!(openai, conversation_id)

Deletes a conversation.

See https://platform.openai.com/docs/api-reference/conversations/delete

new(args)

Creates a new conversation request with the given arguments.

Examples

iex> OpenaiEx.Conversations.new(metadata: %{"user_id" => "123"})
%{metadata: %{"user_id" => "123"}}

iex> OpenaiEx.Conversations.new(items: [%{type: "message", role: "user", content: [%{type: "input_text", text: "Hello"}]}])
%{items: [%{type: "message", role: "user", content: [%{type: "input_text", text: "Hello"}]}]}

iex> OpenaiEx.Conversations.new([])
%{}

retrieve(openai, conversation_id)

retrieve!(openai, conversation_id)

Retrieves a specific conversation by ID.

See https://platform.openai.com/docs/api-reference/conversations/retrieve

update(openai, conversation_id, request)

update!(openai, conversation_id, request)

Updates a conversation's metadata.

See https://platform.openai.com/docs/api-reference/conversations/update