Skip to content

Commit 630a031

Browse files
authored
Match openai logic to retry on >= 500 not == 500 (#1181)
* Match openai logic to retry on >= 500 not == 500 * Lint
1 parent 27903f7 commit 630a031

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

temporalio/contrib/openai_agents/_invoke_model_activity.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,18 @@ 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 (
252+
e.response.status_code in [408, 409, 429]
253+
or e.response.status_code >= 500
254+
):
252255
raise ApplicationError(
253-
"Retryable OpenAI status code",
256+
f"Retryable OpenAI status code: {e.response.status_code}",
254257
non_retryable=False,
255258
next_retry_delay=retry_after,
256259
) from e
257260

258261
raise ApplicationError(
259-
"Non retryable OpenAI status code",
262+
f"Non retryable OpenAI status code: {e.response.status_code}",
260263
non_retryable=True,
261264
next_retry_delay=retry_after,
262265
) from e

0 commit comments

Comments
 (0)