@aigne/example-workflow-reflection 1.7.0 → 1.9.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 +4 -4
- package/index.test.ts +10 -5
- package/index.ts +3 -3
- package/package.json +6 -3
- package/usages.ts +4 -10
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ The following example demonstrates how to build a reflection workflow:
|
|
|
73
73
|
|
|
74
74
|
```typescript
|
|
75
75
|
import assert from "node:assert";
|
|
76
|
-
import { AIAgent,
|
|
76
|
+
import { AIAgent, AIGNE, UserInputTopic, UserOutputTopic } from "@aigne/core";
|
|
77
77
|
import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
|
|
78
78
|
import { z } from "zod";
|
|
79
79
|
|
|
@@ -142,10 +142,10 @@ Please review the code. If previous feedback was provided, see if it was address
|
|
|
142
142
|
includeInputInOutput: true,
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
-
const
|
|
146
|
-
|
|
145
|
+
const aigne = new AIGNE({ model, agents: [coder, reviewer] });
|
|
146
|
+
aigne.publish(UserInputTopic, "Write a function to find the sum of all even numbers in a list.");
|
|
147
147
|
|
|
148
|
-
const { message } = await
|
|
148
|
+
const { message } = await aigne.subscribe(UserOutputTopic);
|
|
149
149
|
console.log(message);
|
|
150
150
|
// Output:
|
|
151
151
|
// {
|
package/index.test.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { test } from "bun:test";
|
|
2
|
-
|
|
3
|
-
test(
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import { runExampleTest } from "@aigne/test-utils/run-example-test.js";
|
|
3
|
+
test(
|
|
4
|
+
"should successfully run the workflow-reflection",
|
|
5
|
+
async () => {
|
|
6
|
+
const { code } = await runExampleTest();
|
|
7
|
+
expect(code).toBe(0);
|
|
8
|
+
},
|
|
9
|
+
{ timeout: 600000 },
|
|
10
|
+
);
|
package/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bunwrapper
|
|
2
2
|
|
|
3
3
|
import { runChatLoopInTerminal } from "@aigne/cli/utils/run-chat-loop.js";
|
|
4
|
-
import { AIAgent,
|
|
4
|
+
import { AIAgent, AIGNE, UserAgent, UserInputTopic, UserOutputTopic } from "@aigne/core";
|
|
5
5
|
import { loadModel } from "@aigne/core/loader/index.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
|
|
@@ -65,10 +65,10 @@ Please review the code. If previous feedback was provided, see if it was address
|
|
|
65
65
|
includeInputInOutput: true,
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
const
|
|
68
|
+
const aigne = new AIGNE({ model, agents: [coder, reviewer] });
|
|
69
69
|
|
|
70
70
|
const userAgent = UserAgent.from({
|
|
71
|
-
context:
|
|
71
|
+
context: aigne.newContext(),
|
|
72
72
|
publishTopic: UserInputTopic,
|
|
73
73
|
subscribeTopic: UserOutputTopic,
|
|
74
74
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/example-workflow-reflection",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "A demonstration of using AIGNE Framework to build a reflection 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-reflection",
|
|
@@ -18,8 +18,11 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"openai": "^4.94.0",
|
|
20
20
|
"zod": "^3.24.2",
|
|
21
|
-
"@aigne/cli": "^1.
|
|
22
|
-
"@aigne/core": "^1.
|
|
21
|
+
"@aigne/cli": "^1.8.1",
|
|
22
|
+
"@aigne/core": "^1.13.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@aigne/test-utils": "^0.1.0"
|
|
23
26
|
},
|
|
24
27
|
"scripts": {
|
|
25
28
|
"start": "bun run index.ts",
|
package/usages.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert";
|
|
2
|
-
import {
|
|
3
|
-
AIAgent,
|
|
4
|
-
ExecutionEngine,
|
|
5
|
-
UserInputTopic,
|
|
6
|
-
UserOutputTopic,
|
|
7
|
-
createPublishMessage,
|
|
8
|
-
} from "@aigne/core";
|
|
2
|
+
import { AIAgent, AIGNE, UserInputTopic, UserOutputTopic, createPublishMessage } from "@aigne/core";
|
|
9
3
|
import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
|
|
10
4
|
import { z } from "zod";
|
|
11
5
|
|
|
@@ -74,13 +68,13 @@ Please review the code. If previous feedback was provided, see if it was address
|
|
|
74
68
|
includeInputInOutput: true,
|
|
75
69
|
});
|
|
76
70
|
|
|
77
|
-
const
|
|
78
|
-
|
|
71
|
+
const aigne = new AIGNE({ model, agents: [coder, reviewer] });
|
|
72
|
+
aigne.publish(
|
|
79
73
|
UserInputTopic,
|
|
80
74
|
createPublishMessage("Write a function to find the sum of all even numbers in a list."),
|
|
81
75
|
);
|
|
82
76
|
|
|
83
|
-
const { message } = await
|
|
77
|
+
const { message } = await aigne.subscribe(UserOutputTopic);
|
|
84
78
|
console.log(message);
|
|
85
79
|
// Output:
|
|
86
80
|
// {
|