POST/embeddings

Create embeddings

This endpoint creates an embedding vector representing the input text.

Request body

  • Name
    input
    Type
    string or array
    Description

    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 an array of token arrays.

  • Name
    model
    Type
    string
    Description

    ID of the model to use.

Optional attributes

MindsDB Inference Endpoints are OpenAI compatible. For the full supported attributes check the OpenAI Docs.

Request

POST
/embeddings
curl https://llm.mdb.ai/embeddings \
  -H "Authorization: Bearer $MINDSDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "The food was delicious and the waiter...",
    "model": "text-embedding-ada-002",
    "encoding_format": "float"
  }'

Response

{
   "object": "list",
    "data": [
      {
        "object": "embedding",
        "embedding": [
          0.0023064255,
          -0.009327292,
          .... (1536 floats total for ada-002)
          -0.0028842222,
        ],
        "index": 0
      }
    ],
    "model": "text-embedding-ada-002",
    "usage": {
      "prompt_tokens": 8,
      "total_tokens": 8
    }
}

Was this page helpful?