Minor formatting update
Browse files- backend/app/vectorstore.py +3 -3
- backend/tests/test_api.py +1 -2
- frontend/src/setup.ts +1 -0
backend/app/vectorstore.py
CHANGED
@@ -139,15 +139,15 @@ def get_all_unique_source_of_docs_in_collection(
|
|
139 |
|
140 |
|
141 |
# TODO This is a dumb hack to get around Qdrant client restrictions when using local file storage.
|
142 |
-
# Instead of using the client directly, we use QdrantVectorStore's similarity search
|
143 |
# with a dummy query to get all documents, then extract unique sources.
|
144 |
def get_all_unique_source_of_docs_in_collection_DUMB(
|
145 |
collection_name: str = PROBLEMS_REFERENCE_COLLECTION_NAME,
|
146 |
) -> List[str]:
|
147 |
vector_store = get_vector_db()
|
148 |
# Use a very generic query that should match everything
|
149 |
-
docs = vector_store.similarity_search("",k=1000)
|
150 |
-
|
151 |
sources = set()
|
152 |
for doc in docs:
|
153 |
if doc.metadata and "title" in doc.metadata:
|
|
|
139 |
|
140 |
|
141 |
# TODO This is a dumb hack to get around Qdrant client restrictions when using local file storage.
|
142 |
+
# Instead of using the client directly, we use QdrantVectorStore's similarity search
|
143 |
# with a dummy query to get all documents, then extract unique sources.
|
144 |
def get_all_unique_source_of_docs_in_collection_DUMB(
|
145 |
collection_name: str = PROBLEMS_REFERENCE_COLLECTION_NAME,
|
146 |
) -> List[str]:
|
147 |
vector_store = get_vector_db()
|
148 |
# Use a very generic query that should match everything
|
149 |
+
docs = vector_store.similarity_search("", k=1000)
|
150 |
+
|
151 |
sources = set()
|
152 |
for doc in docs:
|
153 |
if doc.metadata and "title" in doc.metadata:
|
backend/tests/test_api.py
CHANGED
@@ -37,7 +37,6 @@ def test_feedback_validation_error():
|
|
37 |
|
38 |
# this test can be a bit flaky, but it's not a big deal (because it's checking the content of the response. Correct/Incorrect might be prefaced by /n or something)
|
39 |
def test_successful_feedback():
|
40 |
-
"""Test successful grading of multiple problems"""
|
41 |
response = client.post(
|
42 |
"/api/feedback",
|
43 |
json={
|
@@ -67,7 +66,7 @@ def test_topics_endpoint():
|
|
67 |
response = client.get("/api/topics")
|
68 |
assert response.status_code == 200
|
69 |
result = response.json()
|
70 |
-
|
71 |
assert "sources" in result
|
72 |
assert len(result["sources"]) == 1
|
73 |
assert result["sources"][0] == "LangChain RAG Tutorial"
|
|
|
37 |
|
38 |
# this test can be a bit flaky, but it's not a big deal (because it's checking the content of the response. Correct/Incorrect might be prefaced by /n or something)
|
39 |
def test_successful_feedback():
|
|
|
40 |
response = client.post(
|
41 |
"/api/feedback",
|
42 |
json={
|
|
|
66 |
response = client.get("/api/topics")
|
67 |
assert response.status_code == 200
|
68 |
result = response.json()
|
69 |
+
|
70 |
assert "sources" in result
|
71 |
assert len(result["sources"]) == 1
|
72 |
assert result["sources"][0] == "LangChain RAG Tutorial"
|
frontend/src/setup.ts
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
import '@testing-library/jest-dom';
|