OllamaSharp 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package OllamaSharp --version 1.0.1
NuGet\Install-Package OllamaSharp -Version 1.0.1
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="OllamaSharp" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OllamaSharp --version 1.0.1
#r "nuget: OllamaSharp, 1.0.1"
#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.
// Install OllamaSharp as a Cake Addin
#addin nuget:?package=OllamaSharp&version=1.0.1

// Install OllamaSharp as a Cake Tool
#tool nuget:?package=OllamaSharp&version=1.0.1

OllamaSharp 🦙

OllamaSharp is a .NET binding for the Ollama API, making it easy to interact with Ollama using your favorite .NET languages.

Features

  • Intuitive API client: Set up and interact with Ollama in just a few lines of code.
  • Support for various Ollama operations: Including streaming completions (chatting), listing local models, pulling new models, show model information, creating new models, copying models, deleting models, pushing models, and generating embeddings.
  • Real-time streaming: Stream responses directly to your application.
  • Progress reporting: Get real-time progress feedback on tasks like model pulling.

Usage

Here's a simple example to get you started:

// set up the client
var uri = new Uri("http://localhost:11434");
var ollama = new OllamaApiClient(uri);

// list all local models
var models = await ollama.ListLocalModels();

// stream a completion and write to the console
// keep reusing the context to keep the chat topic going
var context = await ollama.StreamCompletion("How are you today?", "llama2", context, stream => Console.WriteLine(stream.Response));

// pull a model and report progress
await ollama.PullModel("mistral", status => Console.WriteLine($"({status.Percent}%) {status.Status}"));

Credits

Icon and name were reused from the amazing Ollama project.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on OllamaSharp:

Package Downloads
Atc.SemanticKernel.Connectors.Ollama

Atc.SemanticKernel.Connectors.Ollama contains a connector for integrating with local llms through Ollama.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on OllamaSharp:

Repository Stars
platformplatform/PlatformPlatform
🚀 Pre-alpha state. A platform designed for building enterprise-grade, multi-tenant products using Azure, .NET, React, TypeScript, Infrastructure as Code, etc.
Version Downloads Last updated
1.1.9 0 5/15/2024
1.1.8 315 5/10/2024
1.1.7 78 5/10/2024
1.1.5 71 5/10/2024
1.1.4 74 5/10/2024
1.1.3 70 5/10/2024
1.1.2 75 5/10/2024
1.1.1 2,298 3/27/2024
1.1.0 1,268 1/8/2024
1.0.4 234 12/27/2023
1.0.3 274 11/30/2023
1.0.2 251 11/5/2023
1.0.1 142 10/16/2023
1.0.0 125 10/16/2023