You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

34 lines
1.1 KiB

"""
Vector store configurations
"""
from agno.vectordb.qdrant import Qdrant
from agno.vectordb.search import SearchType
import os
# ❌ REMOVE THIS IMPORT
# from .embeddings import get_local_embedder
def get_qdrant_store(collection_name=None, url=None, embedder=None):
"""Get configured Qdrant vector store"""
# 1. ⚠️ CRITICAL CHECK FIRST
# We MUST fail if no embedder is provided, rather than guessing a default
if embedder is None:
raise ValueError("You must provide an 'embedder' instance to get_qdrant_store!")
# 2. Use env var if argument is missing, otherwise use default
base_collection = collection_name or os.getenv("BASE_COLLECTION_NAME")
collection = f"{base_collection}_{embedder.id}_hybrid"
qdrant_host = os.getenv("QDRANT_HOST")
qdrant_port = os.getenv("QDRANT_PORT")
qdrant_api_key = os.getenv("QDRANT_API_KEY")
qdrant_url = f"http://{qdrant_host}:{qdrant_port}"
print(f"Collection: {collection}")
return Qdrant(
collection=collection,
url=qdrant_url,
embedder=embedder,
timeout=10.0,
api_key=qdrant_api_key,
search_type=SearchType.hybrid
)