kelindar/search
Go library for embedded vector search and semantic embeddings using llama.cpp
What it solves
This project provides a lightweight, exact cosine similarity index for managing and searching through small to medium-sized datasets of vectors. It eliminates the need for a heavy external database by providing a native Go implementation for indexing and searching, along with integrated support for generating embeddings from both local and cloud-based providers.
How it works
The library consists of a core search index that performs a linear scan of all vectors to find the most relevant results based on cosine similarity. To get data into the index, it provides two optional embedding modules:
- Local Embeddings: Uses
llama.cppviapuregoto generate embeddings from GGUF models locally on the CPU or GPU. - Cloud Embeddings: Connects to OpenAI-compatible APIs (including OpenRouter) to generate text embeddings.
Users can also provide their own vectors from any custom source, as the core indexing logic is decoupled from the embedding providers.
Who it’s for
Go developers who need to implement vector search functionality without the overhead of a full-scale vector database, specifically for datasets that are small enough to be handled by a linear scan.
Highlights
- Zero-dependency core: The main search package has no native library requirements or dependencies on the embedding modules.
- Flexible embedding options: Supports both local GGUF models and cloud APIs.
- Persistence: Includes built-in methods to read and write the index to files.
- Local GPU support: Local embeddings can be compiled with GPU acceleration (e.g., Vulkan).
- Provider agnostic: Allows easy swapping of embedding providers through a simple interface.
Related
- Project
- Project
- Project
- Project