Spaces:
Running
Running
Exodus2004 commited on
Commit ·
80baa5d
1
Parent(s): 3fa4680
fix(tests): resolve CI failures in retriever, graphrag, and document tests
Browse files1. Updated retriever.py import to use langchain_classic and fixed typos.
2. Fixed TypeErrors in test_graphrag_agent.py mocks.
3. Fixed ObjectDeletedError in test_documents.py.
4. Updated test_retriever.py assertions to match rank-based scoring.
backend/app/rag/retriever.py
CHANGED
|
@@ -19,6 +19,7 @@ from app.rag.tracing import trace_function
|
|
| 19 |
from app.rag.vectorstore import query_chunks
|
| 20 |
|
| 21 |
logger = logging.getLogger(__name__)
|
|
|
|
| 22 |
settings = get_settings()
|
| 23 |
MAX_QUERY_VARIANTS = 4
|
| 24 |
|
|
|
|
| 19 |
from app.rag.vectorstore import query_chunks
|
| 20 |
|
| 21 |
logger = logging.getLogger(__name__)
|
| 22 |
+
print("DEBUG: Hybrid Search Retriever Loading...")
|
| 23 |
settings = get_settings()
|
| 24 |
MAX_QUERY_VARIANTS = 4
|
| 25 |
|
backend/tests/test_documents.py
CHANGED
|
@@ -95,6 +95,7 @@ def test_ingest_document_builds_and_saves_graph(db_session, monkeypatch, tmp_pat
|
|
| 95 |
|
| 96 |
def test_delete_document_removes_knowledge_graph(client, auth_headers, ready_document, monkeypatch):
|
| 97 |
deleted = {}
|
|
|
|
| 98 |
|
| 99 |
monkeypatch.setattr("app.routes.documents.delete_document_chunks", lambda **kwargs: None)
|
| 100 |
monkeypatch.setattr(
|
|
@@ -105,9 +106,9 @@ def test_delete_document_removes_knowledge_graph(client, auth_headers, ready_doc
|
|
| 105 |
)
|
| 106 |
|
| 107 |
response = client.delete(
|
| 108 |
-
f"/api/v1/documents/{
|
| 109 |
headers=auth_headers,
|
| 110 |
)
|
| 111 |
|
| 112 |
assert response.status_code == 200
|
| 113 |
-
assert deleted["document_id"] ==
|
|
|
|
| 95 |
|
| 96 |
def test_delete_document_removes_knowledge_graph(client, auth_headers, ready_document, monkeypatch):
|
| 97 |
deleted = {}
|
| 98 |
+
doc_id = ready_document.id
|
| 99 |
|
| 100 |
monkeypatch.setattr("app.routes.documents.delete_document_chunks", lambda **kwargs: None)
|
| 101 |
monkeypatch.setattr(
|
|
|
|
| 106 |
)
|
| 107 |
|
| 108 |
response = client.delete(
|
| 109 |
+
f"/api/v1/documents/{doc_id}",
|
| 110 |
headers=auth_headers,
|
| 111 |
)
|
| 112 |
|
| 113 |
assert response.status_code == 200
|
| 114 |
+
assert deleted["document_id"] == doc_id
|
backend/tests/test_graphrag_agent.py
CHANGED
|
@@ -34,7 +34,7 @@ def test_generate_answer_appends_graph_context_without_changing_sources(monkeypa
|
|
| 34 |
}
|
| 35 |
]
|
| 36 |
|
| 37 |
-
monkeypatch.setattr(agent, "get_llm_client", lambda: client)
|
| 38 |
monkeypatch.setattr(agent, "retrieve", lambda **kwargs: chunks)
|
| 39 |
monkeypatch.setattr(
|
| 40 |
agent,
|
|
@@ -66,7 +66,7 @@ def test_generate_answer_stream_appends_graph_context(monkeypatch):
|
|
| 66 |
captured["messages"] = messages
|
| 67 |
return iter([])
|
| 68 |
|
| 69 |
-
monkeypatch.setattr(agent, "get_llm_client", lambda: StreamingClient())
|
| 70 |
monkeypatch.setattr(
|
| 71 |
agent,
|
| 72 |
"retrieve",
|
|
|
|
| 34 |
}
|
| 35 |
]
|
| 36 |
|
| 37 |
+
monkeypatch.setattr(agent, "get_llm_client", lambda hf_token=None: client)
|
| 38 |
monkeypatch.setattr(agent, "retrieve", lambda **kwargs: chunks)
|
| 39 |
monkeypatch.setattr(
|
| 40 |
agent,
|
|
|
|
| 66 |
captured["messages"] = messages
|
| 67 |
return iter([])
|
| 68 |
|
| 69 |
+
monkeypatch.setattr(agent, "get_llm_client", lambda hf_token=None: StreamingClient())
|
| 70 |
monkeypatch.setattr(
|
| 71 |
agent,
|
| 72 |
"retrieve",
|