georgeguimaraes/arcana

Embeddable RAG library for Elixir/Phoenix with agentic pipelines and dashboard

What it solves

Arcana is an embeddable RAG (Retrieval-Augmented Generation) library for Elixir and Phoenix applications. It eliminates the need for separate vector databases, indexing services, or orchestration layers by integrating directly into an existing Ecto repository (PostgreSQL with pgvector). It allows developers to add vector search, knowledge graphs, and LLM-driven retrieval to their apps without introducing new infrastructure overhead.

How it works

Arcana operates within the BEAM process model, using Nx.Serving instances for embedders and rerankers under a supervision tree. It leverages PostgreSQL's pgvector extension for storage and supports local-first embeddings via Bumblebee (EXLA, EMLX, or Torchx) or external providers like OpenAI and Cohere.

The library provides three modes of operation:

  • Advanced RAG: A high-level API (Arcana.search/2, Arcana.ask/2) with sensible defaults including query rewriting and reranking.
  • Modular RAG: A customizable pipeline (Arcana.Pipeline) where developers can compose specific steps like gating, rewriting, decomposing, searching, and grounding.
  • Agentic RAG: An LLM-driven loop (Arcana.Loop) where the model chooses tools (search, answer, give up) at runtime to handle multi-hop or open-ended questions.

Who it’s for

Elixir and Phoenix developers who want to implement RAG capabilities—ranging from simple semantic search to complex agentic workflows—directly within their existing application stack and database.

Highlights

  • Infrastructure-less: Uses your existing Postgres database via pgvector instead of a standalone vector DB.
  • Local-first: Supports local embeddings and cross-encoder reranking via Bumblebee.
  • GraphRAG: Implements entity extraction, community detection (Leiden), and graph search fused with vector results.
  • Pluggable Architecture: Every step (chunkers, embedders, searchers, rerankers) is a behavior with a single callback for easy replacement.
  • Observability: Built-in telemetry events and a dedicated LiveView dashboard for monitoring.