The SambaNova Cloud Embeddings API generates vector representations (embeddings) of input text, facilitating tasks such as semantic similarity analysis, clustering, search optimization, and retrieval-augmented generation (RAG). This API enables developers to integrate advanced AI capabilities into their applications by transforming textual data into structured numerical representations.

Endpoint

The API provides an endpoint to generate embedding vectors for input text.

Request

POST https://api.sambanova.ai/v1/embeddings

Authorization: Bearer <your-api-key>

Request body parameters

ParameterTypeDescriptionRequired
inputString or array of stringsThe input text to be embedded. Must not exceed the model’s token limit.Yes
modelStringThe model used to generate embeddings (e.g., E5-Mistral-7B-Instruct).Yes

This API ensures efficient embedding generation, supporting multiple input formats while enforcing model constraints.

Example request

The following example demonstrates how to send a request to the SambaNova Cloud Embeddings API using curl.

CURL request

CURL request
curl https://api.sambanova.ai/v1/embeddings \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "The curious fox dashed through the golden field.",
    "model": "E5-Mistral-7B-Instruct"
  }'

Example response

Example response
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [0.00333473, -0.0223934397434, ..., -0.013434322],
      "index": 0
    }
  ],
  "model": "E5-Mistral-7B-Instruct",
  "usage": {
    "prompt_tokens": 28,
    "total_tokens": 28
  }
}

Response properties

The API response consists of the following properties:

PropertyTypeDescription
objectStringThe type of response, always list.
dataArrayA list of embedding objects.
modelStringThe name of the model used to generate embeddings.
usageObjectToken usage statistics for the request, including prompt_tokens.

Embedding object

PropertyTypeDescription
objectStringAlways embedding.
embeddingArrayThe embedding vector, represented as a list of floats.
indexIntegerThe index of the embedding in the list of embeddings.

Error handling

See API error codes page for more information.

Error typeHTTP codeDescriptionCode
Invalid request error400An issue with the request parameters, e.g., model not compatible or input too long.invalid_request_error
Authentication error401The provided API key is invalid.invalid_authentication
Rate limit exceeded429Request quota exceeded.insufficient_quota
Request timeout408The request timed out.request_timeout

Example error response

Example error response
{
  "error": {
    "message": "Model 'model_name' does not support embeddings.",
    "type": "invalid_request_error",
    "param": "model",
    "code": "model_not_compatible"
  }
}