-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdemo_metagpt.py
78 lines (64 loc) · 2.51 KB
/
demo_metagpt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# -*- coding: utf-8 -*-
"""Demo MetaGPT.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/12XF5HNp3hWLRLxf-rb6KXRKwoTXnmem0
# Running MetaGPT on a Notebook
This notebook is set up to run MetaGPT.
1. Install all necessary dependencies and requirements.
2. Clone the official [MetaGPT repository](https://github.com/geekan/MetaGPT).
3. Set up paths for Puppeteer and MMDC.
4. Import your API KEY.
5. Define the task.
6. Check out the result at: /content/metagpt/workspace
Learn more about how I used this notebook to create a Pong game: [here](https://github.com/kemeny/PongGame).
'''
"""
!apt-get install -y npm
!npm install -g @mermaid-js/mermaid-cli
!pip install aiohttp==3.8.4
!pip install channels==4.0.0
!pip install duckduckgo_search==2.9.4
!pip install faiss_cpu==1.7.4
!pip install fire==0.4.0
!pip install langchain==0.0.231
!pip install loguru==0.6.0
!pip install meilisearch==0.21.0
!pip install openai==0.27.8
!pip install openpyxl
!pip install pydantic==1.10.7
!pip install pytest==7.2.2
!pip install python_docx==0.8.11
!pip install PyYAML==6.0
!pip install tenacity==8.2.2
!pip install tiktoken==0.3.3
!pip install tqdm==4.64.0
!pip install anthropic==0.3.6
!pip install typing-inspect==0.8.0
!pip install libcst==1.0.1
!pip install pandas==1.5.3
!pip install typing-extensions>=4.6.0
# Commented out IPython magic to ensure Python compatibility.
!git clone https://github.com/geekan/metagpt
# %cd metagpt
!python setup.py install
!echo "PUPPETEER_CONFIG: './config/puppeteer-config.json'" >> config.yml
!echo "MMDC: './node_modules/.bin/mmdc'" >> config.yml
import os
os.environ["OPENAI_API_KEY"] = "<TU API KEY DE OPENAI>"
from metagpt.software_company import SoftwareCompany
from metagpt.roles import ProjectManager, ProductManager, Architect, Engineer
import asyncio
async def startup(idea: str, investment: float = 3.0, n_round: int = 5):
"""Run a startup. Be a boss."""
company = SoftwareCompany()
company.hire([ProductManager(), Architect(), ProjectManager(), Engineer()])
company.invest(investment)
company.start_project(idea)
await company.run(n_round=n_round)
# Prompt the user for input
idea = input("Please enter your startup idea (e.g., 'Design a Recommendation System like YouTube'): ")
investment = float(input("Please enter the investment amount (e.g., 3.0): "))
n_round = int(input("Please enter the number of rounds (e.g., 5): "))
# Directly run the startup function with the provided input
await startup(idea, investment, n_round)