OpenaiEx.Chat.Completions (openai_ex v0.9.0)

View Source

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

Summary

Functions

create(openai, chat_completion)

create(openai, chat_completion, list)

create!(openai, chat_completion)

create!(openai, chat_completion, list)

Calls the chat completion 'create' endpoint.

See https://platform.openai.com/docs/api-reference/chat/completions/create for more information.

new(args)

Creates a new chat completion request

Example usage:

iex> _request = OpenaiEx.Chat.Completions.new(model: "davinci", messages: [OpenaiEx.ChatMessage.user("Hello, world!")])
%{messages: [%{content: "Hello, world!", role: "user"}], model: "davinci"}

iex> _request = OpenaiEx.Chat.Completions.new(%{model: "davinci", messages: [OpenaiEx.ChatMessage.user("Hello, world!")]})
%{messages: [%{content: "Hello, world!", role: "user"}], model: "davinci"}