@aigne/example-workflow-group-chat 1.7.3 → 1.8.1
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/index.ts +7 -7
- package/package.json +6 -3
package/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import assert from "node:assert";
|
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import {
|
|
6
6
|
AIAgent,
|
|
7
|
-
|
|
7
|
+
AIGNE,
|
|
8
8
|
FunctionAgent,
|
|
9
9
|
PromptTemplate,
|
|
10
10
|
UserAgent,
|
|
@@ -23,7 +23,7 @@ const model = new OpenAIChatModel({
|
|
|
23
23
|
model: "gpt-4o",
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const aigne = new AIGNE({
|
|
27
27
|
model,
|
|
28
28
|
});
|
|
29
29
|
|
|
@@ -70,7 +70,7 @@ const illustrator = AIAgent.from({
|
|
|
70
70
|
instructions: `\
|
|
71
71
|
You are an Illustrator. You use the generate_image tool to create images given user's requirement.
|
|
72
72
|
Make sure the images have consistent characters and style.`,
|
|
73
|
-
|
|
73
|
+
skills: [generateImage],
|
|
74
74
|
toolChoice: "auto",
|
|
75
75
|
outputSchema: z.object({
|
|
76
76
|
images: z
|
|
@@ -86,7 +86,7 @@ Make sure the images have consistent characters and style.`,
|
|
|
86
86
|
let isFirstQuestion = true;
|
|
87
87
|
|
|
88
88
|
const user = UserAgent.from({
|
|
89
|
-
context:
|
|
89
|
+
context: aigne.newContext(),
|
|
90
90
|
name: "user",
|
|
91
91
|
description: "User for providing final approval",
|
|
92
92
|
publishTopic: DEFAULT_TOPIC,
|
|
@@ -138,9 +138,9 @@ const manager = AIAgent.from({
|
|
|
138
138
|
}),
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
aigne.addAgent(user, writer, editor, illustrator, manager);
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
aigne.subscribe(DEFAULT_TOPIC, (message) => {
|
|
144
144
|
console.log(
|
|
145
145
|
"------------- Received message -------------\n",
|
|
146
146
|
`${message.source}:`,
|
|
@@ -149,7 +149,7 @@ engine.subscribe(DEFAULT_TOPIC, (message) => {
|
|
|
149
149
|
);
|
|
150
150
|
});
|
|
151
151
|
|
|
152
|
-
await
|
|
152
|
+
await aigne.invoke(user, {});
|
|
153
153
|
|
|
154
154
|
function assertZodUnionArray<T extends z.ZodType>(union: T[]): [T, T, ...T[]] {
|
|
155
155
|
if (!(union.length >= 2)) throw new Error("Union must have at least 2 items");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/example-workflow-group-chat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "A demonstration of using AIGNE Framework to build a group chat workflow",
|
|
5
5
|
"author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
|
|
6
6
|
"homepage": "https://github.com/AIGNE-io/aigne-framework/tree/main/examples/workflow-group-chat",
|
|
@@ -18,8 +18,11 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"openai": "^4.94.0",
|
|
20
20
|
"zod": "^3.24.2",
|
|
21
|
-
"@aigne/
|
|
22
|
-
"@aigne/
|
|
21
|
+
"@aigne/core": "^1.13.0",
|
|
22
|
+
"@aigne/cli": "^1.8.1"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@aigne/test-utils": "^0.1.0"
|
|
23
26
|
},
|
|
24
27
|
"scripts": {
|
|
25
28
|
"start": "bun run index.ts",
|