PraisonAI 0.0.1__tar.gz → 0.0.23__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.
Potentially problematic release.
This version of PraisonAI might be problematic. Click here for more details.
- praisonai-0.0.23/LICENSE +20 -0
- praisonai-0.0.23/PKG-INFO +314 -0
- praisonai-0.0.23/README.md +291 -0
- praisonai-0.0.23/praisonai/__init__.py +2 -0
- praisonai-0.0.23/praisonai/__main__.py +10 -0
- praisonai-0.0.23/praisonai/agents_generator.py +272 -0
- praisonai-0.0.23/praisonai/auto.py +186 -0
- praisonai-0.0.23/praisonai/chainlit_ui.py +59 -0
- praisonai-0.0.23/praisonai/cli.py +221 -0
- praisonai-0.0.23/praisonai/deploy.py +138 -0
- praisonai-0.0.23/praisonai/inbuilt_tools/__init__.py +2 -0
- praisonai-0.0.23/praisonai/inbuilt_tools/autogen_tools.py +203 -0
- {PraisonAI-0.0.1 → praisonai-0.0.23}/praisonai/test.py +12 -1
- {PraisonAI-0.0.1 → praisonai-0.0.23}/pyproject.toml +17 -11
- PraisonAI-0.0.1/PKG-INFO +0 -3
- PraisonAI-0.0.1/PraisonAI.egg-info/PKG-INFO +0 -3
- PraisonAI-0.0.1/PraisonAI.egg-info/SOURCES.txt +0 -11
- PraisonAI-0.0.1/PraisonAI.egg-info/dependency_links.txt +0 -1
- PraisonAI-0.0.1/PraisonAI.egg-info/top_level.txt +0 -1
- PraisonAI-0.0.1/README.md +0 -15
- PraisonAI-0.0.1/praisonai/__init__.py +0 -1
- PraisonAI-0.0.1/praisonai/__main__.py +0 -4
- PraisonAI-0.0.1/praisonai/cli.py +0 -114
- PraisonAI-0.0.1/setup.cfg +0 -4
- {PraisonAI-0.0.1 → praisonai-0.0.23}/praisonai/version.py +0 -0
praisonai-0.0.23/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: PraisonAI
|
|
3
|
+
Version: 0.0.23
|
|
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
|
+
Author: Mervin Praison
|
|
6
|
+
Requires-Python: >=3.10,<3.13
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Requires-Dist: Flask (>=3.0.0)
|
|
12
|
+
Requires-Dist: crewai (>=0.30.4)
|
|
13
|
+
Requires-Dist: crewai-tools (>=0.2.6,<0.3.0)
|
|
14
|
+
Requires-Dist: gradio (>=4.26.0)
|
|
15
|
+
Requires-Dist: markdown (>=3.5)
|
|
16
|
+
Requires-Dist: praisonai-tools (>=0.0.4)
|
|
17
|
+
Requires-Dist: pyautogen (>=0.2.19)
|
|
18
|
+
Requires-Dist: rich (>=13.7)
|
|
19
|
+
Project-URL: Homepage, https://docs.praison.ai
|
|
20
|
+
Project-URL: Repository, https://github.com/mervinpraison/PraisonAI
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# Praison AI
|
|
24
|
+
|
|
25
|
+
Praison AI, leveraging both AutoGen and CrewAI or any other agent framework, represents a low-code, centralised framework designed to simplify the creation and orchestration of multi-agent systems for various LLM applications, emphasizing ease of use, customization, and human-agent interaction.
|
|
26
|
+
|
|
27
|
+
## TL;DR
|
|
28
|
+
```bash
|
|
29
|
+
pip install praisonai
|
|
30
|
+
export OPENAI_API_KEY="Enter your API key"
|
|
31
|
+
praisonai --init create a movie script about dog in moon
|
|
32
|
+
praisonai
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install praisonai
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Initialise
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
export OPENAI_API_KEY="Enter your API key"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Generate your OPENAI API KEY from here: https://platform.openai.com/api-keys
|
|
48
|
+
|
|
49
|
+
Note: You can use other providers such as Ollama, Mistral ... etc. Details are provided at the bottom.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
praisonai --init create a movie script about dog in moon
|
|
53
|
+
```
|
|
54
|
+
This will automatically create agents.yaml file in the current directory.
|
|
55
|
+
|
|
56
|
+
### To initialse with a specific agent framework (Optional):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
praisonai --framework autogen --init create movie script about cat in mars
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Run
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
praisonai
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
or
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
python -m praisonai
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Specify the agent framework (Optional):
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
praisonai --framework autogen
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Full Automatic Mode
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
praisonai --auto create a movie script about Dog in Moon
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Create Custom Tools
|
|
87
|
+
|
|
88
|
+
### TL;DR to Create a Custom Tool
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install praisonai duckduckgo-search
|
|
92
|
+
export OPENAI_API_KEY="Enter your API key"
|
|
93
|
+
praisonai --init research about the latest AI News and prepare a detailed report
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
- Add `- InternetSearchTool` in the agents.yaml file in the tools section.
|
|
97
|
+
- Create a file called tools.py and add this code [tools.py](./tools.py)
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
praisonai
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Pre-requisite to Create a Custom Tool
|
|
104
|
+
`agents.yaml` file should be present in the current directory.
|
|
105
|
+
|
|
106
|
+
If it doesn't exist, create it by running the command `praisonai --init research about the latest AI News and prepare a detailed report`.
|
|
107
|
+
|
|
108
|
+
### Step 1 to Create a Custom Tool
|
|
109
|
+
|
|
110
|
+
Create a file called tools.py in the same directory as the agents.yaml file.
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
# example tools.py
|
|
114
|
+
from duckduckgo_search import DDGS
|
|
115
|
+
from praisonai_tools import BaseTool
|
|
116
|
+
|
|
117
|
+
class InternetSearchTool(BaseTool):
|
|
118
|
+
name: str = "InternetSearchTool"
|
|
119
|
+
description: str = "Search Internet for relevant information based on a query or latest news"
|
|
120
|
+
|
|
121
|
+
def _run(self, query: str):
|
|
122
|
+
ddgs = DDGS()
|
|
123
|
+
results = ddgs.text(keywords=query, region='wt-wt', safesearch='moderate', max_results=5)
|
|
124
|
+
return results
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Step 2 to Create a Custom Tool
|
|
128
|
+
|
|
129
|
+
Add the tool to the agents.yaml file as show below under the tools section `- InternetSearchTool`.
|
|
130
|
+
|
|
131
|
+
```yaml
|
|
132
|
+
framework: crewai
|
|
133
|
+
topic: research about the latest AI News and prepare a detailed report
|
|
134
|
+
roles:
|
|
135
|
+
research_analyst:
|
|
136
|
+
backstory: Experienced in gathering and analyzing data related to AI news trends.
|
|
137
|
+
goal: Analyze AI News trends
|
|
138
|
+
role: Research Analyst
|
|
139
|
+
tasks:
|
|
140
|
+
gather_data:
|
|
141
|
+
description: Conduct in-depth research on the latest AI News trends from reputable
|
|
142
|
+
sources.
|
|
143
|
+
expected_output: Comprehensive report on current AI News trends.
|
|
144
|
+
tools:
|
|
145
|
+
- InternetSearchTool
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Test
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
python -m unittest tests.test
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Agents Playbook
|
|
155
|
+
|
|
156
|
+
### Simple Playbook Example
|
|
157
|
+
|
|
158
|
+
```yaml
|
|
159
|
+
framework: crewai
|
|
160
|
+
topic: Artificial Intelligence
|
|
161
|
+
roles:
|
|
162
|
+
screenwriter:
|
|
163
|
+
backstory: 'Skilled in crafting scripts with engaging dialogue about {topic}.'
|
|
164
|
+
goal: Create scripts from concepts.
|
|
165
|
+
role: Screenwriter
|
|
166
|
+
tasks:
|
|
167
|
+
scriptwriting_task:
|
|
168
|
+
description: 'Develop scripts with compelling characters and dialogue about {topic}.'
|
|
169
|
+
expected_output: 'Complete script ready for production.'
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Detailed Playbook Example
|
|
173
|
+
|
|
174
|
+
```yaml
|
|
175
|
+
framework: crewai
|
|
176
|
+
topic: Artificial Intelligence
|
|
177
|
+
roles:
|
|
178
|
+
movie_concept_creator:
|
|
179
|
+
backstory: 'Creative thinker with a deep understanding of cinematic storytelling,
|
|
180
|
+
capable of using AI-generated storylines to create unique and compelling movie
|
|
181
|
+
ideas.'
|
|
182
|
+
goal: Generate engaging movie concepts using AI storylines
|
|
183
|
+
role: Movie Concept Creator
|
|
184
|
+
tasks:
|
|
185
|
+
movie_concept_development:
|
|
186
|
+
description: 'Develop movie concepts from AI-generated storylines, ensuring
|
|
187
|
+
they are engaging and have strong narrative arcs.'
|
|
188
|
+
expected_output: 'Well-structured movie concept document with character
|
|
189
|
+
bios, settings, and plot outlines.'
|
|
190
|
+
screenwriter:
|
|
191
|
+
backstory: 'Expert in writing engaging dialogue and script structure, able to
|
|
192
|
+
turn movie concepts into production-ready scripts.'
|
|
193
|
+
goal: Write compelling scripts based on movie concepts
|
|
194
|
+
role: Screenwriter
|
|
195
|
+
tasks:
|
|
196
|
+
scriptwriting_task:
|
|
197
|
+
description: 'Turn movie concepts into polished scripts with well-developed
|
|
198
|
+
characters, strong dialogue, and effective scene transitions.'
|
|
199
|
+
expected_output: 'Production-ready script with a beginning, middle, and
|
|
200
|
+
end, along with character development and engaging dialogues.'
|
|
201
|
+
editor:
|
|
202
|
+
backstory: 'Adept at identifying inconsistencies, improving language usage,
|
|
203
|
+
and maintaining the overall flow of the script.'
|
|
204
|
+
goal: Refine the scripts and ensure continuity of the movie storyline
|
|
205
|
+
role: Editor
|
|
206
|
+
tasks:
|
|
207
|
+
editing_task:
|
|
208
|
+
description: 'Review, edit, and refine the scripts to ensure they are cohesive
|
|
209
|
+
and follow a well-structured narrative.'
|
|
210
|
+
expected_output: 'A polished final draft of the script with no inconsistencies,
|
|
211
|
+
strong character development, and effective dialogue.'
|
|
212
|
+
dependencies: []
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Include praisonai package in your project
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
from praisonai import PraisonAI
|
|
219
|
+
|
|
220
|
+
def basic(): # Basic Mode
|
|
221
|
+
praison_ai = PraisonAI(agent_file="agents.yaml")
|
|
222
|
+
praison_ai.main()
|
|
223
|
+
|
|
224
|
+
def advanced(): # Advanced Mode with options
|
|
225
|
+
praison_ai = PraisonAI(
|
|
226
|
+
agent_file="agents.yaml",
|
|
227
|
+
framework="autogen",
|
|
228
|
+
)
|
|
229
|
+
praison_ai.main()
|
|
230
|
+
|
|
231
|
+
def auto(): # Full Automatic Mode
|
|
232
|
+
praison_ai = PraisonAI(
|
|
233
|
+
auto="Create a movie script about car in mars",
|
|
234
|
+
framework="autogen"
|
|
235
|
+
)
|
|
236
|
+
print(praison_ai.framework)
|
|
237
|
+
praison_ai.main()
|
|
238
|
+
|
|
239
|
+
if __name__ == "__main__":
|
|
240
|
+
basic()
|
|
241
|
+
advanced()
|
|
242
|
+
auto()
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Include CrewAI Tools
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
pip install "praisonai[crewai-tools]"
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Deploy
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
gcloud init
|
|
255
|
+
gcloud services enable run.googleapis.com
|
|
256
|
+
gcloud services enable containerregistry.googleapis.com
|
|
257
|
+
gcloud services enable cloudbuild.googleapis.com
|
|
258
|
+
|
|
259
|
+
export OPENAI_MODEL_NAME="gpt-4o"
|
|
260
|
+
export OPENAI_API_KEY="Enter your API key"
|
|
261
|
+
export OPENAI_API_BASE="https://api.openai.com/v1"
|
|
262
|
+
|
|
263
|
+
yes | gcloud auth configure-docker us-central1-docker.pkg.dev
|
|
264
|
+
gcloud artifacts repositories create praisonai-repository --repository-format=docker --location=us-central1
|
|
265
|
+
|
|
266
|
+
PROJECT_ID=$(gcloud config get-value project)
|
|
267
|
+
TAG="latest"
|
|
268
|
+
docker build --platform linux/amd64 -t gcr.io/${PROJECT_ID}/praisonai-app:${TAG} .
|
|
269
|
+
docker tag gcr.io/${PROJECT_ID}/praisonai-app:${TAG} us-central1-docker.pkg.dev/${PROJECT_ID}/praisonai-repository/praisonai-app:${TAG}
|
|
270
|
+
docker push us-central1-docker.pkg.dev/${PROJECT_ID}/praisonai-repository/praisonai-app:${TAG}
|
|
271
|
+
|
|
272
|
+
gcloud run deploy praisonai-service \
|
|
273
|
+
--image us-central1-docker.pkg.dev/${PROJECT_ID}/praisonai-repository/praisonai-app:${TAG} \
|
|
274
|
+
--platform managed \
|
|
275
|
+
--region us-central1 \
|
|
276
|
+
--allow-unauthenticated \
|
|
277
|
+
--set-env-vars OPENAI_MODEL_NAME=${OPENAI_MODEL_NAME},OPENAI_API_KEY=${OPENAI_API_KEY},OPENAI_API_BASE=${OPENAI_API_BASE}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Other Models
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
Ollama
|
|
284
|
+
OPENAI_API_BASE='http://localhost:11434/v1'
|
|
285
|
+
OPENAI_MODEL_NAME='mistral'
|
|
286
|
+
OPENAI_API_KEY='NA'
|
|
287
|
+
|
|
288
|
+
FastChat¶
|
|
289
|
+
OPENAI_API_BASE="http://localhost:8001/v1"
|
|
290
|
+
OPENAI_MODEL_NAME='oh-2.5m7b-q51'
|
|
291
|
+
OPENAI_API_KEY=NA
|
|
292
|
+
|
|
293
|
+
LM Studio¶
|
|
294
|
+
OPENAI_API_BASE="http://localhost:8000/v1"
|
|
295
|
+
OPENAI_MODEL_NAME=NA
|
|
296
|
+
OPENAI_API_KEY=NA
|
|
297
|
+
|
|
298
|
+
Mistral API¶
|
|
299
|
+
OPENAI_API_BASE=https://api.mistral.ai/v1
|
|
300
|
+
OPENAI_MODEL_NAME="mistral-small"
|
|
301
|
+
OPENAI_API_KEY=your-mistral-api-key
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## Contributing
|
|
305
|
+
|
|
306
|
+
- Fork on GitHub: Use the "Fork" button on the repository page.
|
|
307
|
+
- Clone your fork: `git clone https://github.com/yourusername/praisonAI.git`
|
|
308
|
+
- Create a branch: `git checkout -b new-feature`
|
|
309
|
+
- Make changes and commit: `git commit -am "Add some feature"`
|
|
310
|
+
- Push to your fork: `git push origin new-feature`
|
|
311
|
+
- Submit a pull request via GitHub's web interface.
|
|
312
|
+
- Await feedback from project maintainers.
|
|
313
|
+
|
|
314
|
+
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# Praison AI
|
|
2
|
+
|
|
3
|
+
Praison AI, leveraging both AutoGen and CrewAI or any other agent framework, represents a low-code, centralised framework designed to simplify the creation and orchestration of multi-agent systems for various LLM applications, emphasizing ease of use, customization, and human-agent interaction.
|
|
4
|
+
|
|
5
|
+
## TL;DR
|
|
6
|
+
```bash
|
|
7
|
+
pip install praisonai
|
|
8
|
+
export OPENAI_API_KEY="Enter your API key"
|
|
9
|
+
praisonai --init create a movie script about dog in moon
|
|
10
|
+
praisonai
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install praisonai
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Initialise
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
export OPENAI_API_KEY="Enter your API key"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Generate your OPENAI API KEY from here: https://platform.openai.com/api-keys
|
|
26
|
+
|
|
27
|
+
Note: You can use other providers such as Ollama, Mistral ... etc. Details are provided at the bottom.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
praisonai --init create a movie script about dog in moon
|
|
31
|
+
```
|
|
32
|
+
This will automatically create agents.yaml file in the current directory.
|
|
33
|
+
|
|
34
|
+
### To initialse with a specific agent framework (Optional):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
praisonai --framework autogen --init create movie script about cat in mars
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Run
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
praisonai
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
or
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python -m praisonai
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Specify the agent framework (Optional):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
praisonai --framework autogen
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Full Automatic Mode
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
praisonai --auto create a movie script about Dog in Moon
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Create Custom Tools
|
|
65
|
+
|
|
66
|
+
### TL;DR to Create a Custom Tool
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install praisonai duckduckgo-search
|
|
70
|
+
export OPENAI_API_KEY="Enter your API key"
|
|
71
|
+
praisonai --init research about the latest AI News and prepare a detailed report
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- Add `- InternetSearchTool` in the agents.yaml file in the tools section.
|
|
75
|
+
- Create a file called tools.py and add this code [tools.py](./tools.py)
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
praisonai
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Pre-requisite to Create a Custom Tool
|
|
82
|
+
`agents.yaml` file should be present in the current directory.
|
|
83
|
+
|
|
84
|
+
If it doesn't exist, create it by running the command `praisonai --init research about the latest AI News and prepare a detailed report`.
|
|
85
|
+
|
|
86
|
+
### Step 1 to Create a Custom Tool
|
|
87
|
+
|
|
88
|
+
Create a file called tools.py in the same directory as the agents.yaml file.
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
# example tools.py
|
|
92
|
+
from duckduckgo_search import DDGS
|
|
93
|
+
from praisonai_tools import BaseTool
|
|
94
|
+
|
|
95
|
+
class InternetSearchTool(BaseTool):
|
|
96
|
+
name: str = "InternetSearchTool"
|
|
97
|
+
description: str = "Search Internet for relevant information based on a query or latest news"
|
|
98
|
+
|
|
99
|
+
def _run(self, query: str):
|
|
100
|
+
ddgs = DDGS()
|
|
101
|
+
results = ddgs.text(keywords=query, region='wt-wt', safesearch='moderate', max_results=5)
|
|
102
|
+
return results
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Step 2 to Create a Custom Tool
|
|
106
|
+
|
|
107
|
+
Add the tool to the agents.yaml file as show below under the tools section `- InternetSearchTool`.
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
framework: crewai
|
|
111
|
+
topic: research about the latest AI News and prepare a detailed report
|
|
112
|
+
roles:
|
|
113
|
+
research_analyst:
|
|
114
|
+
backstory: Experienced in gathering and analyzing data related to AI news trends.
|
|
115
|
+
goal: Analyze AI News trends
|
|
116
|
+
role: Research Analyst
|
|
117
|
+
tasks:
|
|
118
|
+
gather_data:
|
|
119
|
+
description: Conduct in-depth research on the latest AI News trends from reputable
|
|
120
|
+
sources.
|
|
121
|
+
expected_output: Comprehensive report on current AI News trends.
|
|
122
|
+
tools:
|
|
123
|
+
- InternetSearchTool
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Test
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
python -m unittest tests.test
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Agents Playbook
|
|
133
|
+
|
|
134
|
+
### Simple Playbook Example
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
framework: crewai
|
|
138
|
+
topic: Artificial Intelligence
|
|
139
|
+
roles:
|
|
140
|
+
screenwriter:
|
|
141
|
+
backstory: 'Skilled in crafting scripts with engaging dialogue about {topic}.'
|
|
142
|
+
goal: Create scripts from concepts.
|
|
143
|
+
role: Screenwriter
|
|
144
|
+
tasks:
|
|
145
|
+
scriptwriting_task:
|
|
146
|
+
description: 'Develop scripts with compelling characters and dialogue about {topic}.'
|
|
147
|
+
expected_output: 'Complete script ready for production.'
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Detailed Playbook Example
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
framework: crewai
|
|
154
|
+
topic: Artificial Intelligence
|
|
155
|
+
roles:
|
|
156
|
+
movie_concept_creator:
|
|
157
|
+
backstory: 'Creative thinker with a deep understanding of cinematic storytelling,
|
|
158
|
+
capable of using AI-generated storylines to create unique and compelling movie
|
|
159
|
+
ideas.'
|
|
160
|
+
goal: Generate engaging movie concepts using AI storylines
|
|
161
|
+
role: Movie Concept Creator
|
|
162
|
+
tasks:
|
|
163
|
+
movie_concept_development:
|
|
164
|
+
description: 'Develop movie concepts from AI-generated storylines, ensuring
|
|
165
|
+
they are engaging and have strong narrative arcs.'
|
|
166
|
+
expected_output: 'Well-structured movie concept document with character
|
|
167
|
+
bios, settings, and plot outlines.'
|
|
168
|
+
screenwriter:
|
|
169
|
+
backstory: 'Expert in writing engaging dialogue and script structure, able to
|
|
170
|
+
turn movie concepts into production-ready scripts.'
|
|
171
|
+
goal: Write compelling scripts based on movie concepts
|
|
172
|
+
role: Screenwriter
|
|
173
|
+
tasks:
|
|
174
|
+
scriptwriting_task:
|
|
175
|
+
description: 'Turn movie concepts into polished scripts with well-developed
|
|
176
|
+
characters, strong dialogue, and effective scene transitions.'
|
|
177
|
+
expected_output: 'Production-ready script with a beginning, middle, and
|
|
178
|
+
end, along with character development and engaging dialogues.'
|
|
179
|
+
editor:
|
|
180
|
+
backstory: 'Adept at identifying inconsistencies, improving language usage,
|
|
181
|
+
and maintaining the overall flow of the script.'
|
|
182
|
+
goal: Refine the scripts and ensure continuity of the movie storyline
|
|
183
|
+
role: Editor
|
|
184
|
+
tasks:
|
|
185
|
+
editing_task:
|
|
186
|
+
description: 'Review, edit, and refine the scripts to ensure they are cohesive
|
|
187
|
+
and follow a well-structured narrative.'
|
|
188
|
+
expected_output: 'A polished final draft of the script with no inconsistencies,
|
|
189
|
+
strong character development, and effective dialogue.'
|
|
190
|
+
dependencies: []
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Include praisonai package in your project
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
from praisonai import PraisonAI
|
|
197
|
+
|
|
198
|
+
def basic(): # Basic Mode
|
|
199
|
+
praison_ai = PraisonAI(agent_file="agents.yaml")
|
|
200
|
+
praison_ai.main()
|
|
201
|
+
|
|
202
|
+
def advanced(): # Advanced Mode with options
|
|
203
|
+
praison_ai = PraisonAI(
|
|
204
|
+
agent_file="agents.yaml",
|
|
205
|
+
framework="autogen",
|
|
206
|
+
)
|
|
207
|
+
praison_ai.main()
|
|
208
|
+
|
|
209
|
+
def auto(): # Full Automatic Mode
|
|
210
|
+
praison_ai = PraisonAI(
|
|
211
|
+
auto="Create a movie script about car in mars",
|
|
212
|
+
framework="autogen"
|
|
213
|
+
)
|
|
214
|
+
print(praison_ai.framework)
|
|
215
|
+
praison_ai.main()
|
|
216
|
+
|
|
217
|
+
if __name__ == "__main__":
|
|
218
|
+
basic()
|
|
219
|
+
advanced()
|
|
220
|
+
auto()
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Include CrewAI Tools
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
pip install "praisonai[crewai-tools]"
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Deploy
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
gcloud init
|
|
233
|
+
gcloud services enable run.googleapis.com
|
|
234
|
+
gcloud services enable containerregistry.googleapis.com
|
|
235
|
+
gcloud services enable cloudbuild.googleapis.com
|
|
236
|
+
|
|
237
|
+
export OPENAI_MODEL_NAME="gpt-4o"
|
|
238
|
+
export OPENAI_API_KEY="Enter your API key"
|
|
239
|
+
export OPENAI_API_BASE="https://api.openai.com/v1"
|
|
240
|
+
|
|
241
|
+
yes | gcloud auth configure-docker us-central1-docker.pkg.dev
|
|
242
|
+
gcloud artifacts repositories create praisonai-repository --repository-format=docker --location=us-central1
|
|
243
|
+
|
|
244
|
+
PROJECT_ID=$(gcloud config get-value project)
|
|
245
|
+
TAG="latest"
|
|
246
|
+
docker build --platform linux/amd64 -t gcr.io/${PROJECT_ID}/praisonai-app:${TAG} .
|
|
247
|
+
docker tag gcr.io/${PROJECT_ID}/praisonai-app:${TAG} us-central1-docker.pkg.dev/${PROJECT_ID}/praisonai-repository/praisonai-app:${TAG}
|
|
248
|
+
docker push us-central1-docker.pkg.dev/${PROJECT_ID}/praisonai-repository/praisonai-app:${TAG}
|
|
249
|
+
|
|
250
|
+
gcloud run deploy praisonai-service \
|
|
251
|
+
--image us-central1-docker.pkg.dev/${PROJECT_ID}/praisonai-repository/praisonai-app:${TAG} \
|
|
252
|
+
--platform managed \
|
|
253
|
+
--region us-central1 \
|
|
254
|
+
--allow-unauthenticated \
|
|
255
|
+
--set-env-vars OPENAI_MODEL_NAME=${OPENAI_MODEL_NAME},OPENAI_API_KEY=${OPENAI_API_KEY},OPENAI_API_BASE=${OPENAI_API_BASE}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Other Models
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
Ollama
|
|
262
|
+
OPENAI_API_BASE='http://localhost:11434/v1'
|
|
263
|
+
OPENAI_MODEL_NAME='mistral'
|
|
264
|
+
OPENAI_API_KEY='NA'
|
|
265
|
+
|
|
266
|
+
FastChat¶
|
|
267
|
+
OPENAI_API_BASE="http://localhost:8001/v1"
|
|
268
|
+
OPENAI_MODEL_NAME='oh-2.5m7b-q51'
|
|
269
|
+
OPENAI_API_KEY=NA
|
|
270
|
+
|
|
271
|
+
LM Studio¶
|
|
272
|
+
OPENAI_API_BASE="http://localhost:8000/v1"
|
|
273
|
+
OPENAI_MODEL_NAME=NA
|
|
274
|
+
OPENAI_API_KEY=NA
|
|
275
|
+
|
|
276
|
+
Mistral API¶
|
|
277
|
+
OPENAI_API_BASE=https://api.mistral.ai/v1
|
|
278
|
+
OPENAI_MODEL_NAME="mistral-small"
|
|
279
|
+
OPENAI_API_KEY=your-mistral-api-key
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Contributing
|
|
283
|
+
|
|
284
|
+
- Fork on GitHub: Use the "Fork" button on the repository page.
|
|
285
|
+
- Clone your fork: `git clone https://github.com/yourusername/praisonAI.git`
|
|
286
|
+
- Create a branch: `git checkout -b new-feature`
|
|
287
|
+
- Make changes and commit: `git commit -am "Add some feature"`
|
|
288
|
+
- Push to your fork: `git push origin new-feature`
|
|
289
|
+
- Submit a pull request via GitHub's web interface.
|
|
290
|
+
- Await feedback from project maintainers.
|
|
291
|
+
|