Arcana.Config (Arcana v1.2.0)
View SourceConfiguration management for Arcana.
Handles parsing and resolving configuration for embedders, chunkers, and other pluggable components.
Embedder Configuration
# Default: Local Bumblebee with bge-small-en-v1.5
config :arcana, embedder: :local
# Local with different model
config :arcana, embedder: {:local, model: "BAAI/bge-large-en-v1.5"}
# OpenAI (requires req_llm and OPENAI_API_KEY)
config :arcana, embedder: :openai
config :arcana, embedder: {:openai, model: "text-embedding-3-large"}
# Custom function
config :arcana, embedder: fn text -> {:ok, embedding} end
# Custom module implementing Arcana.Embedder behaviour
config :arcana, embedder: MyApp.CohereEmbedder
config :arcana, embedder: {MyApp.CohereEmbedder, api_key: "..."}Chunker Configuration
# Default: text_chunker-based chunking
config :arcana, chunker: :default
# Default chunker with custom options
config :arcana, chunker: {:default, chunk_size: 512, chunk_overlap: 100}
# Custom function (receives text, opts; returns list of chunk maps)
config :arcana, chunker: fn text, _opts ->
[%{text: text, chunk_index: 0, token_count: 10}]
end
# Custom module implementing Arcana.Chunker behaviour
config :arcana, chunker: MyApp.SemanticChunker
config :arcana, chunker: {MyApp.SemanticChunker, model: "..."}
Summary
Functions
Returns the configured chunker as a {module, opts} tuple.
Returns the current Arcana configuration.
Returns the configured embedder as a {module, opts} tuple.
Returns whether GraphRAG is enabled globally or for specific options.
Resolves chunker from options, falling back to global config.
Functions
Returns the configured chunker as a {module, opts} tuple.
Returns the current Arcana configuration.
Useful for logging, debugging, and storing with evaluation runs to track which settings produced which results.
Example
Arcana.Config.current()
# => %{
# embedding: %{module: Arcana.Embedder.Local, model: "BAAI/bge-small-en-v1.5", dimensions: 384},
# vector_store: :pgvector
# }
Returns the configured embedder as a {module, opts} tuple.
Returns whether GraphRAG is enabled globally or for specific options.
Checks the :graph option in the provided opts first, then falls back
to the global configuration.
Examples
# Check global config
Arcana.Config.graph_enabled?([])
# Override with per-call option
Arcana.Config.graph_enabled?(graph: true)
Resolves chunker from options, falling back to global config.