View Source OpenaiEx.Embedding (openai_ex v0.1.9)
This module provides an implementation of the OpenAI embeddings API. The API reference can be found at https://platform.openai.com/docs/api-reference/embeddings.
api-fields
API Fields
The following fields can be used as parameters when creating a new embedding:
:model
:input
:user
Link to this section Summary
Link to this section Functions
Calls the embedding endpoint.
arguments
Arguments
openai
: The OpenAI configuration to use.embedding
: The embedding request to send.
returns
Returns
A map containing the fields of the embedding response.
See https://platform.openai.com/docs/api-reference/embeddings/create for more information.
Creates a new embedding request with the given arguments.
arguments
Arguments
args
: A list of key-value pairs, or a map, representing the fields of the embedding request.
returns
Returns
A map containing the fields of the embedding request.
The :model
and :input
fields are required.
Example usage:
iex> _request = OpenaiEx.Embedding.new(model: "davinci", input: "This is a test")
%{input: "This is a test", model: "davinci"}
iex> _request = OpenaiEx.Embedding.new(%{model: "davinci", input: "This is a test"})
%{input: "This is a test", model: "davinci"}