AIKernel.Providers.Embedding
0.1.4
dotnet add package AIKernel.Providers.Embedding --version 0.1.4
NuGet\Install-Package AIKernel.Providers.Embedding -Version 0.1.4
<PackageReference Include="AIKernel.Providers.Embedding" Version="0.1.4" />
<PackageVersion Include="AIKernel.Providers.Embedding" Version="0.1.4" />
<PackageReference Include="AIKernel.Providers.Embedding" />
paket add AIKernel.Providers.Embedding --version 0.1.4
#r "nuget: AIKernel.Providers.Embedding, 0.1.4"
#:package AIKernel.Providers.Embedding@0.1.4
#addin nuget:?package=AIKernel.Providers.Embedding&version=0.1.4
#tool nuget:?package=AIKernel.Providers.Embedding&version=0.1.4
AIKernel Local Embedding Provider
AIKernel.Providers.Embedding produces 384-dimension text vectors on the CPU from the official intfloat/multilingual-e5-small FP32 ONNX model. It supports the original AIKernel 0.1.4 text interfaces and the batch request interface in AIKernel.Contracts.Embedding. Inputs and inference stay on the host.
Register the model
Download onnx/model.onnx and onnx/tokenizer.json from revision 614241f622f53c4eeff9890bdc4f31cfecc418b3 of the model repository. Keep the two files together in the directory set by ModelDirectory.
| File | SHA-256 |
|---|---|
model.onnx |
ca456c06b3a9505ddfd9131408916dd79290368331e7d76bb621f1cba6bc8665 |
tokenizer.json |
0b44a9d7b51c3c62626640cda0e2c2f70fdacdc25bbbd68038369d14ebdf4c39 |
The model repository identifies the model license as MIT. The NuGet package ships the provider code; the model and tokenizer files are downloaded separately. The provider verifies the file lengths and checksums before using them.
Inference uses ONNX Runtime. The Hugging Face Tokenizers .NET binding applies the official tokenizer pipeline, including whitespace around special tokens.
Configure the provider
Create LocalEmbeddingSettings directly or bind it from the host's configuration. Settings apply to one instance. Rebuild the instance to change its settings. For example, a host using .NET configuration can bind the Embedding section:
{
"Embedding": {
"ModelDirectory": "models/multilingual-e5-small",
"MaxBatchSize": 16,
"MaxTokens": 512,
"MaxRequestBytes": null,
"CpuThreads": 4,
"DefaultNormalize": true,
"DefaultPurpose": "Query"
}
}
MaxBatchSizeandMaxTokensdefault to 16 and 512. Tokens include the automatically added prefix and special tokens. The model context limitsMaxTokensto 512. The capability descriptor reports the configured limits.MaxRequestBytesoptionally caps the combined UTF-8 length of the input texts, before prefixes.CpuThreadsdefaults to the lower of four and the number of available processors. Set it to 0 to use ONNX Runtime's default.- Per-request
NormalizeandPurposeoverride the configured defaults. UseQueryfor a search query andDocumentfor an indexed passage. The provider supplies the model's prefix. - Hosts using
Microsoft.Extensions.Configuration.Bindercan load these settings withconfiguration.GetRequiredSection("Embedding").Get<LocalEmbeddingSettings>().
using AIKernel.Dtos.Providers.Embedding;
using AIKernel.Providers.Embedding;
await using var provider = new LocalEmbeddingProvider(new LocalEmbeddingSettings
{
ModelDirectory = "models/multilingual-e5-small"
});
await provider.InitializeAsync();
var result = await provider.GenerateEmbeddingsAsync(new EmbeddingRequest
{
Inputs = [new EmbeddingInput.Text("画像をPNGで保存する")],
Purpose = EmbeddingPurpose.Document
});
float[] vector = result.Items[0].Dense!;
The available model accepts text and returns dense FP32 vectors. Requests for reduced dimensions, sparse output and unsupported modalities fail with provider error codes. Oversized batches and texts also fail. Inference observes cancellation. An instance without an initialized model has an empty model list and reports provider.model_not_registered for embedding requests.
| 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
- AIKernel.Contracts.Embedding (= 0.1.4)
- Microsoft.ML.OnnxRuntime (>= 1.32.0)
- Tokenizers.HuggingFace (>= 3.23.1)
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.4 | 66 | 11/23/2026 |
Adds real local text embeddings with configurable limits and AIKernel 0.1.4 text API compatibility.