Noizu.OpenAI.Api.Embedding (Noizu Labs: OpenAI v0.1.3)

Link to this section Summary

Functions

Generates embeddings for a list of strings using the specified model.

Link to this section Types

Link to this type

embeddings_options()

@type embeddings_options() ::
  %{
    optional(:model) =>
      Noizu.OpenAI.model_option(embeddings_supported_models()),
    optional(:user) => Noizu.OpenAI.user_option()
  }
  | Keyword.t()
Link to this type

embeddings_response()

@type embeddings_response() :: map()
Link to this type

embeddings_supported_models()

@type embeddings_supported_models() :: :"text-embedding-ada-002"

Link to this section Functions

Link to this function

create(input, options \\ nil)

@spec create(input :: String.t(), embeddings_options()) ::
  {:ok, embeddings_response()} | {:error, term()}

Generates embeddings for a list of strings using the specified model.

parameters

Parameters

  • input: A list of strings for which embeddings are to be generated
  • options: A map or keyword list of optional parameters (e.g., :model, :user)

returns

Returns

Returns a tuple {:ok, response} on successful API call, where response is a map containing the generated embeddings. Returns {:error, term} on failure, where term contains error details.

example

Example

input = ["apple", "orange", "banana"]
{:ok, response} = Noizu.OpenAI.embeddings(input)