Embeddings
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
Authorization
: Bearer <your-api-key>
Request body parameters
Parameter | Type | Description | Required |
---|---|---|---|
input | String or array of strings | The input text to be embedded. Must not exceed the model’s token limit. | Yes |
model | String | The 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
Example response
Response properties
The API response consists of the following properties:
Property | Type | Description |
---|---|---|
object | String | The type of response, always list . |
data | Array | A list of embedding objects. |
model | String | The name of the model used to generate embeddings. |
usage | Object | Token usage statistics for the request, including prompt_tokens . |
Embedding object
Property | Type | Description |
---|---|---|
object | String | Always embedding . |
embedding | Array | The embedding vector, represented as a list of floats. |
index | Integer | The index of the embedding in the list of embeddings. |
Error handling
See API error codes page for more information.
Error type | HTTP code | Description | Code |
---|---|---|---|
Invalid request error | 400 | An issue with the request parameters, e.g., model not compatible or input too long. | invalid_request_error |
Authentication error | 401 | The provided API key is invalid. | invalid_authentication |
Rate limit exceeded | 429 | Request quota exceeded. | insufficient_quota |
Request timeout | 408 | The request timed out. | request_timeout |