# `Arcana`
[🔗](https://github.com/georgeguimaraes/arcana/blob/main/lib/arcana.ex#L1)

RAG (Retrieval Augmented Generation) library for Elixir.

Arcana provides document ingestion, embedding, and vector search
capabilities that you can embed into any Phoenix/Ecto application.

## Usage

    # Ingest a document
    {:ok, document} = Arcana.ingest("Your text content", repo: MyApp.Repo)

    # Search for relevant chunks
    {:ok, results} = Arcana.search("your query", repo: MyApp.Repo)

    # Ask questions with RAG
    {:ok, answer} = Arcana.ask("What is X?", repo: MyApp.Repo, llm: my_llm)

    # Delete a document
    :ok = Arcana.delete(document.id, repo: MyApp.Repo)

## Modules

  * `Arcana.Config` - Configuration management
  * `Arcana.Ingest` - Document ingestion
  * `Arcana.Search` - Vector and hybrid search
  * `Arcana.Ask` - RAG question answering
  * `Arcana.Graph` - GraphRAG functionality

# `ask`

Asks a question using retrieved context from the knowledge base.
See `Arcana.Ask.ask/2` for options.

# `chunker`

Returns the configured chunker as a `{module, opts}` tuple.
See `Arcana.Config` for configuration options.

# `config`

Returns the current Arcana configuration.

# `delete`

Deletes a document and all its chunks.

## Options

  * `:repo` - The Ecto repo to use (required)

# `embedder`

Returns the configured embedder as a `{module, opts}` tuple.
See `Arcana.Config` for configuration options.

# `graph_enabled?`

Returns whether GraphRAG is enabled.

# `ingest`

Ingests text content, creating a document with embedded chunks.
See `Arcana.Ingest.ingest/2` for options.

# `ingest_file`

Ingests a file, parsing its content and creating a document with embedded chunks.
See `Arcana.Ingest.ingest_file/2` for options.

# `rewrite_query`

Rewrites a query using a provided rewriter function.
See `Arcana.Search.rewrite_query/2` for options.

# `search`

Searches for chunks similar to the query.
See `Arcana.Search.search/2` for options.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
