Sylin.Koan.AI.Prompt
0.8.0
dotnet add package Sylin.Koan.AI.Prompt --version 0.8.0
NuGet\Install-Package Sylin.Koan.AI.Prompt -Version 0.8.0
<PackageReference Include="Sylin.Koan.AI.Prompt" Version="0.8.0" />
<PackageVersion Include="Sylin.Koan.AI.Prompt" Version="0.8.0" />
<PackageReference Include="Sylin.Koan.AI.Prompt" />
paket add Sylin.Koan.AI.Prompt --version 0.8.0
#r "nuget: Sylin.Koan.AI.Prompt, 0.8.0"
#:package Sylin.Koan.AI.Prompt@0.8.0
#addin nuget:?package=Sylin.Koan.AI.Prompt&version=0.8.0
#tool nuget:?package=Sylin.Koan.AI.Prompt&version=0.8.0
Koan.AI.Prompt
Uri-inspired prompt primitives for Koan: parse, create, version, and store prompts with variable extraction, few-shot examples, output schema, and A/B testing support.
- Target framework: net10.0
- License: Apache-2.0
- Version: 0.6.3
Install
dotnet add package Sylin.Koan.AI.Prompt
Quick Start
// Build a prompt
var prompt = Prompt.Create()
.System("You are a technical writer.")
.Instruct("Summarise the following article in {{tone}} tone.")
.Constrain("Maximum 200 words.")
.OutputAs<SummaryOutput>() // JSON schema from type
.Example("long article...", "Short summary.")
.Default("tone", "professional");
// Resolve with variables
var resolved = prompt.Resolve(new { tone = "casual" });
// Send to AI
var result = await Client.ChatAsync(resolved.SystemPrompt, resolved.UserMessage, ct);
Prompt API
// Fluent builder
Prompt.Create()
.System(string systemPrompt)
.Instruct(string template) // Supports {{variable}} interpolation
.Constrain(string constraint)
.OutputAs<TOutput>() // Extract JSON schema from type
.OutputAs(OutputSpec spec) // Or provide explicit spec
.Example(string input, string output) // Few-shot example
.Default(string variable, string value)// Default variable value
.Meta(string key, string value) // Arbitrary metadata
// Loading from storage
Prompt.Load("my-prompt") // Latest version
Prompt.Load("my-prompt", version: "v3") // Specific version
Prompt.Load("my-prompt", PromptStrategy.AbTest(["v2", "v3"])) // A/B test
// Instance methods
prompt.Resolve(object variables) // → string (resolved template)
prompt.UnresolvedVariables() // → string[] (missing variables)
prompt.With(string variable, string value) // → new Prompt (immutable update)
Variable Interpolation
Templates use {{variable}} syntax:
var prompt = Prompt.Create()
.Instruct("Translate the following to {{language}}: {{text}}");
var resolved = prompt.Resolve(new { language = "French", text = "Hello world" });
// → "Translate the following to French: Hello world"
Prompt Storage
PromptEntry is a standard Entity<PromptEntry> — prompts are versioned and stored in the configured data backend automatically:
// Store
await new PromptEntry { Name = "my-prompt", Version = "v1", Template = "..." }.Save();
// Retrieve
var entry = await Prompt.Load("my-prompt");
Loading Strategies
| Strategy | Behaviour |
|---|---|
| Latest (default) | Always loads the most recent version |
PromptStrategy.Pinned("v3") |
Always loads a specific version |
PromptStrategy.AbTest(["v2","v3"]) |
Randomly selects between versions |
PromptStrategy.Canary("v4", weight: 0.1) |
Routes 10% traffic to canary version |
Reference
- Related:
Koan.AI(pipeline facade),Koan.AI.Orchestration(chain composition),Koan.AI.Training(training datasets)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Sylin.Koan.AI.Contracts (>= 0.8.0)
- Sylin.Koan.Core (>= 0.8.0)
- Sylin.Koan.Data.Core (>= 0.8.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Sylin.Koan.AI.Prompt:
| Package | Downloads |
|---|---|
|
Sylin.Koan.AI
Koan AI facade and runtime glue. |
|
|
Sylin.Koan.AI.Orchestration
Typed, immutable chain composition for Koan AI: RAG, branching, structured output, and streaming. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.8.0 | 194 | 5/16/2026 |
See release notes: https://github.com/sylin-labs/Koan-framework/releases