Skip to content

Commit 299b4d4

Browse files
committed
Match openai logic to retry on >= 500 not == 500
1 parent 5994a45 commit 299b4d4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

temporalio/contrib/openai_agents/_invoke_model_activity.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,15 @@ def make_tool(tool: ToolInput) -> Tool:
248248
) from e
249249

250250
# Specifically retryable status codes
251-
if e.response.status_code in [408, 409, 429, 500]:
251+
if e.response.status_code in [408, 409, 429] or e.response.status_code >= 500:
252252
raise ApplicationError(
253-
"Retryable OpenAI status code",
253+
f"Retryable OpenAI status code: {e.response.status_code}",
254254
non_retryable=False,
255255
next_retry_delay=retry_after,
256256
) from e
257257

258258
raise ApplicationError(
259-
"Non retryable OpenAI status code",
259+
f"Non retryable OpenAI status code: {e.response.status_code}",
260260
non_retryable=True,
261261
next_retry_delay=retry_after,
262262
) from e

0 commit comments

Comments
 (0)