{ "nodes": [ { "id": "repair-structured-state-data-with-ai-0", "name": "When clicking \"Execute Workflow\"", "type": "n8n-nodes-base.manualTrigger", "position": [ 1040, -260 ], "parameters": {}, "typeVersion": 1 }, { "id": "repair-structured-state-data-with-ai-1", "name": "Basic LLM Chain", "type": "@n8n/n8n-nodes-langchain.chainLlm", "position": [ 1480, -260 ], "parameters": { "hasOutputParser": true }, "typeVersion": 1.5 }, { "id": "repair-structured-state-data-with-ai-2", "name": "Prompt", "type": "n8n-nodes-base.set", "position": [ 1260, -260 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "6f09dac7-429c-4e8f-af32-8e0112efc8c2", "name": "chatInput", "type": "string", "value": "Return the 5 largest states by area in the USA with their 3 largest cities and their population." } ] } }, "typeVersion": 3.4 }, { "id": "repair-structured-state-data-with-ai-3", "name": "OpenAI Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [ 1400, 60 ], "parameters": { "model": { "__rl": true, "mode": "id", "value": "gpt-4o-mini-2024-07-18" }, "options": {} }, "typeVersion": 1.2 }, { "id": "repair-structured-state-data-with-ai-4", "name": "Auto-fixing Output Parser", "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing", "position": [ 1800, 80 ], "parameters": { "options": { "prompt": "Instructions:\n--------------\n{instructions}\n--------------\nCompletion:\n--------------\n{completion}\n--------------\n\nAbove, the Completion did not satisfy the constraints given in the Instructions.\nError:\n--------------\n{error}\n--------------\n\nPlease try again. Please only respond with an answer that satisfies the constraints laid out in the Instructions:" } }, "typeVersion": 1 }, { "id": "repair-structured-state-data-with-ai-5", "name": "OpenAI Chat Model1", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [ 1680, 400 ], "parameters": { "model": { "__rl": true, "mode": "id", "value": "gpt-4o-mini-2024-07-18" }, "options": {} }, "typeVersion": 1.2 }, { "id": "repair-structured-state-data-with-ai-6", "name": "Structured Output Parser", "type": "@n8n/n8n-nodes-langchain.outputParserStructured", "position": [ 2080, 380 ], "parameters": { "schemaType": "manual", "inputSchema": "{\"type\":\"object\",\"properties\":{\"states\":{\"type\":\"array\",\"minItems\":5,\"maxItems\":5,\"items\":{\"type\":\"object\",\"properties\":{\"state\":{\"type\":\"string\"},\"cities\":{\"type\":\"array\",\"minItems\":3,\"maxItems\":3,\"items\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"population\":{\"type\":\"number\"}},\"required\":[\"name\",\"population\"]}}},\"required\":[\"state\",\"cities\"]}}},\"required\":[\"states\"]}" }, "typeVersion": 1.2 } ], "pinData": {}, "connections": { "Prompt": { "main": [ [ { "node": "Basic LLM Chain", "type": "main", "index": 0 } ] ] }, "OpenAI Chat Model": { "ai_languageModel": [ [ { "node": "Basic LLM Chain", "type": "ai_languageModel", "index": 0 } ] ] }, "OpenAI Chat Model1": { "ai_languageModel": [ [ { "node": "Auto-fixing Output Parser", "type": "ai_languageModel", "index": 0 } ] ] }, "Structured Output Parser": { "ai_outputParser": [ [ { "node": "Auto-fixing Output Parser", "type": "ai_outputParser", "index": 0 } ] ] }, "Auto-fixing Output Parser": { "ai_outputParser": [ [ { "node": "Basic LLM Chain", "type": "ai_outputParser", "index": 0 } ] ] }, "When clicking \"Execute Workflow\"": { "main": [ [ { "node": "Prompt", "type": "main", "index": 0 } ] ] } }, "name": "Repair Structured State Data with AI", "active": false }