Larfii commited on
Commit
fad5373
·
1 Parent(s): a5eaa40

Fix JSON parsing error

Browse files
examples/lightrag_lmdeploy_demo.py CHANGED
@@ -12,7 +12,11 @@ if not os.path.exists(WORKING_DIR):
12
 
13
 
14
  async def lmdeploy_model_complete(
15
- prompt=None, system_prompt=None, history_messages=[], keyword_extraction=False, **kwargs
 
 
 
 
16
  ) -> str:
17
  model_name = kwargs["hashing_kv"].global_config["llm_model_name"]
18
  return await lmdeploy_model_if_cache(
 
12
 
13
 
14
  async def lmdeploy_model_complete(
15
+ prompt=None,
16
+ system_prompt=None,
17
+ history_messages=[],
18
+ keyword_extraction=False,
19
+ **kwargs,
20
  ) -> str:
21
  model_name = kwargs["hashing_kv"].global_config["llm_model_name"]
22
  return await lmdeploy_model_if_cache(
lightrag/operate.py CHANGED
@@ -479,7 +479,7 @@ async def kg_query(
479
  print(result)
480
  try:
481
  # json_text = locate_json_string_body_from_string(result) # handled in use_model_func
482
- result = re.search(r"{.*}", json_text, re.DOTALL)
483
  keywords_data = json.loads(result)
484
  hl_keywords = keywords_data.get("high_level_keywords", [])
485
  ll_keywords = keywords_data.get("low_level_keywords", [])
 
479
  print(result)
480
  try:
481
  # json_text = locate_json_string_body_from_string(result) # handled in use_model_func
482
+ result = re.search(r"{.*}", result, re.DOTALL)
483
  keywords_data = json.loads(result)
484
  hl_keywords = keywords_data.get("high_level_keywords", [])
485
  ll_keywords = keywords_data.get("low_level_keywords", [])