Themis.Inference.Remote.Grpc 4.6.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Themis.Inference.Remote.Grpc --version 4.6.0
                    
NuGet\Install-Package Themis.Inference.Remote.Grpc -Version 4.6.0
                    
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.Inference.Remote.Grpc" Version="4.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Themis.Inference.Remote.Grpc" Version="4.6.0" />
                    
Directory.Packages.props
<PackageReference Include="Themis.Inference.Remote.Grpc" />
                    
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.Inference.Remote.Grpc --version 4.6.0
                    
#r "nuget: Themis.Inference.Remote.Grpc, 4.6.0"
                    
#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.Inference.Remote.Grpc@4.6.0
                    
#: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.Inference.Remote.Grpc&version=4.6.0
                    
Install as a Cake Addin
#tool nuget:?package=Themis.Inference.Remote.Grpc&version=4.6.0
                    
Install as a Cake Tool

Themis.Inference.Remote.Grpc

Themis.Inference.Remote.Grpc provides a default gRPC wire contract for Themis decision inference. It is built on Themis.Inference.Remote.Rpc: GrpcDecisionRpcProtocol implements IRemoteDecisionRpcProtocol, while the RPC package supplies the shared provider lifecycle, cancellation forwarding, latency measurement, and logging.

The package includes the versioned themis.inference.v1 protobuf contract, generated client and server stubs, and a server service that delegates to a ThemisDecisionRouter. It provides non-routed Infer and routed InferRouted operations. The contract maps decision state, questions, extras, typed answers, usage, and routing metadata. JSON-valued fields travel as JSON text to preserve their values exactly.

Client

Register the generated client and Themis remote provider. Options can be configured directly, with DI-aware callbacks, or by returning options from a Func<IServiceProvider, GrpcClientFactoryOptions>. The returned IHttpClientBuilder supports channel settings, interceptors, and handler pipelines:

using Microsoft.Extensions.DependencyInjection;
using Grpc.Net.ClientFactory;
using Themis.Core;
using Themis.Core.Extensions;
using Themis.Inference.Remote.Grpc;

services.AddThemisRemoteGrpcDecisionInference(options =>
    options.Address = new Uri("https://inference.example/"))
    .ConfigureChannel(options =>
    {
        options.MaxReceiveMessageSize = 4 * 1024 * 1024;
    });
services.AddThemisDecisionRouter(new DecisionRouterOptions("model-v1")
{
    RouteUnspecifiedRequestsToDefaultModel = true
});

Use the keyed overload to register multiple remote gRPC services:

services.AddThemisRemoteGrpcDecisionInference(
    "secondary",
    options => options.Address = new Uri("https://secondary.example/"));

The Func-based overload can build its options from host services:

services.AddThemisRemoteGrpcDecisionInference(provider =>
    new GrpcClientFactoryOptions
    {
        Address = provider.GetRequiredService<InferenceEndpoint>().Address
    });

Use the generated client directly when making an explicitly routed call. An absent provider key selects the unkeyed provider on the server:

var response = await client.InferRoutedAsync(new RoutedDecisionInferenceRequest
{
    Request = request,
    ProviderKey = "secondary"
});

Authentication, TLS, retry policy, deadlines, and interceptors remain host configuration. The default protocol forwards the caller cancellation token and lets gRPC transport exceptions propagate unchanged.

Server

The server project references Grpc.AspNetCore and Themis.Inference.Remote.Grpc. The package registers the service and its router dependencies; the host still adds gRPC transport services and maps the endpoint:

using Microsoft.Extensions.DependencyInjection;
using Themis.Core;
using Themis.Core.Interfaces;
using Themis;
using Themis.Inference.Remote.Grpc;

builder.Services.AddGrpc();
builder.Services.AddThemis(options =>
    options.ModelBundleDirectory = @"C:\models\support-triage");
builder.Services.AddThemisRemoteGrpcDecisionInferenceServer();

var app = builder.Build();
app.MapGrpcService<ThemisDecisionInferenceGrpcService>();
app.Run();

The server registration can instead create an unkeyed or keyed provider, or create a custom router from DI:

builder.Services.AddThemisRemoteGrpcDecisionInferenceServer(
    provider => provider.GetRequiredService<MyDecisionInferenceProvider>());
builder.Services.AddThemisRemoteGrpcDecisionInferenceServer(
    "secondary",
    provider => provider.GetRequiredService<SecondaryDecisionInferenceProvider>());
builder.Services.AddThemisRemoteGrpcDecisionInferenceServer(
    provider => new ThemisDecisionRouter(
        provider.GetRequiredService<IDecisionInferenceProvider>(),
        new DecisionRouterOptions("model-v1")));

Register the referenced provider types in DI before using the provider factory overloads. The unkeyed provider serves Infer; a keyed provider is selected by InferRouted using its provider key. The Func-based router overload lets the host build a custom router from its own services.

Infer invokes ThemisDecisionRouter.PredictAsync; InferRouted invokes PredictRoutedAsync and can select a keyed provider. Server authentication, authorization, message-size limits, and transport policy are configured by the host. The host can replace the service implementation or use the generated ThemisDecisionInference service base for custom behavior.

The protobuf source is included in the NuGet package under protos/ for non-.NET clients and server implementations. The package does not reference Grpc.AspNetCore; server hosts add that dependency themselves.

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.8.0 0 11/29/2026
4.7.2 47 11/28/2026
4.7.1 72 11/24/2026
4.7.0 79 11/24/2026
4.6.0 93 11/22/2026
4.5.0 97 11/17/2026
4.4.0 95 11/17/2026
4.3.2 99 11/13/2026
4.3.1 93 11/12/2026
4.3.0 98 11/7/2026
4.2.0 100 11/5/2026