Spaces:
Sleeping
Sleeping
Cyber Catalyst Team commited on
Commit ·
24d545a
1
Parent(s): 4c548f9
Fix python syntax indentation error in generator loop
Browse files- backend.py +10 -10
backend.py
CHANGED
|
@@ -853,16 +853,16 @@ async def chat_completions(request: Request, authorization: str = Header(None)):
|
|
| 853 |
|
| 854 |
# Continue the agentic loop (model processes tool results)
|
| 855 |
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
| 866 |
|
| 867 |
return StreamingResponse(
|
| 868 |
generate(),
|
|
|
|
| 853 |
|
| 854 |
# Continue the agentic loop (model processes tool results)
|
| 855 |
|
| 856 |
+
# If we hit max rounds, finish
|
| 857 |
+
yield make_chunk(request_id, requested_model, "\n\n⚠️ Reached maximum tool call rounds.")
|
| 858 |
+
yield make_chunk(request_id, requested_model, finish_reason="stop")
|
| 859 |
+
yield "data: [DONE]\n\n"
|
| 860 |
+
|
| 861 |
+
except Exception as e:
|
| 862 |
+
error_msg = f"\n\n❌ Error: {str(e)}"
|
| 863 |
+
yield make_chunk(request_id, requested_model, error_msg)
|
| 864 |
+
yield make_chunk(request_id, requested_model, finish_reason="stop")
|
| 865 |
+
yield "data: [DONE]\n\n"
|
| 866 |
|
| 867 |
return StreamingResponse(
|
| 868 |
generate(),
|