-
Notifications
You must be signed in to change notification settings - Fork 154
Add JsonSerializerContext support for Native AOT compatibility in OllamaSharp integration #1092
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
Add JsonSerializerContext support for Native AOT compatibility in OllamaSharp integration #1092
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>
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.
Pull request overview
This PR adds Native AOT compatibility to the OllamaSharp integration by exposing the JsonSerializerContext configuration option. OllamaSharp requires a custom JsonSerializerContext for Native AOT scenarios, but the Aspire integration previously did not allow passing this configuration.
Changes:
- Added
JsonSerializerContextproperty toOllamaSharpSettingswith XML documentation - Updated
OllamaApiClientinstantiation to use constructor acceptingJsonSerializerContext - Added comprehensive test coverage for both keyed and non-keyed client scenarios
- Added Native AOT Support section to README with usage examples
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/CommunityToolkit.Aspire.OllamaSharp/OllamaSharpSettings.cs | Added JsonSerializerContext property with XML documentation linking to OllamaSharp's AOT docs |
| src/CommunityToolkit.Aspire.OllamaSharp/AspireOllamaSharpExtensions.cs | Updated client instantiation to pass SelectedModel and JsonSerializerContext to constructor |
| tests/CommunityToolkit.Aspire.OllamaSharp.Tests/OllamaApiClientTests.cs | Added tests verifying JsonSerializerContext is properly passed for keyed and non-keyed clients, plus test with settings overload |
| tests/CommunityToolkit.Aspire.OllamaSharp.Tests/ConfigurationTests.cs | Added test verifying JsonSerializerContext is null by default |
| src/CommunityToolkit.Aspire.OllamaSharp/README.md | Added Native AOT Support section with example usage and link to OllamaSharp documentation |
OllamaSharp supports Native AOT when provided with a
JsonSerializerContext, but the Aspire integration did not expose this configuration option.Changes
JsonSerializerContextproperty with XML documentation referencing OllamaSharp's AOT docsOllamaApiClientinstantiation to use constructor overload acceptingJsonSerializerContextandselectedModelUsage
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
awaescher.github.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
JsonSerializerContextto Ollama #1084💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.