Liath for RAG Pipelines

Liath is an embedded engine for building RAG pipelines. It generates embeddings locally (FastEmbed), indexes them for vector search (USearch), and stores documents and metadata in a key-value store — all in one process. Programmable Lua retrieval lets you run multi-step and hybrid retrieval, filter, deduplicate, re-rank, and assemble context in a single sandboxed program, without stitching together a separate vector database and embedding service.

Best for: RAG

RAG without the plumbing

A typical retrieval-augmented generation stack is a collection of parts: an embedding service, a vector database, a metadata store, and glue code that ties them together and assembles context for the model. Each part is another service to deploy, secure, and keep in sync.

Liath collapses that into one embedded engine. Embeddings are generated locally with FastEmbed, vectors are indexed with USearch, and document text and metadata live in the built-in key-value store — no separate services, no network hops during retrieval.

Retrieval as a program

The real advantage is programmable retrieval. Instead of a single fixed search call, a Lua program can:

  • run several searches and merge the results,
  • filter by metadata and drop duplicates,
  • re-rank with a custom score,
  • and assemble the final context block in the exact shape your prompt needs.

Hybrid and multi-step retrieval that would otherwise be spread across application code becomes one sandboxed execution inside the database.

Index once, retrieve anywhere

Use store_with_embedding to index documents and semantic_search to retrieve them, all callable from Lua. Because Liath is embedded, the same pipeline runs the same way in a notebook, a server, or a local-first app.

See AI agents for agent memory patterns, local-first apps for on-device RAG, and Liath vs Pinecone for how embedded RAG compares to a managed vector service.

Frequently Asked Questions

Can I build a RAG pipeline entirely in Liath?

Yes. Liath generates embeddings locally with FastEmbed, indexes them with USearch, and lets you index documents and retrieve context in Lua. store_with_embedding turns text into searchable memory, and semantic_search retrieves the most relevant chunks — all in one embedded engine.

How does programmable retrieval help RAG?

Instead of a single fixed search call, a Lua program can run multiple searches, filter by metadata, deduplicate, re-rank, and assemble the final context in one sandboxed execution. That makes hybrid and multi-step retrieval straightforward without scattering logic across app code.

Do I need a separate vector database for RAG with Liath?

No. Liath bundles vector search, embeddings, and a key-value store, so documents, their embeddings, and metadata live in one process. There is no separate vector service to deploy or keep in sync.

Is Liath fast enough for RAG retrieval?

Liath's core is written in Rust for low-latency execution, and it runs embedded in your process, avoiding network round-trips to an external vector service during retrieval.

Can Liath keep embeddings alongside document metadata?

Yes. Store document text and metadata in the key-value store and their vectors in the vector index, then join them together inside a Lua retrieval program.

Related Content

Give your agents programmable memory

Open source, MIT licensed. pip install liath or add the liath Rust crate.