Spaces:
Runtime error
Runtime error
Update retriever.py
Browse files- retriever.py +19 -21
retriever.py
CHANGED
@@ -1,21 +1,19 @@
|
|
1 |
-
from typing import List
|
2 |
-
|
3 |
-
# Dummy in-memory document store for simplicity
|
4 |
-
document_store = {
|
5 |
-
"task_id_1": "The Titanic was used in the film The Last Voyage.",
|
6 |
-
"task_id_2": "The fruits in the 2008 painting were apples, grapes, and pears.",
|
7 |
-
# Add more if needed
|
8 |
-
}
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
"""
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
return [
|
18 |
-
|
19 |
-
return ["
|
20 |
-
else:
|
21 |
-
return ["Context not found. Please refer to web or document tools."]
|
|
|
1 |
+
from typing import List
|
2 |
+
|
3 |
+
# Dummy in-memory document store for simplicity
|
4 |
+
document_store = {
|
5 |
+
"task_id_1": "The Titanic was used in the film The Last Voyage.",
|
6 |
+
"task_id_2": "The fruits in the 2008 painting were apples, grapes, and pears.",
|
7 |
+
# Add more if needed
|
8 |
+
}
|
9 |
+
|
10 |
+
def retrieve_context(task_id: str, question: str) -> List[str]:
|
11 |
+
"""
|
12 |
+
Simulated retrieval logic. Replace with RAG/FAISS/LLM Search for real usage.
|
13 |
+
"""
|
14 |
+
if task_id in document_store:
|
15 |
+
return [document_store[task_id]]
|
16 |
+
elif "Titanic" in question:
|
17 |
+
return ["Titanic was featured in The Last Voyage."]
|
18 |
+
else:
|
19 |
+
return ["Context not found. Please refer to web or document tools."]
|
|
|
|