-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.Net: Bug: Time to wait on 429 only in text #8821
Comments
I think the data is available in the response headers, will investigate to confirm. |
I think also, but it is throwing an exception, and i don't see how i then can pickup the header |
@BartNetJS You should eb able to do something like this:
|
@markwallace-microsoft that did the trick. This is the code, quit a lot boilerplate, any suggestion to write it compacter and more readable?:
|
Hi @BartNetJS If the var builder = Kernel.CreateBuilder();
builder.Services.ConfigureHttpClientDefaults(c =>
{
c.AddStandardResilienceHandler().Configure(o =>
{
o.Retry.ShouldRetryAfterHeader = true;
o.Retry.ShouldHandle = args => ValueTask.FromResult(args.Outcome.Result?.StatusCode is HttpStatusCode.TooManyRequests);
});
}); |
Great, makes it a lot simpler. I now hit the default timeouts of 30 second.
Any idea how to implement it? |
Found it in AzureOpenAIClientOptions |
I'm encountering an issue when attempting to use the WaitAndRetryAsync method with a Policy on a 429 in my C# project.
I try to grab the time i have to wait as noted in the error message:
Requests to the ChatCompletions_Create Operation under Azure OpenAI API version 2024-07-01-preview have exceeded token rate limit of your current OpenAI S0 pricing tier. Please retry after 51 seconds. Please go here: https://aka.ms/oai/quotaincrease if you would like to further increase the default rate limit.
Can the time to wait be added as a property HttpOperationException (in Data?) or in the inner exception System.ClientModel.ClientResultException?
The calling function is: await kernel.InvokeAsync(promptFunc, kernelArgs);
Expected behavior
To add the time to wait to a property or in the data list
Screenshots
Platform
The text was updated successfully, but these errors were encountered: