Quellcode durchsuchen

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 vor 8 Monaten
Ursprung
Commit
f46448d04c
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden
1 geänderte Dateien mit 2 neuen und 0 gelöschten Zeilen
  1. 2
    0
      graphrag/general/extractor.py

+ 2
- 0
graphrag/general/extractor.py Datei anzeigen

# #
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
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)

Laden…
Abbrechen
Speichern