struct OpenAI::EmbeddingRequest
- OpenAI::EmbeddingRequest
- Struct
- Value
- Object
Included Modules
- JSON::Serializable
Extended Modules
- JSON::Schema
Defined in:
openai/api/embeddings.crConstructors
- .new(model : OpenAI::EmbeddingModel, input : Array(Array(Int32)) | Array(String) | String, user : Nil | String = nil, encoding_format : OpenAI::EmbeddingEncoding = :float)
- .new(pull : JSON::PullParser)
Instance Method Summary
-
#encoding_format : EmbeddingEncoding
EmbeddingEncoding is the format of the embeddings data.
-
#input : String | Array(String) | Array(Array(Int32))
Input text to embed, encoded as a string or array of tokens.
-
#model : EmbeddingModel
ID of the model to use.
-
#user : String | Nil
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
Constructor Detail
Instance Method Detail
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".
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.
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.
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.