Skip to content

AdamTovatt/vector-sharp

Repository files navigation

VectorSharp

Tests License: MIT

A high-performance .NET library for in-process vector similarity search and text embedding. No external services, no Docker, no infrastructure — just NuGet packages that work.

Packages

Package Description
VectorSharp.Storage In-memory and disk-backed vector storage with SIMD-optimized cosine similarity
VectorSharp.Embedding Channel-based embedding service with configurable parallelism
VectorSharp.Embedding.NomicEmbed Nomic Embed Text v1.5 model for local inference (768-dim, 8192 token context)
VectorSharp.Chunking Streaming text chunker with predefined formats for Markdown and C#

Quick Start

dotnet add package VectorSharp.Storage
dotnet add package VectorSharp.Embedding.NomicEmbed
using VectorSharp.Storage;
using VectorSharp.Embedding;
using VectorSharp.Embedding.NomicEmbed;

// Create an embedding service with local model inference
await using EmbeddingService embedder = new EmbeddingService(NomicEmbedProvider.Create);

// Create a vector store
CosineVectorStore<int> store = VectorStore.Create<int>("my-store", embedder.Dimension);

// Embed and store documents
float[] embedding = await embedder.EmbedAsync("some document text", EmbeddingPurpose.Document);
await store.AddAsync(1, embedding);

// Search with a query
float[] queryEmbedding = await embedder.EmbedAsync("find similar docs", EmbeddingPurpose.Query);
IReadOnlyList<SearchResult<int>> results = await store.FindMostSimilarAsync(queryEmbedding, count: 10);

License

MIT

About

A high-performance, zero-dependency .NET library for in-process vector similarity search with both in-memory and disk-backed storage.

Topics

Resources

Stars

Watchers

Forks

Contributors