@aigne/example-workflow-code-execution 1.7.0 → 1.8.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 -4
- package/index.ts +4 -4
- package/package.json +6 -3
- package/usage.ts +4 -4
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ The following example demonstrates how to build a code-execution workflow:
|
|
|
92
92
|
|
|
93
93
|
```typescript
|
|
94
94
|
import assert from "node:assert";
|
|
95
|
-
import { AIAgent,
|
|
95
|
+
import { AIAgent, AIGNE, FunctionAgent } from "@aigne/core";
|
|
96
96
|
import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
|
|
97
97
|
import { z } from "zod";
|
|
98
98
|
|
|
@@ -123,12 +123,12 @@ const coder = AIAgent.from({
|
|
|
123
123
|
You are a proficient coder. You write code to solve problems.
|
|
124
124
|
Work with the sandbox to execute your code.
|
|
125
125
|
`,
|
|
126
|
-
|
|
126
|
+
skills: [sandbox],
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
-
const
|
|
129
|
+
const aigne = new AIGNE({ model });
|
|
130
130
|
|
|
131
|
-
const result = await
|
|
131
|
+
const result = await aigne.invoke(coder, "10! = ?");
|
|
132
132
|
console.log(result);
|
|
133
133
|
// Output:
|
|
134
134
|
// {
|
package/index.test.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { test } from "bun:test";
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import { runExampleTest } from "@aigne/test-utils/run-example-test.js";
|
|
2
3
|
|
|
3
|
-
test(
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
test(
|
|
5
|
+
"should successfully run the workflow-code-execution",
|
|
6
|
+
async () => {
|
|
7
|
+
const { code } = await runExampleTest();
|
|
8
|
+
expect(code).toBe(0);
|
|
9
|
+
},
|
|
10
|
+
{ timeout: 600000 },
|
|
11
|
+
);
|
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, FunctionAgent } from "@aigne/core";
|
|
5
5
|
import { loadModel } from "@aigne/core/loader/index.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
|
|
@@ -27,13 +27,13 @@ const coder = AIAgent.from({
|
|
|
27
27
|
You are a proficient coder. You write code to solve problems.
|
|
28
28
|
Work with the sandbox to execute your code.
|
|
29
29
|
`,
|
|
30
|
-
|
|
30
|
+
skills: [sandbox],
|
|
31
31
|
memory: true,
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const aigne = new AIGNE({ model });
|
|
35
35
|
|
|
36
|
-
const user =
|
|
36
|
+
const user = aigne.invoke(coder);
|
|
37
37
|
|
|
38
38
|
await runChatLoopInTerminal(user, {
|
|
39
39
|
welcome:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/example-workflow-code-execution",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "A demonstration of using AIGNE Framework to build a code-execution 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-code-execution",
|
|
@@ -18,8 +18,11 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"openai": "^4.94.0",
|
|
20
20
|
"zod": "^3.24.2",
|
|
21
|
-
"@aigne/core": "^1.
|
|
22
|
-
"@aigne/cli": "^1.
|
|
21
|
+
"@aigne/core": "^1.12.0",
|
|
22
|
+
"@aigne/cli": "^1.8.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@aigne/test-utils": "^0.1.0"
|
|
23
26
|
},
|
|
24
27
|
"scripts": {
|
|
25
28
|
"start": "bun run index.ts",
|
package/usage.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert";
|
|
2
|
-
import { AIAgent,
|
|
2
|
+
import { AIAgent, AIGNE, FunctionAgent } from "@aigne/core";
|
|
3
3
|
import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
@@ -30,12 +30,12 @@ const coder = AIAgent.from({
|
|
|
30
30
|
You are a proficient coder. You write code to solve problems.
|
|
31
31
|
Work with the sandbox to execute your code.
|
|
32
32
|
`,
|
|
33
|
-
|
|
33
|
+
skills: [sandbox],
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const aigne = new AIGNE({ model });
|
|
37
37
|
|
|
38
|
-
const result = await
|
|
38
|
+
const result = await aigne.invoke(coder, "10! = ?");
|
|
39
39
|
console.log(result);
|
|
40
40
|
// Output:
|
|
41
41
|
// {
|