View Source OpenaiEx.Edit (openai_ex v0.1.9)

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

api-fields

API Fields

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

  • :model
  • :input
  • :instruction
  • :n
  • :temperature
  • :top_p

Link to this section Summary

Functions

Calls the edit endpoint.

Creates a new edit request with the given arguments.

Link to this section Functions

Calls the edit endpoint.

arguments

Arguments

  • openai: The OpenAI configuration.
  • edit: The edit request, as a map with keys corresponding to the API fields.

returns

Returns

A map containing the fields of the edit response.

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

Creates a new edit request with the given arguments.

arguments

Arguments

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

returns

Returns

A map containing the fields of the edit request.

The :model and :instruction fields are required.

Example usage:

iex> _request = OpenaiEx.Edit.new(model: "davinci", instruction: "This is a test")
%{instruction: "This is a test", model: "davinci"}

iex> _request = OpenaiEx.Edit.new(%{model: "davinci", instruction: "This is a test"})
%{instruction: "This is a test", model: "davinci"}