forked from Pythagora-io/gpt-pilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
95 lines (87 loc) · 2.95 KB
/
main.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env python
import os.path
import sys
from agentneo import AgentNeo, Tracer
agent_session = AgentNeo(
email="EMAIL_ID", base_url="BASE_URL"
)
tracer = Tracer.init(
agent_session,
trace_llms=True,
trace_console=True,
metadata={
"tools": [
{
"name": "codeMonkey",
"description": "Writes and modifies code based on instructions",
},
{
"name": "commandLine",
"description": "Executes command line operations and interprets their results",
},
{
"name": "humanInterface",
"description": "Interacts with the user to gather information or clarifications",
},
{
"name": "projectManager",
"description": "Manages the overall structure and flow of the development process",
},
{
"name": "architect",
"description": "Designs the high-level structure and components of the application",
},
{
"name": "productOwner",
"description": "Defines and prioritizes product features and requirements",
},
{
"name": "devOps",
"description": "Handles deployment, environment setup, and other operational tasks",
},
{
"name": "techLead",
"description": "Provides technical guidance and makes technology stack decisions",
},
]
},
)
try:
from core.cli.main import run_pythagora
except ImportError as err:
pythagora_root = os.path.dirname(__file__)
venv_path = os.path.join(pythagora_root, "venv")
requirements_path = os.path.join(pythagora_root, "requirements.txt")
if sys.prefix == sys.base_prefix:
venv_python_path = os.path.join(
venv_path, "scripts" if sys.platform == "win32" else "bin", "python"
)
print(
f"Python environment for Pythagora is not set up: module `{err.name}` is missing.",
file=sys.stderr,
)
print(
f"Please create Python virtual environment: {sys.executable} -m venv {venv_path}",
file=sys.stderr,
)
print(
f"Then install the required dependencies with: {venv_python_path} -m pip install -r {requirements_path}",
file=sys.stderr,
)
else:
print(
f"Python environment for Pythagora is not completely set up: module `{err.name}` is missing",
file=sys.stderr,
)
print(
f"Please run `{sys.executable} -m pip install -r {requirements_path}` to finish Python setup, and rerun Pythagora.",
file=sys.stderr,
)
tracer.cleanup()
sys.exit(255)
try:
exit_code = run_pythagora()
finally:
tracer.upload_console_llm_trace()
tracer.cleanup()
sys.exit(exit_code)