Sylin.Koan.Data.AI 1.0.64

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

Sylin.Koan.Data.AI

Data-layer AI integration for Koan: embeddings lifecycle, media analysis, and semantic search — all driven by convention, with attribute opt-in for automatic processing.

  • Target framework: net10.0
  • License: Apache-2.0

Install

dotnet add package Sylin.Koan.Data.AI

Meaningful use

Convention over configuration. On-demand operations (embed a string, search semantically) work with zero attributes. Attributes are only needed to opt into automatic processing on entity save.

Embedding metadata inferred only from entity types and attributes is cached across the process. AI services, logging, adapters, configuration, and lifecycle state are resolved from the current host when an operation runs; they are not retained by the metadata cache.


Embeddings

On-demand semantic search (no attributes required)

Referencing this package gives every Entity kind an .Ai gateway — search, scores, embed — and every instance a Similar verb:

var results = await Article.Ai.Search("machine learning basics", s => s.Top(10));
var scored  = await Article.Ai.SearchScored("quick wins", s => s.Top(10).Threshold(0.7));
var similar = await someArticle.Similar(limit: 5);

The declaration lambda is optional (Article.Ai.Search("…") takes the defaults: top 10, no threshold) and carries Top, Threshold, and Partition — see SemanticSearchQuery.

The static surface underneath remains for code that is not standing on an Entity kind:

using static Koan.Data.AI.EntityEmbeddingExtensions;

// Embed and search without any attribute decoration
var results = await SemanticSearch<Article>("machine learning basics", limit: 10);
var similar  = await someArticle.Similar(limit: 5);

Auto-embed on save (opt-in with [Embedding])

[Embedding]
public class Article : Entity<Article>
{
    public string Title   { get; set; } = "";
    public string Content { get; set; } = "";

    [EmbeddingIgnore]  // Exclude from embedding text
    public string InternalNotes { get; set; } = "";
}

// article.Save() → embedding computed and stored automatically

EmbeddingPolicy — control text composition

Value Behaviour
AllStrings Embed all string properties (default)
AllPublic Embed all public properties
FullJson Serialize the whole entity to JSON
Explicit Only embed properties you mark

Async embedding queue

Large or slow-to-embed entities opt into the background queue on the Entity itself:

[Embedding(Async = true)]
public class Article : Entity<Article>
{
    public string Text { get; set; } = "";
}

await article.Save(); // persists the Entity and enqueues its embedding work

The lifecycle hook is the supported enqueue path today; there is no separate public QueueAsync API. The durable row carries identity, content signature, and an opaque logical-flow context—not business text or duplicate provider policy. The worker restores that context, loads the current Entity, and uses the same vector-only embedding writer as the synchronous lifecycle and explicit migrator. It never re-saves the domain Entity. The global queue identity includes a value-opaque context fingerprint, so equal Entity ids in different tenants or subjects cannot overwrite one another. No embedding-specific application plumbing is required. Queue states are Pending, Processing, Completed, Failed, and FailedPermanent.

Worker batching, polling, retry, and rate limits are host policy under Koan:Data:AI:EmbeddingWorker; they are deliberately not repeated on each [Embedding] declaration.

RequeueJob<TEntity>(entityId) targets the row in the caller's current Koan context. For a context-independent operator retry, take the durable JobId returned by GetFailedJobs<TEntity>() and pass it to RequeueJobById<TEntity>(jobId).


Media Analysis

MediaAnalysisAttribute opts an entity into automatic analysis when media files are associated with it (images, audio, video). The attribute is a lifecycle opt-in — on-demand operations work without it.

[MediaAnalysis(MediaAnalysis.Describe | MediaAnalysis.Ocr)]
public class DocumentScan : Entity<DocumentScan>
{
    public string FileUrl       { get; set; } = "";
    public string Description   { get; set; } = "";  // Populated by Describe
    public string ExtractedText { get; set; } = "";  // Populated by Ocr
}

MediaAnalysis flags

Flag What it does
Describe Generate a natural-language description of the image
Ocr Extract text from the image
Transcribe Transcribe speech from audio/video
Classify Classify content into categories
Extract Extract structured data fields

MediaAnalysisMetadata.Resolve<T>()

// Returns null if no [MediaAnalysis] attribute — no attribute = no auto-analysis
var meta = MediaAnalysisMetadata.Resolve<DocumentScan>();
if (meta is not null)
{
    // meta.Modes, meta.DescriptionProperty, meta.OcrTextProperty, etc.
}

Guarantees and limitations

  • Reference plus the host's existing AddKoan() activates embedding/media-analysis lifecycle discovery; there is no Data.AI registration method.
  • On-demand AI operations (the Entity.Ai gateway and the Similar verb) require a running host plus compatible AI and Vector providers. [Embedding] and [MediaAnalysis] opt an Entity into automatic lifecycle work; undecorated Entities are unchanged.
  • Deferred embedding uses durable Koan Jobs/Data state, restores the captured logical context, reloads the current Entity, and writes only the vector/state records. Provider, mixed-model, persistence, and retry-exhaustion failures remain inspectable.
  • Vector writes and Data state confirmation are not cross-store atomic. The package does not provide training, provider inference, media storage, model deployment, automatic schema migration, or a Web/operator surface.

Reference

  • ADR: docs/decisions/AI-0021-category-driven-ai-with-convention-defaults.md
  • Guides: docs/guides/ai-rag-howto.md for retrieval over your own Entities, docs/guides/ai-vector-howto.md for the vector surface underneath
  • Maturity: consult the generated product surface before relying on this unassessed package in a preview application
  • Related: Koan.Data.Vector for raw vector storage, Koan.AI for the chat/embed facade
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 (1)

Showing the top 1 NuGet packages that depend on Sylin.Koan.Data.AI:

Package Downloads
Sylin.Koan.Rag

Koan RAG module: entity-native corpora, agentic retrieval, emergent concept graphs, contextual chunking.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.64 135 9/13/2026
1.0.61 109 9/12/2026
1.0.58 109 9/12/2026
1.0.56 119 9/10/2026
1.0.52 120 9/10/2026
1.0.48 106 9/9/2026
1.0.44 108 9/9/2026
1.0.40 111 9/9/2026
1.0.35 104 9/9/2026
1.0.33 114 9/9/2026
1.0.28 109 9/5/2026
1.0.27 138 8/30/2026
1.0.26 103 8/30/2026
1.0.25 110 8/29/2026
1.0.24 106 8/29/2026
1.0.23 109 8/28/2026
1.0.22 99 8/28/2026
1.0.21 116 8/28/2026
1.0.20 103 8/28/2026
1.0.19 104 8/28/2026
Loading failed