![]() |
VOOZH | about |
dotnet add package Sora.Ai.Provider.Ollama --version 0.4.0
NuGet\Install-Package Sora.Ai.Provider.Ollama -Version 0.4.0
<PackageReference Include="Sora.Ai.Provider.Ollama" Version="0.4.0" />
<PackageVersion Include="Sora.Ai.Provider.Ollama" Version="0.4.0" />Directory.Packages.props
<PackageReference Include="Sora.Ai.Provider.Ollama" />Project file
paket add Sora.Ai.Provider.Ollama --version 0.4.0
#r "nuget: Sora.Ai.Provider.Ollama, 0.4.0"
#:package Sora.Ai.Provider.Ollama@0.4.0
#addin nuget:?package=Sora.Ai.Provider.Ollama&version=0.4.0Install as a Cake Addin
#tool nuget:?package=Sora.Ai.Provider.Ollama&version=0.4.0Install as a Cake Tool
Ollama AI provider for Sora: local LLM chat, stream, and embeddings via Ollama endpoint.
dotnet add package Sylin.Sora.Ai.Provider.Ollama
Register Sora + the Ollama provider (typical ASP.NET Program.cs):
// using Sora.AI; using Sora.Ai.Provider.Ollama; using Sora.AI.Web;
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddSora()
.AddAi()
.AddOllama(o =>
{
o.BaseAddress = new Uri("http://localhost:11434"); // default
o.DefaultModel = "qwen3:4b"; // or any local model/tag
})
.AddAiWeb(); // optional HTTP endpoints under /ai
var app = builder.Build();
app.MapControllers();
app.Run();
Then query the default engine:
using Sora.AI;
var res = await Engine.Prompt("Explain quantum entanglement briefly.");
Console.WriteLine(res.Text);
Or via HTTP (if AddAiWeb is enabled):
POST /ai/chat { "model": "qwen3:4b", "messages": [{ "role": "user", "content": "Explain quantum entanglement briefly." }] }
Set the optional think flag in prompt options. The Ollama adapter emits a top-level think in its JSON payload for models that support it (e.g., Qwen3/R1/DeepSeek‑V3.1 quants).
using Sora.AI;
using Sora.AI.Contracts.Models;
var res = await Engine.Prompt(
"Briefly explain quantum entanglement.",
model: "qwen3:4b",
opts: new AiPromptOptions { Think = true }
);
Console.WriteLine(res.Text);
HTTP example:
POST /ai/chat { "model": "qwen3:4b", "messages": [{ "role": "user", "content": "Explain quantum entanglement briefly." }], "options": { "think": true } }
Unknown fields posted under options are forwarded to Ollama’s options bag in the request. Use this for provider-specific parameters like mirostat, repeat_penalty, etc. Known Sora fields still map to Ollama (temperature, top_p, num_predict, stop). If keys overlap, your posted value wins.
HTTP example:
POST /ai/chat { "model": "qwen3:4b", "messages": [{ "role": "user", "content": "Summarize Bell’s theorem in one sentence." }], "options": { "temperature": 0.6, "topP": 0.95, "maxOutputTokens": 128, "mirostat": 2, "mirostat_tau": 5.0, "repeat_penalty": 1.1 } }
Programmatic example:
using Sora.AI;
using Sora.AI.Contracts.Models;
var opts = new AiPromptOptions
{
Temperature = 0.6,
TopP = 0.95,
MaxOutputTokens = 128,
// Add arbitrary vendor params via object initializer syntax in JSON calls
};
var res = await Engine.Prompt("Summarize Bell’s theorem in one sentence.", "qwen3:4b", opts);
Notes
messages[] instead of a top-level prompt.model and input (array of strings).| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. 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.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 0.4.0 | 396 | 9/5/2025 | 0.4.0 is deprecated because it is no longer maintained. |
| 0.2.20 | 390 | 8/22/2025 | 0.2.20 is deprecated because it is no longer maintained. |
| 0.2.18 | 437 | 8/20/2025 | 0.2.18 is deprecated because it is no longer maintained. |
See release notes: https://github.com/sylin-labs/sora-framework/releases