yangdx
commited on
Commit
·
109c9e2
1
Parent(s):
f0014ab
Fix mix_kg_vector_query function return value error when only_need_context is enabled
Browse files- lightrag/operate.py +8 -1
lightrag/operate.py
CHANGED
|
@@ -1072,7 +1072,14 @@ async def mix_kg_vector_query(
|
|
| 1072 |
return PROMPTS["fail_response"]
|
| 1073 |
|
| 1074 |
if query_param.only_need_context:
|
| 1075 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1076 |
|
| 1077 |
# 5. Construct hybrid prompt
|
| 1078 |
sys_prompt = (
|
|
|
|
| 1072 |
return PROMPTS["fail_response"]
|
| 1073 |
|
| 1074 |
if query_param.only_need_context:
|
| 1075 |
+
context_str = f"""
|
| 1076 |
+
-----Knowledge Graph Context-----
|
| 1077 |
+
{kg_context if kg_context else "No relevant knowledge graph information found"}
|
| 1078 |
+
|
| 1079 |
+
-----Vector Context-----
|
| 1080 |
+
{vector_context if vector_context else "No relevant text information found"}
|
| 1081 |
+
""".strip()
|
| 1082 |
+
return context_str
|
| 1083 |
|
| 1084 |
# 5. Construct hybrid prompt
|
| 1085 |
sys_prompt = (
|