Mistral AI / mistral-embed
Task: Embedding
Modality: Text
Similarity Metric: Any (Normalized)
License: Proprietary
Dimensions: 1024
Max Input Tokens: 8000
Price: $0.10 / 1M tokens
Introduction to mistral-embed
- A specialized embedding model for text data with a context window of 8,000 tokens.
- Optimized for semantic search and RAG applications.
- MTEB retrieval score: 55.26.
How to create embeddings with mistral-embed
We recommend using Mistral AI Library, the Python SDK offered by Mistral AI, to create vector embeddings.
Once the vector embeddings are generated, they can be stored in Zilliz Cloud (a fully managed vector database service powered by Milvus) and used for semantic similarity search. Here are four key steps:
- Sign up for a Zilliz Cloud account for free.
- Set up a serverless cluster and obtain the Public Endpoint and API Key.
- Create a vector collection and insert your vector embeddings.
- Run a semantic search on the stored embeddings.
Generate vector embeddings via Mistral AI’s SDK and insert them into Zilliz Cloud for semantic search
from pymilvus import MilvusClient
from mistralai import Mistral
MISTRALAI_API_KEY = "your-mistral-api-key"
client = Mistral(api_key=MISTRALAI_API_KEY)
docs = [
"Artificial intelligence was founded as an academic discipline in 1956.",
"Alan Turing was the first person to conduct substantial research in AI.",
"Born in Maida Vale, London, Turing was raised in southern England."
]
# Generate embeddings for documents
results = client.embeddings.create(inputs=docs, model="mistral-embed")
docs_embeddings = [data.embedding for data in results.data]
queries = ["When was artificial intelligence founded",
"Where was Alan Turing born?"]
# Generate embeddings for queries
response = client.embeddings.create(inputs=queries, model="mistral-embed")
query_embeddings = [data.embedding for data in response.data]
# Connect to Zilliz Cloud with Public Endpoint and API Key
client = MilvusClient(
uri=ZILLIZ_PUBLIC_ENDPOINT,
token=ZILLIZ_API_KEY)
COLLECTION = "documents"
if client.has_collection(collection_name=COLLECTION):
client.drop_collection(collection_name=COLLECTION)
client.create_collection(
collection_name=COLLECTION,
dimension=1024,
auto_id=True)
for doc, embedding in zip(docs, docs_embeddings):
client.insert(COLLECTION, {"text": doc, "vector": embedding})
results = client.search(
collection_name=COLLECTION,
data=query_embeddings,
consistency_level="Strong",
output_fields=["text"])
For more information, refer to Mistral AI documentation.
Start Free, Scale Easily
Try the fully-managed vector database built for your GenAI applications.
Try Zilliz Cloud for Free