Embedding
Vektorerzeugung für semantische Suche und RAG.
| Model | mxbai-embed-large |
| Dimensionen | 1024 |
| Provider | Ollama (lokal) |
| Fallback | OpenAI (optional) |
Qdrant Collections
| Collection | Zweck | Dimensionen |
| documents | Dokument-Chunks | 1024 |
| mail | E-Mail-Inhalte | 1024 |
| entities | Entitäten-Embeddings | 1024 |
Qdrant-Konfiguration
{
"vectors": {
"size": 1024,
"distance": "Cosine"
},
"hnsw_config": {
"m": 16,
"ef_construct": 100
}
}
Model installieren
ollama pull mxbai-embed-large
ollama list
API-Aufruf
curl http://localhost:11434/api/embeddings -d '{
"model": "mxbai-embed-large",
"prompt": "Text zum Embedden"
}'
Python-Integration
import requests
def get_embedding(text: str) -> list[float]:
response = requests.post(
'http://localhost:11434/api/embeddings',
json={
'model': 'mxbai-embed-large',
'prompt': text
}
)
return response.json()['embedding']
Qdrant-Speicherung
from qdrant_client import QdrantClient
from qdrant_client.models import PointStruct
client = QdrantClient(host="localhost", port=6333)
client.upsert(
collection_name="documents",
points=[
PointStruct(
id=uuid4().hex,
vector=embedding,
payload={
"document_id": 123,
"chunk_id": 1,
"content_preview": text[:200]
}
)
]
)