praisonai 1.0.8 → 1.0.10

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