Themis.Maf
4.0.2
dotnet add package Themis.Maf --version 4.0.2
NuGet\Install-Package Themis.Maf -Version 4.0.2
<PackageReference Include="Themis.Maf" Version="4.0.2" />
<PackageVersion Include="Themis.Maf" Version="4.0.2" />
<PackageReference Include="Themis.Maf" />
paket add Themis.Maf --version 4.0.2
#r "nuget: Themis.Maf, 4.0.2"
#:package Themis.Maf@4.0.2
#addin nuget:?package=Themis.Maf&version=4.0.2
#tool nuget:?package=Themis.Maf&version=4.0.2
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.
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 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 | 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
- Microsoft.Extensions.AI.Abstractions (>= 10.11.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.13)
- Themis (>= 4.0.2)
- Themis.Common (>= 4.0.2)
- Themis.Core (>= 4.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.