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

Infercom 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

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
Usage · object
required

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

data
Embedding · object[]
required

The list of embeddings generated by the model.