Skip to content

Commit 226c845

Browse files
fix: enhance rate limit detection for Azure OpenAI transient errors
1 parent d7055f2 commit 226c845

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/processor/src/libs/agent_framework/azure_openai_response_retry.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ def _looks_like_rate_limit(error: BaseException) -> bool:
8282
if isinstance(status, int) and 500 <= status < 600:
8383
return True
8484

85+
# "The model produced invalid content" is a transient error from Azure OpenAI
86+
# when the model output fails content/schema validation — worth retrying.
87+
if any(
88+
s in msg
89+
for s in ["model produced invalid content", "invalid content"]
90+
):
91+
return True
92+
8593
cause = getattr(error, "__cause__", None)
8694
if cause and cause is not error:
8795
return _looks_like_rate_limit(cause)

src/processor/src/steps/migration_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from datetime import datetime
3333
from typing import Any
3434

35-
from agent_framework import Workflow, WorkflowBuilder, WorkflowEvent
35+
from agent_framework import Workflow, WorkflowBuilder
3636

3737
from openai import AsyncAzureOpenAI
3838

0 commit comments

Comments
 (0)