praisonai 1.0.1 → 1.0.3

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 +104 -27
  2. package/package.json +24 -6
package/README.md CHANGED
@@ -26,20 +26,118 @@ npm install
26
26
  npm run build
27
27
  ```
28
28
 
29
- ## Running Examples
29
+ ## Usage
30
+
31
+ Here are examples of different ways to use PraisonAI:
32
+
33
+ ### 1. Single Agent Example
34
+
35
+ ```typescript
36
+ import { SimpleAgent, OpenAIService } from 'praisonai';
37
+
38
+ async function main() {
39
+ // Initialize a single agent with OpenAI
40
+ const llm = new OpenAIService({
41
+ apiKey: process.env.OPENAI_API_KEY
42
+ });
43
+
44
+ const agent = new SimpleAgent({
45
+ llm,
46
+ name: 'ResearchAssistant',
47
+ description: 'An AI assistant that helps with research tasks'
48
+ });
49
+
50
+ // Execute a task
51
+ const response = await agent.execute('Summarize the key concepts of quantum computing');
52
+ console.log('Agent Response:', response);
53
+ }
54
+
55
+ main();
56
+ ```
57
+
58
+ ### 2. Multi-Agent Example
59
+
60
+ ```typescript
61
+ import { SimpleAgent, OpenAIService, MultiAgentSystem } from 'praisonai';
62
+
63
+ async function main() {
64
+ const llm = new OpenAIService({
65
+ apiKey: process.env.OPENAI_API_KEY
66
+ });
67
+
68
+ // Create multiple agents
69
+ const researcher = new SimpleAgent({
70
+ llm,
71
+ name: 'Researcher',
72
+ description: 'Researches and gathers information'
73
+ });
74
+
75
+ const writer = new SimpleAgent({
76
+ llm,
77
+ name: 'Writer',
78
+ description: 'Writes and formats content'
79
+ });
80
+
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);
87
+ }
88
+
89
+ main();
90
+ ```
30
91
 
31
- The package includes several examples to help you get started. To run an example:
92
+ ### 3. Task-Based Agent Example
32
93
 
33
- 1. Build the package first:
94
+ ```typescript
95
+ import { SimpleAgent, OpenAIService, Task, ArxivSearchTool } from 'praisonai';
96
+
97
+ async function main() {
98
+ const llm = new OpenAIService({
99
+ apiKey: process.env.OPENAI_API_KEY
100
+ });
101
+
102
+ // Create agent with tools
103
+ const agent = new SimpleAgent({
104
+ llm,
105
+ name: 'ResearchAgent',
106
+ tools: [new ArxivSearchTool()]
107
+ });
108
+
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
+ ]
116
+ });
117
+
118
+ const result = await agent.executeTask(task);
119
+ console.log('Task Result:', result);
120
+ }
121
+
122
+ main();
123
+ ```
124
+
125
+ ### Running the Examples
126
+
127
+ 1. First, set up your environment variables:
34
128
  ```bash
35
- npm run build
129
+ export OPENAI_API_KEY='your-api-key'
36
130
  ```
37
131
 
38
- 2. Run an example using ts-node:
132
+ 2. Create a new TypeScript file (e.g., `example.ts`) with any of the above examples.
133
+
134
+ 3. Run the example:
39
135
  ```bash
40
- npx ts-node examples/arxiv-search.ts
136
+ npx ts-node example.ts
41
137
  ```
42
138
 
139
+ For more examples, check out the `examples/concepts/` directory in the repository.
140
+
43
141
  ## Package Structure
44
142
 
45
143
  ```
@@ -56,27 +154,6 @@ src/
56
154
  └── ... (other tools)
57
155
  ```
58
156
 
59
- ## Usage
60
-
61
- Here's a simple example of using the ArxivSearchTool:
62
-
63
- ```typescript
64
- import { ArxivSearchTool } from 'praisonai';
65
-
66
- async function main() {
67
- const searchTool = new ArxivSearchTool();
68
- const papers = await searchTool.execute('quantum computing', 5);
69
-
70
- papers.forEach(paper => {
71
- console.log(`Title: ${paper.title}`);
72
- console.log(`Authors: ${paper.authors.join(', ')}`);
73
- console.log('---');
74
- });
75
- }
76
-
77
- main();
78
- ```
79
-
80
157
  ## Contributing
81
158
 
82
159
  1. Fork the repository
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "praisonai",
3
- "version": "1.0.1",
4
- "description": "PraisonAI TypeScript AI Agents Framework - Javascript AI Agents Framework",
3
+ "version": "1.0.3",
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",
7
7
  "scripts": {
@@ -17,10 +17,28 @@
17
17
  },
18
18
  "keywords": [
19
19
  "ai",
20
- "typescript",
20
+ "agent",
21
+ "ai agent",
22
+ "ai agents",
23
+ "typescript ai",
24
+ "typescript ai agent",
25
+ "javascript ai agent",
26
+ "typescript ai agents",
27
+ "javascript ai agents",
28
+ "npm ai agent framework",
29
+ "npm ai agents framework",
30
+ "node ai agent framework",
31
+ "node ai agents framework",
21
32
  "praisonai",
22
- "arxiv",
23
- "tools"
33
+ "ai agents framework",
34
+ "typescript ai agents framework",
35
+ "javascript ai agents framework",
36
+ "ai framework",
37
+ "typescript ai framework",
38
+ "javascript ai framework",
39
+ "ai agent framework",
40
+ "typescript ai agent framework",
41
+ "javascript ai agent framework"
24
42
  ],
25
43
  "author": "Mervin Praison",
26
44
  "license": "MIT",
@@ -42,7 +60,7 @@
42
60
  "dotenv": "^16.4.1",
43
61
  "fast-xml-parser": "^4.3.4",
44
62
  "openai": "^4.24.7",
45
- "praisonai": "^1.0.0"
63
+ "praisonai": "^1.0.2"
46
64
  },
47
65
  "engines": {
48
66
  "node": ">=14.0.0"