Saif Rehman Nasir
commited on
Commit
•
8af0ee8
1
Parent(s):
a2ff208
Limit communities to 2, Add default value to search strategy
Browse files
app.py
CHANGED
@@ -58,7 +58,9 @@ demo = gr.ChatInterface(
|
|
58 |
value="You are a medical assistant Chatbot. For any query that you don't know, you will say 'I don't know'. You will answer with the given information:",
|
59 |
label="System message",
|
60 |
),
|
61 |
-
gr.Dropdown(
|
|
|
|
|
62 |
gr.Slider(
|
63 |
minimum=0.1,
|
64 |
maximum=1.0,
|
|
|
58 |
value="You are a medical assistant Chatbot. For any query that you don't know, you will say 'I don't know'. You will answer with the given information:",
|
59 |
label="System message",
|
60 |
),
|
61 |
+
gr.Dropdown(
|
62 |
+
choices=["Local", "Global"], value="Local", label="Select search strategy"
|
63 |
+
),
|
64 |
gr.Slider(
|
65 |
minimum=0.1,
|
66 |
maximum=1.0,
|
rag.py
CHANGED
@@ -222,12 +222,10 @@ def global_retriever(query: str, level: int, response_type: str):
|
|
222 |
|
223 |
|
224 |
---Target response length and format---
|
225 |
-
|
226 |
{response_type}
|
227 |
|
228 |
|
229 |
---Analyst Reports---
|
230 |
-
|
231 |
{report_data}
|
232 |
|
233 |
Add sections and commentary to the response as appropriate for the length and format. Do not add references in your answer.
|
@@ -268,13 +266,13 @@ def global_retriever(query: str, level: int, response_type: str):
|
|
268 |
# print(community_data)
|
269 |
intermediate_results = []
|
270 |
i = 0
|
271 |
-
for community in tqdm(community_data[:
|
272 |
intermediate_response = map_chain.invoke(
|
273 |
{"question": query, "context_data": community["output"]}
|
274 |
)
|
275 |
intermediate_results.append(intermediate_response)
|
276 |
i += 1
|
277 |
-
|
278 |
###Debug####
|
279 |
# tokens = global_tokenizer(intermediate_results)
|
280 |
# print(f"Number of input tokens: {len(tokens)}")
|
|
|
222 |
|
223 |
|
224 |
---Target response length and format---
|
|
|
225 |
{response_type}
|
226 |
|
227 |
|
228 |
---Analyst Reports---
|
|
|
229 |
{report_data}
|
230 |
|
231 |
Add sections and commentary to the response as appropriate for the length and format. Do not add references in your answer.
|
|
|
266 |
# print(community_data)
|
267 |
intermediate_results = []
|
268 |
i = 0
|
269 |
+
for community in tqdm(community_data[:2], desc="Processing communities"):
|
270 |
intermediate_response = map_chain.invoke(
|
271 |
{"question": query, "context_data": community["output"]}
|
272 |
)
|
273 |
intermediate_results.append(intermediate_response)
|
274 |
i += 1
|
275 |
+
print(intermediate_results)
|
276 |
###Debug####
|
277 |
# tokens = global_tokenizer(intermediate_results)
|
278 |
# print(f"Number of input tokens: {len(tokens)}")
|