Skip to main content
POST
/
embeddings
JavaScript
import SambaNova from 'sambanova';

const client = new SambaNova({
  apiKey: 'My API Key',
});

const embeddingsResponse = await client.embeddings.create({
  input: ['text to embed number 1', 'text to embed number 2'],
  model: 'E5-Mistral-7B-Instruct',
});

console.log(embeddingsResponse.data);
{
  "data": [
    {
      "index": 0,
      "object": "embedding",
      "embedding": [
        0.024864232167601585,
        -0.01452154759317636,
        0.008880083449184895
      ]
    },
    {
      "index": 1,
      "object": "embedding",
      "embedding": [
        0.010919672437012196,
        0.0016351072117686272,
        0.008019134402275085
      ]
    }
  ],
  "model": "E5-Mistral-7B-Instruct",
  "object": "list",
  "usage": {
    "prompt_tokens": 716,
    "total_tokens": 716
  }
}

Authorizations

Authorization
string
header
required

SambaNova API Key

Body

application/json

Texts to embed and parameters

embeddings request object

model
required

The model ID to use See available models

input
required

Input text to embed. to embed multiple inputs in a single request, pass an array of strings. The input must not exceed the max input tokens for the model The string that will be turned into an embedding.

Response

Successful response

Embeddings response returned by the model

object
enum<string>
required

The object type, which is always "list".

Available options:
list
model
string
required

The name of the model used to generate the embedding.

usage
object | null
required

Usage metrics for the completion, embeddings,transcription or translation request

Examples:
{
"acceptance_rate": 4.058139324188232,
"completion_tokens": 350,
"completion_tokens_after_first_per_sec": 248.09314856382406,
"completion_tokens_after_first_per_sec_first_ten": 249.67922929952655,
"completion_tokens_after_first_per_sec_graph": 452.5030493415834,
"completion_tokens_per_sec": 238.91966176995348,
"end_time": 1737583289.7345645,
"is_last_response": true,
"prompt_tokens_details": { "cached_tokens": 0 },
"prompt_tokens": 43,
"start_time": 1737583288.264706,
"time_to_first_token": 0.06312894821166992,
"total_latency": 1.4649275719174653,
"total_tokens": 393,
"total_tokens_per_sec": 268.27264878740493
}
{ "prompt_tokens": 43, "total_tokens": 393 }
data
Embedding · object[]
required

The list of embeddings generated by the model.

I