mirror of
https://github.com/hanzoai/chat-rag-api.git
synced 2026-10-30 18:45:41 +00:00
Extracted from the deployed chat-rag-api:0.7.8-hanzo image; adds a Qdrant vector store targeting hanzoai/vector as a drop-in for pgvector. - app/services/vector_store/qdrant_vector.py: QdrantVector(QdrantVectorStore) with the id helpers (get_all_ids/get_filtered_ids/get_documents_by_ids), delete-by-file_id, and the route's Mongo-style file_id filter translated to native Qdrant filters. file_id stored in payload metadata (unique point ids). - factory.get_vector_store: mode='qdrant' (lazy import; pg/atlas deploys unaffected). - config: VectorDBType.QDRANT + QDRANT_URL/QDRANT_API_KEY/QDRANT_DISTANCE/ EMBEDDINGS_DIM(1536) + construction branch. - health: qdrant_health_check (client.get_collections()). - requirements: langchain-qdrant==0.2.0, qdrant-client==1.12.1. Verified: pytest tests/test_qdrant_vector.py (4 tests) against in-memory Qdrant; factory builds QdrantVector with all route methods present.
16 lines
462 B
Python
16 lines
462 B
Python
# app/services/mongo_client.py
|
|
import logging
|
|
from pymongo import MongoClient
|
|
from pymongo.errors import PyMongoError
|
|
from app.config import ATLAS_MONGO_DB_URI
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
async def mongo_health_check() -> bool:
|
|
try:
|
|
client = MongoClient(ATLAS_MONGO_DB_URI)
|
|
client.admin.command("ping")
|
|
return True
|
|
except PyMongoError as e:
|
|
logger.error(f"MongoDB health check failed: {e}")
|
|
return False |