praisonai 1.0.3 → 1.0.5

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.
Files changed (2) hide show
  1. package/README.md +105 -49
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # PraisonAI TypeScript Package
1
+ # PraisonAI TypeScript Node.js AI Agents Framework
2
2
 
3
- A powerful TypeScript package for AI-driven tools and utilities.
3
+ PraisonAI is a production-ready Multi AI Agents framework, designed to create AI Agents to automate and solve problems ranging from simple tasks to complex challenges. It provides a low-code solution to streamline the building and management of multi-agent LLM systems, emphasising simplicity, customisation, and effective human-agent collaboration.
4
4
 
5
5
  ## Installation
6
6
 
@@ -33,23 +33,30 @@ Here are examples of different ways to use PraisonAI:
33
33
  ### 1. Single Agent Example
34
34
 
35
35
  ```typescript
36
- import { SimpleAgent, OpenAIService } from 'praisonai';
36
+ import { Agent, PraisonAIAgents } from 'praisonai';
37
37
 
38
38
  async function main() {
39
- // Initialize a single agent with OpenAI
40
- const llm = new OpenAIService({
41
- apiKey: process.env.OPENAI_API_KEY
39
+ // Create a simple agent (no task specified)
40
+ const agent = new Agent({
41
+ name: "BiologyExpert",
42
+ instructions: "Explain the process of photosynthesis in detail.",
43
+ verbose: true
42
44
  });
43
-
44
- const agent = new SimpleAgent({
45
- llm,
46
- name: 'ResearchAssistant',
47
- description: 'An AI assistant that helps with research tasks'
45
+
46
+ // Run the agent
47
+ const praisonAI = new PraisonAIAgents({
48
+ agents: [agent],
49
+ tasks: ["Explain the process of photosynthesis in detail."],
50
+ verbose: true
48
51
  });
49
52
 
50
- // Execute a task
51
- const response = await agent.execute('Summarize the key concepts of quantum computing');
52
- console.log('Agent Response:', response);
53
+ try {
54
+ console.log('Starting single agent example...');
55
+ const results = await praisonAI.start();
56
+ console.log('\nFinal Results:', results);
57
+ } catch (error) {
58
+ console.error('Error:', error);
59
+ }
53
60
  }
54
61
 
55
62
  main();
@@ -58,32 +65,46 @@ main();
58
65
  ### 2. Multi-Agent Example
59
66
 
60
67
  ```typescript
61
- import { SimpleAgent, OpenAIService, MultiAgentSystem } from 'praisonai';
68
+ import { Agent, PraisonAIAgents } from 'praisonai';
62
69
 
