Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vector-index

A pure-Zig vector similarity index with an optional FAISS accelerator.

  • Flat exact search (inner product; pass L2-normalized vectors for cosine) is the implementation of record: no native dependencies, and it cross-compiles statically everywhere Zig does.
  • FAISS, when libfaiss_c is present at runtime, mirrors the vectors in a flat IP index and serves searches (dlopen — never a build or install requirement). The exact scan is the reference the accelerator must agree with, and the test suite asserts it.
  • HNSW in pure Zig is the planned second index type for ANN-scale collections.

Not thread-safe by design: callers hold their own lock. search returns insertion indices, best first.

const vi = @import("vector_index");
var ix = vi.Index.init(gpa, 384);
defer ix.deinit();
try ix.add(&embedding);           // L2-normalized []f32
var hits: [5]vi.Hit = undefined;
const n = ix.search(&query, 5, &hits);
zig build test

Extracted from loom, where it serves the gossiped RAG chunk store.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages