File size: 224 Bytes
6733714
 
 
 
 
 
 
1
2
3
4
5
6
7
def build_context(chunks: list[dict]) -> str:
    context = []
    for c in chunks:
        context.append(
            f"[Source: {c['source']}, Page: {c.get('page')}]\n{c['text']}"
        )
    return "\n\n".join(context)