kernel-memory icon indicating copy to clipboard operation
kernel-memory copied to clipboard

[Question] how I can add ConfigureHttpClientDefaults for SK Retry logic?

Open KSemenenko opened this issue 5 months ago • 4 comments

Context / Scenario

I need retry logic for embedding requests, becse for 500 pages pdf I deffenelty will reach TooManyRequest issue, for Azure ADA2 model.

Question

in SK I can do like this:

semanticKernalBuilder.Services.ConfigureHttpClientDefaults(c =>
{
    // Use a standard resiliency policy, augmented to retry on 401 Unauthorized for this example
    c.AddStandardResilienceHandler().Configure(o =>
    {
        o.Retry.ShouldHandle = args => ValueTask.FromResult(args.Outcome.Result?.StatusCode is HttpStatusCode.Unauthorized);
    });
});

how can I do this for KM?

KSemenenko avatar Jan 26 '24 08:01 KSemenenko