Skip to content

Commit 86780a7

Browse files
Merge pull request #358 from MervinPraison/develop
Add CLI Documentation and Enhance CLI Functionality
2 parents 84c4345 + 0291a9c commit 86780a7

File tree

9 files changed

+153
-20
lines changed

9 files changed

+153
-20
lines changed

docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM python:3.11-slim
22
WORKDIR /app
33
COPY . .
4-
RUN pip install flask praisonai==2.0.62 gunicorn markdown
4+
RUN pip install flask praisonai==2.0.63 gunicorn markdown
55
EXPOSE 8080
66
CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]

docs/api/praisonai/deploy.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ <h2 id="raises">Raises</h2>
110110
file.write(&#34;FROM python:3.11-slim\n&#34;)
111111
file.write(&#34;WORKDIR /app\n&#34;)
112112
file.write(&#34;COPY . .\n&#34;)
113-
file.write(&#34;RUN pip install flask praisonai==2.0.62 gunicorn markdown\n&#34;)
113+
file.write(&#34;RUN pip install flask praisonai==2.0.63 gunicorn markdown\n&#34;)
114114
file.write(&#34;EXPOSE 8080\n&#34;)
115115
file.write(&#39;CMD [&#34;gunicorn&#34;, &#34;-b&#34;, &#34;0.0.0.0:8080&#34;, &#34;api:app&#34;]\n&#39;)
116116

docs/features/cli.mdx

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
title: "Command Line Interface"
3+
sidebarTitle: "CLI"
4+
description: "Use PraisonAI directly from your terminal with simple commands"
5+
icon: "terminal"
6+
---
7+
8+
```mermaid
9+
flowchart LR
10+
Start((🚀)) --> CLI[CLI Command]
11+
CLI --> Agent[AI Agent]
12+
Agent --> Config[Config/YAML]
13+
Config --> Out((🏁))
14+
15+
style Start fill:#8B0000,color:#fff,stroke:#8B0000
16+
style CLI fill:#2E8B57,color:#fff
17+
style Agent fill:#2E8B57,color:#fff
18+
style Config fill:#2E8B57,color:#fff
19+
style Out fill:#8B0000,color:#fff,stroke:#8B0000
20+
```
21+
22+
PraisonAI CLI provides a simple way to interact with AI agents directly from your terminal. You can run quick commands, specify LLM options, or use YAML configuration files for more complex scenarios.
23+
24+
## Quick Start
25+
26+
<Steps>
27+
<Step title="Install Package">
28+
Install the PraisonAI package:
29+
```bash
30+
pip install praisonai
31+
```
32+
</Step>
33+
34+
<Step title="Set API Key">
35+
Set your OpenAI API key as an environment variable:
36+
```bash
37+
export OPENAI_API_KEY=your_api_key_here
38+
```
39+
</Step>
40+
</Steps>
41+
42+
## Usage Examples
43+
44+
<AccordionGroup>
45+
<Accordion title="Simple Command" icon="terminal" defaultOpen>
46+
Run a simple command directly:
47+
```bash
48+
praisonai "write a movie script in 3 lines"
49+
```
50+
</Accordion>
51+
52+
<Accordion title="With LLM Option" icon="wand-magic-sparkles" defaultOpen>
53+
Specify a different LLM model:
54+
```bash
55+
praisonai "write a movie script in 3 lines" --llm gpt-4-mini
56+
```
57+
</Accordion>
58+
59+
<Accordion title="Using YAML Config" icon="file-code" defaultOpen>
60+
Run agents defined in a YAML file:
61+
```bash
62+
praisonai agents.yaml
63+
```
64+
</Accordion>
65+
</AccordionGroup>
66+
67+
## Configuration
68+
69+
<Tabs>
70+
<Tab title="Create Config">
71+
Initialize a new agents.yaml file for your project:
72+
```bash
73+
praisonai --init "Create a movie script about AI"
74+
```
75+
This will create an `agents.yaml` file with predefined configuration for your task.
76+
</Tab>
77+
78+
<Tab title="Auto Mode">
79+
Let PraisonAI automatically create and configure agents:
80+
```bash
81+
praisonai --auto "Create a movie script about AI"
82+
```
83+
This mode will analyze your task and set up appropriate agents automatically.
84+
</Tab>
85+
</Tabs>
86+
87+
## Features
88+
89+
<CardGroup cols={2}>
90+
<Card title="Simple Commands" icon="terminal">
91+
Run AI tasks directly from your terminal with simple commands.
92+
</Card>
93+
<Card title="LLM Options" icon="wand-magic-sparkles">
94+
Choose from different LLM models for your specific needs.
95+
</Card>
96+
<Card title="YAML Support" icon="file-code">
97+
Use YAML files for complex agent configurations and workflows.
98+
</Card>
99+
<Card title="Auto Configuration" icon="robot">
100+
Automatic agent setup based on task requirements.
101+
</Card>
102+
</CardGroup>
103+
104+
## Next Steps
105+
106+
<CardGroup>
107+
<Card title="YAML Configuration" icon="file-code" href="/config">
108+
Learn more about YAML configuration options
109+
</Card>
110+
<Card title="API Reference" icon="code" href="/api-reference">
111+
View the complete API documentation
112+
</Card>
113+
</CardGroup>

docs/mint.json

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
{
120120
"group": "Features",
121121
"pages": [
122+
"features/cli",
122123
"features/autoagents",
123124
"features/image-generation",
124125
"features/selfreflection",

praisonai.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class Praisonai < Formula
33

44
desc "AI tools for various AI applications"
55
homepage "https://github.com/MervinPraison/PraisonAI"
6-
url "https://github.com/MervinPraison/PraisonAI/archive/refs/tags/2.0.62.tar.gz"
6+
url "https://github.com/MervinPraison/PraisonAI/archive/refs/tags/2.0.63.tar.gz"
77
sha256 "1828fb9227d10f991522c3f24f061943a254b667196b40b1a3e4a54a8d30ce32" # Replace with actual SHA256 checksum
88
license "MIT"
99

praisonai/cli.py

+32-13
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ def main(self):
140140
provided arguments.
141141
"""
142142
args = self.parse_args()
143+
# Store args for use in handle_direct_prompt
144+
self.args = args
143145
invocation_cmd = "praisonai"
144146
version_string = f"PraisonAI version {__version__}"
145147

@@ -304,6 +306,7 @@ def parse_args(self):
304306
parser.add_argument("command", nargs="?", help="Command to run or direct prompt")
305307
parser.add_argument("--deploy", action="store_true", help="Deploy the application")
306308
parser.add_argument("--model", type=str, help="Model name")
309+
parser.add_argument("--llm", type=str, help="LLM model to use for direct prompts")
307310
parser.add_argument("--hf", type=str, help="Hugging Face model name")
308311
parser.add_argument("--ollama", type=str, help="Ollama model name")
309312
parser.add_argument("--dataset", type=str, help="Dataset name for training", default="yahma/alpaca-cleaned")
@@ -424,21 +427,33 @@ def handle_direct_prompt(self, prompt):
424427
Handle direct prompt by creating a single agent and running it.
425428
"""
426429
if PRAISONAI_AVAILABLE:
427-
agent = PraisonAgent(
428-
name="DirectAgent",
429-
role="Assistant",
430-
goal="Complete the given task",
431-
backstory="You are a helpful AI assistant"
432-
)
433-
agent.start(prompt)
430+
agent_config = {
431+
"name": "DirectAgent",
432+
"role": "Assistant",
433+
"goal": "Complete the given task",
434+
"backstory": "You are a helpful AI assistant"
435+
}
436+
437+
# Add llm if specified
438+
if hasattr(self, 'args') and self.args.llm:
439+
agent_config["llm"] = self.args.llm
440+
441+
agent = PraisonAgent(**agent_config)
442+
result = agent.start(prompt)
434443
return ""
435444
elif CREWAI_AVAILABLE:
436-
agent = Agent(
437-
name="DirectAgent",
438-
role="Assistant",
439-
goal="Complete the given task",
440-
backstory="You are a helpful AI assistant"
441-
)
445+
agent_config = {
446+
"name": "DirectAgent",
447+
"role": "Assistant",
448+
"goal": "Complete the given task",
449+
"backstory": "You are a helpful AI assistant"
450+
}
451+
452+
# Add llm if specified
453+
if hasattr(self, 'args') and self.args.llm:
454+
agent_config["llm"] = self.args.llm
455+
456+
agent = Agent(**agent_config)
442457
task = Task(
443458
description=prompt,
444459
agent=agent
@@ -450,6 +465,10 @@ def handle_direct_prompt(self, prompt):
450465
return crew.kickoff()
451466
elif AUTOGEN_AVAILABLE:
452467
config_list = self.config_list
468+
# Add llm if specified
469+
if hasattr(self, 'args') and self.args.llm:
470+
config_list[0]['model'] = self.args.llm
471+
453472
assistant = autogen.AssistantAgent(
454473
name="DirectAgent",
455474
llm_config={"config_list": config_list}

praisonai/deploy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def create_dockerfile(self):
5656
file.write("FROM python:3.11-slim\n")
5757
file.write("WORKDIR /app\n")
5858
file.write("COPY . .\n")
59-
file.write("RUN pip install flask praisonai==2.0.62 gunicorn markdown\n")
59+
file.write("RUN pip install flask praisonai==2.0.63 gunicorn markdown\n")
6060
file.write("EXPOSE 8080\n")
6161
file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
6262

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "PraisonAI"
3-
version = "2.0.62"
3+
version = "2.0.63"
44
description = "PraisonAI is an AI Agents Framework with Self Reflection. PraisonAI application combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient human-agent collaboration."
55
readme = "README.md"
66
license = ""
@@ -84,7 +84,7 @@ autogen = ["pyautogen>=0.2.19", "praisonai-tools>=0.0.7", "crewai"]
8484

8585
[tool.poetry]
8686
name = "PraisonAI"
87-
version = "2.0.62"
87+
version = "2.0.63"
8888
description = "PraisonAI is an AI Agents Framework with Self Reflection. PraisonAI application combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient human–agent collaboration."
8989
authors = ["Mervin Praison"]
9090
license = ""

uv.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)