fix: fall back to HuggingFace on empty response instead of hard error
Browse files- app/ai/orchestrator.py +1 -2
app/ai/orchestrator.py
CHANGED
|
@@ -5,7 +5,6 @@ from typing import Any
|
|
| 5 |
from app.ai.providers import (
|
| 6 |
ChatProvider,
|
| 7 |
InvalidToolCallGenerationError,
|
| 8 |
-
ProviderError,
|
| 9 |
RetryableProviderError,
|
| 10 |
)
|
| 11 |
from app.models.domain import AIProviderResponse, ToolCall
|
|
@@ -88,7 +87,7 @@ class AIOrchestrator:
|
|
| 88 |
content = (response.content or "").strip()
|
| 89 |
if content:
|
| 90 |
return content
|
| 91 |
-
raise
|
| 92 |
working_messages.append(_assistant_tool_message(response))
|
| 93 |
for tool_call in response.tool_calls:
|
| 94 |
logger.warning("++++++++"+str(tool_call)+ "&&&"+ str(registry))
|
|
|
|
| 5 |
from app.ai.providers import (
|
| 6 |
ChatProvider,
|
| 7 |
InvalidToolCallGenerationError,
|
|
|
|
| 8 |
RetryableProviderError,
|
| 9 |
)
|
| 10 |
from app.models.domain import AIProviderResponse, ToolCall
|
|
|
|
| 87 |
content = (response.content or "").strip()
|
| 88 |
if content:
|
| 89 |
return content
|
| 90 |
+
raise RetryableProviderError(f"{provider.name} returned an empty response")
|
| 91 |
working_messages.append(_assistant_tool_message(response))
|
| 92 |
for tool_call in response.tool_calls:
|
| 93 |
logger.warning("++++++++"+str(tool_call)+ "&&&"+ str(registry))
|