Themis.Maf 4.7.1

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

Themis.Maf

Themis.Maf adapts typed Themis decision inference to Microsoft.Extensions.AI and Microsoft Agent Framework integrations. It does not implement general chat generation; use a separate provider package for conversational tasks.

The package targets .NET 10. Its keyed decision client and function helpers route DecisionRequest values to IDecisionInferenceProvider.

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.

For a non-ONNX decision provider, use AddThemisDecisionMafWithProvider. It registers the decision router and JSON services without registering the default ONNX provider, model packers, or model artifact services. The provider can be registered under a key and selected for this MAF client:

services.AddThemisDecisionMafWithProvider(
    "ollama-decisions",
    new DecisionRouterOptions("nimble")
    {
        RouteUnspecifiedRequestsToDefaultModel = true
    },
    providerKey: "ollama",
    configureServices: registrations =>
        registrations.AddThemisOllamaSystemOneDecisionInference(
            "ollama",
            options => options.Endpoint = new Uri("http://localhost:11434/")));

Pass the model identifier in ChatOptions.ModelId or the decision request, or configure a real provider default as above. AddThemisDecisionMaf remains the default ONNX convenience composition. The Themis.Maf package still references Themis for that existing API, so this composition avoids ONNX service registration but does not remove transitive ONNX package dependencies.

Constraining a host chat client

When an application already has a Microsoft.Extensions.AI.IChatClient, keep that client registered under its own key and add an opt-in Maf proxy under a different key:

services.AddKeyedSingleton<IChatClient>("remote", (_, _) => remoteChatClient);
services.AddThemisDecisionMafProxy("remote-decision", "remote");

var decisionClient = serviceProvider
    .GetRequiredKeyedService<IChatClient>("remote-decision");

The proxy invokes the registered client, but only accepts the same single-user JSON DecisionRequest contract as the keyed decision client. It supplies a question-specific JSON Schema response format, maps validated probability output to typed Choice, Score, and Noul answers, and returns the original request with a DecisionResponse in the decision field. The proxy rejects invalid requests or output, unsupported generation options, and streaming. The underlying chat client must support structured JSON responses; output is validated even when the client does not enforce the supplied schema. The proxy registers only its JSON and chat-client services; it does not add the default Themis router or ONNX services. The proxy does not replace the host's original client. The host remains responsible for general chat generation and any agent tool-selection loop.

Application-input mapping and queued decision handling are outside this package and are maintained separately.

License

Themis' adapter code is licensed under MIT, and the NuGet package includes the Themis license text. Microsoft.Extensions.AI retains its 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
4.7.1 52 11/24/2026
4.7.0 53 11/24/2026
4.6.0 102 11/22/2026
4.5.0 103 11/17/2026
4.4.0 95 11/17/2026
4.3.2 102 11/13/2026
4.3.1 92 11/12/2026
4.3.0 105 11/7/2026
4.2.0 108 11/5/2026
4.1.0 103 11/2/2026
4.0.2 116 10/27/2026
4.0.1 120 10/27/2026
4.0.0 102 10/26/2026
2.0.3 126 10/25/2026 2.0.3 is deprecated because it is no longer maintained.
2.0.1 125 10/25/2026 2.0.1 is deprecated because it is no longer maintained.
1.7.1 129 10/22/2026 1.7.1 is deprecated because it is no longer maintained.
1.7.0 289 10/22/2026 1.7.0 is deprecated because it is no longer maintained.
1.5.1 128 10/19/2026 1.5.1 is deprecated because it is no longer maintained.
1.3.0 137 10/17/2026 1.3.0 is deprecated because it is no longer maintained.
1.2.0 130 10/17/2026 1.2.0 is deprecated because it is no longer maintained.
Loading failed