NAME

OpenAPI::Client::OpenAI::Path::embeddings - Documentation for the /embeddings path.

DESCRIPTION

This document describes the API endpoint at /embeddings.

PATHS

POST /embeddings

Creates an embedding vector representing the input text.

Operation ID

createEmbedding

$client->createEmbedding( ... );

Parameters

Request Body

Content Type: application/json

Models

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.

  • text-embedding-ada-002

  • text-embedding-3-small

  • text-embedding-3-large

Example:

{
   "encoding_format" : "float",
   "input" : "The quick brown fox jumped over the lazy dog",
   "model" : "text-embedding-3-small",
   "user" : "user-1234"
}


         

Responses

Status Code: 200

OK

Content Types:

  • application/json

    Example (See the OpenAI spec for more detail):

    {
       "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"
       ],
       "usage" : null
    }

SEE ALSO

OpenAPI::Client::OpenAI::Path

COPYRIGHT AND LICENSE

Copyright (C) 2023-2025 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.