Install
dotnet add package ElBruno.LocalEmbeddings.Harrier --version 1.6.4
| Product | Versions |
|---|---|
| .NET |
README
ElBruno.LocalEmbeddings.Harrier
High-quality multilingual embeddings using Microsoft Harrier-OSS-v1 locally with ONNX Runtime.
Installation
dotnet add package ElBruno.LocalEmbeddings.Harrier
Quick Start
using ElBruno.LocalEmbeddings.Harrier;
// Create with default settings (downloads INT8 quantized model on first run)
await using var generator = await HarrierEmbeddingGenerator.CreateAsync();
// Generate embeddings
var embeddings = await generator.GenerateAsync(["Hello world!", "Hola mundo!"]);
Console.WriteLine($"Dimensions: {embeddings[0].Vector.Length}"); // 640
Model Details
- Publisher: Microsoft (MIT license)
- Architecture: Decoder-only (Gemma 3 based)
- Parameters: 270M
- Embedding dimensions: 640
- Context window: 32,768 tokens
- Languages: 94+
- MTEB-v2 ranking: #1
- Default variant: INT8 Quantized (~270 MB)
Features
- π¦ Top-ranked embedding model on MTEB-v2 β best semantic quality
- π Multilingual support β 94+ languages
- π¦ Multiple quantization variants β Choose between quality (FP32/FP16) and speed (INT8/Q4)
- π― Instruction-tuned β Specify task-specific prefixes for better results
- π Long context β Supports up to 32,768 tokens
- β‘ ONNX Runtime β Runs locally on CPU, zero external API calls
- π Private by default β No data sent to external services
Configuration
var options = new HarrierEmbeddingsOptions
{
// Model variant (FP32, FP16, Quantized, Q4)
ModelVariant = HarrierModelVariant.Quantized,
// Instruction prefix for task-specific embeddings
InstructionPrefix = "Instruct: Retrieve semantically similar text\nQuery: ",
// Token limit
MaxSequenceLength = 8192,
// Cache and download
EnsureModelDownloaded = true,
CacheDirectory = null // Auto-detect per platform
};
await using var generator = await HarrierEmbeddingGenerator.CreateAsync(options);
Dependency Injection
using ElBruno.LocalEmbeddings.Harrier.Extensions;
using Microsoft.Extensions.AI;
services.AddHarrierEmbeddings(options =>
{
options.ModelVariant = HarrierModelVariant.Q4;
});
// Resolve as IEmbeddingGenerator<string, Embedding<float>>
var generator = serviceProvider.GetRequiredService<IEmbeddingGenerator<string, Embedding<float>>>();
Learn More
π Full Harrier Integration Guide β Instruction prefixes, configuration, troubleshooting, and migration from MiniLM.
π¬ HarrierConsoleApp Sample β Complete working example with 6 progressive scenarios.
License
MIT β See LICENSE
Changes from Previous Version
No structural changes between v1.6.3 and v1.6.4.
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.