From 2bfef7096086839b7856b0b4aeafd876ff900de3 Mon Sep 17 00:00:00 2001 From: yangdx Date: Tue, 22 Apr 2025 21:17:01 +0800 Subject: [PATCH] Fix context format --- lightrag/operate.py | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lightrag/operate.py b/lightrag/operate.py index 12cfd5d6..eb027325 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -1349,20 +1349,25 @@ async def _build_query_context( relations_str = json.dumps(relations_context, ensure_ascii=False) text_units_str = json.dumps(text_units_context, ensure_ascii=False) - result = f""" - -----Entities----- - ```json - {entities_str} - ``` - -----Relationships----- - ```json - {relations_str} - ``` - -----Sources----- - ```json - {text_units_str} - ``` - """.strip() + result = f"""-----Entities----- + +```json +{entities_str} +``` + +-----Relationships----- + +```json +{relations_str} +``` + +-----Sources----- + +```json +{text_units_str} +``` + +""" return result