![]() |
VOOZH | about |
dotnet add package Raygun.Aspire.Hosting.Ollama --version 1.1.0
NuGet\Install-Package Raygun.Aspire.Hosting.Ollama -Version 1.1.0
<PackageReference Include="Raygun.Aspire.Hosting.Ollama" Version="1.1.0" />
<PackageVersion Include="Raygun.Aspire.Hosting.Ollama" Version="1.1.0" />Directory.Packages.props
<PackageReference Include="Raygun.Aspire.Hosting.Ollama" />Project file
paket add Raygun.Aspire.Hosting.Ollama --version 1.1.0
#r "nuget: Raygun.Aspire.Hosting.Ollama, 1.1.0"
#:package Raygun.Aspire.Hosting.Ollama@1.1.0
#addin nuget:?package=Raygun.Aspire.Hosting.Ollama&version=1.1.0Install as a Cake Addin
#tool nuget:?package=Raygun.Aspire.Hosting.Ollama&version=1.1.0Install as a Cake Tool
An Aspire component leveraging the Ollama container with support for downloading a model on startup.
Install the Raygun.Aspire.Hosting.Ollama NuGet package into the Aspire orchestration project (AppHost). Either use the NuGet package management GUI in the IDE you use, OR use the below dotnet command.
dotnet add package Raygun.Aspire.Hosting.Ollama
Use the static AddOllama method to add this container component to the application builder.
// The distributed application builder is created here
var ollama = builder.AddOllama();
// The builder is used to build and run the app somewhere down here
The AddOllama method has optional arguments to set the name, port and modelName.
The name is what gets displayed in the Aspire orchestration app against this component.
The port is provided randomly by Aspire. If for whatever reason you need a fixed port, you can set that here.
The modelName specifies what LLM to pull when it starts up. The default is llama3. You can also set this to null to prevent any models being pulled on startup - leaving you with a plain Ollama container to work with.
When the Ollama container for this component first spins up, this component will download the LLM (llama3 unless otherwise specified). The progress of this download will be displayed in the State column for this component on the Aspire orchestration app. Important: Keep the Aspire orchestration app open until the download is complete, otherwise the download will be cancelled. In the spirit of productivity, we recommend kicking off this process before heading for lunch. This component binds a volume called "ollama" so that once the model is fully downloaded, it'll be available for subsequent runs.
You can pass the ollama component to other Aspire components in the usual way:
builder.AddMyComponent().WithReference(ollama);
Within that component (e.g. a web app), you can fetch the Ollama connection string from the application builder as follows.
Note that if you changed the name of the Ollama component via the name argument, then you'll need to use that here when specifying which connection string to get.
var connectionString = builder.Configuration.GetConnectionString("Ollama");
You can then call any of the Ollama endpoints through this connection string. We recommend using the OllamaSharp client to do this.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.