mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
Merge branch 'fix-openai-return-bug' into 'code_intepreter'
fix: keep same return value in get_choice_function_arguments. See merge request agents/data_agents_opt!53
This commit is contained in:
commit
8ed51b10b3
1 changed files with 2 additions and 2 deletions
|
|
@ -204,7 +204,7 @@ class OpenAILLM(BaseLLM):
|
|||
# 匹配language
|
||||
language_pattern = re.compile(r'[\"\']?language[\"\']?\s*:\s*["\']([^"\']+?)["\']', re.DOTALL)
|
||||
language_match = language_pattern.search(arguments)
|
||||
language_value = language_match.group(1) if language_match else None
|
||||
language_value = language_match.group(1) if language_match else "python"
|
||||
|
||||
# 匹配code
|
||||
code_pattern = r'(["\'`]{3}|["\'`])([\s\S]*?)\1'
|
||||
|
|
@ -241,7 +241,7 @@ class OpenAILLM(BaseLLM):
|
|||
f"Got JSONDecodeError for {message.tool_calls[0].function.arguments},\
|
||||
we will use RegExp to parse code, \n {e}"
|
||||
)
|
||||
return {"language": "python", "code": self._parse_arguments(message.tool_calls[0].function.arguments)}
|
||||
return self._parse_arguments(message.tool_calls[0].function.arguments)
|
||||
elif message.tool_calls is None and message.content is not None:
|
||||
# reponse is message
|
||||
return {"language": "markdown", "code": self.get_choice_text(rsp)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue