praisonai 1.0.9 → 1.0.11

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.
@@ -9,13 +9,14 @@ export declare class Agent {
9
9
  private taskAgent;
10
10
  constructor(config: ProxyAgentConfig);
11
11
  execute(input: Task | string): Promise<any>;
12
+ start(prompt: string, previousResult?: string): Promise<string>;
12
13
  chat(prompt: string, previousResult?: string): Promise<string>;
13
14
  }
14
15
  export declare class PraisonAIAgents {
15
16
  private simpleImpl;
16
17
  private taskImpl;
17
18
  constructor(config: any);
18
- start(): Promise<any[]>;
19
+ start(): Promise<string[]>;
19
20
  chat(): Promise<string[]>;
20
21
  }
21
22
  export { Task } from './types';
@@ -43,6 +43,22 @@ class Agent {
43
43
  }
44
44
  throw new Error('No agent implementation available');
45
45
  }
46
+ async start(prompt, previousResult) {
47
+ if (this.simpleAgent) {
48
+ return this.simpleAgent.start(prompt, previousResult);
49
+ }
50
+ else if (this.taskAgent) {
51
+ // For task agents, we'll use execute but wrap the prompt in a simple task
52
+ const task = new types_2.Task({
53
+ name: 'Start Task',
54
+ description: prompt,
55
+ expected_output: 'A response to the prompt',
56
+ dependencies: []
57
+ });
58
+ return this.taskAgent.execute(task, [previousResult]);
59
+ }
60
+ throw new Error('No agent implementation available');
61
+ }
46
62
  async chat(prompt, previousResult) {
47
63
  if (this.simpleAgent) {
48
64
  return this.simpleAgent.chat(prompt, previousResult);
@@ -67,22 +83,23 @@ class PraisonAIAgents {
67
83
  this.taskImpl = null;
68
84
  // Auto-detect mode based on tasks type
69
85
  if (Array.isArray(config.tasks) && config.tasks.length > 0) {
70
- const firstTask = config.tasks[0];
71
- if (firstTask instanceof types_2.Task) {
72
- this.taskImpl = new types_1.PraisonAIAgents({
86
+ // If tasks are strings, use simple mode
87
+ if (typeof config.tasks[0] === 'string') {
88
+ this.simpleImpl = new simple_1.PraisonAIAgents({
73
89
  agents: config.agents,
74
90
  tasks: config.tasks,
75
91
  verbose: config.verbose,
76
- process: config.process,
77
- manager_llm: config.manager_llm
92
+ process: config.process
78
93
  });
79
94
  }
80
95
  else {
81
- this.simpleImpl = new simple_1.PraisonAIAgents({
96
+ // Otherwise, use task mode
97
+ this.taskImpl = new types_1.PraisonAIAgents({
82
98
  agents: config.agents,
83
99
  tasks: config.tasks,
84
100
  verbose: config.verbose,
85
- process: config.process
101
+ process: config.process,
102
+ manager_llm: config.manager_llm
86
103
  });
87
104
  }
88
105
  }
@@ -91,12 +108,12 @@ class PraisonAIAgents {
91
108
  }
92
109
  }
93
110
  async start() {
94
- if (this.taskImpl) {
95
- return this.taskImpl.start();
96
- }
97
- else if (this.simpleImpl) {
111
+ if (this.simpleImpl) {
98
112
  return this.simpleImpl.start();
99
113
  }
114
+ else if (this.taskImpl) {
115
+ return this.taskImpl.start();
116
+ }
100
117
  throw new Error('No implementation available');
101
118
  }
102
119
  async chat() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "praisonai",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
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",
@@ -60,7 +60,7 @@
60
60
  "dotenv": "^16.4.1",
61
61
  "fast-xml-parser": "^4.3.4",
62
62
  "openai": "^4.24.7",
63
- "praisonai": "^1.0.8"
63
+ "praisonai": "^1.0.10"
64
64
  },
65
65
  "engines": {
66
66
  "node": ">=14.0.0"