@aigne/example-workflow-router 1.13.7 → 1.13.10
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 +5 -0
- package/package.json +6 -6
- package/usages.ts +7 -3
package/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ const productSupport = AIAgent.from({
|
|
|
11
11
|
Your goal is to provide accurate and helpful information about the product.
|
|
12
12
|
Be polite, professional, and ensure the user feels supported.`,
|
|
13
13
|
memory: new DefaultMemory(),
|
|
14
|
+
inputKey: "message",
|
|
14
15
|
});
|
|
15
16
|
|
|
16
17
|
const feedback = AIAgent.from({
|
|
@@ -20,6 +21,7 @@ const feedback = AIAgent.from({
|
|
|
20
21
|
Your goal is to listen to the user's feedback, acknowledge their input, and provide appropriate responses.
|
|
21
22
|
Be empathetic, understanding, and ensure the user feels heard.`,
|
|
22
23
|
memory: new DefaultMemory(),
|
|
24
|
+
inputKey: "message",
|
|
23
25
|
});
|
|
24
26
|
|
|
25
27
|
const other = AIAgent.from({
|
|
@@ -29,6 +31,7 @@ const other = AIAgent.from({
|
|
|
29
31
|
Your goal is to provide accurate and helpful information on a wide range of topics.
|
|
30
32
|
Be friendly, knowledgeable, and ensure the user feels satisfied with the information provided.`,
|
|
31
33
|
memory: new DefaultMemory(),
|
|
34
|
+
inputKey: "message",
|
|
32
35
|
});
|
|
33
36
|
|
|
34
37
|
const triage = AIAgent.from({
|
|
@@ -39,6 +42,7 @@ You must always choose a tool — do not answer the question directly or leave t
|
|
|
39
42
|
Be concise, accurate, and ensure efficient handoff to the correct agent.`,
|
|
40
43
|
skills: [productSupport, feedback, other],
|
|
41
44
|
toolChoice: AIAgentToolChoice.router,
|
|
45
|
+
inputKey: "message",
|
|
42
46
|
});
|
|
43
47
|
|
|
44
48
|
await runWithAIGNE(triage, {
|
|
@@ -53,5 +57,6 @@ I can help you with any questions you have, such as
|
|
|
53
57
|
How can I assist you today?
|
|
54
58
|
`,
|
|
55
59
|
defaultQuestion: "How do I use this product?",
|
|
60
|
+
inputKey: "message",
|
|
56
61
|
},
|
|
57
62
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/example-workflow-router",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.10",
|
|
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,14 +16,14 @@
|
|
|
16
16
|
"README.md"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@aigne/agent-library": "^1.
|
|
20
|
-
"@aigne/cli": "^1.
|
|
21
|
-
"@aigne/openai": "^0.3.
|
|
22
|
-
"@aigne/core": "^1.
|
|
19
|
+
"@aigne/agent-library": "^1.14.0",
|
|
20
|
+
"@aigne/cli": "^1.12.0",
|
|
21
|
+
"@aigne/openai": "^0.3.3",
|
|
22
|
+
"@aigne/core": "^1.21.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/bun": "^1.2.9",
|
|
26
|
-
"@aigne/test-utils": "^0.4.
|
|
26
|
+
"@aigne/test-utils": "^0.4.3"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"start": "bun run index.ts",
|
package/usages.ts
CHANGED
|
@@ -15,6 +15,7 @@ const productSupport = AIAgent.from({
|
|
|
15
15
|
instructions: `You are an agent capable of handling any product-related questions.
|
|
16
16
|
Your goal is to provide accurate and helpful information about the product.
|
|
17
17
|
Be polite, professional, and ensure the user feels supported.`,
|
|
18
|
+
inputKey: "message",
|
|
18
19
|
outputKey: "product_support",
|
|
19
20
|
});
|
|
20
21
|
|
|
@@ -24,6 +25,7 @@ const feedback = AIAgent.from({
|
|
|
24
25
|
instructions: `You are an agent capable of handling any feedback-related questions.
|
|
25
26
|
Your goal is to listen to the user's feedback, acknowledge their input, and provide appropriate responses.
|
|
26
27
|
Be empathetic, understanding, and ensure the user feels heard.`,
|
|
28
|
+
inputKey: "message",
|
|
27
29
|
outputKey: "feedback",
|
|
28
30
|
});
|
|
29
31
|
|
|
@@ -33,6 +35,7 @@ const other = AIAgent.from({
|
|
|
33
35
|
instructions: `You are an agent capable of handling any general questions.
|
|
34
36
|
Your goal is to provide accurate and helpful information on a wide range of topics.
|
|
35
37
|
Be friendly, knowledgeable, and ensure the user feels satisfied with the information provided.`,
|
|
38
|
+
inputKey: "message",
|
|
36
39
|
outputKey: "other",
|
|
37
40
|
});
|
|
38
41
|
|
|
@@ -43,23 +46,24 @@ const triage = AIAgent.from({
|
|
|
43
46
|
Be efficient, clear, and ensure the user is connected to the right resource quickly.`,
|
|
44
47
|
skills: [productSupport, feedback, other],
|
|
45
48
|
toolChoice: AIAgentToolChoice.router, // Set toolChoice to "router" to enable router mode
|
|
49
|
+
inputKey: "message",
|
|
46
50
|
});
|
|
47
51
|
|
|
48
52
|
const aigne = new AIGNE({ model });
|
|
49
53
|
|
|
50
|
-
const result1 = await aigne.invoke(triage, "How to use this product?");
|
|
54
|
+
const result1 = await aigne.invoke(triage, { message: "How to use this product?" });
|
|
51
55
|
console.log(result1);
|
|
52
56
|
// {
|
|
53
57
|
// product_support: "I’d be happy to help you with that! However, I need to know which specific product you’re referring to. Could you please provide me with the name or type of product you have in mind?",
|
|
54
58
|
// }
|
|
55
59
|
|
|
56
|
-
const result2 = await aigne.invoke(triage, "I have feedback about the app.");
|
|
60
|
+
const result2 = await aigne.invoke(triage, { message: "I have feedback about the app." });
|
|
57
61
|
console.log(result2);
|
|
58
62
|
// {
|
|
59
63
|
// feedback: "Thank you for sharing your feedback! I'm here to listen. Please go ahead and let me know what you’d like to share about the app.",
|
|
60
64
|
// }
|
|
61
65
|
|
|
62
|
-
const result3 = await aigne.invoke(triage, "What is the weather today?");
|
|
66
|
+
const result3 = await aigne.invoke(triage, { message: "What is the weather today?" });
|
|
63
67
|
console.log(result3);
|
|
64
68
|
// {
|
|
65
69
|
// other: "I can't provide real-time weather updates. However, you can check a reliable weather website or a weather app on your phone for the current conditions in your area. If you tell me your location, I can suggest a few sources where you can find accurate weather information!",
|