Repolode
kelindar

kelindar/search

Go library for exact cosine-similarity vector search, with optional local GGUF embeddings via llama.cpp and cloud embeddings via OpenAI-compatible APIs.

Stars
561
Forks
24
Open issues
5
Last commit
2 months ago

What is it?

kelindar/search is a Go library for storing vectors in an in-memory index and finding the most similar entries by cosine similarity. The core package has no native dependencies and handles indexing, search and persistence on its own, which suits small and medium datasets where an exact scan is acceptable.

Embedding providers are separate modules. The llama package runs local GGUF models such as MiniLM through llama.cpp using purego, with CPU by default and optional GPU layers. The openai package calls OpenAI-compatible embedding endpoints, including OpenRouter, using only the standard library. Any function that returns a []float32 can also feed the index through a small interface.

The project is split into independent Go modules so applications only pull in the provider they use. Local embeddings require building a llama.cpp wrapper library for Linux, macOS or Windows first.

Key features

  • 01Exact cosine similarity search over in-memory vectors, returning results sorted by relevance.
  • 02Index persistence through file and io.Writer/Reader functions.
  • 03Local GGUF embeddings through llama.cpp with optional GPU layers.
  • 04Cloud embeddings through OpenAI-compatible APIs, including OpenRouter, with batch requests.
  • 05Provider-agnostic design where any function returning vectors can feed the index.

Use cases

  • Adding semantic search to a Go service with a few thousand to tens of thousands of documents.
  • Running embeddings fully locally with a GGUF model such as MiniLM.
  • Switching between OpenAI and OpenRouter embedding models without changing index code.
  • Prototyping retrieval features where an exact scan is fast enough.

Quick start

  1. 1

    Clone the repository with its submodules and LFS files

    git submodule update --init --recursive
  2. 2

    Fetch the model and vector fixtures via Git LFS

    git lfs pull
  3. 3

    Install the core search library

    go get github.com/kelindar/search

Things to know

  • Search is exact and scans every vector, so it suits only small and medium datasets.
  • Local embeddings require building a native llama.cpp library with CMake and a C/C++ compiler.
  • Requires Go 1.27 or newer.

In collections

Topics

FAQ

What is search?
Go library for exact cosine-similarity vector search, with optional local GGUF embeddings via llama.cpp and cloud embeddings via OpenAI-compatible APIs. kelindar/search is a Go library for storing vectors in an in-memory index and finding the most similar entries by cosine similarity. The core package has no native dependencies and handles indexing, search and persistence on its own, which suits small and medium datasets where an exact scan is acceptable.
Is search free to use? What license does it have?
search is open source under the MIT license. Check the license terms before using it in commercial products.
Is search still maintained?
Updated within 6 months. The last commit to search was on Sep 19, 2026.
What can I use search for?
Adding semantic search to a Go service with a few thousand to tens of thousands of documents. Running embeddings fully locally with a GGUF model such as MiniLM. Switching between OpenAI and OpenRouter embedding models without changing index code. Prototyping retrieval features where an exact scan is fast enough.
How do I install search?
Clone the repository with its submodules and LFS files: git submodule update --init --recursive Fetch the model and vector fixtures via Git LFS: git lfs pull Install the core search library: go get github.com/kelindar/search
Where can I get search?
The source code and installation instructions are on GitHub: https://github.com/kelindar/search

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects