mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-27 01:36:29 +02:00
Merge branch 'code_intepreter' into sd_and_debugcode_ut
This commit is contained in:
commit
192e2aa807
13 changed files with 180 additions and 855 deletions
|
|
@ -1,4 +1,12 @@
|
|||
from metagpt.actions.write_plan import Plan, Task, precheck_update_plan_from_rsp
|
||||
import pytest
|
||||
|
||||
from metagpt.actions.write_plan import (
|
||||
Plan,
|
||||
Task,
|
||||
WritePlan,
|
||||
precheck_update_plan_from_rsp,
|
||||
)
|
||||
from metagpt.schema import Message
|
||||
|
||||
|
||||
def test_precheck_update_plan_from_rsp():
|
||||
|
|
@ -12,3 +20,12 @@ def test_precheck_update_plan_from_rsp():
|
|||
invalid_rsp = "wrong"
|
||||
success, _ = precheck_update_plan_from_rsp(invalid_rsp, plan)
|
||||
assert not success
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_write_plan():
|
||||
rsp = await WritePlan().run(context=[Message("run analysis on sklearn iris dataset", role="user")])
|
||||
|
||||
assert "task_id" in rsp
|
||||
assert "instruction" in rsp
|
||||
assert "json" not in rsp # the output should be the content inside ```json ```
|
||||
|
|
|
|||
13
tests/metagpt/roles/test_code_interpreter.py
Normal file
13
tests/metagpt/roles/test_code_interpreter.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import pytest
|
||||
|
||||
from metagpt.logs import logger
|
||||
from metagpt.roles.code_interpreter import CodeInterpreter
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_code_interpreter():
|
||||
requirement = "Run data analysis on sklearn Iris dataset, include a plot"
|
||||
ci = CodeInterpreter(goal=requirement, auto_run=True, use_tools=False)
|
||||
rsp = await ci.run(requirement)
|
||||
logger.info(rsp)
|
||||
assert len(rsp.content) > 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue