update logger warning for JSONDecodeError.

This commit is contained in:
刘棒棒 2024-01-22 16:14:59 +08:00
parent 1793a5fec6
commit 64a296a29d

View file

@ -237,9 +237,13 @@ class OpenAILLM(BaseLLM):
try:
return json.loads(message.tool_calls[0].function.arguments, strict=False)
except json.decoder.JSONDecodeError as e:
logger.debug(
f"Got JSONDecodeError for {message.tool_calls[0].function.arguments},\
we will use RegExp to parse code, \n {e}"
logger.warning(
"\n".join(
[
(f"Got JSONDecodeError for \n{'--'*40} \n{message.tool_calls[0].function.arguments}"),
(f"{'--'*40}\nwe will use RegExp to parse code. JSONDecodeError is: {e}"),
]
)
)
return self._parse_arguments(message.tool_calls[0].function.arguments)
elif message.tool_calls is None and message.content is not None: