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.
E5-Mistral-7B-Instruct
Section titled “E5-Mistral-7B-Instruct”- 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
codecontext_length_exceededandparaminput - Embedding dimensions: 4,096
- Supported languages: English, German, French, Italian, Portuguese, Hindi, Spanish, Thai
For setup and integration:
- Get an API key from the API keys and URLs page.
- Review sample implementations in the documentation.
- Generate embeddings using provided examples.
- Integrate embeddings into your application workflows.
For a detailed breakdown of available parameters, see the Embedding endpoint API reference.
Generating embeddings
Section titled “Generating embeddings”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.
Generating a single embedding
Section titled “Generating a single embedding”To generate an embedding for a single input text, use client.embeddings.create() with the model name and input string.
Example
Section titled “Example”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)from openai import OpenAI
client = OpenAI( 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)Example response
Section titled “Example 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 }}Generating multiple embeddings
Section titled “Generating multiple embeddings”To generate embeddings for multiple inputs in a single request, pass an array of input strings to the input parameter.
Example
Section titled “Example”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)from openai import OpenAI
client = OpenAI( 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)Example response
Section titled “Example 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] } ]}