fix: add missing is_ready method to QdrantService to prevent AttributeError during chat stream retrieval
Browse files
src/services/qdrant_service.py
CHANGED
|
@@ -98,6 +98,9 @@ class QdrantService:
|
|
| 98 |
) -> List[Any]:
|
| 99 |
"""Hybrid search with metadata filtering."""
|
| 100 |
|
|
|
|
|
|
|
|
|
|
| 101 |
from qdrant_client.http import models as rest
|
| 102 |
|
| 103 |
filter_conditions = []
|
|
@@ -120,6 +123,10 @@ class QdrantService:
|
|
| 120 |
logger.error(f"Qdrant search failed: {e}")
|
| 121 |
return []
|
| 122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
def as_retriever(self, k: int = 5, metadata_filters: Dict[str, Any] = None):
|
| 124 |
"""Return a LangChain retriever interface with dynamic filters."""
|
| 125 |
from qdrant_client.http import models as rest
|
|
|
|
| 98 |
) -> List[Any]:
|
| 99 |
"""Hybrid search with metadata filtering."""
|
| 100 |
|
| 101 |
+
if not self.vectorstore:
|
| 102 |
+
return []
|
| 103 |
+
|
| 104 |
from qdrant_client.http import models as rest
|
| 105 |
|
| 106 |
filter_conditions = []
|
|
|
|
| 123 |
logger.error(f"Qdrant search failed: {e}")
|
| 124 |
return []
|
| 125 |
|
| 126 |
+
def is_ready(self) -> bool:
|
| 127 |
+
"""Check if the vector store is initialized and ready."""
|
| 128 |
+
return self.vectorstore is not None
|
| 129 |
+
|
| 130 |
def as_retriever(self, k: int = 5, metadata_filters: Dict[str, Any] = None):
|
| 131 |
"""Return a LangChain retriever interface with dynamic filters."""
|
| 132 |
from qdrant_client.http import models as rest
|