Skip to content

Conversation

iBotPeaches
Copy link
Collaborator

What:

  • Bug Fix
  • New Feature

Description:

Every provider has a different error format which we don't really have a unified parsing mechanism for. However all major players in the scene agree that an HTTP 429 is a rate limit, so we can leverage that. During #643 I believe I missed the non-OpenAI rate limit errors as no direct HTTP status code checking occurs (with exception of a few cases).

This means a rate limit bubbles through to an ErrorException (in case of OpenAI) or in case of another provider - goes onward to the concrete class and crashes.

This adds a tiny check for only HTTP 429 as the payload structure is wildly different between all providers. Userland implementations can use the exception (for backoff/retries) and dig into the include Response for more in-depth handling.

Related:

fixes: #587

@iBotPeaches iBotPeaches merged commit 03ac006 into main Aug 21, 2025
24 checks passed
@iBotPeaches iBotPeaches added this to the v0.16.0 milestone Aug 21, 2025
@iBotPeaches iBotPeaches deleted the 429-support branch August 21, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle responses with no choices in CreateResponse
1 participant