Themis.Core
4.5.0
dotnet add package Themis.Core --version 4.5.0
NuGet\Install-Package Themis.Core -Version 4.5.0
<PackageReference Include="Themis.Core" Version="4.5.0" />
<PackageVersion Include="Themis.Core" Version="4.5.0" />
<PackageReference Include="Themis.Core" />
paket add Themis.Core --version 4.5.0
#r "nuget: Themis.Core, 4.5.0"
#:package Themis.Core@4.5.0
#addin nuget:?package=Themis.Core&version=4.5.0
#tool nuget:?package=Themis.Core&version=4.5.0
Themis.Core
Themis.Core provides provider and runtime-initialization contracts, model
routing, and the keyed model-packing registry used by Themis.
The package targets .NET 10 and depends on Themis.Common. Add
Themis.Inference for the built-in ONNX provider and packer.
Hand-written typed decision schemas
For fixed question sets, implement IDecisionSchema<TSelf, TInput> with a
central question, question definitions, and a response mapper. The generic
input is serialized by Themis at the router boundary; application code does
not need to construct a JsonElement. Dynamic callers can continue using
DecisionRequest directly.
public sealed record TicketState(string Message);
public sealed record TicketTriage(string Department)
: IDecisionSchema<TicketTriage, TicketState>
{
public static string CentralQuestion => "How should this ticket be routed?";
public static IReadOnlyDictionary<string, QuestionDefinition> Questions { get; } =
new Dictionary<string, QuestionDefinition>
{
["department"] = new(QuestionType.Choice, "Choose the owning team.")
};
public static TicketTriage MapResponse(DecisionResponse response) =>
new(response.GetRequiredAnswer<ChoiceAnswer>("department").Choice);
}
var result = await router.PredictSchemaAsync<TicketTriage, TicketState>(
new(new TicketState("The invoice appears duplicated."), Model: "triage-model"));
DecisionSchemaContext<TInput> also accepts provider key, task, language, and
object-valued extras. Missing answers and answer-kind mismatches reported by
GetRequiredAnswer<TAnswer> use ThemisMappingException; custom mapping
exceptions propagate unchanged.
PredictSchemaAsync uses web JSON defaults for state and extras. Set its
jsonSerializerDefaults parameter to JsonSerializerDefaults.General or
.Web, or pass an IJsonWrapper through jsonWrapper for host-specific
settings; an explicit wrapper takes precedence. QuestionDefinition.FromCriteria
and DecisionEvaluationCase.Create<TState> accept the same defaults and wrapper
options, so criteria, evaluation state, and inference state can use consistent
serialization rules.
The router keeps route selection behind an internal resolver and exposes
Route/RouteRouted for inspecting the selected model and provider. Callers
can explicitly select a model or keyed provider with the existing request
contracts. There is not yet a public custom-route-selector API; the internal
resolver can evolve without freezing an unsupported routing extension contract.
Optional confidence escalation
Register the primary and escalation providers under keys, then register a
composed key with AddThemisConfidenceEscalationProvider. Select that key
through DecisionSchemaContext<TInput>.ProviderKey or RouteRequest. The
internal provider forwards the same request to the primary provider and invokes
the escalation provider only when a configured answer succeeds but falls below
its measured per-question threshold. There are no default thresholds.
Concurrency, timeout, and optional per-minute escalation limits are configured
through ConfidenceEscalationOptions. Provider failures, invalid/missing
answers, and cancellation are not treated as uncertainty; human review remains
an application outcome.
Local-provider lifecycle
Register a lifecycle-controlled default provider with
AddThemisDecisionProviderLifecycle, or a keyed one with
AddThemisKeyedDecisionProviderLifecycle. The host supplies a factory that
creates a provider instance owned exclusively by the lifecycle; do not return
another container-owned singleton. Use the default lifecycle registration in
place of other default IDecisionInferenceProvider registrations. Resolve the public
IDecisionProviderLifecycle to control it. FirstUse is the default mode;
Startup requires the host to call StartAsync before serving traffic;
Explicit requires InitializeAsync. WarmupAsync can initialize and run a
host-owned warmup request. RetireAsync rejects new calls, drains active
inference, disposes owned resources, and releases the underlying provider
reference. A retired first-use provider may initialize again on its next call;
startup/explicit modes require another explicit initialization.
services.AddThemisDecisionProviderLifecycle(
(serviceProvider, cancellationToken) => CreateLocalProviderAsync(serviceProvider, cancellationToken),
DecisionProviderActivationMode.Startup);
services.AddThemisDecisionRouter();
var lifecycle = app.Services.GetRequiredService<IDecisionProviderLifecycle>();
await lifecycle.StartAsync(hostStoppingToken);
// Stop accepting new work before retiring during host shutdown.
await lifecycle.RetireAsync(hostStoppingToken);
Disposal does not guarantee that the runtime immediately returns native model memory to the operating system. The router may continue to hold its lifecycle wrapper; retirement releases the owned provider/session reference behind that explicit boundary.
Provider telemetry
Provider calls through ThemisDecisionAgent are instrumented automatically.
The Themis.DecisionInference activity source traces routing, provider calls,
batches, and lifecycle operations. The meter records provider-call outcomes.
Telemetry does not include request state, question keys, answer content, model
IDs, provider registration keys, or credentials. Hosts configure exporters.
License
Themis.Core is licensed under MIT. The package includes the Themis license text;
its dependency has its own package metadata and terms.
| 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.DependencyInjection.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.13)
- Themis.Common (>= 4.5.0)
NuGet packages (20)
Showing the top 5 NuGet packages that depend on Themis.Core:
| Package | Downloads |
|---|---|
|
Themis.Inference.Ollama
Ollama System One decision inference without ONNX runtime dependencies. |
|
|
Themis.Inference
Prepared ONNX inference, bundle validation, and model packing for Themis. |
|
|
Themis
Typed model decisions for .NET apps, with dependency-injection registration and a default ONNX runtime. |
|
|
Themis.Maf
Expose typed Themis decision inference through Microsoft.Extensions.AI. |
|
|
Themis.Inference.WinML
Optional Windows ML execution-provider integration for Themis ONNX inference. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 4.5.0 | 68 | 11/17/2026 | |
| 4.4.0 | 75 | 11/17/2026 | |
| 4.3.2 | 234 | 11/13/2026 | |
| 4.3.1 | 245 | 11/12/2026 | |
| 4.3.0 | 323 | 11/7/2026 | |
| 4.2.0 | 302 | 11/5/2026 | |
| 4.1.0 | 301 | 11/2/2026 | |
| 4.0.2 | 362 | 10/27/2026 | |
| 4.0.1 | 222 | 10/27/2026 | |
| 4.0.0 | 235 | 10/26/2026 | |
| 2.0.3 | 268 | 10/25/2026 | |
| 2.0.1 | 187 | 10/25/2026 | |
| 1.7.1 | 245 | 10/22/2026 | |
| 1.7.0 | 339 | 10/22/2026 | |
| 1.5.1 | 278 | 10/19/2026 | |
| 1.3.0 | 174 | 10/17/2026 | |
| 1.2.0 | 158 | 10/17/2026 | |
| 1.0.0 | 199 | 10/15/2026 |