25 lines
719 B
Python
25 lines
719 B
Python
from sentence_transformers import SentenceTransformer
|
|
from qdrant_client import QdrantClient
|
|
from qdrant_client.models import VectorParams, Distance
|
|
import os
|
|
|
|
# Embedding-Modell
|
|
model = SentenceTransformer("all-MiniLM-L6-v2")
|
|
|
|
# Qdrant-Client
|
|
qdrant = QdrantClient(
|
|
host=os.getenv("QDRANT_HOST", "localhost"),
|
|
port=int(os.getenv("QDRANT_PORT", 6333))
|
|
)
|
|
|
|
# Collections initialisieren
|
|
for coll in ["exercises", "training_plans"]:
|
|
if not qdrant.collection_exists(coll):
|
|
qdrant.recreate_collection(
|
|
collection_name=coll,
|
|
vectors_config=VectorParams(
|
|
size=model.get_sentence_embedding_dimension(),
|
|
distance=Distance.COSINE
|
|
)
|
|
)
|