koog
koog copied to clipboard
Add OpenAI retry message pattern support to `DefaultRetryAfterExtractor`
OpenAI returns this error message in the response body along with the 429 Too Many Requests response:
Rate limit reached for o3 in organization org-XXX on tokens per min (TPM): Limit 30000, Used 27418, Requested 6549. Please try again in 7.934s. Visit https://platform.openai.com/account/rate-limits to learn more.
Currently DefaultRetryAfterExtractor does not handle try again in X.XXXs pattern:
https://github.com/JetBrains/koog/blob/3c87f2a6bb1f6ee640e8b2a078a74b0eb56afaa8/prompt/prompt-executor/prompt-executor-clients/src/commonMain/kotlin/ai/koog/prompt/executor/clients/retry/RetryConfig.kt#L152-L157
This PR adds support for the OpenAI retry message regex pattern and includes a test to verify it.