Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

add new test for tool_calls_rsp.

刘棒棒31813f2512b1
diff --git a/tests/metagpt/provider/test_openai.py b/tests/metagpt/provider/test_openai.py
index 2e5799475..7a771bcac 100644
--- a/tests/metagpt/provider/test_openai.py
+++ b/tests/metagpt/provider/test_openai.py
@@ -87,6 +87,16 @@ class TestOpenAI:
messages.append(
ChatCompletionMessage(content="Completed a python code for hello world!", role="assistant", tool_calls=None)
)
+ # 添加 openai tool calls respond bug, code 出现在ChatCompletionMessage.content中
+ messages.extend(
+ [
+ ChatCompletionMessage(content="```python\nprint('hello world')```", role="assistant", tool_calls=None),
+ ChatCompletionMessage(content="'''python\nprint('hello world')'''", role="assistant", tool_calls=None),
+ ChatCompletionMessage(
+ content='"""python\nprint(\'hello world\')"""', role="assistant", tool_calls=None
+ ),
+ ]
+ )
choices = [
Choice(finish_reason="tool_calls", logprobs=None, index=i, message=msg) for i, msg in enumerate(messages)
]