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
                    
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="Sylin.Koan.AI.Prompt" Version="0.8.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sylin.Koan.AI.Prompt" Version="0.8.0" />
                    
Directory.Packages.props
<PackageReference Include="Sylin.Koan.AI.Prompt" />
                    
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 Sylin.Koan.AI.Prompt --version 0.8.0
                    
#r "nuget: Sylin.Koan.AI.Prompt, 0.8.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 Sylin.Koan.AI.Prompt@0.8.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=Sylin.Koan.AI.Prompt&version=0.8.0
                    
Install as a Cake Addin
#tool nuget:?package=Sylin.Koan.AI.Prompt&version=0.8.0
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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