63
70
  async function main() {
64
- const llm = new OpenAIService({
65
- apiKey: process.env.OPENAI_API_KEY
71
+ // Create multiple agents with different roles
72
+ const researchAgent = new Agent({
73
+ name: "ResearchAgent",
74
+ instructions: "Research and provide detailed information about renewable energy sources.",
75
+ verbose: true
76
+ });
77
+
78
+ const summaryAgent = new Agent({
79
+ name: "SummaryAgent",
80
+ instructions: "Create a concise summary of the research findings about renewable energy sources. Use {previous_result} as input.",
81
+ verbose: true
66
82
  });
67
83
 
68
- // Create multiple agents
69
- const researcher = new SimpleAgent({
70
- llm,
71
- name: 'Researcher',
72
- description: 'Researches and gathers information'
84
+ const recommendationAgent = new Agent({
85
+ name: "RecommendationAgent",
86
+ instructions: "Based on the summary in {previous_result}, provide specific recommendations for implementing renewable energy solutions.",
87
+ verbose: true
73
88
  });
74
89
 
75
- const writer = new SimpleAgent({
76
- llm,
77
- name: 'Writer',
78
- description: 'Writes and formats content'
90
+ // Run the agents in sequence
91
+ const praisonAI = new PraisonAIAgents({
92
+ agents: [researchAgent, summaryAgent, recommendationAgent],
93
+ tasks: [
94
+ "Research and analyze current renewable energy technologies and their implementation.",
95
+ "Summarize the key findings from the research.",
96
+ "Provide actionable recommendations based on the summary."
97
+ ],
98
+ verbose: true
79
99
  });
80
100
 
81
- // Create multi-agent system
82
- const system = new MultiAgentSystem([researcher, writer]);
83
-
84
- // Execute collaborative task
85
- const result = await system.execute('Research and write a summary about AI agents');
86
- console.log('Multi-Agent Result:', result);
101
+ try {
102
+ console.log('Starting multi-agent example...');
103
+ const results = await praisonAI.start();
104
+ console.log('\nFinal Results:', results);
105
+ } catch (error) {
106
+ console.error('Error:', error);
107
+ }
87
108
  }
88
109
 
89
110
  main();
@@ -92,31 +113,66 @@ main();
92
113
  ### 3. Task-Based Agent Example
93
114
 
94
115
  ```typescript
95
- import { SimpleAgent, OpenAIService, Task, ArxivSearchTool } from 'praisonai';
116
+ import { Agent, Task, PraisonAIAgents } from 'praisonai';
96
117
 
97
118
  async function main() {
98
- const llm = new OpenAIService({
99
- apiKey: process.env.OPENAI_API_KEY
119
+ // Create agents first
120
+ const dietAgent = new Agent({
121
+ name: "DietAgent",
122
+ role: "Nutrition Expert",
123
+ goal: "Create healthy and delicious recipes",
124
+ backstory: "You are a certified nutritionist with years of experience in creating balanced meal plans.",
125
+ verbose: true, // Enable streaming output
126
+ instructions: `You are a professional chef and nutritionist. Create 5 healthy food recipes that are both nutritious and delicious.
127
+ Each recipe should include:
128
+ 1. Recipe name
129
+ 2. List of ingredients with quantities
130
+ 3. Step-by-step cooking instructions
131
+ 4. Nutritional information
132
+ 5. Health benefits
133
+
134
+ Format your response in markdown.`
135
+ });
136
+
137
+ const blogAgent = new Agent({
138
+ name: "BlogAgent",
139
+ role: "Food Blogger",
140
+ goal: "Write engaging blog posts about food and recipes",
141
+ backstory: "You are a successful food blogger known for your ability to make recipes sound delicious and approachable.",
142
+ verbose: true, // Enable streaming output
143
+ instructions: `You are a food and health blogger. Write an engaging blog post about the provided recipes.
144
+ The blog post should:
145
+ 1. Have an engaging title
146
+ 2. Include an introduction about healthy eating`
147
+ });
148
+
149
+ // Create tasks
150
+ const createRecipesTask = new Task({
151
+ name: "Create Recipes",
152
+ description: "Create 5 healthy and delicious recipes",
153
+ agent: dietAgent
100
154
  });
101
155
 
102
- // Create agent with tools
103
- const agent = new SimpleAgent({
104
- llm,
105
- name: 'ResearchAgent',
106
- tools: [new ArxivSearchTool()]
156
+ const writeBlogTask = new Task({
157
+ name: "Write Blog",
158
+ description: "Write a blog post about the recipes",
159
+ agent: blogAgent,
160
+ dependencies: [createRecipesTask] // This task depends on the recipes being created first
107
161
  });
108
162
 
109
- // Create and execute a task
110
- const task = new Task({
111
- objective: 'Find recent quantum computing papers',
112
- steps: [
113
- 'Search for quantum computing papers',
114
- 'Summarize the findings'
115
- ]
163
+ // Run the tasks
164
+ const praisonAI = new PraisonAIAgents({
165
+ tasks: [createRecipesTask, writeBlogTask],
166
+ verbose: true
116
167
  });
117
168
 
118
- const result = await agent.executeTask(task);
119
- console.log('Task Result:', result);
169
+ try {
170
+ console.log('Starting task-based example...');
171
+ const results = await praisonAI.start();
172
+ console.log('\nFinal Results:', results);
173
+ } catch (error) {
174
+ console.error('Error:', error);
175
+ }
120
176
  }
121
177
 
122
178
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "praisonai",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "PraisonAI TypeScript AI Agents Framework - Node.js, npm, and Javascript AI Agents Framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",