Skip to content

Commit

Permalink
Lil fix
Browse files Browse the repository at this point in the history
  • Loading branch information
keell0renz committed Sep 22, 2024
1 parent 5a94bc2 commit da48add
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugins/example/_multion/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,14 @@ async def multion_endpoint(memory: Memory, uid: str = Query(...)):
if not books:
return EndpointResponse(message='No books were suggested or mentioned.')

result = await call_multion(books, user_id)
try:
result = await asyncio.wait_for(call_multion(books, user_id), timeout=120)
except asyncio.TimeoutError:
print("Timeout error occurred")
return EndpointResponse(message="Timeout error occurred.")
except Exception as e:
print(f"Error calling Multion API: {str(e)}")
return EndpointResponse(message=f"Error calling Multion API: {str(e)}")
if isinstance(result, bytes):
result = result.decode('utf-8')

Expand Down

0 comments on commit da48add

Please sign in to comment.