CanDoItAll.AgentFramework.SemanticCompletion.Onnx 0.1.18

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

CanDoItAll Agent Framework Semantic Completion — ONNX

Optional local ONNX Runtime embeddings for CanDoItAll.AgentFramework.SemanticCompletion.Driver, targeting .NET 10. This package contains the ONNX adapter, BERT WordPiece tokenizer, and explicit Hugging Face model acquisition helper. It depends on the Driver contracts; the Driver does not depend on this package.

No model binaries are bundled.

Install

dotnet add package CanDoItAll.AgentFramework.SemanticCompletion.Onnx

Create and own a provider directly

using CanDoItAll.AgentFramework.SemanticCompletion.Onnx;

using var embeddings = new OnnxAgentTextEmbeddingGenerator(
    new OnnxAgentTextEmbeddingOptions
    {
        ModelDirectory = ".models/Xenova/all-MiniLM-L6-v2",
        ModelFileName = "onnx/model.onnx",
        VocabularyFileName = "vocab.txt",
        MaxTokenCount = 128,
        NormalizeOutput = true,
    });

OnnxAgentTextEmbeddingGenerator owns an ONNX InferenceSession and implements IDisposable. Reuse one instance rather than creating a session per request. Dispose directly constructed instances. When the DI container constructs the singleton, dispose the service provider/host so the session is released.

Use with the Driver DI extension

Register ONNX before the Driver. The Driver uses TryAdd, so the custom provider remains selected:

using CanDoItAll.AgentFramework.SemanticCompletion.Driver.DependencyInjection;
using CanDoItAll.AgentFramework.SemanticCompletion.Driver.Embeddings;
using CanDoItAll.AgentFramework.SemanticCompletion.Onnx;
using Microsoft.Extensions.DependencyInjection;

services.Configure<OnnxAgentTextEmbeddingOptions>(options =>
{
    options.ModelDirectory = ".models/Xenova/all-MiniLM-L6-v2";
    options.MaxTokenCount = 128;
});
services.AddSingleton<IAgentTextEmbeddingGenerator, OnnxAgentTextEmbeddingGenerator>();
services.AddAgentSemanticCompletionDriver();

The singleton can receive concurrent GenerateAsync calls after the Driver's one-time intent initialization. Validate concurrency and native-runtime settings for the host's workload. The Driver checks that every candidate and query uses the same profile ID and dimension, and always computes bounded full cosine similarity. NormalizeOutput defaults to true, but correctness does not rely on that declaration.

Acquire model assets explicitly

The defaults expect the Hugging Face repository Xenova/all-MiniLM-L6-v2, files onnx/model.onnx and vocab.txt, under .models/Xenova/all-MiniLM-L6-v2.

using var httpClient = new HttpClient();
var downloader = new HuggingFaceModelDownloader(httpClient);
var token = Environment.GetEnvironmentVariable("HF_TOKEN")
    ?? Environment.GetEnvironmentVariable("HUGGINGFACE_TOKEN")
    ?? Environment.GetEnvironmentVariable("HUGGING_FACE_HUB_TOKEN");

await downloader.DownloadAsync(
    new HuggingFaceModelDownloadOptions
    {
        RepositoryId = "Xenova/all-MiniLM-L6-v2",
        Revision = "main",
        OutputDirectory = ".models/Xenova/all-MiniLM-L6-v2",
    },
    token);

Keep access tokens in the host environment or secret store; do not put them in source, options files, logs, or package content. The downloader sends a bearer token only when one is supplied, creates missing directories, and reuses existing non-empty files. Pin a reviewed model revision for reproducible production deployments.

Licensing and trust

This NuGet package does not redistribute Hugging Face model weights. Model selection, download authorization, integrity/provenance checks, storage, and compliance with the selected model's license are the consuming application's responsibility. Microsoft ONNX Runtime and other transitive dependencies retain their own licenses. Review the package dependency list and the model repository before distribution.

Neural similarity remains fallback evidence; it is not authoritative workflow completion, authorization, or proof.

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
0.1.18 161 7/31/2026
0.1.17 101 7/30/2026
0.1.15 111 7/26/2026