mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-06-04 11:24:00 +08:00
Fix 6030 (#6070)
### What problem does this PR solve? Close #6030 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
f16418ccf7
commit
c00def5b71
@ -19,6 +19,7 @@ from collections import defaultdict
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import json_repair
|
import json_repair
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import trio
|
||||||
|
|
||||||
from api.utils import get_uuid
|
from api.utils import get_uuid
|
||||||
from graphrag.query_analyze_prompt import PROMPTS
|
from graphrag.query_analyze_prompt import PROMPTS
|
||||||
@ -41,7 +42,7 @@ class KGSearch(Dealer):
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
def query_rewrite(self, llm, question, idxnms, kb_ids):
|
def query_rewrite(self, llm, question, idxnms, kb_ids):
|
||||||
ty2ents = get_entity_type2sampels(idxnms, kb_ids)
|
ty2ents = trio.run(lambda: get_entity_type2sampels(idxnms, kb_ids))
|
||||||
hint_prompt = PROMPTS["minirag_query2kwd"].format(query=question,
|
hint_prompt = PROMPTS["minirag_query2kwd"].format(query=question,
|
||||||
TYPE_POOL=json.dumps(ty2ents, ensure_ascii=False, indent=2))
|
TYPE_POOL=json.dumps(ty2ents, ensure_ascii=False, indent=2))
|
||||||
result = self._chat(llm, hint_prompt, [{"role": "user", "content": "Output:"}], {"temperature": .5})
|
result = self._chat(llm, hint_prompt, [{"role": "user", "content": "Output:"}], {"temperature": .5})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user