haiku.rag/docs/configuration/prompts.md
Yiorgis Gozadinos ed5519b38d
Make the documented configuration match the code
search.limit was documented as 10 in three places while the default is 5.
The documented way to disable reranking, provider: "", is a valid
ModelConfig, so it raised "Unknown reranking provider" — disabling means
omitting reranking.model or setting it to null. The inline provider list
named four of the six rerankers. prompts.picture_description: null fails
validation, since the field is a non-optional str.

storage.data_dir: "" coerced to Path("") — the working directory — while two
doc pages promise the platform default and soliplex's example config relies
on it. Empty or whitespace now resolves to the platform directory; an
explicit "." is still honoured, so a config that wants the working directory
says so.

Three tests keep this from drifting again: every fenced yaml block in the
docs validates against AppConfig, every value in the complete example either
equals its default or is listed as a deliberate deviation, and empty
data_dir resolves to the platform default.

init-config's test reimplemented the command body instead of invoking it,
which is why the command carried a coverage pragma. It now goes through
CliRunner, with the refuse-to-overwrite guard covered too.
2026-08-19 15:52:50 +03:00

2.6 KiB

Prompt Customization

Customize the prompts used by haiku.rag's capabilities to match your domain.

Configuration

prompts:
  # Domain context prepended to capability instructions
  domain_preamble: |
    This knowledge base contains technical documentation for the Helios solar panel
    system, including installation manuals, maintenance procedures, and safety guidelines.
    Questions about "the system" or unqualified specs refer to the Helios panel.    

  # VLM prompt for image description during conversion.
  # Omit the key to use the built-in prompt.
  picture_description: |
    Describe this figure in two sentences, naming any axis labels and units.    

Domain Preamble

The domain_preamble field provides domain context prepended to the RAG and analysis capability instructions. Use this to:

  • Describe what the knowledge base contains
  • Clarify domain-specific terminology
  • Provide context that helps the model interpret ambiguous queries

Important: domain_preamble is for domain context, not behavioral instructions. Descriptions of subject matter, terminology, and content scope belong here. Applications can add behavioral guidance through normal Pydantic AI agent instructions.

Example:

prompts:
  domain_preamble: |
    This knowledge base contains product documentation, API references,
    and troubleshooting guides for Acme Corp's cloud platform.
    "Deployment" refers to Acme's managed deployment service, not general CI/CD.    

Picture Description Prompt

Customize the prompt used when generating VLM descriptions for embedded images during document conversion. This prompt is sent to the configured Vision Language Model for each image.

Default prompt:

Describe this image for a blind user. State the image type (screenshot, chart, photo, etc.),
what it depicts, any visible text, and key visual details. Be concise and accurate.

Custom example:

prompts:
  picture_description: |
    Describe this image for a document search system.
    Focus on: image type, main content, any text, key visual elements.
    Be concise and factual.    

The prompt is used when processing.pictures is "description". See Picture Handling for full configuration.

Programmatic Configuration

from haiku.rag.config import AppConfig
from haiku.rag.config.models import PromptsConfig

config = AppConfig(
    prompts=PromptsConfig(
        domain_preamble="This knowledge base contains Acme Corp product documentation and API references.",
        picture_description="Describe this image for search indexing.",
    )
)