mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-06-04 11:24:00 +08:00
Remove <think> for KG extraction. (#5027)
### What problem does this PR solve? #4946 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
ab17606e79
commit
f46448d04c
@ -15,6 +15,7 @@
|
|||||||
#
|
#
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
from collections import defaultdict, Counter
|
from collections import defaultdict, Counter
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
@ -59,6 +60,7 @@ class Extractor:
|
|||||||
if response:
|
if response:
|
||||||
return response
|
return response
|
||||||
response = self._llm.chat(system, hist, conf)
|
response = self._llm.chat(system, hist, conf)
|
||||||
|
response = re.sub(r"<think>.*</think>", "", response)
|
||||||
if response.find("**ERROR**") >= 0:
|
if response.find("**ERROR**") >= 0:
|
||||||
raise Exception(response)
|
raise Exception(response)
|
||||||
set_llm_cache(self._llm.llm_name, system, response, history, gen_conf)
|
set_llm_cache(self._llm.llm_name, system, response, history, gen_conf)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user