praisonai 1.5.3 → 1.6.0
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.
- package/README.md +12 -12
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/index.js +2 -1
- package/dist/agent/proxy.d.ts +11 -1
- package/dist/agent/proxy.js +16 -6
- package/dist/agent/simple.d.ts +28 -11
- package/dist/agent/simple.js +17 -14
- package/dist/agent/types.d.ts +7 -3
- package/dist/agent/types.js +6 -6
- package/dist/cli/commands/eval.d.ts +2 -0
- package/dist/cli/commands/eval.js +58 -3
- package/dist/cli/commands/flow.js +2 -2
- package/dist/cli/features/flow-display.d.ts +1 -1
- package/dist/cli/features/flow-display.js +2 -2
- package/dist/eval/index.d.ts +1 -0
- package/dist/eval/index.js +16 -1
- package/dist/eval/judge.d.ts +275 -0
- package/dist/eval/judge.js +528 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.js +38 -12
- package/dist/llm/providers/registry.js +22 -9
- package/dist/os/agentos.d.ts +145 -0
- package/dist/os/agentos.js +268 -0
- package/dist/os/config.d.ts +65 -0
- package/dist/os/config.js +50 -0
- package/dist/os/index.d.ts +31 -0
- package/dist/os/index.js +37 -0
- package/dist/os/protocols.d.ts +55 -0
- package/dist/os/protocols.js +21 -0
- package/dist/workflows/index.d.ts +28 -8
- package/dist/workflows/index.js +29 -9
- package/dist/workflows/loop.js +1 -1
- package/dist/workflows/repeat.js +1 -1
- package/dist/workflows/yaml-parser.d.ts +2 -2
- package/dist/workflows/yaml-parser.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Here are examples of different ways to use PraisonAI:
|
|
|
33
33
|
### 1. Single Agent Example
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
-
import { Agent,
|
|
36
|
+
import { Agent, AgentTeam } from 'praisonai';
|
|
37
37
|
|
|
38
38
|
async function main() {
|
|
39
39
|
// Create a simple agent (no task specified)
|
|
@@ -43,8 +43,8 @@ async function main() {
|
|
|
43
43
|
verbose: true
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
// Run the agent
|
|
47
|
-
const
|
|
46
|
+
// Run the agent with AgentTeam
|
|
47
|
+
const team = new AgentTeam({
|
|
48
48
|
agents: [agent],
|
|
49
49
|
tasks: ["Explain the process of photosynthesis in detail."],
|
|
50
50
|
verbose: true
|
|
@@ -52,7 +52,7 @@ async function main() {
|
|
|
52
52
|
|
|
53
53
|
try {
|
|
54
54
|
console.log('Starting single agent example...');
|
|
55
|
-
const results = await
|
|
55
|
+
const results = await team.start();
|
|
56
56
|
console.log('\nFinal Results:', results);
|
|
57
57
|
} catch (error) {
|
|
58
58
|
console.error('Error:', error);
|
|
@@ -65,7 +65,7 @@ main();
|
|
|
65
65
|
### 2. Multi-Agent Example
|
|
66
66
|
|
|
67
67
|
```typescript
|
|
68
|
-
import { Agent,
|
|
68
|
+
import { Agent, AgentTeam } from 'praisonai';
|
|
69
69
|
|
|
70
70
|
async function main() {
|
|
71
71
|
// Create multiple agents with different roles
|
|
@@ -87,8 +87,8 @@ async function main() {
|
|
|
87
87
|
verbose: true
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
// Run the agents in sequence
|
|
91
|
-
const
|
|
90
|
+
// Run the agents in sequence with AgentTeam
|
|
91
|
+
const team = new AgentTeam({
|
|
92
92
|
agents: [researchAgent, summaryAgent, recommendationAgent],
|
|
93
93
|
tasks: [
|
|
94
94
|
"Research and analyze current renewable energy technologies and their implementation.",
|
|
@@ -100,7 +100,7 @@ async function main() {
|
|
|
100
100
|
|
|
101
101
|
try {
|
|
102
102
|
console.log('Starting multi-agent example...');
|
|
103
|
-
const results = await
|
|
103
|
+
const results = await team.start();
|
|
104
104
|
console.log('\nFinal Results:', results);
|
|
105
105
|
} catch (error) {
|
|
106
106
|
console.error('Error:', error);
|
|
@@ -113,7 +113,7 @@ main();
|
|
|
113
113
|
### 3. Task-Based Agent Example
|
|
114
114
|
|
|
115
115
|
```typescript
|
|
116
|
-
import { Agent, Task,
|
|
116
|
+
import { Agent, Task, AgentTeam } from 'praisonai';
|
|
117
117
|
|
|
118
118
|
async function main() {
|
|
119
119
|
// Create agents first
|
|
@@ -160,15 +160,15 @@ The blog post should:
|
|
|
160
160
|
dependencies: [createRecipesTask] // This task depends on the recipes being created first
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
-
// Run the tasks
|
|
164
|
-
const
|
|
163
|
+
// Run the tasks with AgentTeam
|
|
164
|
+
const team = new AgentTeam({
|
|
165
165
|
tasks: [createRecipesTask, writeBlogTask],
|
|
166
166
|
verbose: true
|
|
167
167
|
});
|
|
168
168
|
|
|
169
169
|
try {
|
|
170
170
|
console.log('Starting task-based example...');
|
|
171
|
-
const results = await
|
|
171
|
+
const results = await team.start();
|
|
172
172
|
console.log('\nFinal Results:', results);
|
|
173
173
|
} catch (error) {
|
|
174
174
|
console.error('Error:', error);
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* - Router: Simplified keyword/pattern-based routing
|
|
8
8
|
* - Workflow: Step-based workflow execution (from workflows module)
|
|
9
9
|
*/
|
|
10
|
-
export { Agent, PraisonAIAgents, Agents } from './simple';
|
|
11
|
-
export type { SimpleAgentConfig, PraisonAIAgentsConfig } from './simple';
|
|
10
|
+
export { Agent, AgentTeam, PraisonAIAgents, Agents } from './simple';
|
|
11
|
+
export type { SimpleAgentConfig, AgentTeamConfig, PraisonAIAgentsConfig } from './simple';
|
|
12
12
|
export { AudioAgent, createAudioAgent } from './audio';
|
|
13
13
|
export type { AudioAgentConfig, SpeakOptions, TranscribeOptions, SpeakResult, TranscribeResult, AudioProvider } from './audio';
|
|
14
14
|
export { Router, RouterAgent, createRouter, routeConditions } from './router';
|
package/dist/agent/index.js
CHANGED
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
* - Workflow: Step-based workflow execution (from workflows module)
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Task = exports.routeConditions = exports.createRouter = exports.RouterAgent = exports.Router = exports.createAudioAgent = exports.AudioAgent = exports.Agents = exports.PraisonAIAgents = exports.Agent = void 0;
|
|
12
|
+
exports.Task = exports.routeConditions = exports.createRouter = exports.RouterAgent = exports.Router = exports.createAudioAgent = exports.AudioAgent = exports.Agents = exports.PraisonAIAgents = exports.AgentTeam = exports.Agent = void 0;
|
|
13
13
|
exports.setTaskMode = setTaskMode;
|
|
14
14
|
// Core exports - the main API surface
|
|
15
15
|
var simple_1 = require("./simple");
|
|
16
16
|
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return simple_1.Agent; } });
|
|
17
|
+
Object.defineProperty(exports, "AgentTeam", { enumerable: true, get: function () { return simple_1.AgentTeam; } });
|
|
17
18
|
Object.defineProperty(exports, "PraisonAIAgents", { enumerable: true, get: function () { return simple_1.PraisonAIAgents; } });
|
|
18
19
|
Object.defineProperty(exports, "Agents", { enumerable: true, get: function () { return simple_1.Agents; } });
|
|
19
20
|
// AudioAgent - Speech synthesis and transcription
|
package/dist/agent/proxy.d.ts
CHANGED
|
@@ -16,11 +16,21 @@ export declare class Agent {
|
|
|
16
16
|
start(prompt: string, previousResult?: string): Promise<string>;
|
|
17
17
|
chat(prompt: string, previousResult?: string): Promise<string>;
|
|
18
18
|
}
|
|
19
|
-
export declare class
|
|
19
|
+
export declare class AgentTeam {
|
|
20
20
|
private simpleImpl;
|
|
21
21
|
private taskImpl;
|
|
22
22
|
constructor(config: any);
|
|
23
23
|
start(): Promise<string[]>;
|
|
24
24
|
chat(): Promise<string[]>;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* PraisonAIAgents - Silent alias for AgentTeam (backward compatibility)
|
|
28
|
+
* @deprecated Use AgentTeam instead
|
|
29
|
+
*/
|
|
30
|
+
export declare const PraisonAIAgents: typeof AgentTeam;
|
|
31
|
+
/**
|
|
32
|
+
* Agents - Silent alias for AgentTeam (backward compatibility)
|
|
33
|
+
* @deprecated Use AgentTeam instead
|
|
34
|
+
*/
|
|
35
|
+
export declare const Agents: typeof AgentTeam;
|
|
26
36
|
export { Task } from './types';
|
package/dist/agent/proxy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Task = exports.PraisonAIAgents = exports.Agent = void 0;
|
|
3
|
+
exports.Task = exports.Agents = exports.PraisonAIAgents = exports.AgentTeam = exports.Agent = void 0;
|
|
4
4
|
const simple_1 = require("./simple");
|
|
5
5
|
const types_1 = require("./types");
|
|
6
6
|
const types_2 = require("./types");
|
|
@@ -113,7 +113,7 @@ class Agent {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
exports.Agent = Agent;
|
|
116
|
-
class
|
|
116
|
+
class AgentTeam {
|
|
117
117
|
constructor(config) {
|
|
118
118
|
this.simpleImpl = null;
|
|
119
119
|
this.taskImpl = null;
|
|
@@ -121,7 +121,7 @@ class PraisonAIAgents {
|
|
|
121
121
|
if (Array.isArray(config.tasks)) {
|
|
122
122
|
// If tasks are provided and are strings, use simple mode
|
|
123
123
|
if (config.tasks.length > 0 && typeof config.tasks[0] === 'string') {
|
|
124
|
-
this.simpleImpl = new simple_1.
|
|
124
|
+
this.simpleImpl = new simple_1.AgentTeam({
|
|
125
125
|
agents: config.agents,
|
|
126
126
|
tasks: config.tasks,
|
|
127
127
|
verbose: config.verbose,
|
|
@@ -130,7 +130,7 @@ class PraisonAIAgents {
|
|
|
130
130
|
}
|
|
131
131
|
else if (config.tasks.length > 0) {
|
|
132
132
|
// If tasks are provided but not strings, use task mode
|
|
133
|
-
this.taskImpl = new types_1.
|
|
133
|
+
this.taskImpl = new types_1.TaskAgentTeam({
|
|
134
134
|
agents: config.agents,
|
|
135
135
|
tasks: config.tasks,
|
|
136
136
|
verbose: config.verbose,
|
|
@@ -141,7 +141,7 @@ class PraisonAIAgents {
|
|
|
141
141
|
}
|
|
142
142
|
// If no tasks provided, create simple implementation with auto-generated tasks
|
|
143
143
|
if (!this.simpleImpl && !this.taskImpl) {
|
|
144
|
-
this.simpleImpl = new simple_1.
|
|
144
|
+
this.simpleImpl = new simple_1.AgentTeam({
|
|
145
145
|
agents: config.agents,
|
|
146
146
|
verbose: config.verbose,
|
|
147
147
|
process: config.process
|
|
@@ -168,6 +168,16 @@ class PraisonAIAgents {
|
|
|
168
168
|
throw new Error('No implementation available');
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
exports.
|
|
171
|
+
exports.AgentTeam = AgentTeam;
|
|
172
|
+
/**
|
|
173
|
+
* PraisonAIAgents - Silent alias for AgentTeam (backward compatibility)
|
|
174
|
+
* @deprecated Use AgentTeam instead
|
|
175
|
+
*/
|
|
176
|
+
exports.PraisonAIAgents = AgentTeam;
|
|
177
|
+
/**
|
|
178
|
+
* Agents - Silent alias for AgentTeam (backward compatibility)
|
|
179
|
+
* @deprecated Use AgentTeam instead
|
|
180
|
+
*/
|
|
181
|
+
exports.Agents = AgentTeam;
|
|
172
182
|
var types_3 = require("./types");
|
|
173
183
|
Object.defineProperty(exports, "Task", { enumerable: true, get: function () { return types_3.Task; } });
|
package/dist/agent/simple.d.ts
CHANGED
|
@@ -224,7 +224,21 @@ export declare class Agent {
|
|
|
224
224
|
/**
|
|
225
225
|
* Configuration for multi-agent orchestration
|
|
226
226
|
*/
|
|
227
|
-
export interface
|
|
227
|
+
export interface AgentTeamConfig {
|
|
228
|
+
agents: Agent[];
|
|
229
|
+
tasks?: string[];
|
|
230
|
+
verbose?: boolean;
|
|
231
|
+
pretty?: boolean;
|
|
232
|
+
process?: 'sequential' | 'parallel';
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* @deprecated Use AgentTeamConfig instead. This is a silent alias for backward compatibility.
|
|
236
|
+
*/
|
|
237
|
+
export type PraisonAIAgentsConfig = AgentTeamConfig;
|
|
238
|
+
/**
|
|
239
|
+
* @deprecated Use AgentTeamConfig instead. This is a silent alias for backward compatibility.
|
|
240
|
+
*/
|
|
241
|
+
export interface AgentsConfig {
|
|
228
242
|
agents: Agent[];
|
|
229
243
|
tasks?: string[];
|
|
230
244
|
verbose?: boolean;
|
|
@@ -253,7 +267,7 @@ export interface PraisonAIAgentsConfig {
|
|
|
253
267
|
* });
|
|
254
268
|
* ```
|
|
255
269
|
*/
|
|
256
|
-
export declare class
|
|
270
|
+
export declare class AgentTeam {
|
|
257
271
|
private agents;
|
|
258
272
|
private tasks;
|
|
259
273
|
private verbose;
|
|
@@ -263,27 +277,30 @@ export declare class PraisonAIAgents {
|
|
|
263
277
|
* Create a multi-agent orchestration
|
|
264
278
|
* @param configOrAgents - Either an array of agents or a config object
|
|
265
279
|
*/
|
|
266
|
-
constructor(configOrAgents:
|
|
280
|
+
constructor(configOrAgents: AgentTeamConfig | Agent[]);
|
|
267
281
|
private generateTasks;
|
|
268
282
|
private executeSequential;
|
|
269
283
|
start(): Promise<string[]>;
|
|
270
284
|
chat(): Promise<string[]>;
|
|
271
285
|
}
|
|
272
286
|
/**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
|
|
276
|
-
|
|
287
|
+
* PraisonAIAgents - Silent alias for AgentTeam (backward compatibility)
|
|
288
|
+
* @deprecated Use AgentTeam instead
|
|
289
|
+
*/
|
|
290
|
+
export declare const PraisonAIAgents: typeof AgentTeam;
|
|
291
|
+
/**
|
|
292
|
+
* Agents - Silent alias for AgentTeam (backward compatibility)
|
|
293
|
+
* @deprecated Use AgentTeam instead
|
|
277
294
|
*
|
|
278
295
|
* @example
|
|
279
296
|
* ```typescript
|
|
280
|
-
* import { Agent,
|
|
297
|
+
* import { Agent, AgentTeam } from 'praisonai';
|
|
281
298
|
*
|
|
282
|
-
* const
|
|
299
|
+
* const team = new AgentTeam([
|
|
283
300
|
* new Agent({ instructions: "Research the topic" }),
|
|
284
301
|
* new Agent({ instructions: "Write based on research" })
|
|
285
302
|
* ]);
|
|
286
|
-
* await
|
|
303
|
+
* await team.start();
|
|
287
304
|
* ```
|
|
288
305
|
*/
|
|
289
|
-
export declare const Agents: typeof
|
|
306
|
+
export declare const Agents: typeof AgentTeam;
|
package/dist/agent/simple.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.Agents = exports.PraisonAIAgents = exports.Agent = void 0;
|
|
36
|
+
exports.Agents = exports.PraisonAIAgents = exports.AgentTeam = exports.Agent = void 0;
|
|
37
37
|
const openai_1 = require("../llm/openai");
|
|
38
38
|
const logger_1 = require("../utils/logger");
|
|
39
39
|
const crypto_1 = require("crypto");
|
|
@@ -601,13 +601,13 @@ exports.Agent = Agent;
|
|
|
601
601
|
* });
|
|
602
602
|
* ```
|
|
603
603
|
*/
|
|
604
|
-
class
|
|
604
|
+
class AgentTeam {
|
|
605
605
|
/**
|
|
606
606
|
* Create a multi-agent orchestration
|
|
607
607
|
* @param configOrAgents - Either an array of agents or a config object
|
|
608
608
|
*/
|
|
609
609
|
constructor(configOrAgents) {
|
|
610
|
-
// Support array syntax: new
|
|
610
|
+
// Support array syntax: new AgentTeam([a1, a2])
|
|
611
611
|
const config = Array.isArray(configOrAgents)
|
|
612
612
|
? { agents: configOrAgents }
|
|
613
613
|
: configOrAgents;
|
|
@@ -647,7 +647,7 @@ class PraisonAIAgents {
|
|
|
647
647
|
return results;
|
|
648
648
|
}
|
|
649
649
|
async start() {
|
|
650
|
-
await logger_1.Logger.debug('Starting
|
|
650
|
+
await logger_1.Logger.debug('Starting AgentTeam execution...');
|
|
651
651
|
await logger_1.Logger.debug('Process mode:', this.process);
|
|
652
652
|
await logger_1.Logger.debug('Tasks:', this.tasks);
|
|
653
653
|
let results;
|
|
@@ -664,7 +664,7 @@ class PraisonAIAgents {
|
|
|
664
664
|
results = await this.executeSequential();
|
|
665
665
|
}
|
|
666
666
|
if (this.verbose) {
|
|
667
|
-
await logger_1.Logger.info('
|
|
667
|
+
await logger_1.Logger.info('AgentTeam execution completed.');
|
|
668
668
|
for (let i = 0; i < results.length; i++) {
|
|
669
669
|
await logger_1.Logger.section(`Result from Agent ${i + 1}`, results[i]);
|
|
670
670
|
}
|
|
@@ -675,22 +675,25 @@ class PraisonAIAgents {
|
|
|
675
675
|
return this.start();
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
|
-
exports.
|
|
678
|
+
exports.AgentTeam = AgentTeam;
|
|
679
679
|
/**
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
|
|
683
|
-
|
|
680
|
+
* PraisonAIAgents - Silent alias for AgentTeam (backward compatibility)
|
|
681
|
+
* @deprecated Use AgentTeam instead
|
|
682
|
+
*/
|
|
683
|
+
exports.PraisonAIAgents = AgentTeam;
|
|
684
|
+
/**
|
|
685
|
+
* Agents - Silent alias for AgentTeam (backward compatibility)
|
|
686
|
+
* @deprecated Use AgentTeam instead
|
|
684
687
|
*
|
|
685
688
|
* @example
|
|
686
689
|
* ```typescript
|
|
687
|
-
* import { Agent,
|
|
690
|
+
* import { Agent, AgentTeam } from 'praisonai';
|
|
688
691
|
*
|
|
689
|
-
* const
|
|
692
|
+
* const team = new AgentTeam([
|
|
690
693
|
* new Agent({ instructions: "Research the topic" }),
|
|
691
694
|
* new Agent({ instructions: "Write based on research" })
|
|
692
695
|
* ]);
|
|
693
|
-
* await
|
|
696
|
+
* await team.start();
|
|
694
697
|
* ```
|
|
695
698
|
*/
|
|
696
|
-
exports.Agents =
|
|
699
|
+
exports.Agents = AgentTeam;
|
package/dist/agent/types.d.ts
CHANGED
|
@@ -35,20 +35,24 @@ export declare class Agent {
|
|
|
35
35
|
constructor(config: TaskAgentConfig);
|
|
36
36
|
execute(task: Task, dependencyResults?: any[]): Promise<any>;
|
|
37
37
|
}
|
|
38
|
-
export interface
|
|
38
|
+
export interface TaskAgentTeamConfig {
|
|
39
39
|
agents: Agent[];
|
|
40
40
|
tasks: Task[];
|
|
41
41
|
verbose?: boolean;
|
|
42
42
|
process?: 'sequential' | 'parallel' | 'hierarchical';
|
|
43
43
|
manager_llm?: string;
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use TaskAgentTeamConfig instead
|
|
47
|
+
*/
|
|
48
|
+
export type TaskPraisonAIAgentsConfig = TaskAgentTeamConfig;
|
|
49
|
+
export declare class TaskAgentTeam {
|
|
46
50
|
private agents;
|
|
47
51
|
private tasks;
|
|
48
52
|
private verbose;
|
|
49
53
|
private process;
|
|
50
54
|
private manager_llm;
|
|
51
|
-
constructor(config:
|
|
55
|
+
constructor(config: TaskAgentTeamConfig);
|
|
52
56
|
start(): Promise<any[]>;
|
|
53
57
|
private executeSequential;
|
|
54
58
|
private executeHierarchical;
|
package/dist/agent/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.TaskAgentTeam = exports.Agent = exports.Task = void 0;
|
|
4
4
|
const openai_1 = require("../llm/openai");
|
|
5
5
|
const logger_1 = require("../utils/logger");
|
|
6
6
|
class Task {
|
|
@@ -81,17 +81,17 @@ Based on these results, please complete your task.`;
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
exports.Agent = Agent;
|
|
84
|
-
class
|
|
84
|
+
class TaskAgentTeam {
|
|
85
85
|
constructor(config) {
|
|
86
86
|
this.agents = config.agents;
|
|
87
87
|
this.tasks = config.tasks;
|
|
88
88
|
this.verbose = config.verbose || false;
|
|
89
89
|
this.process = config.process || 'sequential';
|
|
90
90
|
this.manager_llm = config.manager_llm || 'gpt-5-nano';
|
|
91
|
-
logger_1.Logger.debug('
|
|
91
|
+
logger_1.Logger.debug('TaskAgentTeam initialized', { config });
|
|
92
92
|
}
|
|
93
93
|
async start() {
|
|
94
|
-
logger_1.Logger.debug('Starting
|
|
94
|
+
logger_1.Logger.debug('Starting TaskAgentTeam execution...');
|
|
95
95
|
logger_1.Logger.debug('Starting with process mode:', this.process);
|
|
96
96
|
let results;
|
|
97
97
|
switch (this.process) {
|
|
@@ -112,7 +112,7 @@ class PraisonAIAgents {
|
|
|
112
112
|
results = await this.executeSequential();
|
|
113
113
|
}
|
|
114
114
|
if (this.verbose) {
|
|
115
|
-
logger_1.Logger.info('\
|
|
115
|
+
logger_1.Logger.info('\nTaskAgentTeam execution completed.');
|
|
116
116
|
results.forEach((result, index) => {
|
|
117
117
|
logger_1.Logger.info(`\nFinal Result from Task ${index + 1}:`);
|
|
118
118
|
console.log(result);
|
|
@@ -162,4 +162,4 @@ class PraisonAIAgents {
|
|
|
162
162
|
return results;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
exports.
|
|
165
|
+
exports.TaskAgentTeam = TaskAgentTeam;
|
|
@@ -45,12 +45,12 @@ const cli_spec_1 = require("../spec/cli-spec");
|
|
|
45
45
|
const errors_1 = require("../output/errors");
|
|
46
46
|
async function execute(args, options) {
|
|
47
47
|
const subcommand = args[0];
|
|
48
|
-
if (!subcommand || !['accuracy', 'performance', 'reliability'].includes(subcommand)) {
|
|
48
|
+
if (!subcommand || !['accuracy', 'performance', 'reliability', 'judge'].includes(subcommand)) {
|
|
49
49
|
if (options.json || options.output === 'json') {
|
|
50
|
-
(0, json_1.printError)(errors_1.ERROR_CODES.INVALID_ARGS, 'Please specify a subcommand: accuracy, performance, or
|
|
50
|
+
(0, json_1.printError)(errors_1.ERROR_CODES.INVALID_ARGS, 'Please specify a subcommand: accuracy, performance, reliability, or judge');
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
await pretty.error('Please specify a subcommand: accuracy, performance, or
|
|
53
|
+
await pretty.error('Please specify a subcommand: accuracy, performance, reliability, or judge');
|
|
54
54
|
}
|
|
55
55
|
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
56
56
|
}
|
|
@@ -72,6 +72,9 @@ async function execute(args, options) {
|
|
|
72
72
|
case 'reliability':
|
|
73
73
|
await runReliabilityEval(options, config, outputFormat);
|
|
74
74
|
break;
|
|
75
|
+
case 'judge':
|
|
76
|
+
await runJudgeEval(options, config, outputFormat);
|
|
77
|
+
break;
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
catch (error) {
|
|
@@ -245,3 +248,55 @@ function calculateSimilarity(str1, str2) {
|
|
|
245
248
|
const union = new Set([...words1, ...words2]);
|
|
246
249
|
return intersection.length / union.size;
|
|
247
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Run LLM-as-Judge evaluation
|
|
253
|
+
*/
|
|
254
|
+
async function runJudgeEval(options, config, outputFormat) {
|
|
255
|
+
// Lazy import to avoid performance impact
|
|
256
|
+
const { Judge } = await Promise.resolve().then(() => __importStar(require('../../eval/judge')));
|
|
257
|
+
const output = options.input;
|
|
258
|
+
if (!output) {
|
|
259
|
+
throw new Error('--input is required for judge evaluation (the output to judge)');
|
|
260
|
+
}
|
|
261
|
+
const startTime = Date.now();
|
|
262
|
+
const threshold = options.threshold ?? 7.0;
|
|
263
|
+
const judge = new Judge({
|
|
264
|
+
model: config.model,
|
|
265
|
+
threshold,
|
|
266
|
+
criteria: options.criteria,
|
|
267
|
+
});
|
|
268
|
+
const result = await judge.run({
|
|
269
|
+
output,
|
|
270
|
+
expected: options.expected,
|
|
271
|
+
criteria: options.criteria,
|
|
272
|
+
});
|
|
273
|
+
const duration = Date.now() - startTime;
|
|
274
|
+
if (outputFormat === 'json') {
|
|
275
|
+
(0, json_1.outputJson)((0, json_1.formatSuccess)({
|
|
276
|
+
type: 'judge',
|
|
277
|
+
threshold,
|
|
278
|
+
result: {
|
|
279
|
+
score: result.score,
|
|
280
|
+
passed: result.passed,
|
|
281
|
+
reasoning: result.reasoning,
|
|
282
|
+
suggestions: result.suggestions,
|
|
283
|
+
}
|
|
284
|
+
}, { duration_ms: duration, model: config.model }));
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
await pretty.heading('LLM-as-Judge Evaluation Results');
|
|
288
|
+
await pretty.keyValue({
|
|
289
|
+
'Score': `${result.score.toFixed(1)}/10`,
|
|
290
|
+
'Status': result.passed ? '✅ PASSED' : '❌ FAILED',
|
|
291
|
+
'Threshold': threshold,
|
|
292
|
+
'Reasoning': result.reasoning,
|
|
293
|
+
'Duration': `${duration}ms`
|
|
294
|
+
});
|
|
295
|
+
if (result.suggestions.length > 0) {
|
|
296
|
+
await pretty.heading('Suggestions');
|
|
297
|
+
for (const suggestion of result.suggestions) {
|
|
298
|
+
console.log(` • ${suggestion}`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
@@ -49,7 +49,7 @@ async function handleShow(args, options, isJson) {
|
|
|
49
49
|
showStatus: Boolean(options.status),
|
|
50
50
|
compact: Boolean(options.compact)
|
|
51
51
|
});
|
|
52
|
-
display.
|
|
52
|
+
display.fromTasks(steps);
|
|
53
53
|
if (isJson) {
|
|
54
54
|
const graph = display.getGraph();
|
|
55
55
|
console.log(JSON.stringify({
|
|
@@ -89,7 +89,7 @@ async function handleDot(args, options, isJson) {
|
|
|
89
89
|
];
|
|
90
90
|
}
|
|
91
91
|
const display = (0, flow_display_1.createFlowDisplay)();
|
|
92
|
-
display.
|
|
92
|
+
display.fromTasks(steps);
|
|
93
93
|
const dot = display.toDot();
|
|
94
94
|
if (isJson) {
|
|
95
95
|
console.log(JSON.stringify({ success: true, dot }));
|
|
@@ -47,7 +47,7 @@ class FlowDisplay {
|
|
|
47
47
|
/**
|
|
48
48
|
* Build graph from workflow steps
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
fromTasks(steps) {
|
|
51
51
|
this.graph.nodes.clear();
|
|
52
52
|
this.graph.edges = [];
|
|
53
53
|
// Add start node
|
|
@@ -249,6 +249,6 @@ function createFlowDisplay(config) {
|
|
|
249
249
|
*/
|
|
250
250
|
function renderWorkflow(steps) {
|
|
251
251
|
const display = createFlowDisplay();
|
|
252
|
-
display.
|
|
252
|
+
display.fromTasks(steps);
|
|
253
253
|
return display.render();
|
|
254
254
|
}
|
package/dist/eval/index.d.ts
CHANGED
|
@@ -61,3 +61,4 @@ export declare class EvalSuite {
|
|
|
61
61
|
}
|
|
62
62
|
export { Evaluator, createEvaluator, createDefaultEvaluator, relevanceCriterion, lengthCriterion, containsKeywordsCriterion, noHarmfulContentCriterion, type EvalCriteria, type EvalResult as BaseEvalResult, type EvalSummary, type EvaluatorConfig, } from './base';
|
|
63
63
|
export { EvalResults, createEvalResults, type TestResult, type AggregatedResults, type TrendPoint, } from './results';
|
|
64
|
+
export { Judge, AccuracyJudge, CriteriaJudge, RecipeJudge, addJudge, getJudge, listJudges, removeJudge, addOptimizationRule, getOptimizationRule, listOptimizationRules, removeOptimizationRule, parseJudgeResponse, type JudgeConfig, type JudgeCriteriaConfig, type JudgeResult, type JudgeRunOptions, type JudgeOptions, type JudgeProtocol, } from './judge';
|
package/dist/eval/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Evaluation Framework - Accuracy, Performance, and Reliability evaluation
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createEvalResults = exports.EvalResults = exports.noHarmfulContentCriterion = exports.containsKeywordsCriterion = exports.lengthCriterion = exports.relevanceCriterion = exports.createDefaultEvaluator = exports.createEvaluator = exports.Evaluator = exports.EvalSuite = void 0;
|
|
6
|
+
exports.parseJudgeResponse = exports.removeOptimizationRule = exports.listOptimizationRules = exports.getOptimizationRule = exports.addOptimizationRule = exports.removeJudge = exports.listJudges = exports.getJudge = exports.addJudge = exports.RecipeJudge = exports.CriteriaJudge = exports.AccuracyJudge = exports.Judge = exports.createEvalResults = exports.EvalResults = exports.noHarmfulContentCriterion = exports.containsKeywordsCriterion = exports.lengthCriterion = exports.relevanceCriterion = exports.createDefaultEvaluator = exports.createEvaluator = exports.Evaluator = exports.EvalSuite = void 0;
|
|
7
7
|
exports.accuracyEval = accuracyEval;
|
|
8
8
|
exports.performanceEval = performanceEval;
|
|
9
9
|
exports.reliabilityEval = reliabilityEval;
|
|
@@ -168,3 +168,18 @@ Object.defineProperty(exports, "noHarmfulContentCriterion", { enumerable: true,
|
|
|
168
168
|
var results_1 = require("./results");
|
|
169
169
|
Object.defineProperty(exports, "EvalResults", { enumerable: true, get: function () { return results_1.EvalResults; } });
|
|
170
170
|
Object.defineProperty(exports, "createEvalResults", { enumerable: true, get: function () { return results_1.createEvalResults; } });
|
|
171
|
+
// Re-export Judge (LLM-as-Judge)
|
|
172
|
+
var judge_1 = require("./judge");
|
|
173
|
+
Object.defineProperty(exports, "Judge", { enumerable: true, get: function () { return judge_1.Judge; } });
|
|
174
|
+
Object.defineProperty(exports, "AccuracyJudge", { enumerable: true, get: function () { return judge_1.AccuracyJudge; } });
|
|
175
|
+
Object.defineProperty(exports, "CriteriaJudge", { enumerable: true, get: function () { return judge_1.CriteriaJudge; } });
|
|
176
|
+
Object.defineProperty(exports, "RecipeJudge", { enumerable: true, get: function () { return judge_1.RecipeJudge; } });
|
|
177
|
+
Object.defineProperty(exports, "addJudge", { enumerable: true, get: function () { return judge_1.addJudge; } });
|
|
178
|
+
Object.defineProperty(exports, "getJudge", { enumerable: true, get: function () { return judge_1.getJudge; } });
|
|
179
|
+
Object.defineProperty(exports, "listJudges", { enumerable: true, get: function () { return judge_1.listJudges; } });
|
|
180
|
+
Object.defineProperty(exports, "removeJudge", { enumerable: true, get: function () { return judge_1.removeJudge; } });
|
|
181
|
+
Object.defineProperty(exports, "addOptimizationRule", { enumerable: true, get: function () { return judge_1.addOptimizationRule; } });
|
|
182
|
+
Object.defineProperty(exports, "getOptimizationRule", { enumerable: true, get: function () { return judge_1.getOptimizationRule; } });
|
|
183
|
+
Object.defineProperty(exports, "listOptimizationRules", { enumerable: true, get: function () { return judge_1.listOptimizationRules; } });
|
|
184
|
+
Object.defineProperty(exports, "removeOptimizationRule", { enumerable: true, get: function () { return judge_1.removeOptimizationRule; } });
|
|
185
|
+
Object.defineProperty(exports, "parseJudgeResponse", { enumerable: true, get: function () { return judge_1.parseJudgeResponse; } });
|