mirror of
https://github.com/HKUDS/LightRAG.git
synced 2025-10-06 13:35:45 +00:00
Save keywords to cache only when it's no empty
This commit is contained in:
parent
3c3cdba499
commit
2d387fa6de
@ -760,7 +760,7 @@ async def extract_keywords_only(
|
||||
# 6. Parse out JSON from the LLM response
|
||||
match = re.search(r"\{.*\}", result, re.DOTALL)
|
||||
if not match:
|
||||
logger.error("No JSON-like structure found in the result.")
|
||||
logger.error("No JSON-like structure found in the LLM respond.")
|
||||
return [], []
|
||||
try:
|
||||
keywords_data = json.loads(match.group(0))
|
||||
@ -772,6 +772,7 @@ async def extract_keywords_only(
|
||||
ll_keywords = keywords_data.get("low_level_keywords", [])
|
||||
|
||||
# 7. Cache only the processed keywords with cache type
|
||||
if hl_keywords or ll_keywords:
|
||||
cache_data = {"high_level_keywords": hl_keywords, "low_level_keywords": ll_keywords}
|
||||
await save_to_cache(
|
||||
hashing_kv,
|
||||
|
Loading…
x
Reference in New Issue
Block a user