Themis.Maf 1.5.1

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

Themis.Maf

Use Themis.Maf when an application already uses Microsoft Agent Framework or Microsoft.Extensions.AI and wants to connect that flow to Themis. It adapts conversational inference through IInferenceProvider, and separately exposes typed decision inference through an opt-in keyed IChatClient and keyed MAF function.

The package targets .NET 10. AddThemisMaf registers Themis services and the adapter; provide a conversational inference provider and its model separately. The separate Themis.Inference.Ollama package implements chat without its own ONNX Runtime or tokenizer dependency. The legacy Themis.Maf registration still depends on Themis to preserve existing AddThemisMaf behavior.

services.AddThemisMaf(
    configure: maf =>
    {
        maf.Model = "chat-model";
        maf.Temperature = 0.2;
        maf.MaxOutputTokens = 512;
        maf.TopP = 0.9;
        maf.EnableToolCalls = true;
        maf.EnableStructuredOutput = true;
        maf.EnableStreaming = true;
    },
    configureServices: registrations =>
        registrations.AddSingleton<IInferenceProvider, MyConversationalProvider>());

The package registers IChatClient, IThemisMafProvider, and ThemisMafAgentFactory. The provider abstraction keeps the adapter independent from a specific remote chat vendor; applications can replace IThemisMafProvider or IChatClient through configureServices. The MAF options supply default generation settings; per-request ChatOptions.ModelId, temperature, maximum output tokens, top-p, stop sequences, and seed take precedence. IInferenceProvider must be registered for conversational inference, while Themis options and other service implementations can be configured through the same registration call. Tool calls, JSON response formats, and true provider streaming are disabled by default. Enable them explicitly with the corresponding ThemisMafOptions properties; the Ollama provider supports these capabilities. Unsupported content or provider capabilities fail with an informative NotSupportedException rather than being ignored. The adapter also forwards frequency and presence penalties to providers that support them; Ollama reports them as unsupported because its chat API does not provide equivalent controls. Non-streaming token usage maps to ChatResponse.Usage; streamed usage is available on the final update through the rldc.usage additional property. This adapter targets conversational inference through IInferenceProvider; typed decision inference uses the separate IDecisionInferenceProvider contract. It is available through the explicit decision registrations below and does not replace the conversational client.

Decision inference

Register a keyed decision-backed IChatClient when the caller already has a DecisionRequest serialized as the text of one MAF user message:

services.AddThemisDecisionMaf(
    "decision",
    configureServices: registrations =>
        registrations.AddSingleton<IDecisionInferenceProvider, MyDecisionProvider>());

var client = serviceProvider.GetRequiredKeyedService<IChatClient>("decision");

The JSON object must contain state, centralQuestion, and questions; it may also contain model, task, lang, and extras. Optional text-only System message text is added, in order, to extras.maf.systemMessages; existing extras are preserved, and an existing maf.systemMessages array is extended. The response message is JSON with the original user request value in request and the typed DecisionResponse in decision. ChatOptions.ModelId overrides the request's model when set; otherwise Themis routing uses the request fields.

This connector accepts exactly one user text message and optional text-only System messages per call. It does not generate natural language, interpret conversation history, execute MAF tools, or stream. Unsupported message shapes, tool/generation options, and streaming fail explicitly. Use the keyed decision-agent helper to expose typed inference as an executable function to a separate generative MAF agent:

services.AddThemisDecisionAgent(
    "risk",
    model: "decision-model",
    configureServices: registrations =>
        registrations.AddSingleton<IDecisionInferenceProvider, MyDecisionProvider>());
services.RegisterThemisAsTool("risk", "evaluate_decision", "Evaluates a structured decision request.");

var decisionTool = serviceProvider.GetRequiredKeyedService<AIFunction>("risk");

RegisterThemisAsTool takes a JSON string argument named requestJson, which must use the same decision-request shape. The resulting function returns the echoed request and typed decision response. This tool does not itself provide a generative agent or perform the outer agent's tool-selection loop.

Use the factory's callback to configure the chat-backed agent:

var agent = serviceProvider
    .GetRequiredService<ThemisMafAgentFactory>()
    .Create(static _ => { });

Typed application-input mapping is provided by the separate Themis.Engine project; see the root README for its attributes, runtime criteria, and keyed mapping examples.

License

Themis' adapter code is licensed under MIT, and the NuGet package includes the Themis license text. Its Microsoft Agent Framework and Microsoft.Extensions.AI dependencies retain their own terms; model assets and providers are also separately licensed.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.1 44 10/19/2026
1.3.0 90 10/17/2026
1.2.0 79 10/17/2026
1.0.0 90 10/15/2026