Problem/Motivation

Currently we are looking at the error message we get back from the LLM and try to map that to our exceptions, however the client has a better method for it here: https://github.com/openai-php/client/blob/main/src/Exceptions/ErrorExcep...

We should map to this instead.

Proposed resolution

  • Map to the different Exceptions to different error types "insufficient_quota" etc. in OpenAI's responses.
  • Do it in one method that can be overriden.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

marcus_johansson created an issue. See original summary.

pinesh’s picture

Implemented improved error handling using OpenAI client's built-in error type detection. The patch maps specific OpenAI error types
(insufficient_quota, billing_not_active, rate_limit_exceeded) to appropriate AI module exceptions while maintaining backward compatibility
with legacy string matching. Ready for review and testing.

ishani patel made their first commit to this issue’s fork.

ishani patel’s picture

Assigned: Unassigned » ishani patel

ishani patel’s picture

I've raised MR from the patch.
Please review.
THank you!

ishani patel’s picture

Assigned: ishani patel » Unassigned
marcus_johansson’s picture

Status: Active » Closed (outdated)

This already exists.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.