struct

OpenAI::EmbeddingRequest

Inherits JSON::Serializable / Struct / Value / Object

Constructors

new(model : OpenAI::EmbeddingModel, input : Array(Array(Int32)) | Array(String) | String, user : Nil | String = nil, encoding_format : OpenAI::EmbeddingEncoding = :float)
Source
new(pull : JSON::PullParser)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

encoding_format

EmbeddingEncoding is the format of the embeddings data. Currently, only float and base64 are supported, however, base64 is not officially documented. If not specified OpenAI will use "float".

Source
input

Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed the max input tokens for the model (8191 tokens for EmbeddingModel::AdaEmbeddingV2) and cannot be an empty string.

Source
model

ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.

Source
user

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.

Source