Add AddOllamaChatClient extensions for IChatClient interface#6
Open
rogerbarreto wants to merge 4 commits intomainfrom
Open
Add AddOllamaChatClient extensions for IChatClient interface#6rogerbarreto wants to merge 4 commits intomainfrom
rogerbarreto wants to merge 4 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements missing
AddOllamaChatClientextension methods for the Ollama Connector targeting theIChatClientinterface, following the same patterns as existingIChatCompletionServiceextensions.Changes
🔧 Extension Methods Added
IServiceCollection Extensions (in
OllamaServiceCollectionExtensions.DependencyInjection.cs):AddOllamaChatClient(modelId, endpoint, serviceId)- Using URI endpointAddOllamaChatClient(modelId, httpClient, serviceId)- Using HttpClientAddOllamaChatClient(ollamaClient, serviceId)- Using existing OllamaApiClientIKernelBuilder Extensions (in
OllamaKernelBuilderExtensions.cs):AddOllamaChatClient(modelId, endpoint, serviceId)- Using URI endpointAddOllamaChatClient(modelId, httpClient, serviceId)- Using HttpClientAddOllamaChatClient(ollamaClient, serviceId)- Using existing OllamaApiClient🧪 Comprehensive Testing
Unit Tests Created:
OllamaServiceCollectionExtensionsChatClientTests.cs- 7 tests for service collection extensionsOllamaKernelBuilderExtensionsChatClientTests.cs- 6 tests for kernel builder extensionsOllamaChatClientTests.cs- 12 tests for IChatClient functionalityIntegration Tests Created:
OllamaChatClientIntegrationTests.cs- 7 integration tests🎯 Key Features
IChatCompletionServiceextensionsIChatClientinstead ofIChatCompletionServiceUseKernelFunctionInvocation()for function calling capabilities[assembly: Experimental("SKEXP0070")]dotnet formatTest Results
Usage Examples
Files Modified/Created
Modified:
dotnet/src/Connectors/Connectors.Ollama/Extensions/OllamaServiceCollectionExtensions.DependencyInjection.csdotnet/src/Connectors/Connectors.Ollama/Extensions/OllamaKernelBuilderExtensions.csCreated:
dotnet/src/Connectors/Connectors.Ollama.UnitTests/Extensions/OllamaServiceCollectionExtensionsChatClientTests.csdotnet/src/Connectors/Connectors.Ollama.UnitTests/Extensions/OllamaKernelBuilderExtensionsChatClientTests.csdotnet/src/Connectors/Connectors.Ollama.UnitTests/Services/OllamaChatClientTests.csdotnet/src/IntegrationTests/Connectors/Ollama/OllamaChatClientIntegrationTests.csThe implementation is production-ready, follows all established patterns, includes comprehensive testing, and provides the same functionality as existing
IChatCompletionServiceextensions but targeting theIChatClientinterface instead.Pull Request opened by Augment Code with guidance from the PR author