Problem/Motivation

From time to time I get this error:

Drupal\ai\Exception\AiRequestErrorException: Error invoking model response: Your requests to text-embedding-ada-002 for text-embedding-ada-002 in Germany West Central have exceeded the call rate limit for your current OpenAI S0 pricing tier. This request was for Embeddings_Create under Azure OpenAI API version 2023-05-15. Please retry after 1 second. To increase your default rate limit, visit: ``https://aka.ms/oai/quotaincrease``. in Drupal\ai\Plugin\ProviderProxy->wrapperCall() (line 309 of /var/www/html/docroot/modules/contrib/ai/src/Plugin/ProviderProxy.php).

It seems that exception AiRateLimitException is not thrown, because it looks for 'Request too large' words in the message, but they are not in the message.

Steps to reproduce

Try to call the embeddings creation a lot of times during short period of time.

Proposed resolution

Change the search pattern for AiRateLimitException to 'have exceeded the call rate limit' or similar.

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

a.dmitriiev created an issue. See original summary.

a.dmitriiev’s picture

Status: Active » Needs review
marcus_johansson’s picture

Status: Needs review » Fixed

Looks good to me, getting merged.

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

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

Maintainers, credit people who helped resolve this issue.

  • a.dmitriiev committed 1fcacf6b on 1.2.x
    feat: #3557858 AiRateLimitException is not thrown even if message in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.