vibe.assistant.services.reference_documents

Reference Documents Configuration and Resolution.

This module provides configuration parsing and file resolution for assistant reference documents that will be uploaded to vector stores for file_search grounding.

Configuration in config.yml: assistants: my_assistant: reference_documents: # Option 1: Directory mode directory: "reference_docs"

      # Option 2: Explicit file list
      files:
        - path: "document.pdf"
          label: "Human-readable name"
          purpose: [facts, style]

      # Common settings
      purpose: [facts, style, reasoning]
      grounding_instructions: "Custom instructions..."

DocumentPurpose

Purpose tags for reference documents.

These affect how the system prompt is constructed for grounding.

ReferenceDocumentFile

Configuration for a single reference document file.

filename

filename: str

Return just the filename.

ReferenceDocumentsConfig

Parsed configuration for reference documents.

This class represents the resolved configuration, with all file paths validated and resolved to absolute paths.

file_paths

file_paths: list[Path]

Return list of all file paths.

is_empty

is_empty: bool

Return True if no documents configured.

parse_reference_documents_config

parse_reference_documents_config(config: dict[str, Any], template_dir: Path) -> ReferenceDocumentsConfig

Parse and validate reference_documents configuration.

Parameters:
  • config (dict[str, Any]) –

    The reference_documents dict from assistant config

  • template_dir (Path) –

    Base directory for resolving relative paths

Returns:
Raises:
  • FileNotFoundError

    If configured files/directory don't exist

  • ValueError

    If configuration is invalid

build_grounding_instructions

build_grounding_instructions(config: ReferenceDocumentsConfig) -> str

Build system prompt section for reference document grounding.

Generates instructions based on the configured purposes and any custom grounding_instructions.

Parameters:
Returns:
  • str

    System prompt text to be injected