Skip to content
InfercomInfercomInfercom Documentation

Features

Implement Embeddings Features - Developer Guide

Implement embeddings with Infercom API. E5-Mistral-7B-Instruct for semantic search, RAG, and classification on EU-sovereign infrastructure.

An embedding is a vectorized numerical representation of data, where the relatedness between different pieces of information is captured through measurable distances. These embeddings are commonly used in applications such as recommendation systems, classification, and search.

  • Model: E5-Mistral-7B-Instruct
  • Description: High-quality multilingual embedding model based on Mistral 7B. Excels at semantic similarity, retrieval, and classification tasks across multiple languages.
  • Model ID: E5-Mistral-7B-Instruct
  • Context length: 4,096 tokens. A longer input returns HTTP 400 with code context_length_exceeded and param input
  • Embedding dimensions: 4,096
  • Supported languages: English, German, French, Italian, Portuguese, Hindi, Spanish, Thai

For setup and integration:

  1. Get an API key from the API keys and URLs page.
  2. Review sample implementations in the documentation.
  3. Generate embeddings using provided examples.
  4. Integrate embeddings into your application workflows.

For a detailed breakdown of available parameters, see the Embedding endpoint API reference.

The Infercom Embeddings API is designed for seamless integration with existing applications and follows OpenAI’s embeddings API structure, simplifying migration and adoption.

The model takes in text as input and outputs a vector of floating-point numbers, which can be used for tasks like similarity searches.

To generate an embedding for a single input text, use client.embeddings.create() with the model name and input string.

from sambanova import SambaNova
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
response = client.embeddings.create(
model="E5-Mistral-7B-Instruct",
input="The quick brown fox jumps over the lazy dog"
)
print(response)
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [0.002843, -0.017531, ..., 0.012934],
"index": 0
}
],
"model": "E5-Mistral-7B-Instruct",
"usage": {
"prompt_tokens": 10,
"total_tokens": 10
}
}

To generate embeddings for multiple inputs in a single request, pass an array of input strings to the input parameter.

from sambanova import SambaNova
client = SambaNova(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
response = client.embeddings.create(
model="E5-Mistral-7B-Instruct",
input=[
"Our solar system orbits the Milky Way galaxy at about 515,000 mph",
"Jupiter's Great Red Spot is a storm that has been raging for at least 350 years."
]
)
print(response)
{
"model": "E5-Mistral-7B-Instruct",
"object": "list",
"data": [
{
"index": 0,
"object": "embedding",
"embedding": [0.2633975, 0.13856208, ..., 0.04331574]
},
{
"index": 1,
"object": "embedding",
"embedding": [-0.14496337, 0.21044481, ..., -0.16187587]
}
]
}