Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -264,14 +264,14 @@ async def run_hackrx(req: RunRequest):
|
|
| 264 |
tasks.append(ml_models["llm"].ainvoke(ml_models["prompt_template"].format_prompt(**prompt_input)))
|
| 265 |
# tasks = [hybrid_rag_chain.ainvoke({"full_query": q}) for q in req.questions]
|
| 266 |
results = await asyncio.gather(*tasks)
|
| 267 |
-
answers = []
|
| 268 |
-
|
| 269 |
-
for msg in results:
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
|
| 276 |
return JSONResponse({"answers": answers}, status_code=200)
|
| 277 |
|
|
|
|
| 264 |
tasks.append(ml_models["llm"].ainvoke(ml_models["prompt_template"].format_prompt(**prompt_input)))
|
| 265 |
# tasks = [hybrid_rag_chain.ainvoke({"full_query": q}) for q in req.questions]
|
| 266 |
results = await asyncio.gather(*tasks)
|
| 267 |
+
# answers = []
|
| 268 |
+
|
| 269 |
+
# for msg in results:
|
| 270 |
+
# # Safely access the content field
|
| 271 |
+
# if hasattr(msg, "content"):
|
| 272 |
+
# answers.append(msg.content.strip())
|
| 273 |
+
# # Extract the content from each result and parse it
|
| 274 |
+
answers = [parse_llm_response(result.content) for result in results]
|
| 275 |
|
| 276 |
return JSONResponse({"answers": answers}, status_code=200)
|
| 277 |
|