Configuration
Configuration is done through YAML configuration files.
Note
haiku.rag enforces one hard rule on existing databases: the embedding vector_dim in your config must match the value stored in the db. A mismatch exits with ConfigMismatchError and you must rebuild to apply the change (see Rebuild Database).
Changing only provider or name (e.g. switching from Ollama to vLLM serving the same model) is treated as soft drift: haiku.rag logs a one-time warning and updates the stored settings to match your config. Subsequent opens are silent. If the change was unintentional, revert your config to match the previously stored settings before running anything that depends on retrieval quality.
Getting Started
Generate a configuration file with defaults:
This creates a haiku.rag.yaml file in your current directory with all available settings.
Configuration File Locations
haiku.rag searches for configuration files in this order:
- Path specified via
--configflag:haiku-rag --config /path/to/config.yaml <command> ./haiku.rag.yaml(current directory)- Platform-specific user directory:
- Linux:
~/.local/share/haiku.rag/haiku.rag.yaml - macOS:
~/Library/Application Support/haiku.rag/haiku.rag.yaml - Windows:
C:/Users/<USER>/AppData/Roaming/haiku.rag/haiku.rag.yaml
- Linux:
Minimal Configuration
A minimal configuration file with defaults:
# haiku.rag.yaml
environment: production
embeddings:
model:
provider: ollama
name: qwen3-embedding:4b
vector_dim: 2560
qa:
model:
provider: ollama
name: gpt-oss
enable_thinking: true
Complete Configuration Example
# haiku.rag.yaml
environment: production
storage:
data_dir: "" # Empty = use default platform location
vacuum_retention_seconds: 86400
monitor:
directories:
- /path/to/documents
- /another/path
ignore_patterns: [] # Gitignore-style patterns to exclude
include_patterns: [] # Gitignore-style patterns to include
lancedb:
uri: "" # Empty for local, or db://, s3://, az://, gs://
api_key: ""
region: ""
embeddings:
model:
provider: ollama
name: qwen3-embedding:4b
vector_dim: 2560
reranking:
model:
provider: "" # Empty to disable, or mxbai, cohere, zeroentropy, vllm
name: ""
qa:
model:
provider: ollama
name: gpt-oss
enable_thinking: true
temperature: 0.3
max_searches: 3
research:
model:
provider: "" # Empty to use qa settings
name: ""
enable_thinking: false
temperature: 0.3
max_iterations: 3
max_concurrency: 1
search:
limit: 10 # Default number of results to return
max_context_chars: 10000 # Maximum characters in expanded context
vector_index_metric: cosine # cosine, l2, or dot
vector_refine_factor: 30
prompts:
domain_preamble: "" # Prepended to all agent prompts
qa: null # Custom QA agent prompt (null = use default)
synthesis: null # Custom research synthesis prompt (null = use default)
processing:
converter: docling-local # docling-local or docling-serve
chunker: docling-local # docling-local or docling-serve
chunker_type: hybrid # hybrid or hierarchical
chunk_size: 256
chunking_tokenizer: "Qwen/Qwen3-Embedding-0.6B"
chunking_merge_peers: true
chunking_use_markdown_tables: false
auto_title: false # Auto-generate titles on ingestion
title_model:
provider: ollama
name: gpt-oss
enable_thinking: false
temperature: 0.3
max_tokens: 100
conversion_options:
do_ocr: true
force_ocr: false
ocr_lang: []
do_table_structure: true
table_mode: accurate
table_cell_matching: true
images_scale: 2.0
providers:
ollama:
base_url: http://localhost:11434
docling_serve:
base_url: http://localhost:5001
api_key: ""
timeout: 300
Programmatic Configuration
When using haiku.rag as a Python library, you can pass configuration directly to the HaikuRAG client:
from haiku.rag.config import AppConfig
from haiku.rag.config.models import EmbeddingModelConfig, ModelConfig, QAConfig, EmbeddingsConfig
from haiku.rag.client import HaikuRAG
# Create custom configuration
custom_config = AppConfig(
qa=QAConfig(
model=ModelConfig(
provider="openai",
name="gpt-4o",
temperature=0.3
)
),
embeddings=EmbeddingsConfig(
model=EmbeddingModelConfig(
provider="ollama",
name="qwen3-embedding:4b",
vector_dim=2560
)
),
processing={"chunk_size": 512}
)
# Pass configuration to the client
async with HaikuRAG(config=custom_config) as client:
...
If you don't pass a config, the client uses the global configuration loaded from your YAML file or defaults.
This is useful for: - Jupyter notebooks - Python scripts - Testing with different configurations - Applications that need multiple clients with different configurations
Configuration Topics
For detailed configuration of specific topics, see:
- Providers - Model settings and provider-specific configuration (embeddings, reranking)
- Search and Question Answering - Search settings, question answering, and research workflows
- Document Processing - Document conversion, chunking, and file monitoring
- Storage - Database, remote storage, and vector indexing
- Prompts - Customize agent prompts for your domain