Skip to content

Commit

Permalink
improved error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
phact committed Jul 31, 2024
1 parent a9c7771 commit 40462fb
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions impl/routes_v2/threads_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1607,18 +1607,15 @@ async def submit_tool_ouputs_to_run(
astradb=astradb,
created_at=created_at
)
try:
response = await get_async_chat_completion_response(
messages=message_content,
model=model,
stream=True,
**litellm_kwargs[0],
)
return StreamingResponse(message_delta_streamer(message_id, created_at, response, run, astradb),
media_type="text/event-stream")
except asyncio.CancelledError:
logger.error("process_rag cancelled")
raise RuntimeError("process_rag cancelled")
response = await get_async_chat_completion_response(
messages=message_content,
model=model,
stream=True,
**litellm_kwargs[0],
)
return StreamingResponse(message_delta_streamer(message_id, created_at, response, run, astradb),
media_type="text/event-stream")

except Exception as e:
logger.info(e)
await update_run_status(thread_id=thread_id, id=run_id, status="failed", astradb=astradb)
Expand Down

0 comments on commit 40462fb

Please sign in to comment.