-
Notifications
You must be signed in to change notification settings - Fork 110
Add custom service key support to AddKeyedOllamaApiClient #741
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
Conversation
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
@copilot can we also support keys passed to AddKeyedChatClient and the embedding generator method |
…ddingGenerator Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Added support for custom service keys in both New overloads:
This allows scenarios like: builder.AddKeyedOllamaApiClient("OllamaKey", "LocalAI")
.AddKeyedChatClient("ChatKey1")
.AddKeyedChatClient("ChatKey2")
.AddKeyedEmbeddingGenerator("EmbedKey"); Implemented in commit 2c95517. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should not be change at this PR. We have a seperate workflow for changing this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes, sorry I keep forgetting that in the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot undo the changes in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted the changes to the API surface file as requested. This auto-generated file should not be manually modified. Fixed in commit 63729e3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted the changes to the API surface file as requested. This auto-generated file should not be manually modified. Fixed in commit 63729e3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot undo the changes in this file
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Minimum allowed line rate is |
This PR adds the ability to specify custom service keys when registering keyed Ollama API clients, resolving the limitation where users couldn't differentiate between multiple clients using the same connection but different models.
Problem
Previously,
AddKeyedOllamaApiClient
automatically used the connection name as the service key, making it impossible to register multiple Ollama clients for different use cases (e.g., chat vs vision models) on the same connection:Solution
Added two new overloads following the established RavenDB pattern that accept an explicit
object serviceKey
parameter:Usage
Now users can differentiate between multiple models using custom service keys:
Changes Made
AddKeyedOllamaApiClient
overloads with explicitobject serviceKey
parameterAspireOllamaApiClientBuilder
to useobject?
for service key instead ofstring
AddKeyedChatClient
,AddKeyedEmbeddingGenerator
) to handle the new typeTesting
Added tests to verify:
Fixes #717.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
aka.ms
curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED
(dns block)dnceng.pkgs.visualstudio.com
dotnet build src/CommunityToolkit.Aspire.OllamaSharp/CommunityToolkit.Aspire.OllamaSharp.csproj
(dns block)dotnet test tests/CommunityToolkit.Aspire.OllamaSharp.Tests/ --no-build --verbosity minimal
(dns block)dotnet build --no-restore
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.