File size: 8,602 Bytes
0a84888 |
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 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
{
"name": "Agents vs chains",
"nodes": [
{
"parameters": {},
"id": "9e1d8f35-e1ba-4600-977d-e54a919c2c62",
"name": "Chat Trigger",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1,
"position": [
520,
420
],
"webhookId": "84bfdbd0-e2ce-4bfa-b746-985e64a14484"
},
{
"parameters": {
"options": {}
},
"id": "4b89df4b-4f78-4f52-a51d-eeb66a7948e5",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1,
"position": [
1020,
420
],
"credentials": {
"openAiApi": {
"id": "tW3bkXa0SAK0OzvR",
"name": "OpenAi account Debs"
}
}
},
{
"parameters": {
"options": {}
},
"id": "a0045df2-d212-4e6a-a2d4-722136dcb8b5",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1,
"position": [
980,
880
],
"credentials": {
"openAiApi": {
"id": "tW3bkXa0SAK0OzvR",
"name": "OpenAi account Debs"
}
}
},
{
"parameters": {},
"id": "d702f647-1fa7-4b4f-91b1-e0152326ea11",
"name": "Simple Memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.2,
"position": [
1280,
460
]
},
{
"parameters": {},
"id": "76cc359a-5ec8-446a-a8e0-9035d18247cb",
"name": "Wikipedia",
"type": "@n8n/n8n-nodes-langchain.toolWikipedia",
"typeVersion": 1,
"position": [
1540,
340
]
},
{
"parameters": {
"options": {}
},
"id": "01d1785f-f7c4-47d2-97b7-76eeff68002d",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.5,
"position": [
1060,
140
]
},
{
"parameters": {
"messages": {
"messageValues": [
{
"message": "Every time you respond, start your response with the sentence: \"This message came from the chain\"."
}
]
}
},
"id": "bcdcd704-13f5-4906-b337-7ec4629b9781",
"name": "Basic LLM Chain",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"typeVersion": 1.4,
"position": [
1040,
680
]
},
{
"parameters": {
"content": "## Try it out\n\nSelect **Chat**, and try out these queries:\n\n- Please show me a Wikipedia article about cats (agent)\n- Please show me a Wikipedia article about cats (chain)\n- What was my last question? (chain)\n- What was my last question? (agent)\n",
"height": 343.8587887368956,
"color": 4
},
"id": "f08e231b-739a-4b9d-b738-139b7e3bd60b",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
240,
420
]
},
{
"parameters": {
"content": "**Set your credentials**",
"height": 193,
"width": 167,
"color": 2
},
"id": "5421fd4d-c82f-483a-8238-869b9a10000d",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
980,
360
]
},
{
"parameters": {
"content": "**Set your credentials**",
"height": 193,
"width": 167,
"color": 2
},
"id": "23fac3a8-a220-40a5-8d3d-4a3013b0f1da",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
940,
820
]
},
{
"parameters": {
"content": "**Memory allows the agent to access previous parts of the chat**\n",
"height": 244,
"color": 5
},
"id": "08397bde-06e4-4bff-b130-cbc4408a0ecc",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1200,
360
]
},
{
"parameters": {
"content": "**The agent can use the Wikipedia tool to access articles from Wikipedia**",
"height": 238,
"color": 5
},
"id": "a53ff4f2-9d06-4166-9ad6-760cd8fe4a54",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1460,
240
]
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": false,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"leftValue": "={{ $json.chatInput }}",
"rightValue": "agent",
"operator": {
"type": "string",
"operation": "contains"
}
}
],
"combinator": "and"
}
},
{
"conditions": {
"options": {
"caseSensitive": false,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "248f4a34-89c1-4d1e-867a-daa024c8635a",
"leftValue": "={{ $json.chatInput }}",
"rightValue": "chain",
"operator": {
"type": "string",
"operation": "contains"
}
}
],
"combinator": "and"
}
}
]
},
"options": {
"ignoreCase": true
}
},
"id": "ab2bff8d-e914-421d-9aa3-9d0ad815cea6",
"name": "Check user input for \"chain\" or \"agent\"",
"type": "n8n-nodes-base.switch",
"typeVersion": 3,
"position": [
740,
420
]
},
{
"parameters": {
"content": "## Next steps\n\nLearn more about [Advanced AI in n8n](https://docs.n8n.io/advanced-ai/)"
},
"id": "f077f8e6-789a-4db1-8402-fb173c296017",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
1560,
840
]
}
],
"pinData": {},
"connections": {
"Chat Trigger": {
"main": [
[
{
"node": "Check user input for \"chain\" or \"agent\"",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Basic LLM Chain",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Wikipedia": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Check user input for \"chain\" or \"agent\"": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Basic LLM Chain",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "59784a0f-0601-4456-b48d-9a191e203461",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "cb484ba7b742928a2048bf8829668bed5b5ad9787579adea888f05980292a4a7"
},
"id": "qK43vJw6dRZkXo6h",
"tags": [
{
"createdAt": "2021-06-25T07:47:07.640Z",
"updatedAt": "2021-06-25T07:47:07.640Z",
"id": "1",
"name": "docs"
},
{
"createdAt": "2023-02-22T12:06:03.372Z",
"updatedAt": "2023-02-22T12:06:03.372Z",
"id": "63",
"name": "createdBy:Debs"
}
]
} |