Skip to content

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

Merge branch 'code_intepreter' into code_intepreter_add_vision

mannaandpoem23fdf90d21a6
diff --cc examples/imitate_webpage.py
index 47fcd251f,000000000..b4610d5e0
mode 100644,000000..100644
--- a/examples/imitate_webpage.py
+++ b/examples/imitate_webpage.py
@@@ -1,25 -1,0 +1,25 @@@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+@Time : 2024/01/15
+@Author : mannaandpoem
+@File : imitate_webpage.py
+"""
+from metagpt.roles.code_interpreter import CodeInterpreter
+
+
+async def main():
- prompt = """This is a URL of webpage: https://cn.bing.com/
++ prompt = """This is a URL of webpage: 'https://www.baidu.com/' .
+Firstly, utilize Selenium and WebDriver for rendering.
+Secondly, convert image to a webpage including HTML, CSS and JS in one go.
+Finally, save webpage in a text file.
+Note: All required dependencies and environments have been fully installed and configured."""
+ ci = CodeInterpreter(goal=prompt, use_tools=True)
+
+ await ci.run(prompt)
+
+
+if __name__ == '__main__':
+ import asyncio
+
+ asyncio.run(main())
diff --cc metagpt/tools/__init__.py
index 045ede622,41c8708b2..84b9cbd12
--- a/metagpt/tools/__init__.py
+++ b/metagpt/tools/__init__.py
@@@ -72,12 -70,12 +71,18 @@@ TOOL_TYPE_MAPPINGS =
desc="Only for evaluating model.",
usage_prompt=MODEL_EVALUATE_PROMPT,
),
+ "stable_diffusion": ToolType(
+ name="stable_diffusion",
+ module="metagpt.tools.sd_engine",
+ desc="Related to text2image, image2image using stable diffusion model.",
+ usage_prompt="",
+ ),
+ "vision": ToolType(
+ name="vision",
+ module=str(TOOL_LIBS_PATH / "vision"),
+ desc="Only for converting image into webpage code.",
+ usage_prompt=VISION_PROMPT,
+ ),
"other": ToolType(
name="other",
module="",