Starlings.Models.E5.Extensions.AI
0.4.0
See the version list below for details.
dotnet add package Starlings.Models.E5.Extensions.AI --version 0.4.0
NuGet\Install-Package Starlings.Models.E5.Extensions.AI -Version 0.4.0
<PackageReference Include="Starlings.Models.E5.Extensions.AI" Version="0.4.0" />
<PackageVersion Include="Starlings.Models.E5.Extensions.AI" Version="0.4.0" />
<PackageReference Include="Starlings.Models.E5.Extensions.AI" />
paket add Starlings.Models.E5.Extensions.AI --version 0.4.0
#r "nuget: Starlings.Models.E5.Extensions.AI, 0.4.0"
#:package Starlings.Models.E5.Extensions.AI@0.4.0
#addin nuget:?package=Starlings.Models.E5.Extensions.AI&version=0.4.0
#tool nuget:?package=Starlings.Models.E5.Extensions.AI&version=0.4.0
Starlings.Models.E5.Extensions.AI
Microsoft.Extensions.AI IEmbeddingGenerator<string, Embedding<float>> over the multilingual-e5-small embedder in Starlings.Models.E5: the same tokenizer, encoder and numbers, usable with Microsoft.Extensions.AI middleware and dependency injection. The API may still change.
Maturity
Maturity is per profile, generated from the registry manifests by model-pipeline catalog (do not edit this table by hand). Gates, evidence and capabilities per profile: the model catalog.
| Profile | Maturity | Platforms |
|---|---|---|
multilingual-e5-small/onnx-fp32-cpu |
stable | linux-x64 cpu: supported; windows-x64 cpu: experimental |
multilingual-e5-small/onnx-fp32-cuda |
stable | linux-x64 cuda: supported; windows-x64 cuda: untested |
Install
dotnet add package Starlings.Models.E5.Extensions.AI
dotnet add package Microsoft.ML.OnnxRuntime --version 1.30.0 # or Microsoft.ML.OnnxRuntime.Gpu.Linux; exactly one
Use
using Starlings.Models.E5;
using Starlings.Models.E5.Extensions.AI;
using Microsoft.Extensions.AI;
await E5ModelAssets.DownloadAsync(); // explicit acquisition, once
E5ModelFiles files = E5ModelAssets.OpenLocal(); // offline
using IEmbeddingGenerator<string, Embedding<float>> generator = E5EmbeddingGenerator.Create(files,
new E5EmbeddingGeneratorOptions { InputType = E5InputType.Query }); // adds "query: "; the default adds nothing
var embeddings = await generator.GenerateAsync(["how much protein should a female eat"]);
// Or with DI: services.AddE5EmbeddingGenerator(files);
- Prefixes are explicit:
E5InputType.QueryorPassageper generator, or per request withAdditionalProperties["e5_input_type"]. GenerateAsyncruns inline unless a scheduler is set: by default it runs synchronously on the calling thread and returns a completed task; withExecutionSchedulerset it runs as one task on that scheduler (below). Failures and cancellation are reported through the task, never thrown synchronously.- Unsupported options (
Dimensionsother than 384, anotherModelId, aRawRepresentationFactory, unknown additional properties) fail withNotSupportedExceptioninstead of being ignored.
Streaming (experimental)
await foreach (Embedding<float> embedding in generator.EmbedStreamAsync(ReadPassagesAsync(), cancellationToken: ct))
{
// one embedding per text, in input order
}
EmbedStreamAsync(IAsyncEnumerable<string>, options, cancellationToken) embeds a stream without materializing it. Request options are resolved once, before the first value. Values are tokenized as they arrive and grouped as the encoder groups an explicit batch (MaxBatchSize rows and, when set, MaxBatchTokens padded cells); a group runs when the next value does not fit or the source ends, and its embeddings are then yielded. With SortByLength off the embeddings equal one GenerateAsync call over the same values bit for bit. There is no per-embedding usage, and micro-batching does not apply. Status: experimental (capability extensions_ai.stream; weight-free tests). The profile capability streaming (incremental output of one input) stays unsupported.
Execution scheduler (experimental, opt-in)
E5EmbeddingGeneratorOptions.ExecutionScheduler (a TaskScheduler, null by default) chooses where GenerateAsync and the stream's encoder runs execute. Null keeps the inline behavior above. TaskScheduler.Default offloads to the thread pool; an application's own scheduler (for example one thread per device) can serialize or place the work. The numbers do not change. Status: experimental (capability extensions_ai.execution_scheduler; weight-free tests).
Micro-batching (experimental, opt-in)
var generator = E5EmbeddingGenerator.Create(files, new E5EmbeddingGeneratorOptions
{
MicroBatching = new() { MaxRows = 8, MaxWait = TimeSpan.FromMilliseconds(2) }, // null (default): off
});
With MicroBatching set, a GenerateAsync call with exactly one value is tokenized and validated on the calling thread (an invalid value fails only its own call), then queued; one dispatcher thread embeds the queued values of concurrent callers in padded batches of at most MaxRows values and MaxTokens padded token cells, dispatched when full or when the oldest has waited MaxWait (default zero: no added latency, a batch holds what queued while the previous one ran). Outputs then depend on the concurrent traffic: equal to a single call within the profile's padded-batch tolerance, not bit for bit reproducible. Calls with several values run as one explicit batch, as without the option. Cancelling a queued call removes it; cancelling a dispatched one cancels only that caller's task (the batch keeps running for the others). A full queue (QueueCapacity) makes callers wait for a slot. Dispose faults queued calls with ObjectDisposedException and waits for a running batch. MicroBatchingStatistics reports batches, items, padding and queue and run time. Status: experimental (capability extensions_ai.micro_batching): weight-free tests and one real-model test within the padded-batch tolerance on Linux x64 CPU; no benchmark adoption decision, no CUDA run and no soak yet.
Status: supported on the Stable e5 onnx-fp32-cpu profile (Linux x64 CPU; G7 passed; the contract is in the Starlings.Models.E5 README); supported over a CUDA session on the Stable onnx-fp32-cuda profile (Linux x64, RTX 3090; 46 protected texts within the CUDA profile's bound, rerun by the per-release GPU regression; the contract is the README's "Stable contract: CUDA"). See the 0.2.0 release notes.
| 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.10.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Starlings.Models.E5 (= 0.4.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Starlings.Models.E5.Extensions.AI:
| Package | Downloads |
|---|---|
|
Starlings.Models.E5.Browser
intfloat/multilingual-e5-small (revision 614241f6) sentence embeddings in the browser (Blazor WebAssembly and other .NET browser-wasm apps) on onnxruntime-web: the owned tokenizer (Starlings.Tokenizers) and the same padding, mean pooling and L2 normalization code as Starlings.Models.E5, async, plus a Microsoft.Extensions.AI IEmbeddingGenerator. Pins the fp32 graph (from the Hub) and the int8-embed variant (host it yourself) by SHA-256. Profiles multilingual-e5-small/onnx-fp32-wasm, onnx-int8embed-wasm (and -webgpu with Starlings.Runtime.OnnxWeb.WebGpu). WebAssembly has no support badge. Maturity is per model profile (Stable, Preview or Experimental): see the README, generated from the model registry. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.5.0 | 115 | 11/3/2026 |
| 0.4.0 | 100 | 11/3/2026 |
| 0.3.0 | 136 | 10/19/2026 |
| 0.2.0 | 155 | 10/17/2026 |
| 0.1.0-preview.6 | 118 | 10/14/2026 |