NAME
OpenAPI::Client::OpenAI::Path::embeddings - Documentation for the /embeddings path.
OPERATIONS
POST /embeddings
createEmbedding
$client->create_embedding({
body => { ... },
});
Creates an embedding vector representing the input text.
Responses
200 - OK
Content-Type: application/json
Example:
{
"data" : [
"{\n \"object\": \"embedding\",\n \"embedding\": [\n 0.0023064255,\n -0.009327292,\n .... (1536 floats total for ada-002)\n -0.0028842222,\n ],\n \"index\": 0\n}\n"
],
"model" : "string",
"object" : "list",
"usage" : {
"prompt_tokens" : 0,
"total_tokens" : 0
}
}
SCHEMAS
CreateEmbeddingRequest
Properties:
dimensions(integer) - The number of dimensions the resulting output embeddings should have. Only supported intext-embedding-3and later models.encoding_format(string) - The format to return the embeddings in. Can be eitherfloatorbase64.Allowed values: float, base64
Default: float
input(oneOf, required) - 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. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. Example Python code for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request.model(anyOf, required) - 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.user(string) - A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more .
CreateEmbeddingResponse
Properties:
data(array of Embedding, required) - The list of embeddings generated by the model.model(string, required) - The name of the model used to generate the embedding.object(string, required) - The object type, which is always "list".Allowed values: list
usage(object, required) - The usage information for the request.
Embedding
Properties:
embedding(array of number, required) - The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the embedding guide .index(integer, required) - The index of the embedding in the list of embeddings.object(string, required) - The object type, which is always "embedding".Allowed values: embedding
SEE ALSO
COPYRIGHT AND LICENSE
Copyright (C) 2023-2026 by Nelson Ferraz
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.