Skip to content

Allow disabling resilience for Ollama #1112

@dealloc

Description

@dealloc

Related to an existing integration?

Yes

Existing integration

CommunityToolkit.Aspire.OllamaSharp

Overview

When making calls to Ollama using extended thinking or larger prompts, the chance a single request will take longer than 10s which will trigger Aspire's default resilience handlers.

for example:

routes.MapGet("/", static ([FromKeyedServices("thinking")] IChatClient client) => Results.ServerSentEvents(
	client
		.GetStreamingResponseAsync([new ChatMessage(ChatRole.User, "Hello, world!")])
		.Where(message => string.IsNullOrWhiteSpace(message.Text) is false)
		.Select(message => message.Text),
	eventType: "message"
));
Image

Usage example

Ollama's AddKeyedOllamaApiClient internally registers a http client, but doesn't expose any way to configure it.

Similar to #1084 I'd like a way to access the HTTP client that's being configured internally.
Perhaps an optional argument can be added at the end of the signature?

Breaking change?

No

Alternatives

The http client is named internally as $"{connectionName}_httpClient" so I can get to it that way, but I don't like relying on internals of the integration.

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions