From f46448d04c83aa84827012eadd54bd91e15fddf7 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Mon, 17 Feb 2025 14:06:06 +0800 Subject: [PATCH] Remove for KG extraction. (#5027) ### What problem does this PR solve? #4946 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- graphrag/general/extractor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphrag/general/extractor.py b/graphrag/general/extractor.py index ffcb889a5..50184002f 100644 --- a/graphrag/general/extractor.py +++ b/graphrag/general/extractor.py @@ -15,6 +15,7 @@ # import logging import os +import re from collections import defaultdict, Counter from concurrent.futures import ThreadPoolExecutor from copy import deepcopy @@ -59,6 +60,7 @@ class Extractor: if response: return response response = self._llm.chat(system, hist, conf) + response = re.sub(r".*", "", response) if response.find("**ERROR**") >= 0: raise Exception(response) set_llm_cache(self._llm.llm_name, system, response, history, gen_conf)