Skip to content

Discover Build5Nines.SharpVector

Build5Nines.SharpVector is the lightweight, in-memory, semantic search, text vector database built for .NET applications. It enables fast and flexible vector-based similarity search for text data β€” ideal for search engines, recommendation systems, semantic analysis, and AI-enhanced features.

.NET Core Tests Build and Release Libraries.io dependency status for GitHub repo

NuGet License: MIT Framework: .NET 8+ Semantic Search: Enabled Gen AI: Ready

Vector databases are used with Semantic Search and Generative AI solutions augmenting the LLM (Large Language Model) with the ability to load additional context data with the AI prompt using the RAG (Retrieval-Augmented Generation) design pattern.

While there are lots of large databases that can be used to build Vector Databases (like Azure CosmosDB, PostgreSQL w/ pgvector, Azure AI Search, Elasticsearch, and more), there are not many options for a lightweight vector database that can be embedded into any .NET application. Build5Nines SharpVector is the lightweight in-memory Text Vector Database for use in any .NET application that you're looking for!


"For the in-memory vector database, we're using Build5Nines.SharpVector, an excellent open-source project by Chris Pietschmann. SharpVector makes it easy to store and retrieve vectorized data, making it an ideal choice for our sample RAG implementation."

- Tulika Chaudharie, Principal Product Manager at Microsoft for Azure App Service


πŸš€ Basic Usage

Here's a really simple usage of creating a vector database, adding some text to it, then performing a semantic search on the data.

C#
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using Build5Nines.SharpVector;

// Create new vector database
var vdb = new BasicMemoryVectorDatabase();

// Get text to vectorize
string[] texts = LoadMultipleTexts();
// Define metadata to store alongside the text vectors
var metadata = "custom metadata";

// Add multiple texts with metadata to vector database
foreach(var t in texts)
{
    // vectorize the text
    vdb.AddText(t, metadata);
}

// Perform semantic search using Cosine Similarity search on the text vectors in the database
var result = vdb.Search("Build5Nines.SharpVector is awesome!");

// Loop through search results
foreach(var item in results.Texts)
{
    var itemText = item.Text;
    var itemMetadata = item.Metadata;

    // do something with the semantic search results
}

πŸ’‘ Key Features

  • πŸ” Text Embedding & Search – Store and search documents using vector similarity (cosine, Euclidean, etc.)
  • 🧠 Pluggable Embeddings – Works with your own vectorizer (like OpenAI, Ollama, or custom)
  • ⚑ In-Memory Performance – Designed for speed in local or embedded applications
  • πŸ› οΈ Lightweight & Easy to Use – Minimal dependencies, simple API
  • πŸ“¦ Custom Metadata - Store additional metadata with each text entry stored in the vector database.
  • πŸ› οΈ Supports async/await - Async methods for scalable and non-blocking database operations.
  • ⚑ Vector Comparisons - Supports various vector comparison methods for searching similar texts. Including cosine similarity (by default), and configurable for Euclidean distance. Or write your own custom vector comparison algorithm.

Your IT Career Upgrade Starts Now!

We believe mentorship is the fastest, most powerful way to unlock your IT career – and master in-demand skills like Cloud, Cybersecurity, DevOps, Development, and AI. You don’t have to do it alone. Our community is here to rise with you.

Join the Build5Nines Membership and get access to exclusive courses, hands-on labs, members-only forums, and mentoring.

Join Now at members.build5nines.com β†’


🧠 Use Cases

An in-memory vector databases like Build5Nines.SharpVector provides several advantages over a traditional vector database server, particularly in scenarios that might demand high performance, low latency, and efficient resource usage.

SharpVector is great for:

  • Building semantic search over documents or notes

  • Embedding search within desktop or server .NET applications

  • Powering recommendation features based on text similarity

  • Integrating with OpenAI or local embeddings for intelligent querying

  • Offline or Edge computing with limited or no internet connectivity

  • Development and testing without the overhead of installing a server


βš™οΈ Local, OpenAI, or Ollama Embeddings Generation

Build5Nines.SharpVector includes a local text vectorizer to generate embeddings for text added to the database. This is automatic and eliminates external LLM server dependencies. However, both OpenAI Embeddings and Ollama Embeddings are also supported for more robust and higher quality embeddings support.

  • Local Embeddings


    Use built-in functionality to generate text vector embeddings, without server dependencies.

    Getting started

  • OpenAI Embeddings


    Use OpenAI and/or Azure OpenAI Service embeddings models like text-embedding-ada-002 or others.

    Getting started

  • Ollama Embeddings


    Use Ollama embeddings models like nomic-embed-text or others.

    Get Started


πŸ™Œ Contributing

We welcome contributions, feedback, and new ideas. Whether it's a bug report or a pull request, head over to our GitHub repository to start collaborating!


The Build5Nines SharpVector project is maintained by Chris Pietschmann, founder of Build5Nines, Microsoft MVP, HashiCorp Ambassador, and Microsoft Certified Trainer (MCT).