File size: 365 Bytes
18ef2cd
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from typing import Dict


def format_source_label(meta: Dict, index: int) -> str:
    """Create a readable label for a retrieved chunk."""
    source = (
            meta.get("source")
            or meta.get("file_path")
            or meta.get("path")
            or meta.get("document_id")
            or "Unknown source"
    )
    return f"[{index}] {source}"