VOOZH about

URL: https://www.nuget.org/packages/ElBruno.LocalEmbeddings.Npu

โ‡ฑ NuGet Gallery | ElBruno.LocalEmbeddings.Npu 1.5.0


๏ปฟ

๐Ÿ‘ Image
ElBruno.LocalEmbeddings.Npu 1.5.0

dotnet add package ElBruno.LocalEmbeddings.Npu --version 1.5.0
 
 
NuGet\Install-Package ElBruno.LocalEmbeddings.Npu -Version 1.5.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="ElBruno.LocalEmbeddings.Npu" Version="1.5.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ElBruno.LocalEmbeddings.Npu" Version="1.5.0" />
 
Directory.Packages.props
<PackageReference Include="ElBruno.LocalEmbeddings.Npu" />
 
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 ElBruno.LocalEmbeddings.Npu --version 1.5.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ElBruno.LocalEmbeddings.Npu, 1.5.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 ElBruno.LocalEmbeddings.Npu@1.5.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=ElBruno.LocalEmbeddings.Npu&version=1.5.0
 
Install as a Cake Addin
#tool nuget:?package=ElBruno.LocalEmbeddings.Npu&version=1.5.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

LocalEmbeddings

๐Ÿ‘ NuGet
๐Ÿ‘ NuGet Downloads
๐Ÿ‘ Build Status
๐Ÿ‘ GitHub stars
๐Ÿ‘ Twitter Follow

A .NET library for generating text embeddings locally using ONNX Runtime and Microsoft.Extensions.AI abstractions โ€” no external API calls required.

๐ŸŽฅ Quick Overview

New to local embeddings? Watch this 5-minute video explaining the main goal of the library.

Want to build RAG applications? Read this blog post about 3 RAG approaches in .NET with local embeddings and zero cloud calls.

Interested in image embeddings? Check out the YouTube video and blog post about local image embeddings with CLIP and ONNX.

Features

  • Local Embedding Generation โ€” Run inference entirely on your machine using ONNX Runtime
  • Microsoft.Extensions.AI Integration โ€” Implements IEmbeddingGenerator<string, Embedding<float>>
  • ๐Ÿฆ… Harrier model support โ€” Microsoft Harrier-OSS-v1 (270M, 640-dim, 94+ languages, instruction-tuned) via ElBruno.LocalEmbeddings.Harrier
  • Kernel Memory Integration โ€” Companion package ElBruno.LocalEmbeddings.KernelMemory provides a native ITextEmbeddingGenerator adapter for Microsoft Kernel Memory
  • VectorData Integration โ€” Companion package ElBruno.LocalEmbeddings.VectorData adds DI helpers for Microsoft.Extensions.VectorData (VectorStore and typed collections)
  • Built-in In-Memory Vector Store โ€” ElBruno.LocalEmbeddings.VectorData includes InMemoryVectorStore (no Semantic Kernel connector dependency required)
  • HuggingFace Model Support โ€” Use popular sentence transformer models from HuggingFace Hub
  • Automatic Model Caching โ€” Models are downloaded once and cached locally
  • Dependency Injection Support โ€” First-class IServiceCollection integration
  • Single-String Convenience API โ€” GenerateAsync("text") and GenerateEmbeddingAsync("text") โ€” no array wrapping needed
  • Similarity Helpers โ€” Cosine similarity, all-pairs Similarity(...) matrix, and one-line FindClosestAsync(...) semantic search
  • Thread-Safe & Batched โ€” Concurrent generation and efficient multi-text processing

๐Ÿ“ฆ NuGet Packages

Package Version Downloads Description
ElBruno.LocalEmbeddings ๐Ÿ‘ NuGet
๐Ÿ‘ Downloads
Core library โ€” ONNX Runtime + Microsoft.Extensions.AI
ElBruno.LocalEmbeddings.Harrier ๐Ÿ‘ NuGet
๐Ÿ‘ Downloads
Microsoft Harrier-OSS-v1 (270M, 640-dim, 94+ languages)
ElBruno.LocalEmbeddings.ImageEmbeddings ๐Ÿ‘ NuGet
๐Ÿ‘ Downloads
CLIP-based image embeddings for multimodal search
ElBruno.LocalEmbeddings.ImageEmbeddings.Downloader ๐Ÿ‘ NuGet
๐Ÿ‘ Downloads
Model downloader for image embeddings
ElBruno.LocalEmbeddings.KernelMemory ๐Ÿ‘ NuGet
๐Ÿ‘ Downloads
Microsoft Kernel Memory adapter
ElBruno.LocalEmbeddings.VectorData ๐Ÿ‘ NuGet
๐Ÿ‘ Downloads
Microsoft.Extensions.VectorData + InMemoryVectorStore
ElBruno.LocalEmbeddings.Npu ๐Ÿ‘ NuGet
๐Ÿ‘ Downloads
NPU-accelerated embeddings via DirectML
ElBruno.LocalEmbeddings.Npu.Intel ๐Ÿ‘ NuGet
๐Ÿ‘ Downloads
Intel Core Ultra NPU via OpenVINO
ElBruno.LocalEmbeddings.Npu.Qualcomm ๐Ÿ‘ NuGet
๐Ÿ‘ Downloads
Qualcomm Snapdragon X NPU via QNN

Installation

dotnet add package ElBruno.LocalEmbeddings

For Harrier model support, install the companion package:

dotnet add package ElBruno.LocalEmbeddings.Harrier

For Kernel Memory integration, also install:

