@aigne/example-workflow-sequential 1.2.0 → 1.3.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
@@ -72,12 +72,12 @@ The following example demonstrates how to build a sequential workflow:
72
72
 
73
73
  ```typescript
74
74
  import assert from "node:assert";
75
- import { AIAgent, ChatModelOpenAI, ExecutionEngine } from "@aigne/core-next";
75
+ import { AIAgent, OpenAIChatModel, ExecutionEngine, sequential } from "@aigne/core";
76
76
 
77
77
  const { OPENAI_API_KEY } = process.env;
78
78
  assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
79
79
 
80
- const model = new ChatModelOpenAI({
80
+ const model = new OpenAIChatModel({
81
81
  apiKey: OPENAI_API_KEY,
82
82
  });
83
83
 
@@ -125,12 +125,9 @@ Draft copy:
125
125
 
126
126
  const engine = new ExecutionEngine({ model });
127
127
 
128
- const result = await engine.run(
129
- { product: "AIGNE is a No-code Generative AI Apps Engine" },
130
- conceptExtractor,
131
- writer,
132
- formatProof,
133
- );
128
+ const result = await engine.call(sequential(conceptExtractor, writer, formatProof), {
129
+ product: "AIGNE is a No-code Generative AI Apps Engine",
130
+ });
134
131
 
135
132
  console.log(result);
136
133
 
package/index.ts CHANGED
@@ -1,12 +1,18 @@
1
1
  #!/usr/bin/env npx -y bun
2
2
 
3
3
  import assert from "node:assert";
4
- import { AIAgent, ChatModelOpenAI, ExecutionEngine, runChatLoopInTerminal } from "@aigne/core-next";
4
+ import {
5
+ AIAgent,
6
+ ExecutionEngine,
7
+ OpenAIChatModel,
8
+ runChatLoopInTerminal,
9
+ sequential,
10
+ } from "@aigne/core";
5
11
 
6
12
  const { OPENAI_API_KEY } = process.env;
7
13
  assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
8
14
 
9
- const model = new ChatModelOpenAI({
15
+ const model = new OpenAIChatModel({
10
16
  apiKey: OPENAI_API_KEY,
11
17
  });
12
18
 
@@ -54,7 +60,7 @@ Draft copy:
54
60
 
55
61
  const engine = new ExecutionEngine({ model });
56
62
 
57
- const userAgent = await engine.run(conceptExtractor, writer, formatProof);
63
+ const userAgent = engine.call(sequential(conceptExtractor, writer, formatProof));
58
64
 
59
65
  await runChatLoopInTerminal(userAgent, {
60
66
  welcome: `Hello, I'm a marketing assistant. I can help you with product descriptions, marketing copy, and editing.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/example-workflow-sequential",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "A demonstration of using AIGNE Framework to build a sequential 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-sequential",
@@ -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.2.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 } from "@aigne/core-next";
2
+ import { AIAgent, ExecutionEngine, OpenAIChatModel, sequential } 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
 
@@ -52,12 +52,9 @@ Draft copy:
52
52
 
53
53
  const engine = new ExecutionEngine({ model });
54
54
 
55
- const result = await engine.run(
56
- { product: "AIGNE is a No-code Generative AI Apps Engine" },
57
- conceptExtractor,
58
- writer,
59
- formatProof,
60
- );
55
+ const result = await engine.call(sequential(conceptExtractor, writer, formatProof), {
56
+ product: "AIGNE is a No-code Generative AI Apps Engine",
57
+ });
61
58
 
62
59
  console.log(result);
63
60