add comments for openai tools_call respond bug.

This commit is contained in:
刘棒棒 2024-01-23 17:53:50 +08:00
parent 0cc0a16e52
commit bcda7ac951

View file

@ -248,7 +248,8 @@ class OpenAILLM(BaseLLM):
)
return self._parse_arguments(message.tool_calls[0].function.arguments)
elif message.tool_calls is None and message.content is not None:
# reponse is code, fix openai tools_call respond bug.
# reponse is code, fix openai tools_call respond bug,
# The response content is `code``, but it appears in the content instead of the arguments.
code_formats = ("```", '"""', "'''")
if message.content.startswith(code_formats) and message.content.endswith(code_formats):
code = CodeParser.parse_code(None, message.content)