struct OpenAI::EmbeddingRequest

Included Modules

Extended Modules

Defined in:

openai/api/embeddings.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(model : OpenAI::EmbeddingModel, input : Array(Array(Int32)) | Array(String) | String, user : Nil | String = nil, encoding_format : OpenAI::EmbeddingEncoding = :float) #

[View source]
def self.new(pull : JSON::PullParser) #

[View source]

Instance Method Detail

def encoding_format : EmbeddingEncoding #

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".


[View source]
def input : String | Array(String) | Array(Array(Int32)) #

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.


[View source]
def model : EmbeddingModel #

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.


[View source]
def user : String | Nil #

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


[View source]