Spaces:
Running
Running
GitHub Actions commited on
Commit ·
5fed3ee
1
Parent(s): a9c06ad
Deploy 4992b4c
Browse files- app/services/vector_store.py +12 -12
- pytest.ini +1 -0
app/services/vector_store.py
CHANGED
|
@@ -238,15 +238,16 @@ class VectorStore:
|
|
| 238 |
]
|
| 239 |
qdrant_filter = Filter(must=must_conditions)
|
| 240 |
|
| 241 |
-
|
| 242 |
collection_name=self.collection,
|
| 243 |
-
|
|
|
|
| 244 |
limit=top_k,
|
| 245 |
query_filter=qdrant_filter,
|
| 246 |
with_payload=True,
|
| 247 |
)
|
| 248 |
|
| 249 |
-
return [Chunk(**hit.payload) for hit in
|
| 250 |
|
| 251 |
except Exception as exc:
|
| 252 |
raise RetrievalError(
|
|
@@ -268,12 +269,10 @@ class VectorStore:
|
|
| 268 |
if not indices:
|
| 269 |
return []
|
| 270 |
try:
|
| 271 |
-
|
| 272 |
collection_name=self.collection,
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
vector=SparseVector(indices=indices, values=values),
|
| 276 |
-
),
|
| 277 |
limit=top_k,
|
| 278 |
query_filter=Filter(
|
| 279 |
must=[
|
|
@@ -285,7 +284,7 @@ class VectorStore:
|
|
| 285 |
),
|
| 286 |
with_payload=True,
|
| 287 |
)
|
| 288 |
-
return [Chunk(**hit.payload) for hit in
|
| 289 |
|
| 290 |
except Exception as exc:
|
| 291 |
# Sparse index may not exist on old collections — log and continue.
|
|
@@ -349,9 +348,10 @@ class VectorStore:
|
|
| 349 |
returned by the main dense search in retrieve.py).
|
| 350 |
"""
|
| 351 |
try:
|
| 352 |
-
|
| 353 |
collection_name=self.collection,
|
| 354 |
-
|
|
|
|
| 355 |
limit=top_k,
|
| 356 |
query_filter=Filter(
|
| 357 |
must=[
|
|
@@ -363,7 +363,7 @@ class VectorStore:
|
|
| 363 |
),
|
| 364 |
with_payload=True,
|
| 365 |
)
|
| 366 |
-
return [Chunk(**hit.payload) for hit in
|
| 367 |
except Exception as exc:
|
| 368 |
logger.warning(
|
| 369 |
"search_by_raptor_level(level=%d) failed: %s — skipping RAPTOR results.", level, exc
|
|
|
|
| 238 |
]
|
| 239 |
qdrant_filter = Filter(must=must_conditions)
|
| 240 |
|
| 241 |
+
response = self.client.query_points(
|
| 242 |
collection_name=self.collection,
|
| 243 |
+
query=query_vector,
|
| 244 |
+
using=_DENSE_VEC,
|
| 245 |
limit=top_k,
|
| 246 |
query_filter=qdrant_filter,
|
| 247 |
with_payload=True,
|
| 248 |
)
|
| 249 |
|
| 250 |
+
return [Chunk(**hit.payload) for hit in response.points if hit.payload]
|
| 251 |
|
| 252 |
except Exception as exc:
|
| 253 |
raise RetrievalError(
|
|
|
|
| 269 |
if not indices:
|
| 270 |
return []
|
| 271 |
try:
|
| 272 |
+
response = self.client.query_points(
|
| 273 |
collection_name=self.collection,
|
| 274 |
+
query=SparseVector(indices=indices, values=values),
|
| 275 |
+
using=_SPARSE_VEC,
|
|
|
|
|
|
|
| 276 |
limit=top_k,
|
| 277 |
query_filter=Filter(
|
| 278 |
must=[
|
|
|
|
| 284 |
),
|
| 285 |
with_payload=True,
|
| 286 |
)
|
| 287 |
+
return [Chunk(**hit.payload) for hit in response.points if hit.payload]
|
| 288 |
|
| 289 |
except Exception as exc:
|
| 290 |
# Sparse index may not exist on old collections — log and continue.
|
|
|
|
| 348 |
returned by the main dense search in retrieve.py).
|
| 349 |
"""
|
| 350 |
try:
|
| 351 |
+
response = self.client.query_points(
|
| 352 |
collection_name=self.collection,
|
| 353 |
+
query=query_vector,
|
| 354 |
+
using=_DENSE_VEC,
|
| 355 |
limit=top_k,
|
| 356 |
query_filter=Filter(
|
| 357 |
must=[
|
|
|
|
| 363 |
),
|
| 364 |
with_payload=True,
|
| 365 |
)
|
| 366 |
+
return [Chunk(**hit.payload) for hit in response.points if hit.payload]
|
| 367 |
except Exception as exc:
|
| 368 |
logger.warning(
|
| 369 |
"search_by_raptor_level(level=%d) failed: %s — skipping RAPTOR results.", level, exc
|
pytest.ini
CHANGED
|
@@ -6,3 +6,4 @@ python_functions = test_*
|
|
| 6 |
addopts = -x --tb=short -q
|
| 7 |
filterwarnings =
|
| 8 |
ignore::DeprecationWarning:slowapi.*
|
|
|
|
|
|
| 6 |
addopts = -x --tb=short -q
|
| 7 |
filterwarnings =
|
| 8 |
ignore::DeprecationWarning:slowapi.*
|
| 9 |
+
ignore:The default value of `allowed_objects` will change:langchain_core._api.deprecation.LangChainPendingDeprecationWarning
|