Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -161,7 +161,13 @@ async def run_hackrx(req: RunRequest):
|
|
| 161 |
tasks.append(ml_models["llm"].ainvoke(ml_models["prompt_template"].format_prompt(**prompt_input)))
|
| 162 |
|
| 163 |
results = await asyncio.gather(*tasks)
|
| 164 |
-
answers = [parse_llm_response(result.content) for result in results]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
return JSONResponse({"answers": answers}, status_code=200)
|
| 166 |
|
| 167 |
@app.get("/", include_in_schema=False)
|
|
|
|
| 161 |
tasks.append(ml_models["llm"].ainvoke(ml_models["prompt_template"].format_prompt(**prompt_input)))
|
| 162 |
|
| 163 |
results = await asyncio.gather(*tasks)
|
| 164 |
+
# answers = [parse_llm_response(result.content) for result in results]
|
| 165 |
+
answers = []
|
| 166 |
+
|
| 167 |
+
for msg in results:
|
| 168 |
+
# Safely access the content field
|
| 169 |
+
if hasattr(msg, "content"):
|
| 170 |
+
answers.append(msg.content.strip())
|
| 171 |
return JSONResponse({"answers": answers}, status_code=200)
|
| 172 |
|
| 173 |
@app.get("/", include_in_schema=False)
|