Sfoglia il codice sorgente

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)
tags/v0.17.0
Kevin Hu 8 mesi fa
parent
commit
f46448d04c
Nessun account collegato all'indirizzo email del committer
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2
    0
      graphrag/general/extractor.py

+ 2
- 0
graphrag/general/extractor.py Vedi File

@@ -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"<think>.*</think>", "", response)
if response.find("**ERROR**") >= 0:
raise Exception(response)
set_llm_cache(self._llm.llm_name, system, response, history, gen_conf)

Loading…
Annulla
Salva