Repository navigation
Expand file tree
/
Copy pathCustomer Support Agent.json
More file actions
263 lines (263 loc) · 9.04 KB
/
Copy pathCustomer Support Agent.json
File metadata and controls
263 lines (263 loc) · 9.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
{
"name": "Customer Support Agent",
"nodes": [
{
"parameters": {
"workflowInputs": {
"values": [
{
"name": "query"
},
{
"name": "session_id"
}
]
}
},
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1.1,
"position": [
0,
0
],
"id": "b94384af-5c09-49f7-8abe-9d5b1d1e8383",
"name": "When Executed by Another Workflow"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
80,
208
],
"id": "de9d7d2a-353a-4c10-bbb5-fa2c73ff2c29",
"name": "Google Gemini Chat Model",
"credentials": {
"googlePalmApi": {
"id": "FCueVwq1thZXfmbB",
"name": "demo_key"
}
}
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "Call this tool to Access the database.",
"tableName": {
"__rl": true,
"value": "documents",
"mode": "list",
"cachedResultName": "documents"
},
"topK": 20,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
"typeVersion": 1.3,
"position": [
368,
144
],
"id": "60d07ff3-8a39-4e9d-a272-91414bc4cef3",
"name": "Knowledge Base",
"credentials": {
"supabaseApi": {
"id": "BF3uc6E3Vsqrb5H2",
"name": "RAG System"
}
}
},
{
"parameters": {},
"type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
"typeVersion": 1,
"position": [
368,
320
],
"id": "82ed7237-b04d-4e1e-8a31-573baca9b104",
"name": "Embeddings Google Gemini",
"credentials": {
"googlePalmApi": {
"id": "FCueVwq1thZXfmbB",
"name": "demo_key"
}
}
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $fromAI('session_id', 'the session id of the memory buffer') }}"
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
224,
208
],
"id": "5b9d9ef6-3a6e-492f-b1ed-57cf5d2bfc0f",
"name": "Simple Memory"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "81e42018-dd7b-4187-a0a6-5abd20b7012b",
"name": "output",
"value": "={{ $json.output }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
560,
0
],
"id": "4327b27e-b32a-4881-85d9-bc8fe8e1fdba",
"name": "Edit Fields"
},
{
"parameters": {
"content": "",
"height": 688,
"width": 912
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-80,
-160
],
"id": "fbb4af90-fef1-425e-8e32-d7eb5375aaa8",
"name": "Sticky Note"
},
{
"parameters": {
"content": "# Customer Support Agent",
"height": 96,
"width": 448
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
144,
-160
],
"id": "88ec3d8e-2b6c-45f2-bca2-bf7ad7071465",
"name": "Sticky Note1"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.query }}",
"options": {
"systemMessage": "=# Overview \nYou are a Retrieval-Augmented Generation (RAG) expert AI agent designed to answer user queries with high accuracy by retrieving information from authoritative sources within the Knowledge Base (KB). \n\n## Context \n- Your primary responsibility is to provide factually correct, concise, and well-sourced answers. \n- All answers must be derived from the Knowledge Base, with explicit citation of MoF policies where relevant. \n- You must avoid ambiguity, speculation, and unnecessary elaboration. \n- You also have access to a memory tool containing past interactions. If a user query matches a previously answered question, you must retrieve the answer from memory instead of re-querying the Knowledge Base. \n\n## Instructions \n1. First, check the memory tool to determine if the current query has already been answered in a past interaction. \n - If yes, return the stored answer directly from memory for faster delivery. \n - If no, proceed to query the Knowledge Base. \n2. Always query the Knowledge Base as many times as needed to ensure accuracy and completeness when no memory match exists. \n3. Do not ask the user follow-up or clarifying questions. Answer directly, even if the query is ambiguous. \n4. Provide responses in a concise, clear format that always ends with a **Citation** line. \n5. Explicitly cite the Knowledge Base source(s) using the format: \n - Citation: [MoF Policy ###: Policy Title] \n6. If the answer cannot be determined from the Knowledge Base, state: \n \"The information required to answer this question is not available in the provided knowledge bases.\" \n\n## Tools \n- Knowledge Base (KB) containing MoF policies and regulations \n- Memory tool containing past interactions \n\n## Examples \n- Input: \"What are the requirements for Zone A?\" \n- Output: \n \"Yes—Zone A requires submission ≥3 days before activation, allows up to 100 participants, and the nonprofit status and non-sensitive data comply with Zone A restrictions. \n\n Citation: [MoF Policy 001: Permit Eligibility by Zone]\" \n\n- Input: \"Can I register an event in Zone C with 500 participants?\" \n- Output: \n \"No—Zone C permits a maximum of 300 participants, therefore 500 participants exceeds the allowed limit. \n\n Citation: [MoF Policy 004: Zone Capacity Regulations]\" \n\n- Input: \"What are the rules for Zone X?\" \n- Output: \n \"The information required to answer this question is not available in the provided knowledge bases.\" \n\n## SOP (Standard Operating Procedure) \n1. Receive the user query. \n2. Check the memory tool for a matching past interaction. \n - If a match exists, return the stored answer directly. \n - If no match exists, proceed to Step 3. \n3. Search the Knowledge Base thoroughly for relevant MoF policies. \n4. Retrieve authoritative information from the correct policy. \n5. Construct a concise factual response in the approved output format. \n6. Always end the answer with the **Citation line** referencing the specific MoF policy. \n7. If no answer is available, return the fallback statement. \n\n## Final Notes \n- Always prioritize factual accuracy and proper MoF policy citation. \n- Never speculate or provide answers unsupported by the Knowledge Base. \n- Always follow the exact output format for consistency. \n- Use memory first for efficiency; use KB only when memory does not contain the answer. \n"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
208,
0
],
"id": "d7aeef89-8417-4bc6-9ac0-56d15cd8482b",
"name": "Customer Support Agent"
}
],
"pinData": {
"When Executed by Another Workflow": [
{
"json": {
"query": "Can you summarize the policy number 1"
}
}
]
},
"connections": {
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Customer Support Agent",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Customer Support Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Knowledge Base": {
"ai_tool": [
[
{
"node": "Customer Support Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Embeddings Google Gemini": {
"ai_embedding": [
[
{
"node": "Knowledge Base",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "Customer Support Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Customer Support Agent": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "2924e4f5-177a-4c73-b503-8d29372dee6d",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "9d139cc8817edbfe921ebb49cf470f37a38acccf02e4b0f7ecbfe97b65e3e56c"
},
"id": "XDGzcFdBP7ib9jFu",
"tags": []
}