dotnet add package ElBruno.LocalEmbeddings.KernelMemory

For VectorData integration, install:

dotnet add package ElBruno.LocalEmbeddings.VectorData

Quick Start

1) Generate one embedding

using ElBruno.LocalEmbeddings;

await using var generator = await LocalEmbeddingGenerator.CreateAsync();
var embedding = await generator.GenerateEmbeddingAsync("Hello, world!");
Console.WriteLine(embedding.Vector.Length); // 384

2) Generate embeddings for multiple texts

var inputs = new[] { "first text", "second text", "third text" };
var embeddings = await generator.GenerateAsync(inputs);
Console.WriteLine(embeddings.Count); // 3

3) Compare two texts with cosine similarity

using ElBruno.LocalEmbeddings.Extensions;

var pair = await generator.GenerateAsync(["I love coding", "I enjoy programming"]);
var score = pair[0].CosineSimilarity(pair[1]);
Console.WriteLine(score);

4) Semantic search in one line

var corpus = new[]
{
 "Python for data science",
 "JavaScript for web apps",
 "Swift for iOS development"
};

var corpusEmbeddings = await generator.GenerateAsync(corpus);
var results = await generator.FindClosestAsync(
 "best language for websites",
 corpus,
 corpusEmbeddings,
 topK: 2,
 minScore: 0.2f);

foreach (var result in results)
 Console.WriteLine($"{result.Score:F3} - {result.Text}");

5) Using Harrier model (higher quality, multilingual)

using ElBruno.LocalEmbeddings.Harrier;

var generator = await HarrierEmbeddingGenerator.CreateAsync();
var embedding = await generator.GenerateEmbeddingAsync("Hello, world!");
Console.WriteLine($"Dimensions: {embedding.Vector.Length}"); // 640

For custom models and runtime behavior, use the options-based constructor: new LocalEmbeddingGenerator(new LocalEmbeddingsOptions { ... }).

Note: The synchronous constructor remains available for backward compatibility, but performs blocking initialization when downloads are needed.

Want to go further? Read the and the other docs in this repo for DI, configuration, VectorData, Kernel Memory, and full RAG examples.

Prefer a containerized dev environment? See the Dev Container section in the .

Samples

All sample applications are located in src/Samples/. See the for prerequisites and run instructions.

Sample What It Shows
Minimal hello world with sentence-transformers/all-MiniLM-L12-v2
All the basics: single/batch embeddings, similarity, semantic search, DI
Harrier embedding model usage and similarity search
Embedding-only semantic search Q&A using shared VectorData InMemoryVectorStore (no LLM needed)
Full RAG with Ollama + phi4-mini + Kernel Memory
Full RAG with Foundry Local + phi4-mini
Minimal image RAG: index images โ†’ search by text
Interactive image RAG chat with text and image-to-image search

Configuration

var options = new LocalEmbeddingsOptions
{
 ModelName = "sentence-transformers/all-MiniLM-L6-v2", // HuggingFace model
 MaxSequenceLength = 512, // Max tokens
 CacheDirectory = null, // Auto-detect per platform
 EnsureModelDownloaded = true, // Download if missing
 NormalizeEmbeddings = false // L2 normalize vectors
};

See for supported models, local model paths, and cache locations.

Common model options (with model cards)

Estimated download sizes below are approximate and can vary by ONNX variant (fp32/int8) and tokenizer assets.

Documentation

Topic Description
Step-by-step guide from hello world to RAG
Classes, methods, and extension methods
Options, supported models, cache locations
Non-default free models, local download workflow, and license notes
All DI overloads and IConfiguration binding
Microsoft Harrier-OSS-v1 local embedding model
Using local embeddings with Microsoft Kernel Memory
Using local embeddings with Microsoft.Extensions.VectorData abstractions
Build from source, repo structure, guidelines
Planned and completed features/samples with priorities
NuGet publishing with GitHub Actions + Trusted Publishing
Versioned summary of notable changes

Have an idea for a new feature or sample? Please open an issue and share your suggestion.

Building from Source

git clone https://github.com/elbruno/elbruno.localembeddings.git
cd elbruno.localembeddings
dotnet build
dotnet test

Requirements

  • .NET 10.0 SDK or later
  • ONNX Runtime compatible platform (Windows, Linux, macOS)

๐Ÿ‘‹ About the Author

Hi! I'm ElBruno ๐Ÿงก, a passionate developer and content creator exploring AI, .NET, and modern development practices.

Made with โค๏ธ by ElBruno

If you like this project, consider following my work across platforms:

  • ๐Ÿ“ป Podcast: No Tienen Nombre โ€” Spanish-language episodes on AI, development, and tech culture
  • ๐Ÿ’ป Blog: ElBruno.com โ€” Deep dives on embeddings, RAG, .NET, and local AI
  • ๐Ÿ“บ YouTube: youtube.com/elbruno โ€” Demos, tutorials, and live coding
  • ๐Ÿ”— LinkedIn: @elbruno โ€” Professional updates and insights
  • ๐• Twitter: @elbruno โ€” Quick tips, releases, and tech news

License

This project is licensed under the MIT License โ€” see the file for details.

Product Versions Compatible and additional computed target framework versions.
.NET net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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
1.5.0 98 5/23/2026
1.4.6 112 4/28/2026
1.4.5 102 4/28/2026
1.4.3 113 4/7/2026
1.4.2 113 4/7/2026
1.4.1 115 4/7/2026
1.0.1 96 5/20/2026