@aigne/example-workflow-router 1.10.0 → 1.11.1
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/index.ts +6 -5
- package/package.json +6 -6
- package/usages.ts +2 -2
- /package/{LICENSE → LICENSE.md} +0 -0
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, AIGNE } from "@aigne/core";
|
|
4
|
+
import { AIAgent, AIAgentToolChoice, AIGNE } from "@aigne/core";
|
|
5
5
|
import { loadModel } from "@aigne/core/loader/index.js";
|
|
6
6
|
|
|
7
7
|
const model = await loadModel();
|
|
@@ -35,11 +35,12 @@ const other = AIAgent.from({
|
|
|
35
35
|
|
|
36
36
|
const triage = AIAgent.from({
|
|
37
37
|
name: "triage",
|
|
38
|
-
instructions: `You are an agent
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
instructions: `You are an intelligent routing agent responsible for directing user queries to the most appropriate specialized agent.
|
|
39
|
+
Your task is to analyze the user's request and select exactly one tool from the available options.
|
|
40
|
+
You must always choose a tool — do not answer the question directly or leave the tool unspecified.
|
|
41
|
+
Be concise, accurate, and ensure efficient handoff to the correct agent.`,
|
|
41
42
|
skills: [productSupport, feedback, other],
|
|
42
|
-
toolChoice:
|
|
43
|
+
toolChoice: AIAgentToolChoice.router,
|
|
43
44
|
});
|
|
44
45
|
|
|
45
46
|
const aigne = new AIGNE({ model });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/example-workflow-router",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "A demonstration of using AIGNE Framework to build a router 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-router",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"README.md"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"openai": "^4.
|
|
20
|
-
"zod": "^3.24.
|
|
21
|
-
"@aigne/
|
|
22
|
-
"@aigne/
|
|
19
|
+
"openai": "^4.97.0",
|
|
20
|
+
"zod": "^3.24.4",
|
|
21
|
+
"@aigne/cli": "^1.9.1",
|
|
22
|
+
"@aigne/core": "^1.15.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@aigne/test-utils": "^0.
|
|
25
|
+
"@aigne/test-utils": "^0.2.0"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"start": "bun run index.ts",
|
package/usages.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert";
|
|
2
|
-
import { AIAgent, AIGNE } from "@aigne/core";
|
|
2
|
+
import { AIAgent, AIAgentToolChoice, AIGNE } from "@aigne/core";
|
|
3
3
|
import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
|
|
4
4
|
|
|
5
5
|
const { OPENAI_API_KEY } = process.env;
|
|
@@ -42,7 +42,7 @@ const triage = AIAgent.from({
|
|
|
42
42
|
Your goal is to understand the user's query and direct them to the agent best suited to assist them.
|
|
43
43
|
Be efficient, clear, and ensure the user is connected to the right resource quickly.`,
|
|
44
44
|
skills: [productSupport, feedback, other],
|
|
45
|
-
toolChoice:
|
|
45
|
+
toolChoice: AIAgentToolChoice.router, // Set toolChoice to "router" to enable router mode
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
const aigne = new AIGNE({ model });
|
/package/{LICENSE → LICENSE.md}
RENAMED
|
File without changes
|