VOOZH about

URL: https://www.nuget.org/packages/Raygun.Aspire.Hosting.Ollama

⇱ NuGet Gallery | Raygun.Aspire.Hosting.Ollama 1.1.0




👁 Image
Raygun.Aspire.Hosting.Ollama 1.1.0

dotnet add package Raygun.Aspire.Hosting.Ollama --version 1.1.0
 
 
NuGet\Install-Package Raygun.Aspire.Hosting.Ollama -Version 1.1.0
 
 
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="Raygun.Aspire.Hosting.Ollama" Version="1.1.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Raygun.Aspire.Hosting.Ollama" Version="1.1.0" />
 
Directory.Packages.props
<PackageReference Include="Raygun.Aspire.Hosting.Ollama" />
 
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 Raygun.Aspire.Hosting.Ollama --version 1.1.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Raygun.Aspire.Hosting.Ollama, 1.1.0"
 
 
#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 Raygun.Aspire.Hosting.Ollama@1.1.0
 
 
#: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=Raygun.Aspire.Hosting.Ollama&version=1.1.0
 
Install as a Cake Addin
#tool nuget:?package=Raygun.Aspire.Hosting.Ollama&version=1.1.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Raygun.Aspire.Hosting.Ollama

An Aspire component leveraging the Ollama container with support for downloading a model on startup.

Installation

1. Install the NuGet package

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

2. Add the Ollama container

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

Configuration

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.

Downloading the LLM

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.

Accessing the Ollama server from other Aspire components

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. 
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

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 708 8/13/2024
1.0.0 287 6/7/2024