This PR updates the example of parallel requests to API to allow cool down for AzureOpenAI API.
Motivation
The current code supports both OpenAI and AzureOpenAI APIs, but the rate limit error will not be correctly detected when using AzureOpenAI due to the difference in error messages. An example of AzureOpenAI's rate limit error is:
{'code': '429', 'message': 'Requests to the Embeddings_Create Operation under Azure OpenAI API version 2023-12-01-preview have exceeded call rate limit of your current OpenAI S0 pricing tier. Please retry after 8 seconds. Please go here: https://aka.ms/oai/quotaincrease if you would like to further increase the default rate limit.'}
And this leads to the cool down code never activated.
For new content
When contributing new content, read through our contribution guidelines, and mark the following action items as completed:
[ ] I have added a new entry in registry.yaml (and, optionally, in authors.yaml) so that my content renders on the cookbook website.
[ ] Relevance: This content is related to building with OpenAI technologies and is useful to others.
[ ] Uniqueness: I have searched for related examples in the OpenAI Cookbook, and verified that my content offers new insights or unique information compared to existing documentation.
[ ] Spelling and Grammar: I have checked for spelling or grammatical mistakes.
[ ] Clarity: I have done a final read-through and verified that my submission is well-organized and easy to understand.
[ ] Correctness: The information I include is correct and all of my code executes successfully.
[ ] Completeness: I have explained everything fully, including all necessary references and citations.
We will rate each of these areas on a scale from 1 to 4, and will only accept contributions that score 3 or higher on all areas. Refer to our contribution guidelines for more details.
Summary
This PR updates the example of parallel requests to API to allow cool down for AzureOpenAI API.
Motivation
The current code supports both OpenAI and AzureOpenAI APIs, but the rate limit error will not be correctly detected when using AzureOpenAI due to the difference in error messages. An example of AzureOpenAI's rate limit error is:
And this leads to the cool down code never activated.
For new content
When contributing new content, read through our contribution guidelines, and mark the following action items as completed:
We will rate each of these areas on a scale from 1 to 4, and will only accept contributions that score 3 or higher on all areas. Refer to our contribution guidelines for more details.