@aigne/example-workflow-concurrency 1.1.0 → 1.2.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 CHANGED
@@ -74,12 +74,12 @@ The following example demonstrates how to build a concurrency workflow:
74
74
 
75
75
  ```typescript
76
76
  import assert from "node:assert";
77
- import { AIAgent, ChatModelOpenAI, ExecutionEngine, parallel } from "@aigne/core-next";
77
+ import { AIAgent, OpenAIChatModel, ExecutionEngine, parallel } from "@aigne/core";
78
78
 
79
79
  const { OPENAI_API_KEY } = process.env;
80
80
  assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
81
81
 
82
- const model = new ChatModelOpenAI({
82
+ const model = new OpenAIChatModel({
83
83
  apiKey: OPENAI_API_KEY,
84
84
  });
85
85
 
@@ -103,10 +103,9 @@ Product description:
103
103
 
104
104
  const engine = new ExecutionEngine({ model });
105
105
 
106
- const result = await engine.run(
107
- { product: "AIGNE is a No-code Generative AI Apps Engine" },
108
- parallel(featureExtractor, audienceAnalyzer),
109
- );
106
+ const result = await engine.call(parallel(featureExtractor, audienceAnalyzer), {
107
+ product: "AIGNE is a No-code Generative AI Apps Engine",
108
+ });
110
109
 
111
110
  console.log(result);
112
111
 
package/index.ts CHANGED
@@ -3,16 +3,16 @@
3
3
  import assert from "node:assert";
4
4
  import {
5
5
  AIAgent,
6
- ChatModelOpenAI,
7
6
  ExecutionEngine,
7
+ OpenAIChatModel,
8
8
  parallel,
9
9
  runChatLoopInTerminal,
10
- } from "@aigne/core-next";
10
+ } from "@aigne/core";
11
11
 
12
12
  const { OPENAI_API_KEY } = process.env;
13
13
  assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
14
14
 
15
- const model = new ChatModelOpenAI({
15
+ const model = new OpenAIChatModel({
16
16
  apiKey: OPENAI_API_KEY,
17
17
  });
18
18
 
@@ -36,7 +36,7 @@ Product description:
36
36
 
37
37
  const engine = new ExecutionEngine({ model });
38
38
 
39
- const userAgent = await engine.run(parallel(featureExtractor, audienceAnalyzer));
39
+ const userAgent = engine.call(parallel(featureExtractor, audienceAnalyzer));
40
40
 
41
41
  await runChatLoopInTerminal(userAgent, {
42
42
  welcome: `Hello, I'm a product analyst and market researcher. I can help you with extracting features and identifying target audience.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/example-workflow-concurrency",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "A demonstration of using AIGNE Framework to build a concurrency 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-concurrency",
@@ -16,10 +16,12 @@
16
16
  "README.md"
17
17
  ],
18
18
  "dependencies": {
19
+ "openai": "^4.89.0",
19
20
  "zod": "^3.24.2",
20
- "@aigne/core-next": "^1.1.0"
21
+ "@aigne/core": "^1.3.0"
21
22
  },
22
23
  "scripts": {
23
- "start": "npx -y bun run index.ts"
24
+ "start": "npx -y bun run index.ts",
25
+ "lint": "tsc --noEmit"
24
26
  }
25
27
  }
package/usages.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import assert from "node:assert";
2
- import { AIAgent, ChatModelOpenAI, ExecutionEngine, parallel } from "@aigne/core-next";
2
+ import { AIAgent, ExecutionEngine, OpenAIChatModel, parallel } from "@aigne/core";
3
3
 
4
4
  const { OPENAI_API_KEY } = process.env;
5
5
  assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
6
6
 
7
- const model = new ChatModelOpenAI({
7
+ const model = new OpenAIChatModel({
8
8
  apiKey: OPENAI_API_KEY,
9
9
  });
10
10
 
@@ -28,10 +28,9 @@ Product description:
28
28
 
29
29
  const engine = new ExecutionEngine({ model });
30
30
 
31
- const result = await engine.run(
32
- { product: "AIGNE is a No-code Generative AI Apps Engine" },
33
- parallel(featureExtractor, audienceAnalyzer),
34
- );
31
+ const result = await engine.call(parallel(featureExtractor, audienceAnalyzer), {
32
+ product: "AIGNE is a No-code Generative AI Apps Engine",
33
+ });
35
34
 
36
35
  console.log(result);
37
36