shrutikaP8497 commited on
Commit
dc92f95
·
verified ·
1 Parent(s): 5ff43bd

Update retriever.py

Browse files
Files changed (1) hide show
  1. retriever.py +7 -15
retriever.py CHANGED
@@ -1,19 +1,11 @@
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."]
 
1
+ import json
2
 
3
+ # Load the context from context.json once at startup
4
+ with open("context.json", "r") as f:
5
+ context_data = json.load(f)
 
 
 
6
 
7
+ def retrieve_relevant_context(task_id: str) -> str:
8
  """
9
+ Retrieves the relevant context for a given task_id using preloaded context.json.
10
  """
11
+ return context_data.get(task_id, "")