rag.format
Format search hits into a numbered, human-readable text string.
Format search hits into a numbered, human-readable text string.
- format_hits(hits, max_chars=None, include_parent=True)[source]
Format search hits into a numbered, human-readable text string.
Each hit is rendered with its index, source, relevance score, content, and optionally a snippet of its parent context.
- Parameters:
- Returns:
A formatted string, or an empty string if hits is empty.
- Return type:
Functions
- format_hits(hits, max_chars=None, include_parent=True)[source]
Format search hits into a numbered, human-readable text string.
Each hit is rendered with its index, source, relevance score, content, and optionally a snippet of its parent context.
- Parameters:
- Returns:
A formatted string, or an empty string if hits is empty.
- Return type: