From d8cd48f43b9fa48b94be16300df9039d05c72c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos?= Date: Thu, 11 Dec 2025 12:43:42 -0300 Subject: [PATCH] fix(cache): include language parameter in keywords extraction cache key --- lightrag/operate.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lightrag/operate.py b/lightrag/operate.py index c6724974..05940899 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -3264,10 +3264,16 @@ async def extract_keywords_only( It ONLY extracts keywords (hl_keywords, ll_keywords). """ - # 1. Handle cache if needed - add cache type for keywords + # 1. Build the examples + examples = "\n".join(PROMPTS["keywords_extraction_examples"]) + + language = global_config["addon_params"].get("language", DEFAULT_SUMMARY_LANGUAGE) + + # 2. Handle cache if needed - add cache type for keywords args_hash = compute_args_hash( param.mode, text, + language, ) cached_result = await handle_cache( hashing_kv, args_hash, text, param.mode, cache_type="keywords" @@ -3284,11 +3290,6 @@ async def extract_keywords_only( "Invalid cache format for keywords, proceeding with extraction" ) - # 2. Build the examples - examples = "\n".join(PROMPTS["keywords_extraction_examples"]) - - language = global_config["addon_params"].get("language", DEFAULT_SUMMARY_LANGUAGE) - # 3. Build the keyword-extraction prompt kw_prompt = PROMPTS["keywords_extraction"].format( query=text,