PraisonAI 0.0.14__tar.gz → 0.0.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {praisonai-0.0.14 → praisonai-0.0.16}/PKG-INFO +47 -1
- {praisonai-0.0.14 → praisonai-0.0.16}/README.md +45 -0
- {praisonai-0.0.14 → praisonai-0.0.16}/praisonai/auto.py +1 -1
- {praisonai-0.0.14 → praisonai-0.0.16}/praisonai/cli.py +9 -4
- {praisonai-0.0.14 → praisonai-0.0.16}/pyproject.toml +2 -1
- praisonai-0.0.14/praisonai/auto-old.py +0 -151
- praisonai-0.0.14/praisonai/cli-old.py +0 -143
- {praisonai-0.0.14 → praisonai-0.0.16}/praisonai/__init__.py +0 -0
- {praisonai-0.0.14 → praisonai-0.0.16}/praisonai/__main__.py +0 -0
- {praisonai-0.0.14 → praisonai-0.0.16}/praisonai/deploy.py +0 -0
- {praisonai-0.0.14 → praisonai-0.0.16}/praisonai/test.py +0 -0
- {praisonai-0.0.14 → praisonai-0.0.16}/praisonai/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: praisonAI
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16
|
|
4
4
|
Summary: praisonAI application combines AutoGen and CrewAI or similar frameworks into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customization, and efficient human-agent collaboration.
|
|
5
5
|
Author: Mervin Praison
|
|
6
6
|
Requires-Python: >=3.10,<3.13
|
|
@@ -12,6 +12,7 @@ Provides-Extra: tools
|
|
|
12
12
|
Requires-Dist: Flask (>=3.0.0)
|
|
13
13
|
Requires-Dist: crewai (>=0.22.5)
|
|
14
14
|
Requires-Dist: gradio (>=4.20.0)
|
|
15
|
+
Requires-Dist: markdown (>=3.5)
|
|
15
16
|
Requires-Dist: pyautogen (>=0.2.19)
|
|
16
17
|
Requires-Dist: rich (>=13.7)
|
|
17
18
|
Project-URL: Homepage, https://github.com/mervinpraison/praisonAI
|
|
@@ -35,6 +36,11 @@ praisonai --init create a movie script about dog in moon
|
|
|
35
36
|
```
|
|
36
37
|
This will automatically create agents.yaml file in the current directory.
|
|
37
38
|
|
|
39
|
+
To initialse with a specific agent framework:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
praisonai --framework autogen --init create movie script about cat in mars
|
|
43
|
+
```
|
|
38
44
|
|
|
39
45
|
## Run
|
|
40
46
|
|
|
@@ -68,6 +74,24 @@ python -m unittest tests.test
|
|
|
68
74
|
|
|
69
75
|
## Agents Playbook
|
|
70
76
|
|
|
77
|
+
### Simple Playbook
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
framework: crewai
|
|
81
|
+
topic: Artificial Intelligence
|
|
82
|
+
roles:
|
|
83
|
+
screenwriter:
|
|
84
|
+
backstory: 'Skilled in crafting scripts with engaging dialogue about {topic}.'
|
|
85
|
+
goal: Create scripts from concepts.
|
|
86
|
+
role: Screenwriter
|
|
87
|
+
tasks:
|
|
88
|
+
scriptwriting_task:
|
|
89
|
+
description: 'Develop scripts with compelling characters and dialogue about {topic}.'
|
|
90
|
+
expected_output: 'Complete script ready for production.'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Detailed Playbook
|
|
94
|
+
|
|
71
95
|
```yaml
|
|
72
96
|
framework: crewai
|
|
73
97
|
topic: Artificial Intelligence
|
|
@@ -167,6 +191,28 @@ gcloud run deploy praisonai-service \
|
|
|
167
191
|
--allow-unauthenticated \
|
|
168
192
|
--set-env-vars OPENAI_MODEL_NAME=${OPENAI_MODEL_NAME},OPENAI_API_KEY=${OPENAI_API_KEY},OPENAI_API_BASE=${OPENAI_API_BASE}
|
|
169
193
|
|
|
194
|
+
## Other Models
|
|
195
|
+
|
|
196
|
+
Ollama
|
|
197
|
+
OPENAI_API_BASE='http://localhost:11434/v1'
|
|
198
|
+
OPENAI_MODEL_NAME='mistral'
|
|
199
|
+
OPENAI_API_KEY='NA'
|
|
200
|
+
|
|
201
|
+
FastChat¶
|
|
202
|
+
OPENAI_API_BASE="http://localhost:8001/v1"
|
|
203
|
+
OPENAI_MODEL_NAME='oh-2.5m7b-q51'
|
|
204
|
+
OPENAI_API_KEY=NA
|
|
205
|
+
|
|
206
|
+
LM Studio¶
|
|
207
|
+
OPENAI_API_BASE="http://localhost:8000/v1"
|
|
208
|
+
OPENAI_MODEL_NAME=NA
|
|
209
|
+
OPENAI_API_KEY=NA
|
|
210
|
+
|
|
211
|
+
Mistral API¶
|
|
212
|
+
OPENAI_API_BASE=https://api.mistral.ai/v1
|
|
213
|
+
OPENAI_MODEL_NAME="mistral-small"
|
|
214
|
+
OPENAI_API_KEY=your-mistral-api-key
|
|
215
|
+
|
|
170
216
|
## Contributing
|
|
171
217
|
|
|
172
218
|
- Fork on GitHub: Use the "Fork" button on the repository page.
|
|
@@ -15,6 +15,11 @@ praisonai --init create a movie script about dog in moon
|
|
|
15
15
|
```
|
|
16
16
|
This will automatically create agents.yaml file in the current directory.
|
|
17
17
|
|
|
18
|
+
To initialse with a specific agent framework:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
praisonai --framework autogen --init create movie script about cat in mars
|
|
22
|
+
```
|
|
18
23
|
|
|
19
24
|
## Run
|
|
20
25
|
|
|
@@ -48,6 +53,24 @@ python -m unittest tests.test
|
|
|
48
53
|
|
|
49
54
|
## Agents Playbook
|
|
50
55
|
|
|
56
|
+
### Simple Playbook
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
framework: crewai
|
|
60
|
+
topic: Artificial Intelligence
|
|
61
|
+
roles:
|
|
62
|
+
screenwriter:
|
|
63
|
+
backstory: 'Skilled in crafting scripts with engaging dialogue about {topic}.'
|
|
64
|
+
goal: Create scripts from concepts.
|
|
65
|
+
role: Screenwriter
|
|
66
|
+
tasks:
|
|
67
|
+
scriptwriting_task:
|
|
68
|
+
description: 'Develop scripts with compelling characters and dialogue about {topic}.'
|
|
69
|
+
expected_output: 'Complete script ready for production.'
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Detailed Playbook
|
|
73
|
+
|
|
51
74
|
```yaml
|
|
52
75
|
framework: crewai
|
|
53
76
|
topic: Artificial Intelligence
|
|
@@ -147,6 +170,28 @@ gcloud run deploy praisonai-service \
|
|
|
147
170
|
--allow-unauthenticated \
|
|
148
171
|
--set-env-vars OPENAI_MODEL_NAME=${OPENAI_MODEL_NAME},OPENAI_API_KEY=${OPENAI_API_KEY},OPENAI_API_BASE=${OPENAI_API_BASE}
|
|
149
172
|
|
|
173
|
+
## Other Models
|
|
174
|
+
|
|
175
|
+
Ollama
|
|
176
|
+
OPENAI_API_BASE='http://localhost:11434/v1'
|
|
177
|
+
OPENAI_MODEL_NAME='mistral'
|
|
178
|
+
OPENAI_API_KEY='NA'
|
|
179
|
+
|
|
180
|
+
FastChat¶
|
|
181
|
+
OPENAI_API_BASE="http://localhost:8001/v1"
|
|
182
|
+
OPENAI_MODEL_NAME='oh-2.5m7b-q51'
|
|
183
|
+
OPENAI_API_KEY=NA
|
|
184
|
+
|
|
185
|
+
LM Studio¶
|
|
186
|
+
OPENAI_API_BASE="http://localhost:8000/v1"
|
|
187
|
+
OPENAI_MODEL_NAME=NA
|
|
188
|
+
OPENAI_API_KEY=NA
|
|
189
|
+
|
|
190
|
+
Mistral API¶
|
|
191
|
+
OPENAI_API_BASE=https://api.mistral.ai/v1
|
|
192
|
+
OPENAI_MODEL_NAME="mistral-small"
|
|
193
|
+
OPENAI_API_KEY=your-mistral-api-key
|
|
194
|
+
|
|
150
195
|
## Contributing
|
|
151
196
|
|
|
152
197
|
- Fork on GitHub: Use the "Fork" button on the repository page.
|
|
@@ -121,8 +121,9 @@ class PraisonAI:
|
|
|
121
121
|
invocation_cmd = "praisonai"
|
|
122
122
|
version_string = f"praisonAI version {__version__}"
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
if args.framework:
|
|
125
|
+
self.framework = args.framework
|
|
126
|
+
|
|
126
127
|
ui = args.ui
|
|
127
128
|
|
|
128
129
|
if args.agent_file:
|
|
@@ -179,13 +180,17 @@ class PraisonAI:
|
|
|
179
180
|
return args
|
|
180
181
|
|
|
181
182
|
def create_gradio_interface(self):
|
|
182
|
-
def generate_crew_and_kickoff_interface(
|
|
183
|
+
def generate_crew_and_kickoff_interface(auto_args, framework):
|
|
184
|
+
self.framework = framework
|
|
185
|
+
self.agent_file = "test.yaml"
|
|
186
|
+
generator = AutoGenerator(topic=auto_args , framework=self.framework)
|
|
187
|
+
self.agent_file = generator.generate()
|
|
183
188
|
result = self.generate_crew_and_kickoff()
|
|
184
189
|
return result
|
|
185
190
|
|
|
186
191
|
gr.Interface(
|
|
187
192
|
fn=generate_crew_and_kickoff_interface,
|
|
188
|
-
inputs=["
|
|
193
|
+
inputs=[gr.Textbox(lines=2, label="Auto Args"), gr.Dropdown(choices=["crewai", "autogen"], label="Framework")],
|
|
189
194
|
outputs="textbox",
|
|
190
195
|
title="Praison AI Studio",
|
|
191
196
|
description="Create Agents and perform tasks",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "praisonAI"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.16"
|
|
4
4
|
description = "praisonAI application combines AutoGen and CrewAI or similar frameworks into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customization, and efficient human-agent collaboration."
|
|
5
5
|
authors = ["Mervin Praison"]
|
|
6
6
|
license = ""
|
|
@@ -20,6 +20,7 @@ pyautogen = ">=0.2.19"
|
|
|
20
20
|
crewai = ">=0.22.5"
|
|
21
21
|
gradio = ">=4.20.0"
|
|
22
22
|
Flask = ">=3.0.0"
|
|
23
|
+
markdown = ">=3.5"
|
|
23
24
|
|
|
24
25
|
[tool.poetry.dev-dependencies]
|
|
25
26
|
pytest = "^5.2"
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
from openai import OpenAI
|
|
2
|
-
from pydantic import BaseModel, Field
|
|
3
|
-
from typing import Dict
|
|
4
|
-
import instructor
|
|
5
|
-
import os
|
|
6
|
-
import json
|
|
7
|
-
|
|
8
|
-
config_list = [
|
|
9
|
-
{
|
|
10
|
-
'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-4-turbo-preview"),
|
|
11
|
-
'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
task = "Movie Story writing"
|
|
16
|
-
|
|
17
|
-
# Define new Pydantic models to represent the script writing team structure
|
|
18
|
-
class TaskDetails(BaseModel):
|
|
19
|
-
description: str
|
|
20
|
-
expected_output: str
|
|
21
|
-
|
|
22
|
-
class RoleDetails(BaseModel):
|
|
23
|
-
role: str
|
|
24
|
-
goal: str
|
|
25
|
-
backstory: str
|
|
26
|
-
tasks: Dict[str, TaskDetails]
|
|
27
|
-
|
|
28
|
-
class TeamStructure(BaseModel):
|
|
29
|
-
roles: Dict[str, RoleDetails]
|
|
30
|
-
|
|
31
|
-
# Enables `response_model` in create call with the new model
|
|
32
|
-
client = instructor.patch(
|
|
33
|
-
OpenAI(
|
|
34
|
-
base_url=config_list[0]['base_url'],
|
|
35
|
-
api_key=os.getenv("OPENAI_API_KEY"),
|
|
36
|
-
),
|
|
37
|
-
mode=instructor.Mode.JSON,
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
response = client.chat.completions.create(
|
|
41
|
-
model=config_list[0]['model'],
|
|
42
|
-
response_model=TeamStructure,
|
|
43
|
-
max_retries=10,
|
|
44
|
-
messages=[
|
|
45
|
-
{"role": "system", "content": "You are a helpful assistant designed to output complex team structures."},
|
|
46
|
-
{"role": "user", "content":
|
|
47
|
-
"""Generate a team structure for """ + task + """ task.
|
|
48
|
-
No Input data will be provided to the team.
|
|
49
|
-
The team will work in sequence. First role will pass the output to the next role, and so on.
|
|
50
|
-
The last role will generate the final output.
|
|
51
|
-
Think step by step.
|
|
52
|
-
With maximum 3 roles, each with 1 task. Include role goals, backstories, task descriptions, and expected outputs.
|
|
53
|
-
Output Structure:
|
|
54
|
-
{
|
|
55
|
-
"roles": {
|
|
56
|
-
"<role_id>": {
|
|
57
|
-
"role": "<role_name>",
|
|
58
|
-
"goal": "<role_goal>",
|
|
59
|
-
"backstory": "<role_backstory>",
|
|
60
|
-
"tasks": {
|
|
61
|
-
"<task_id>": {
|
|
62
|
-
"description": "<task_description>",
|
|
63
|
-
"expected_output": "<task_expected_output>"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
"<role_id>": {
|
|
68
|
-
"role": "<role_name>",
|
|
69
|
-
"goal": "<role_goal>",
|
|
70
|
-
"backstory": "<role_backstory>",
|
|
71
|
-
"tasks": {
|
|
72
|
-
"<task_id>": {
|
|
73
|
-
"description": "<task_description>",
|
|
74
|
-
"expected_output": "<task_expected_output>"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
Example Below:
|
|
81
|
-
{
|
|
82
|
-
"roles": {
|
|
83
|
-
"narrative_designer": {
|
|
84
|
-
"role": "Narrative Designer",
|
|
85
|
-
"goal": "Create AI storylines",
|
|
86
|
-
"backstory": "Skilled in narrative development for AI, with a focus on story resonance.",
|
|
87
|
-
"tasks": {
|
|
88
|
-
"story_concept_development": {
|
|
89
|
-
"description": "Craft a unique AI story concept with depth and engagement.",
|
|
90
|
-
"expected_output": "Document with narrative arcs, character bios, and settings."
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
"scriptwriter": {
|
|
95
|
-
"role": "Scriptwriter",
|
|
96
|
-
"goal": "Write scripts from AI concepts",
|
|
97
|
-
"backstory": "Expert in dialogue and script structure, translating concepts into scripts.",
|
|
98
|
-
"tasks": {
|
|
99
|
-
"scriptwriting_task": {
|
|
100
|
-
"description": "Turn narrative concepts into scripts, including dialogue and scenes.",
|
|
101
|
-
"expected_output": "Production-ready script with dialogue and scene details."
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
"""}
|
|
108
|
-
]
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
print(response.model_dump_json(indent=2))
|
|
112
|
-
|
|
113
|
-
import yaml
|
|
114
|
-
|
|
115
|
-
def convert_and_save(json_data, topic="Artificial Intelligence", filename="test.yaml"):
|
|
116
|
-
"""Converts the provided JSON data into the desired YAML format and saves it to a file.
|
|
117
|
-
|
|
118
|
-
Args:
|
|
119
|
-
json_data (dict): The JSON data representing the team structure.
|
|
120
|
-
topic (str, optional): The topic to be inserted into the YAML. Defaults to "Artificial Intelligence".
|
|
121
|
-
filename (str, optional): The name of the YAML file to save. Defaults to "test.yaml".
|
|
122
|
-
"""
|
|
123
|
-
|
|
124
|
-
yaml_data = {
|
|
125
|
-
"framework": "crewai",
|
|
126
|
-
"topic": topic,
|
|
127
|
-
"roles": {},
|
|
128
|
-
"dependencies": []
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
# Process roles in the order they appear in JSON
|
|
132
|
-
for role_id, role_details in json_data['roles'].items():
|
|
133
|
-
yaml_data['roles'][role_id] = {
|
|
134
|
-
"backstory": "" + role_details['backstory'],
|
|
135
|
-
"goal": role_details['goal'],
|
|
136
|
-
"role": role_details['role'],
|
|
137
|
-
"tasks": {}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
for task_id, task_details in role_details['tasks'].items():
|
|
141
|
-
yaml_data['roles'][role_id]['tasks'][task_id] = {
|
|
142
|
-
"description": "" + task_details['description'],
|
|
143
|
-
"expected_output": "" + task_details['expected_output']
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
# Save to YAML file, maintaining the order
|
|
147
|
-
with open(filename, 'w') as f:
|
|
148
|
-
yaml.dump(yaml_data, f, allow_unicode=True, sort_keys=False)
|
|
149
|
-
|
|
150
|
-
json_data = json.loads(response.model_dump_json())
|
|
151
|
-
convert_and_save(json_data)
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
# praisonai/cli.py
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
from version import __version__
|
|
5
|
-
import yaml, os
|
|
6
|
-
from rich import print
|
|
7
|
-
from dotenv import load_dotenv
|
|
8
|
-
from crewai import Agent, Task, Crew
|
|
9
|
-
load_dotenv()
|
|
10
|
-
import autogen
|
|
11
|
-
import gradio as gr
|
|
12
|
-
import argparse
|
|
13
|
-
|
|
14
|
-
config_list = [
|
|
15
|
-
{
|
|
16
|
-
'model': os.environ.get("OPENAI_MODEL_NAME", "gpt-3.5-turbo"),
|
|
17
|
-
'base_url': os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1"),
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
def generate_crew_and_kickoff(agent_file, framework=None):
|
|
22
|
-
with open(agent_file, 'r') as f:
|
|
23
|
-
config = yaml.safe_load(f)
|
|
24
|
-
|
|
25
|
-
topic = config['topic']
|
|
26
|
-
framework = framework or config.get('framework')
|
|
27
|
-
|
|
28
|
-
agents = {}
|
|
29
|
-
tasks = []
|
|
30
|
-
if framework == "autogen":
|
|
31
|
-
# Load the LLM configuration dynamically
|
|
32
|
-
print(config_list)
|
|
33
|
-
llm_config = {"config_list": config_list}
|
|
34
|
-
|
|
35
|
-
for role, details in config['roles'].items():
|
|
36
|
-
agent_name = details['role'].format(topic=topic).replace("{topic}", topic)
|
|
37
|
-
agent_goal = details['goal'].format(topic=topic)
|
|
38
|
-
# Creating an AssistantAgent for each role dynamically
|
|
39
|
-
agents[role] = autogen.AssistantAgent(
|
|
40
|
-
name=agent_name,
|
|
41
|
-
llm_config=llm_config,
|
|
42
|
-
system_message=details['backstory'].format(topic=topic)+". Reply \"TERMINATE\" in the end when everything is done.",
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
# Preparing tasks for initiate_chats
|
|
46
|
-
for task_name, task_details in details.get('tasks', {}).items():
|
|
47
|
-
description_filled = task_details['description'].format(topic=topic)
|
|
48
|
-
expected_output_filled = task_details['expected_output'].format(topic=topic)
|
|
49
|
-
|
|
50
|
-
chat_task = {
|
|
51
|
-
"recipient": agents[role],
|
|
52
|
-
"message": description_filled,
|
|
53
|
-
"summary_method": "last_msg",
|
|
54
|
-
# Additional fields like carryover can be added based on dependencies
|
|
55
|
-
}
|
|
56
|
-
tasks.append(chat_task)
|
|
57
|
-
|
|
58
|
-
# Assuming the user proxy agent is set up as per your requirements
|
|
59
|
-
user = autogen.UserProxyAgent(
|
|
60
|
-
name="User",
|
|
61
|
-
human_input_mode="NEVER",
|
|
62
|
-
is_termination_msg=lambda x: (x.get("content") or "").rstrip().rstrip(".").lower().endswith("terminate") or "TERMINATE" in (x.get("content") or ""),
|
|
63
|
-
code_execution_config={
|
|
64
|
-
"work_dir": "coding",
|
|
65
|
-
"use_docker": False,
|
|
66
|
-
},
|
|
67
|
-
# additional setup for the user proxy agent
|
|
68
|
-
)
|
|
69
|
-
response = user.initiate_chats(tasks)
|
|
70
|
-
result = "### Output ###\n"+response[-1].summary if hasattr(response[-1], 'summary') else ""
|
|
71
|
-
else:
|
|
72
|
-
for role, details in config['roles'].items():
|
|
73
|
-
role_filled = details['role'].format(topic=topic)
|
|
74
|
-
goal_filled = details['goal'].format(topic=topic)
|
|
75
|
-
backstory_filled = details['backstory'].format(topic=topic)
|
|
76
|
-
|
|
77
|
-
# Assume tools are loaded and handled here as per your requirements
|
|
78
|
-
agent = Agent(role=role_filled, goal=goal_filled, backstory=backstory_filled, allow_delegation=False)
|
|
79
|
-
agents[role] = agent
|
|
80
|
-
|
|
81
|
-
for task_name, task_details in details.get('tasks', {}).items():
|
|
82
|
-
description_filled = task_details['description'].format(topic=topic)
|
|
83
|
-
expected_output_filled = task_details['expected_output'].format(topic=topic)
|
|
84
|
-
|
|
85
|
-
task = Task(description=description_filled, expected_output=expected_output_filled, agent=agent)
|
|
86
|
-
tasks.append(task)
|
|
87
|
-
|
|
88
|
-
crew = Crew(
|
|
89
|
-
agents=list(agents.values()),
|
|
90
|
-
tasks=tasks,
|
|
91
|
-
verbose=2
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
response = crew.kickoff()
|
|
95
|
-
result = f"### Output ###\n{response}"
|
|
96
|
-
return result
|
|
97
|
-
|
|
98
|
-
def main(args=None):
|
|
99
|
-
if args is None:
|
|
100
|
-
args = parse_args()
|
|
101
|
-
|
|
102
|
-
invocation_cmd = "praisonai"
|
|
103
|
-
version_string = f"praisonAI version {__version__}"
|
|
104
|
-
framework = args.framework # Default framework
|
|
105
|
-
ui = args.ui # Default UI flag
|
|
106
|
-
print(args)
|
|
107
|
-
|
|
108
|
-
if args.agent_file:
|
|
109
|
-
agent_file = args.agent_file
|
|
110
|
-
else:
|
|
111
|
-
agent_file = "agents.yaml"
|
|
112
|
-
|
|
113
|
-
if ui:
|
|
114
|
-
create_gradio_interface()
|
|
115
|
-
else:
|
|
116
|
-
result = generate_crew_and_kickoff(agent_file, framework)
|
|
117
|
-
print(result)
|
|
118
|
-
|
|
119
|
-
def parse_args():
|
|
120
|
-
parser = argparse.ArgumentParser(prog="praisonai", description="praisonAI command-line interface")
|
|
121
|
-
parser.add_argument("--framework", choices=["crewai", "autogen"], default="crewai", help="Specify the framework")
|
|
122
|
-
parser.add_argument("--ui", action="store_true", help="Enable UI mode")
|
|
123
|
-
parser.add_argument("--auto", action="store_true", help="Enable auto mode")
|
|
124
|
-
parser.add_argument("agent_file", nargs="?", help="Specify the agent file")
|
|
125
|
-
|
|
126
|
-
return parser.parse_args()
|
|
127
|
-
|
|
128
|
-
def create_gradio_interface():
|
|
129
|
-
def generate_crew_and_kickoff_interface(agent_file, framework):
|
|
130
|
-
result = generate_crew_and_kickoff(agent_file, framework)
|
|
131
|
-
return result
|
|
132
|
-
|
|
133
|
-
gr.Interface(
|
|
134
|
-
fn=generate_crew_and_kickoff_interface,
|
|
135
|
-
inputs=["textbox", "radio"],
|
|
136
|
-
outputs="textbox",
|
|
137
|
-
title="Generate Crew and Kickoff",
|
|
138
|
-
description="Generate a crew and kickoff the tasks",
|
|
139
|
-
theme="default"
|
|
140
|
-
).launch()
|
|
141
|
-
|
|
142
|
-
if __name__ == "__main__":
|
|
143
|
-
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|