@aigne/example-workflow-router 1.1.0-beta.9 → 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
@@ -2,6 +2,31 @@
2
2
 
3
3
  This is a demonstration of using [AIGNE Framework](https://github.com/AIGNE-io/aigne-framework) to build a router workflow.
4
4
 
5
+ ```mermaid
6
+ flowchart LR
7
+ in(In)
8
+ out(Out)
9
+ triage(Triage)
10
+ productSupport(Product Support)
11
+ feedback(Feedback)
12
+ other(Other)
13
+
14
+ in ==> triage
15
+ triage ==> productSupport ==> out
16
+ triage -.-> feedback -.-> out
17
+ triage -.-> other -.-> out
18
+
19
+ classDef inputOutput fill:#f9f0ed,stroke:#debbae,stroke-width:2px,color:#b35b39,font-weight:bolder;
20
+ classDef processing fill:#F0F4EB,stroke:#C2D7A7,stroke-width:2px,color:#6B8F3C,font-weight:bolder;
21
+
22
+ class in inputOutput
23
+ class out inputOutput
24
+ class triage processing
25
+ class productSupport processing
26
+ class feedback processing
27
+ class other processing
28
+ ```
29
+
5
30
  ## Prerequisites
6
31
 
7
32
  - [Node.js](https://nodejs.org) and npm installed on your machine
@@ -11,7 +36,7 @@ This is a demonstration of using [AIGNE Framework](https://github.com/AIGNE-io/a
11
36
  ## Try without Installation
12
37
 
13
38
  ```bash
14
- OPENAI_API_KEY=YOUR_OPENAI_API_KEY # setup your OpenAI API key
39
+ export OPENAI_API_KEY=YOUR_OPENAI_API_KEY # setup your OpenAI API key
15
40
 
16
41
  npx -y @aigne/example-workflow-router # run the example
17
42
  ```
package/index.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  #!/usr/bin/env npx -y bun
2
2
 
3
+ import assert from "node:assert";
3
4
  import { AIAgent, ChatModelOpenAI, ExecutionEngine, runChatLoopInTerminal } from "@aigne/core-next";
4
5
 
6
+ const { OPENAI_API_KEY } = process.env;
7
+ assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
8
+
5
9
  const model = new ChatModelOpenAI({
6
- apiKey: process.env.OPENAI_API_KEY,
10
+ apiKey: OPENAI_API_KEY,
7
11
  });
8
12
 
9
13
  const productSupport = AIAgent.from({
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@aigne/example-workflow-router",
3
- "version": "1.1.0-beta.9",
3
+ "version": "1.2.0",
4
4
  "description": "A demonstration of using AIGNE Framework to build a router workflow",
5
- "author": "",
5
+ "author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
6
+ "homepage": "https://github.com/AIGNE-io/aigne-framework/tree/main/examples/workflow-router",
6
7
  "license": "ISC",
7
- "main": "index.js",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/AIGNE-io/aigne-framework"
11
+ },
8
12
  "bin": "index.ts",
9
13
  "files": [
10
14
  ".env.local.example",
@@ -13,7 +17,7 @@
13
17
  ],
14
18
  "dependencies": {
15
19
  "zod": "^3.24.2",
16
- "@aigne/core-next": "^1.1.0-beta.9"
20
+ "@aigne/core-next": "^1.2.0"
17
21
  },
18
22
  "scripts": {
19
23
  "start": "npx -y bun run index.ts"
package/usages.ts CHANGED
@@ -1,7 +1,11 @@
1
+ import assert from "node:assert";
1
2
  import { AIAgent, ChatModelOpenAI, ExecutionEngine } from "@aigne/core-next";
2
3
 
4
+ const { OPENAI_API_KEY } = process.env;
5
+ assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
6
+
3
7
  const model = new ChatModelOpenAI({
4
- apiKey: process.env.OPENAI_API_KEY,
8
+ apiKey: OPENAI_API_KEY,
5
9
  });
6
10
 
7
11
  const productSupport = AIAgent.from({