CommunityToolkit.Aspire.OllamaSharp 9.7.0-beta.337

Prefix Reserved
This is a prerelease version of CommunityToolkit.Aspire.OllamaSharp.
There is a newer version of this package available.
See the version list below for details.
dotnet add package CommunityToolkit.Aspire.OllamaSharp --version 9.7.0-beta.337
                    
NuGet\Install-Package CommunityToolkit.Aspire.OllamaSharp -Version 9.7.0-beta.337
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommunityToolkit.Aspire.OllamaSharp" Version="9.7.0-beta.337" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommunityToolkit.Aspire.OllamaSharp" Version="9.7.0-beta.337" />
                    
Directory.Packages.props
<PackageReference Include="CommunityToolkit.Aspire.OllamaSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CommunityToolkit.Aspire.OllamaSharp --version 9.7.0-beta.337
                    
#r "nuget: CommunityToolkit.Aspire.OllamaSharp, 9.7.0-beta.337"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CommunityToolkit.Aspire.OllamaSharp@9.7.0-beta.337
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CommunityToolkit.Aspire.OllamaSharp&version=9.7.0-beta.337&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CommunityToolkit.Aspire.OllamaSharp&version=9.7.0-beta.337&prerelease
                    
Install as a Cake Tool

CommunityToolkit.Aspire.OllamaSharp library

Registers IOllamaClientApi in the DI container to interact with the Ollama API and optionally supports registering an IChatClient or IEmbeddingGenerator from Microsoft.Extensions.AI.

Getting Started

Prerequisites

  • Ollama HTTP(S) endpoint

Install the package

Install the .NET Aspire OllamaSharp library using the following command:

dotnet add package CommunityToolkit.Aspire.OllamaSharp

Example usage

In the Program.cs file of your project, call the AddOllamaClientApi extension method to register the IOllamaClientApi in the DI container. This method takes the connection name as a parameter:

builder.AddOllamaClientApi("ollama");

Then, in your service, inject IOllamaClientApi and use it to interact with the Ollama API:

public class MyService(IOllamaClientApi ollamaClientApi)
{
    // ...
}
Integration with Microsoft.Extensions.AI

To use the integration with Microsoft.Extensions.AI, call the AddOllamaSharpChatClient or AddOllamaSharpEmbeddingGenerator extension method in the Program.cs file of your project. These methods take the connection name as a parameter, just as AddOllamaClientApi does, and will register the IOllamaApiClient, as well as the IChatClient or IEmbeddingGenerator in the DI container. The IEmbeddingsGenerator is registered with the generic arguments of <string, Embedding<float>>.

Additional documentation

Feedback & contributing

https://github.com/CommunityToolkit/Aspire

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on CommunityToolkit.Aspire.OllamaSharp:

