mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-11 15:15:18 +02:00
add new test for aask_code about write code by steps.
This commit is contained in:
parent
1145641cdc
commit
5af4f6b4c5
1 changed files with 14 additions and 0 deletions
|
|
@ -78,3 +78,17 @@ def test_ask_code_list_str():
|
|||
assert "language" in rsp
|
||||
assert "code" in rsp
|
||||
assert len(rsp["code"]) > 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_ask_code_steps2():
|
||||
llm = OpenAIGPTAPI()
|
||||
msg = ["step by setp 生成代码: Step 1. 先生成随机数组a, Step 2. 求a中最大值, Step 3. 绘制数据a的直方图"]
|
||||
rsp = await llm.aask_code(msg) # -> {'language': 'python', 'code': 'max_value = max(a)\nmax_value'}
|
||||
print(rsp)
|
||||
assert "language" in rsp
|
||||
assert "code" in rsp
|
||||
assert len(rsp["code"]) > 0
|
||||
assert "Step 1" in rsp["code"]
|
||||
assert "Step 2" in rsp["code"]
|
||||
assert "Step 3" in rsp["code"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue