-
Notifications
You must be signed in to change notification settings - Fork 823
Open
Labels
area-ai-templatesMicrosoft.Extensions.AI.TemplatesMicrosoft.Extensions.AI.TemplatesbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.
Description
Description
The latest AI Chat Template includes a modification for the resiliency when Ollama is selected, since Ollama calls can take a while (especially without good GPU support) and resiliency default is 10 seconds. This modification shouldn't be in the Extensions.cs in ServiceDefaults, since this will modify the HttpClient for all projects in the solution. It should just be in the Web project Program.cs.
Reproduction Steps
Create a new project with Ollama selected as the LLM.
Expected behavior
- ServiceDefaults Extensions.cs is the exact same as a new .NET Aspire project.
- Web project Program.cs includes the call to RemoveAllResilienceHandlers and add in standard resilience handler with extended timeouts.
Actual behavior
ServiceDefaults Extensions.cs is modified to affect all HttpClients in the entire solution:
#pragma warning disable EXTEXP0001 // RemoveAllResilienceHandlers is experimental
http.RemoveAllResilienceHandlers();
#pragma warning restore EXTEXP0001
// Turn on resilience by default
http.AddStandardResilienceHandler(config =>
{
// Extend the HTTP Client timeout for Ollama
config.AttemptTimeout.Timeout = TimeSpan.FromMinutes(3);
// Must be at least double the AttemptTimeout to pass options validation
config.CircuitBreaker.SamplingDuration = TimeSpan.FromMinutes(10);
config.TotalRequestTimeout.Timeout = TimeSpan.FromMinutes(10);
});
// Turn on service discovery by default
http.AddServiceDiscovery();
});
Regression?
No, this was a new addition.
Known Workarounds
Delete code from ServiceDefaults and add it to Web project.
Configuration
No response
Other information
No response
Metadata
Metadata
Assignees
Labels
area-ai-templatesMicrosoft.Extensions.AI.TemplatesMicrosoft.Extensions.AI.TemplatesbugThis issue describes a behavior which is not expected - a bug.This issue describes a behavior which is not expected - a bug.