Log llm response on exception (#6750)

### What problem does this PR solve?

Log llm response on exception

### Type of change

- [x] Refactoring
This commit is contained in:
Zhichang Yu
2025-04-02 17:10:57 +08:00
committed by GitHub
parent 724a36fcdb
commit e7a2a4b7ff
5 changed files with 45 additions and 57 deletions

View File

@ -56,7 +56,8 @@ class Extractor:
response = self._llm.chat(system_msg[0]["content"], hist, conf)
response = re.sub(r"<think>.*</think>", "", response, flags=re.DOTALL)
if response.find("**ERROR**") >= 0:
raise Exception(response)
logging.warning(f"Extractor._chat got error. response: {response}")
return ""
set_llm_cache(self._llm.llm_name, system, response, history, gen_conf)
return response