Repository Stars
dotnet/eShop
A reference .NET application implementing an eCommerce site
foxminchan/BookWorm
The practical implementation of .NET Aspire using Microservices
davidfowl/aspire-ai-chat-demo
Aspire AI Chat is a full-stack chat sample that combines modern technologies to deliver a ChatGPT-like experience.
Version Downloads Last Updated
9.7.1-beta.343 110 8/8/2025
9.7.1-beta.342 117 8/7/2025
9.7.1-beta.341 114 8/6/2025
9.7.1-beta.340 125 8/5/2025
9.7.1-beta.339 117 8/5/2025
9.7.0 100 8/1/2025
9.7.0-beta.337 67 8/1/2025
9.7.0-beta.336 80 8/1/2025
9.7.0-beta.335 77 8/1/2025
9.7.0-beta.333 86 7/30/2025
9.6.1-beta.332 84 7/30/2025
9.6.1-beta.331 84 7/30/2025
9.6.1-beta.330 83 7/30/2025
9.6.1-beta.329 85 7/30/2025
9.6.1-beta.328 87 7/29/2025
9.6.1-beta.327 90 7/28/2025
9.6.1-beta.326 85 7/28/2025
9.6.0 788 7/10/2025
9.6.0-beta.324 112 7/10/2025
9.5.1-beta.323 107 7/10/2025
9.5.1-beta.322 110 7/10/2025
9.5.1-beta.321 112 7/10/2025
9.5.1-beta.320 137 7/9/2025
9.5.1-beta.319 118 7/8/2025
9.5.1-beta.318 162 7/2/2025
9.5.1-beta.317 112 6/30/2025
9.5.1-beta.315 133 6/26/2025
9.5.1-beta.314 173 6/23/2025
9.5.1-beta.313 147 6/20/2025
9.5.1-beta.312 114 6/20/2025
9.5.1-beta.311 135 6/18/2025
9.5.1-beta.310 123 6/17/2025
9.5.1-beta.309 111 6/17/2025
9.5.1-beta.308 117 6/17/2025
9.5.1-beta.307 120 6/16/2025
9.5.1-beta.306 312 6/11/2025
9.5.1-beta.305 205 6/7/2025
9.5.1-beta.304 137 6/6/2025
9.5.1-beta.303 145 6/4/2025
9.5.1-beta.302 123 6/4/2025
9.5.1-beta.301 134 6/2/2025
9.5.1-beta.300 231 5/28/2025
9.5.0 3,755 5/27/2025
9.5.0-beta.299 124 5/27/2025
9.5.0-beta.298 133 5/26/2025
9.5.0-beta.297 84 5/24/2025
9.5.0-beta.296 77 5/24/2025
9.5.0-beta.295 44 5/24/2025
9.4.1-beta.291 1,186 5/19/2025
9.4.1-beta.289 6,278 5/16/2025
9.4.1-beta.288 200 5/16/2025
9.4.1-beta.287 182 5/16/2025
9.4.1-beta.286 185 5/16/2025
9.4.1-beta.285 222 5/14/2025
9.4.1-beta.284 216 5/13/2025
9.4.1-beta.283 220 5/12/2025
9.4.1-beta.282 422 5/7/2025
9.4.1-beta.280 177 5/2/2025
9.4.1-beta.279 134 5/2/2025
9.4.1-beta.277 734 4/23/2025
9.4.1-beta.276 145 4/23/2025
9.4.1-beta.275 149 4/23/2025
9.4.1-beta.274 139 4/23/2025
9.4.1-beta.273 127 4/23/2025
9.4.1-beta.272 139 4/23/2025
9.4.1-beta.271 136 4/23/2025
9.4.1-beta.270 156 4/20/2025
9.4.0-preview.1.250420-0640 1,166 4/20/2025
9.4.0-beta.269 126 4/20/2025
9.4.0-beta.268 142 4/20/2025
9.3.1-beta.267 382 4/20/2025
9.3.1-beta.266 285 4/19/2025
9.3.1-beta.265 448 4/15/2025
9.3.1-beta.264 395 4/15/2025
9.3.1-beta.263 388 4/15/2025
9.3.1-beta.262 395 4/15/2025
9.3.1-beta.260 1,359 4/10/2025
9.3.1-beta.259 4,393 4/8/2025
9.3.1-beta.258 137 4/8/2025
9.3.1-beta.257 138 4/8/2025
9.3.1-beta.256 148 4/8/2025
9.3.1-beta.255 137 4/8/2025
9.3.1-beta.254 143 4/8/2025
9.3.1-beta.253 191 4/1/2025
9.3.1-beta.252 182 3/27/2025
9.3.1-beta.250 114 3/27/2025
9.3.1-beta.249 116 3/27/2025
9.3.1-beta.248 111 3/27/2025
9.3.1-beta.247 117 3/27/2025
9.3.1-beta.244 472 3/25/2025
9.3.1-beta.242 464 3/24/2025
9.3.1-beta.241 174 3/19/2025
9.3.0-preview.1.250319-0516 1,326 3/19/2025
9.3.0-beta.239 134 3/19/2025
9.2.2-beta.237 130 3/19/2025
9.2.2-beta.236 270 3/14/2025
9.2.2-beta.230 140 3/13/2025
9.2.2-beta.229 132 3/13/2025
9.2.2-beta.228 175 3/11/2025
9.2.2-beta.227 140 3/11/2025
9.2.2-beta.226 136 3/11/2025
9.2.2-beta.225 135 3/11/2025
9.2.2-beta.224 135 3/11/2025
9.2.2-beta.223 142 3/10/2025
9.2.2-beta.222 139 3/10/2025
9.2.2-beta.220 137 3/9/2025
9.2.2-beta.218 134 3/9/2025
9.2.2-beta.217 197 3/7/2025
9.2.2-beta.216 178 3/7/2025
9.2.2-beta.215 196 3/7/2025
9.2.2-beta.214 185 3/5/2025
9.2.2-beta.213 175 3/5/2025
9.2.2-beta.212 176 3/5/2025
9.2.2-beta.211 182 3/4/2025
9.2.2-beta.210 185 3/4/2025
9.2.2-beta.208 83 3/3/2025
9.2.1-preview.1.250303-0329 801 3/3/2025
9.2.1-beta.207 389 3/2/2025
9.2.1-beta.206 69 3/1/2025
9.2.1-beta.205 87 2/27/2025
9.2.1-beta.204 75 2/26/2025
9.2.1-beta.203 63 2/26/2025
9.2.0-preview.1.250226-0510 7,862 2/26/2025
9.2.0-beta.202 58 2/26/2025
9.2.0-beta.201 73 2/26/2025
9.2.0-beta.199 70 2/26/2025
9.2.0-beta.198 58 2/26/2025
9.1.1-beta.197 107 2/25/2025
9.1.1-beta.196 76 2/25/2025
9.1.1-beta.195 76 2/25/2025
9.1.1-beta.194 76 2/25/2025
9.1.1-beta.193 76 2/25/2025
9.1.1-beta.192 70 2/24/2025
9.1.1-beta.191 81 2/24/2025
9.1.1-beta.190 713 2/19/2025
9.1.1-beta.189 74 2/19/2025
9.1.1-beta.188 73 2/19/2025
9.1.1-beta.187 89 2/19/2025
9.1.1-beta.183 105 2/18/2025
9.1.1-beta.182 78 2/18/2025
9.1.1-beta.181 92 2/18/2025
9.1.1-beta.180 87 2/17/2025
9.1.1-beta.178 262 2/17/2025
9.1.1-beta.177 189 2/12/2025
9.1.1-beta.176 127 2/11/2025
9.1.1-beta.175 81 2/11/2025
9.1.1-beta.173 253 2/10/2025
9.1.1-beta.169 128 2/6/2025
9.1.1-beta.168 75 2/5/2025
9.1.1-beta.166 100 2/5/2025
9.1.1-beta.165 69 2/5/2025
9.1.1-beta.164 86 2/3/2025
9.1.1-beta.162 83 2/3/2025
9.1.1-beta.155 170 1/30/2025
9.1.1-beta.154 70 1/30/2025
9.1.1-beta.153 62 1/30/2025
9.1.1-beta.152 56 1/29/2025
9.1.1-beta.150 79 1/29/2025
9.1.1-beta.148 83 1/26/2025
9.1.1-beta.147 71 1/26/2025
9.1.1-beta.146 76 1/23/2025
9.1.1-beta.145 68 1/22/2025
9.1.1-beta.144 58 1/22/2025
9.1.1-beta.142 69 1/22/2025
9.1.1-beta.140 77 1/22/2025
9.1.1-beta.139 81 1/21/2025
9.1.1-beta.138 67 1/20/2025
9.1.1-beta.137 79 1/17/2025
9.1.1-beta.136 65 1/15/2025
9.1.1-beta.135 38 1/15/2025
9.1.1-beta.134 38 1/15/2025
9.1.1-beta.128 61 1/9/2025
9.1.1-beta.127 56 1/9/2025
9.1.1-beta.126 57 1/9/2025
9.1.1-beta.125 68 1/9/2025
9.1.1-beta.124 58 1/9/2025
9.1.0 20,004 12/12/2024
9.1.0-beta.123 82 1/3/2025
9.1.0-beta.122 79 1/3/2025
9.1.0-beta.121 77 1/2/2025
9.1.0-beta.120 72 12/30/2024
9.1.0-beta.119 66 12/30/2024
9.1.0-beta.118 70 12/30/2024
9.1.0-beta.116 72 12/30/2024
9.1.0-beta.114 72 12/30/2024
9.1.0-beta.113 70 12/30/2024
9.1.0-beta.112 76 12/18/2024
9.1.0-beta.110 72 12/16/2024
9.1.0-beta.109 73 12/12/2024
9.0.1-beta.108 77 12/12/2024
9.0.1-beta.107 64 12/11/2024
9.0.1-beta.106 71 12/12/2024
9.0.1-beta.104 77 12/11/2024
9.0.1-beta.102 135 12/6/2024
9.0.1-beta.99 69 12/6/2024
9.0.1-beta.98 68 12/6/2024
9.0.1-beta.95 72 12/5/2024
9.0.1-beta.94 67 12/5/2024
9.0.1-beta.93 68 12/2/2024
9.0.1-beta.92 83 11/30/2024
9.0.1-beta.91 63 11/30/2024
9.0.1-beta.90 78 11/29/2024
9.0.1-beta.89 76 11/29/2024
9.0.1-beta.88 75 11/27/2024
9.0.1-beta.87 78 11/27/2024
9.0.1-beta.86 72 11/27/2024
9.0.1-beta.84 100 11/24/2024
9.0.1-beta.83 93 11/22/2024
9.0.1-beta.82 81 11/21/2024
9.0.1-beta.81 79 11/19/2024
9.0.1-beta.80 66 11/19/2024
9.0.1-beta.79 68 11/19/2024
9.0.1-beta.77 91 11/15/2024
9.0.0 613 11/15/2024
9.0.0-beta.76 76 11/14/2024
9.0.0-beta.75 68 11/14/2024
9.0.0-beta.74 60 11/14/2024
9.0.0-beta.73 79 11/14/2024
9.0.0-beta.72 76 11/14/2024
9.0.0-beta.71 74 11/13/2024
9.0.0-beta.70 75 11/13/2024
9.0.0-beta.69 93 11/13/2024
9.0.0-beta.68 74 11/13/2024
9.0.0-beta.67 76 11/13/2024
9.0.0-beta.66 86 11/13/2024
9.0.0-beta.63 83 11/12/2024
9.0.0-beta.54 83 10/31/2024
9.0.0-beta.53 67 10/29/2024
8.3.0 319 10/29/2024
8.3.0-beta.51 69 10/29/2024
8.3.0-beta.50 82 10/28/2024
8.3.0-beta.49 74 10/28/2024
8.3.0-beta.48 68 10/28/2024
8.3.0-beta.47 82 10/28/2024
8.3.0-beta.46 69 10/27/2024
8.3.0-beta.45 78 10/25/2024
8.3.0-beta.44 67 10/25/2024
8.3.0-beta.43 71 10/25/2024
8.3.0-beta.42 81 10/24/2024
8.2.1 1,085 10/23/2024
8.2.1-beta.40 66 10/23/2024
8.2.1-beta.39 69 10/23/2024
8.2.1-beta.38 76 10/23/2024
8.2.1-beta.37 74 10/23/2024
8.2.1-beta.36 77 10/23/2024
8.2.1-beta.35 96 10/23/2024
8.2.0-beta.34 82 10/23/2024
8.2.0-beta.33 73 10/23/2024
8.2.0-beta.32 66 10/22/2024
1.0.0-beta.60 78 11/11/2024
1.0.0-beta.58 78 11/4/2024
1.0.0-beta.57 77 11/1/2024
1.0.0-beta.56 68 11/1/2024
1.0.0-beta.55 73 11/1/2024