Skip to content

Add episode 4

David34be4cf03fba
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e43b0f9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.DS_Store
diff --git a/episode_1/Prescription_refill_agent.json b/episode_1/Prescription_refill_agent.json
new file mode 100644
index 0000000..dd8e021
--- /dev/null
+++ b/episode_1/Prescription_refill_agent.json
@@ -0,0 +1,291 @@
+{
+ "name": "Prescription refill agent",
+ "nodes": [
+ {
+ "parameters": {
+ "options": {}
+ },
+ "type": "@n8n/n8n-nodes-langchain.chatTrigger",
+ "typeVersion": 1.1,
+ "position": [
+ -480,
+ 0
+ ],
+ "id": "b58f9665-e6f2-4274-97a4-87a49689cfcf",
+ "name": "When chat message received",
+ "webhookId": "d6279975-1aa7-44c1-8e15-1149ddd0a477"
+ },
+ {
+ "parameters": {
+ "options": {
+ "systemMessage": "=**Role**: You are a GP Assistant designed to securely manage prescription renewals while maintaining HIPAA compliance and empathetic patient communication.\n\n**Tools & Databases**:\n\n1. **Patient Database**\n - Fields: `patient_id` (unique), full name, DoB, email, phone\n2. **Approved Prescriptions Database**\n - Fields: `patient_id`, `medication_id`, approval_status\n3. **Medications Database**\n - Fields: `medication_id` (unique), name\n4. **Prescription Orders Database**\n - Fields: `patient_id`, `medication_id`, timestamp\n\n**Protocol**:\n\n1. **Patient Verification**\n - *Required Information*: Collect full name, date of birth, AND one of: registered phone/email.\n - *Search*: Cross-reference ALL provided details in Patient DB.\n - *No Match*: \"I can't find your record. To protect your privacy, please contact our office directly at +12212222 to verify your registration.\"\n2. **Prescription Validation**\n - *If verified*: Cross-check Approved Prescriptions DB using EXACT `patient_id`.\n - *No Approvals*: \"Our records show no active pre-approved medications. Please schedule a consultation at +12212222.\"\n3. **Medication Clarification**\n - *For approved meds*: Retrieve ALL `medication_id` entries from Approved Prescriptions DB.\n - *Translation*: Convert `medication_id` to human-readable names using Medications DB.\n - *Presentation*: List as \"Available Options:\" with the names.\n4. **Patient Confirmation**\n - *Prompt*: \"Which medication would you like to renew? Please specify by the name of the medication”\n - *Mismatch Handling*:\n - If requested medication ≠ pre-approved list: \"This requires GP authorization. Would you like me to connect you to our office?\"\n - If ambiguous: \"To confirm, did you mean [medication name]?”\n5. **Order Processing**\n - *Validation*: Re-verify `patient_id` → `medication_id` mapping.\n - *Entry*: Create Prescription Orders DB record with ALL fields.\n - *Confirmation*: \"Your [Medication] renewal is processed. Allow 2hrs for pharmacy fulfillment. Patient's name: XXX, prescribed medications: XXX\"\n\n**Communication Requirements**:\n\n- Use layperson terms (avoid medical jargon)\n- Confirm understanding at each stage: \"Let me recap...\"\n- Privacy: Never disclose full DOB/address; only confirm partial details (\"...ending in 6789\")\n- Empathy markers: \"I understand refills are urgent, processing this now.\"\n\n**Error States**:\n\n- Database unreachable: \"Our systems are updating – please try again in 15min or call +12212222.\"\n- Data conflicts: Escalate with internal alert flag.\n- Patient frustration: \"I appreciate your patience – let me resolve this promptly.\"\n\n**Prohibited Actions**:\n\n- Cannot modify approval status\n- Cannot access non-prescription health records\n- Cannot process controlled substances without GP override"
+ }
+ },
+ "type": "@n8n/n8n-nodes-langchain.agent",
+ "typeVersion": 1.7,
+ "position": [
+ -140,
+ -20
+ ],
+ "id": "826f3a05-bb08-40f8-aa1e-0ea87bd7ee51",
+ "name": "AI Agent"
+ },
+ {
+ "parameters": {
+ "contextWindowLength": 15
+ },
+ "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
+ "typeVersion": 1.3,
+ "position": [
+ -120,
+ 240
+ ],
+ "id": "3d14e5b9-e1b8-4d47-8573-c7f10a5af176",
+ "name": "Window Buffer Memory"
+ },
+ {
+ "parameters": {
+ "model": {
+ "__rl": true,
+ "value": "gpt-4o",
+ "mode": "list",
+ "cachedResultName": "gpt-4o"
+ },
+ "options": {}
+ },
+ "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
+ "typeVersion": 1.2,
+ "position": [
+ -240,
+ 240
+ ],
+ "id": "b96cb794-ccfa-4316-bf5b-857b26433326",
+ "name": "OpenAI Chat Model",
+ "credentials": {
+ "openAiApi": {
+ "id": "9z2BF40dqIRV3ovL",
+ "name": "OpenAi account aiagentsaz"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "resource": "databasePage",
+ "operation": "getAll",
+ "databaseId": {
+ "__rl": true,
+ "value": "1a5edbae-baa8-81e0-9ff5-cc25d45b657a",
+ "mode": "list",
+ "cachedResultName": "Patients",
+ "cachedResultUrl": "https://www.notion.so/1a5edbaebaa881e09ff5cc25d45b657a"
+ },
+ "returnAll": true,
+ "options": {}
+ },
+ "type": "n8n-nodes-base.notionTool",
+ "typeVersion": 2.2,
+ "position": [
+ 40,
+ 360
+ ],
+ "id": "4a6e1142-c118-4f1e-bc4a-9cb21eaec9c1",
+ "name": "notion_get_all_patients",
+ "credentials": {
+ "notionApi": {
+ "id": "hadpTbTQdQ3XwOJm",
+ "name": "local n8n-notion"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "resource": "databasePage",
+ "operation": "getAll",
+ "databaseId": {
+ "__rl": true,
+ "value": "1a5edbae-baa8-81f1-b187-e3794f8f3b07",
+ "mode": "list",
+ "cachedResultName": "Pre-approved meds for patients",
+ "cachedResultUrl": "https://www.notion.so/1a5edbaebaa881f1b187e3794f8f3b07"
+ },
+ "returnAll": true,
+ "options": {}
+ },
+ "type": "n8n-nodes-base.notionTool",
+ "typeVersion": 2.2,
+ "position": [
+ 180,
+ 440
+ ],
+ "id": "08100637-a522-4b17-b7c5-d44a32395b51",
+ "name": "notion_get_all_approved_prescriptions",
+ "credentials": {
+ "notionApi": {
+ "id": "hadpTbTQdQ3XwOJm",
+ "name": "local n8n-notion"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "resource": "databasePage",
+ "operation": "getAll",
+ "databaseId": {
+ "__rl": true,
+ "value": "1a5edbae-baa8-8104-b2b9-f89a3a5415b7",
+ "mode": "list",
+ "cachedResultName": "Medications",
+ "cachedResultUrl": "https://www.notion.so/1a5edbaebaa88104b2b9f89a3a5415b7"
+ },
+ "returnAll": true,
+ "options": {}
+ },
+ "type": "n8n-nodes-base.notionTool",
+ "typeVersion": 2.2,
+ "position": [
+ 240,
+ 200
+ ],
+ "id": "54798506-b740-4c19-a2b4-8c49cac01525",
+ "name": "notion_get_all_medication_names",
+ "credentials": {
+ "notionApi": {
+ "id": "hadpTbTQdQ3XwOJm",
+ "name": "local n8n-notion"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "resource": "databasePage",
+ "databaseId": {
+ "__rl": true,
+ "value": "1a5edbae-baa8-8108-8115-c3e9e069c8bc",
+ "mode": "list",
+ "cachedResultName": "Prescription orders",
+ "cachedResultUrl": "https://www.notion.so/1a5edbaebaa881088115c3e9e069c8bc"
+ },
+ "title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', `The full name of the patient`, 'string') }}",
+ "propertiesUi": {
+ "propertyValues": [
+ {
+ "key": "Medication|rich_text",
+ "textContent": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', `The name of the prescribed medication`, 'string') }}"
+ },
+ {
+ "key": "Order date|date",
+ "includeTime": false,
+ "date": "={{ $now }}"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.notionTool",
+ "typeVersion": 2.2,
+ "position": [
+ 420,
+ 200
+ ],
+ "id": "98a42472-94f3-49da-b98c-73f2a8ccf860",
+ "name": "notion_add_order",
+ "credentials": {
+ "notionApi": {
+ "id": "hadpTbTQdQ3XwOJm",
+ "name": "local n8n-notion"
+ }
+ }
+ }
+ ],
+ "pinData": {},
+ "connections": {
+ "When chat message received": {
+ "main": [
+ [
+ {
+ "node": "AI Agent",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Window Buffer Memory": {
+ "ai_memory": [
+ [
+ {
+ "node": "AI Agent",
+ "type": "ai_memory",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "OpenAI Chat Model": {
+ "ai_languageModel": [
+ [
+ {
+ "node": "AI Agent",
+ "type": "ai_languageModel",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "notion_get_all_patients": {
+ "ai_tool": [
+ [
+ {
+ "node": "AI Agent",
+ "type": "ai_tool",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "notion_get_all_approved_prescriptions": {
+ "ai_tool": [
+ [
+ {
+ "node": "AI Agent",
+ "type": "ai_tool",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "notion_get_all_medication_names": {
+ "ai_tool": [
+ [
+ {
+ "node": "AI Agent",
+ "type": "ai_tool",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "notion_add_order": {
+ "ai_tool": [
+ [
+ {
+ "node": "AI Agent",
+ "type": "ai_tool",
+ "index": 0
+ }
+ ]
+ ]
+ }
+ },
+ "active": false,
+ "settings": {
+ "executionOrder": "v1"
+ },
+ "versionId": "cda193d6-df39-466b-bf44-8cbeb0743917",
+ "meta": {
+ "templateCredsSetupCompleted": true,
+ "instanceId": "636db6b6ab21a21c6458e2137f340e33dc3e49f5a1c560c8d1e2372c227cf40e"
+ },
+ "id": "LLxs2jwlPWDUX0XN",
+ "tags": []
+}
\ No newline at end of file
diff --git a/episode_2/daily_digest.json b/episode_2/daily_digest.json
new file mode 100644
index 0000000..f1b93e3
--- /dev/null
+++ b/episode_2/daily_digest.json
@@ -0,0 +1,1185 @@
+{
+ "name": "Daily digest",
+ "nodes": [
+ {
+ "parameters": {
+ "rule": {
+ "interval": [
+ {
+ "field": "cronExpression",
+ "expression": "0 9 * * 1-5"
+ }
+ ]
+ }
+ },
+ "type": "n8n-nodes-base.scheduleTrigger",
+ "typeVersion": 1.2,
+ "position": [
+ -840,
+ 400
+ ],
+ "id": "0b16d999-8207-416c-9d8a-1c20b17a7a37",
+ "name": "Schedule Trigger"
+ },
+ {
+ "parameters": {
+ "url": "https://feeds.businessinsider.com/custom/all",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.rssFeedRead",
+ "typeVersion": 1.1,
+ "position": [
+ -300,
+ 0
+ ],
+ "id": "c699bcf1-7c0e-4ddc-9b4d-a350c4032778",
+ "name": "business insider"
+ },
+ {
+ "parameters": {
+ "url": "http://rss.cnn.com/rss/money_topstories.rss",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.rssFeedRead",
+ "typeVersion": 1.1,
+ "position": [
+ -300,
+ -160
+ ],
+ "id": "5696ca20-43b3-4913-b4fd-a1f82d975f60",
+ "name": "cnn"
+ },
+ {
+ "parameters": {},
+ "type": "n8n-nodes-base.merge",
+ "typeVersion": 3,
+ "position": [
+ -80,
+ -80
+ ],
+ "id": "7f0cfcb2-2612-4f86-b0f2-b68a88ddfbad",
+ "name": "Merge"
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "fe0167d3-2e87-4b6b-a7b7-3993cafce60e",
+ "name": "title",
+ "value": "={{ $json.title }}",
+ "type": "string"
+ },
+ {
+ "id": "cd5318c7-c8b8-45a0-b0a1-00afecdc819c",
+ "name": "contentSnippet",
+ "value": "={{ $json.contentSnippet }}",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 140,
+ -80
+ ],
+ "id": "73051173-2cd9-4689-9624-ea6e6558da20",
+ "name": "Edit Fields"
+ },
+ {
+ "parameters": {
+ "aggregate": "aggregateAllItemData",
+ "destinationFieldName": "news",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.aggregate",
+ "typeVersion": 1,
+ "position": [
+ 360,
+ -80
+ ],
+ "id": "146994a7-67c9-446b-9fe4-cf36495859eb",
+ "name": "Aggregate"
+ },
+ {
+ "parameters": {
+ "promptType": "define",
+ "text": "=Create a summary of the biggest news stories in the last 24 hours.\nMake sure to categorize the news by topics, and list the title and the summary under each category.\n\n<news>\n{{ JSON.stringify($json.news) }}\n</news> \n"
+ },
+ "type": "@n8n/n8n-nodes-langchain.chainLlm",
+ "typeVersion": 1.5,
+ "position": [
+ 580,
+ -80
+ ],
+ "id": "68574ace-e7e4-49ce-b502-e97df8bf29bf",
+ "name": "Basic LLM Chain"
+ },
+ {
+ "parameters": {
+ "model": {
+ "__rl": true,
+ "mode": "list",
+ "value": "gpt-4o-mini"
+ },
+ "options": {}
+ },
+ "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
+ "typeVersion": 1.2,
+ "position": [
+ 500,
+ 140
+ ],
+ "id": "0f959448-8208-48b3-b8b3-2fc98e54b499",
+ "name": "OpenAI Chat Model",
+ "credentials": {
+ "openAiApi": {
+ "id": "9z2BF40dqIRV3ovL",
+ "name": "OpenAI"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "f1472042-3f7a-4fe3-b4f3-4cb377e5ceb8",
+ "name": "news",
+ "value": "={{ $json.text }}",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 940,
+ -80
+ ],
+ "id": "684acea8-8df5-4e87-b656-f92b12f6ccbf",
+ "name": "Edit Fields1"
+ },
+ {
+ "parameters": {
+ "content": "# News",
+ "height": 620,
+ "width": 1720
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ -380,
+ -300
+ ],
+ "id": "ad462f94-bd3b-4c60-be31-2d2b5ffeb971",
+ "name": "Sticky Note"
+ },
+ {
+ "parameters": {
+ "numberInputs": 4
+ },
+ "type": "n8n-nodes-base.merge",
+ "typeVersion": 3,
+ "position": [
+ 1880,
+ 380
+ ],
+ "id": "e1923af5-8e37-44c3-bd49-db9b64ddbfd9",
+ "name": "Merge1"
+ },
+ {
+ "parameters": {
+ "operation": "5DayForecast",
+ "format": "imperial",
+ "cityName": "los angeles,us"
+ },
+ "type": "n8n-nodes-base.openWeatherMap",
+ "typeVersion": 1,
+ "position": [
+ -300,
+ 700
+ ],
+ "id": "d5bf3c95-4427-4b67-9e98-9ee2d65aa754",
+ "name": "OpenWeatherMap",
+ "credentials": {
+ "openWeatherMapApi": {
+ "id": "gTK9YmLWx133jqwn",
+ "name": "OpenWeatherMap"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "fieldToSplitOut": "list",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.splitOut",
+ "typeVersion": 1,
+ "position": [
+ -60,
+ 700
+ ],
+ "id": "cac0b96d-0d38-44ed-b5a8-7516c648bb7c",
+ "name": "Split Out"
+ },
+ {
+ "parameters": {
+ "conditions": {
+ "options": {
+ "caseSensitive": true,
+ "leftValue": "",
+ "typeValidation": "strict",
+ "version": 2
+ },
+ "conditions": [
+ {
+ "id": "ca2a4f67-c574-47a8-9aeb-3a586140943f",
+ "leftValue": "={{ $now.plus(1, \"days\").toSeconds() > $json.dt }}",
+ "rightValue": "",
+ "operator": {
+ "type": "boolean",
+ "operation": "true",
+ "singleValue": true
+ }
+ }
+ ],
+ "combinator": "and"
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.filter",
+ "typeVersion": 2.2,
+ "position": [
+ 160,
+ 700
+ ],
+ "id": "24b87753-5c93-4465-ad1d-8b8ff28ff295",
+ "name": "Filter"
+ },
+ {
+ "parameters": {
+ "aggregate": "aggregateAllItemData",
+ "destinationFieldName": "weather_forecast",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.aggregate",
+ "typeVersion": 1,
+ "position": [
+ 380,
+ 700
+ ],
+ "id": "8878a4f7-344d-42a3-a2dd-feecf4ac8cda",
+ "name": "Aggregate1"
+ },
+ {
+ "parameters": {
+ "promptType": "define",
+ "text": "=Summarize the weather forecast for the next 24 hours using the provided forecast data. \nAdd clothing suggestions for a middle aged female who typically wears casual clothing.\nPlease note if she needs to carry an umbrella.\nThe summary should be an overview for the day, don't provide hourly breakdown on the weather changes.\n\n<WeatherForecast>\n{{ JSON.stringify($json.weather_forecast) }}\n</WeatherForecast>"
+ },
+ "type": "@n8n/n8n-nodes-langchain.chainLlm",
+ "typeVersion": 1.5,
+ "position": [
+ 600,
+ 700
+ ],
+ "id": "3f602627-157d-41be-beb6-f793cf153bce",
+ "name": "Basic LLM Chain1"
+ },
+ {
+ "parameters": {
+ "model": {
+ "__rl": true,
+ "mode": "list",
+ "value": "gpt-4o-mini"
+ },
+ "options": {}
+ },
+ "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
+ "typeVersion": 1.2,
+ "position": [
+ 560,
+ 880
+ ],
+ "id": "d2ead07a-ca9b-4a88-abd5-aaa7d8d131b4",
+ "name": "OpenAI Chat Model1",
+ "credentials": {
+ "openAiApi": {
+ "id": "9z2BF40dqIRV3ovL",
+ "name": "OpenAI"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "0dfe8ddb-2165-43d1-9114-4abffc3ecfbc",
+ "name": "weather_forecast",
+ "value": "={{ $json.text }}",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 960,
+ 700
+ ],
+ "id": "5f4338b7-65a7-492a-b03f-5ae64f50b115",
+ "name": "Edit Fields2"
+ },
+ {
+ "parameters": {
+ "content": "# Weather",
+ "height": 600,
+ "width": 1720
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ -380,
+ 540
+ ],
+ "id": "a5538857-d109-4cfb-9657-1358bd22da5c",
+ "name": "Sticky Note1"
+ },
+ {
+ "parameters": {
+ "operation": "getAll",
+ "simple": false,
+ "filters": {
+ "labelIds": [
+ "CATEGORY_PERSONAL"
+ ],
+ "readStatus": "unread",
+ "receivedAfter": "={{ $now.minus(1, \"day\") }}"
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.gmail",
+ "typeVersion": 2.1,
+ "position": [
+ -220,
+ 1400
+ ],
+ "id": "4ae8e742-28aa-45eb-918e-db6e0c82d539",
+ "name": "Gmail",
+ "webhookId": "c485b21f-207d-4efb-9e85-566ff2e3de15",
+ "credentials": {
+ "gmailOAuth2": {
+ "id": "E1ofNfqugb4UykcT",
+ "name": "Gmail 2rum2room2"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "c5d24917-c196-4979-b118-40bedcf0511a",
+ "name": "email",
+ "value": "={{ $json.text }}",
+ "type": "string"
+ },
+ {
+ "id": "f99c070e-5e12-4b9f-8a46-84cad215c4d5",
+ "name": "from",
+ "value": "={{ $json.from.value }}",
+ "type": "array"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 0,
+ 1400
+ ],
+ "id": "f644eea4-4049-483b-b3db-c74a8d7fbe69",
+ "name": "Edit Fields3"
+ },
+ {
+ "parameters": {
+ "aggregate": "aggregateAllItemData",
+ "destinationFieldName": "emails",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.aggregate",
+ "typeVersion": 1,
+ "position": [
+ 220,
+ 1400
+ ],
+ "id": "8b6de565-0a0d-47ff-b947-189240062045",
+ "name": "Aggregate2"
+ },
+ {
+ "parameters": {
+ "promptType": "define",
+ "text": "=Extract all the emails that were sent by humans and aren't newsletters or system updates or calendar updates and summarize the emails in one sentence for a digest and add who (name + email) sent the email.\n\n<emails>\n{{ $json.emails.map(item => `\\n<email>\\n<from>\\n${JSON.stringify(item.from)}\\n</from>\\n<body>\\n${item.email}\\n</body>\\n</email>\\n`).join('') }}\n</emails>\n",
+ "hasOutputParser": true
+ },
+ "type": "@n8n/n8n-nodes-langchain.chainLlm",
+ "typeVersion": 1.5,
+ "position": [
+ 440,
+ 1400
+ ],
+ "id": "2a13a119-e213-4737-a720-af35fc5c9577",
+ "name": "Basic LLM Chain2"
+ },
+ {
+ "parameters": {
+ "model": {
+ "__rl": true,
+ "mode": "list",
+ "value": "gpt-4o-mini"
+ },
+ "options": {}
+ },
+ "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
+ "typeVersion": 1.2,
+ "position": [
+ 400,
+ 1620
+ ],
+ "id": "c94f0d02-c3aa-40c3-82dc-9acab3ecefeb",
+ "name": "OpenAI Chat Model2",
+ "credentials": {
+ "openAiApi": {
+ "id": "9z2BF40dqIRV3ovL",
+ "name": "OpenAI"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "jsonSchemaExample": "{\n\t\"emails\": [\"email 1\", \"email 2\"]\n}"
+ },
+ "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
+ "typeVersion": 1.2,
+ "position": [
+ 580,
+ 1620
+ ],
+ "id": "911a632f-b9be-44f3-94d3-0a7afa5bdc95",
+ "name": "Structured Output Parser"
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "8b795abf-c0d7-42f9-aa3d-f5a4ed47dda1",
+ "name": "emails",
+ "value": "={{ JSON.stringify($json.output.emails) }}",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 800,
+ 1400
+ ],
+ "id": "553c916b-8c64-4817-a02f-a4e22f378fd4",
+ "name": "Edit Fields4"
+ },
+ {
+ "parameters": {
+ "content": "# Emails",
+ "height": 480,
+ "width": 1500
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ -380,
+ 1320
+ ],
+ "id": "c8323aef-0af0-4390-8b21-54c284afaf9a",
+ "name": "Sticky Note2"
+ },
+ {
+ "parameters": {
+ "operation": "getAll",
+ "calendar": {
+ "__rl": true,
+ "value": "[email protected]",
+ "mode": "list",
+ "cachedResultName": "[email protected]"
+ },
+ "timeMax": "={{ $now.plus({ days: 1 }) }}",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.googleCalendar",
+ "typeVersion": 1.3,
+ "position": [
+ -260,
+ 2160
+ ],
+ "id": "c5cc9012-51cf-40fa-9d16-f49d0a1ebeff",
+ "name": "Google Calendar",
+ "credentials": {
+ "googleCalendarOAuth2Api": {
+ "id": "Qys2Y2daXPMBhCyH",
+ "name": "Google Calendar account 2"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "c2ed0b62-fb10-4d36-a53e-b448f385b93f",
+ "name": "summary",
+ "value": "={{ $json.summary }}",
+ "type": "string"
+ },
+ {
+ "id": "a224249f-f845-43a2-b50c-805212713481",
+ "name": "startDate",
+ "value": "={{ $json.start.dateTime }}",
+ "type": "string"
+ },
+ {
+ "id": "60793d7b-ba96-4114-9682-b722d7402f7a",
+ "name": "timezone",
+ "value": "={{ $json.start.timeZone }}",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ -40,
+ 2160
+ ],
+ "id": "e30bef49-6dd7-4883-acb4-6317f47e16f6",
+ "name": "Edit Fields5"
+ },
+ {
+ "parameters": {
+ "aggregate": "aggregateAllItemData",
+ "destinationFieldName": "calendar_events",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.aggregate",
+ "typeVersion": 1,
+ "position": [
+ 180,
+ 2160
+ ],
+ "id": "adb5dd8e-846a-4e6d-b1e9-b2ccfd6cb8df",
+ "name": "Aggregate3"
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "768d5214-4d37-4b8f-9cbb-e34305e68381",
+ "name": "calendar_events",
+ "value": "={{ JSON.stringify($json.calendar_events) }}",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 400,
+ 2160
+ ],
+ "id": "64b20097-2a25-4ee5-91c2-a54d89d2ed78",
+ "name": "Edit Fields6"
+ },
+ {
+ "parameters": {
+ "content": "# Calendar",
+ "height": 440,
+ "width": 1120
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ -380,
+ 1960
+ ],
+ "id": "1604da9b-d170-44c7-a834-6ece8201580a",
+ "name": "Sticky Note3"
+ },
+ {
+ "parameters": {
+ "fieldsToAggregate": {
+ "fieldToAggregate": [
+ {
+ "fieldToAggregate": "news"
+ },
+ {
+ "fieldToAggregate": "weather_forecast"
+ },
+ {
+ "fieldToAggregate": "emails"
+ },
+ {
+ "fieldToAggregate": "calendar_events"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.aggregate",
+ "typeVersion": 1,
+ "position": [
+ 2100,
+ 400
+ ],
+ "id": "975c0dbb-a077-48d0-b5b3-a8a752bea03c",
+ "name": "Aggregate4"
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "68158149-a655-4cba-857d-e1b289bd750f",
+ "name": "news",
+ "value": "={{ $json.news[0] }}",
+ "type": "string"
+ },
+ {
+ "id": "c3d828f7-f9a5-47b4-9e0f-03eea9e4b7bb",
+ "name": "weather_forecast",
+ "value": "={{ $json.weather_forecast[0] }}",
+ "type": "string"
+ },
+ {
+ "id": "531afbd6-339e-4408-bfc4-7c2daca1a751",
+ "name": "emails",
+ "value": "={{ $json.emails[0] }}",
+ "type": "string"
+ },
+ {
+ "id": "05bb70c2-ec0a-4b38-a08c-6d5c3bd44d06",
+ "name": "calendar_events",
+ "value": "={{ $json.calendar_events[0] }}",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 2320,
+ 400
+ ],
+ "id": "aef32391-f74c-4ca9-8985-73f8b573d264",
+ "name": "Edit Fields7"
+ },
+ {
+ "parameters": {
+ "promptType": "define",
+ "text": "=\nCreate a daily digest from the data below.\nUse a personal, light-hearted tone (2nd person). \nUse the `send_daily_digest` tool to send the digest.\n\nThe elements of to include (from the source data)\n1. Weather forecast\n2. News\n3. Emails\n4. Calendar events\n\n<DataSource>\n<News>\n{{ $json.news }}\n</News>\n<WeatherForecast>\n{{ $json.weather_forecast }}\n</WeatherForecast>\n<Emails>\n{{ $json.emails }}\n</Emails>\n<CalendarEvents>\n{{ $json.calendar_events }}\n</CalendarEvents>\n</DataSource>\n\nMake sure to format the email as raw text with proper new lines, separating everything.\nDo not use any markdown - as it will be read on mobile. Don't use any bold, other styling.\n\nExample formating:\n\nHi there,\n\nToday's weather\n- forecast\n- clothing recommendations\n\nUnread emails\n- email 1\n- email 2\n\nToday's events\n- event 1\n- event 2\n\nLatest news\n\nCategory 1\n- news item 1\n\nCategory 2\n- news item 1\n\nHave a great day, Miri!",
+ "options": {}
+ },
+ "type": "@n8n/n8n-nodes-langchain.agent",
+ "typeVersion": 1.7,
+ "position": [
+ 3000,
+ 400
+ ],
+ "id": "99b4c5ec-7084-4eef-a10d-d022c37531cf",
+ "name": "AI Agent"
+ },
+ {
+ "parameters": {
+ "model": {
+ "__rl": true,
+ "mode": "list",
+ "value": "gpt-4o-mini"
+ },
+ "options": {}
+ },
+ "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
+ "typeVersion": 1.2,
+ "position": [
+ 2920,
+ 640
+ ],
+ "id": "8d436468-15e4-44be-b76c-cfe0e56fff6f",
+ "name": "OpenAI Chat Model3",
+ "credentials": {
+ "openAiApi": {
+ "id": "9z2BF40dqIRV3ovL",
+ "name": "OpenAI"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "sendTo": "[email protected]",
+ "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
+ "emailType": "text",
+ "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.gmailTool",
+ "typeVersion": 2.1,
+ "position": [
+ 3160,
+ 620
+ ],
+ "id": "ed44dc4e-578f-48e4-9558-1ae6b50dc8f7",
+ "name": "send_digest",
+ "webhookId": "162a213b-823b-4420-8c95-05e882822299",
+ "credentials": {
+ "gmailOAuth2": {
+ "id": "E1ofNfqugb4UykcT",
+ "name": "Gmail 2rum2room2"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "content": "# Build and send digest",
+ "height": 500,
+ "width": 640,
+ "color": 4
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ 2780,
+ 300
+ ],
+ "id": "90367bfc-2bb2-4a89-a0a3-cb3e637ab201",
+ "name": "Sticky Note4"
+ },
+ {
+ "parameters": {
+ "content": "# Prepare the data",
+ "height": 460,
+ "width": 720
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ 1800,
+ 240
+ ],
+ "id": "88400a74-eba1-4721-8318-4d366b793cf3",
+ "name": "Sticky Note5"
+ }
+ ],
+ "pinData": {},
+ "connections": {
+ "Schedule Trigger": {
+ "main": [
+ [
+ {
+ "node": "cnn",
+ "type": "main",
+ "index": 0
+ },
+ {
+ "node": "business insider",
+ "type": "main",
+ "index": 0
+ },
+ {
+ "node": "OpenWeatherMap",
+ "type": "main",
+ "index": 0
+ },
+ {
+ "node": "Gmail",
+ "type": "main",
+ "index": 0
+ },
+ {
+ "node": "Google Calendar",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "cnn": {
+ "main": [
+ [
+ {
+ "node": "Merge",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "business insider": {
+ "main": [
+ [
+ {
+ "node": "Merge",
+ "type": "main",
+ "index": 1
+ }
+ ]
+ ]
+ },
+ "Merge": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Edit Fields": {
+ "main": [
+ [
+ {
+ "node": "Aggregate",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Aggregate": {
+ "main": [
+ [
+ {
+ "node": "Basic LLM Chain",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "OpenAI Chat Model": {
+ "ai_languageModel": [
+ [
+ {
+ "node": "Basic LLM Chain",
+ "type": "ai_languageModel",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Basic LLM Chain": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields1",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Edit Fields1": {
+ "main": [
+ [
+ {
+ "node": "Merge1",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "OpenWeatherMap": {
+ "main": [
+ [
+ {
+ "node": "Split Out",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Split Out": {
+ "main": [
+ [
+ {
+ "node": "Filter",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Filter": {
+ "main": [
+ [
+ {
+ "node": "Aggregate1",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Aggregate1": {
+ "main": [
+ [
+ {
+ "node": "Basic LLM Chain1",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "OpenAI Chat Model1": {
+ "ai_languageModel": [
+ [
+ {
+ "node": "Basic LLM Chain1",
+ "type": "ai_languageModel",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Basic LLM Chain1": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields2",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Gmail": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields3",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Edit Fields3": {
+ "main": [
+ [
+ {
+ "node": "Aggregate2",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Aggregate2": {
+ "main": [
+ [
+ {
+ "node": "Basic LLM Chain2",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "OpenAI Chat Model2": {
+ "ai_languageModel": [
+ [
+ {
+ "node": "Basic LLM Chain2",
+ "type": "ai_languageModel",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Structured Output Parser": {
+ "ai_outputParser": [
+ [
+ {
+ "node": "Basic LLM Chain2",
+ "type": "ai_outputParser",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Basic LLM Chain2": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields4",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Google Calendar": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields5",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Edit Fields5": {
+ "main": [
+ [
+ {
+ "node": "Aggregate3",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Aggregate3": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields6",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Edit Fields2": {
+ "main": [
+ [
+ {
+ "node": "Merge1",
+ "type": "main",
+ "index": 1
+ }
+ ]
+ ]
+ },
+ "Edit Fields4": {
+ "main": [
+ [
+ {
+ "node": "Merge1",
+ "type": "main",
+ "index": 2
+ }
+ ]
+ ]
+ },
+ "Edit Fields6": {
+ "main": [
+ [
+ {
+ "node": "Merge1",
+ "type": "main",
+ "index": 3
+ }
+ ]
+ ]
+ },
+ "Merge1": {
+ "main": [
+ [
+ {
+ "node": "Aggregate4",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Aggregate4": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields7",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Edit Fields7": {
+ "main": [
+ [
+ {
+ "node": "AI Agent",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "OpenAI Chat Model3": {
+ "ai_languageModel": [
+ [
+ {
+ "node": "AI Agent",
+ "type": "ai_languageModel",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "send_digest": {
+ "ai_tool": [
+ [
+ {
+ "node": "AI Agent",
+ "type": "ai_tool",
+ "index": 0
+ }
+ ]
+ ]
+ }
+ },
+ "active": false,
+ "settings": {
+ "executionOrder": "v1"
+ },
+ "versionId": "8fa463c2-4112-4a7e-8883-0e467f16cbc0",
+ "meta": {
+ "templateCredsSetupCompleted": true,
+ "instanceId": "636db6b6ab21a21c6458e2137f340e33dc3e49f5a1c560c8d1e2372c227cf40e"
+ },
+ "id": "E7MvzxYrEXnM4sDf",
+ "tags": []
+}
\ No newline at end of file
diff --git a/episode_3/Create_a_LinkedIn_post__with_approval.json b/episode_3/Create_a_LinkedIn_post__with_approval.json
new file mode 100644
index 0000000..e9f6d6a
--- /dev/null
+++ b/episode_3/Create_a_LinkedIn_post__with_approval.json
@@ -0,0 +1,825 @@
+{
+ "name": "Create a LinkedIn post (with approval)",
+ "nodes": [
+ {
+ "parameters": {},
+ "type": "n8n-nodes-base.manualTrigger",
+ "typeVersion": 1,
+ "position": [
+ -300,
+ 0
+ ],
+ "id": "73fde98a-7475-4dc3-9fca-5f12ae3d1725",
+ "name": "When clicking ‘Test workflow’"
+ },
+ {
+ "parameters": {
+ "url": "https://venturebeat.com/category/ai/feed/",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.rssFeedRead",
+ "typeVersion": 1.1,
+ "position": [
+ 440,
+ 0
+ ],
+ "id": "5f97ff6d-1470-407b-8cd7-fa38d14dac3e",
+ "name": "RSS Read"
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "c5321485-5348-4ca3-83af-3daf61b150d0",
+ "name": "title",
+ "value": "={{ $json.title }}",
+ "type": "string"
+ },
+ {
+ "id": "705a2b08-41fa-4764-b533-c855249eac53",
+ "name": "link",
+ "value": "={{ $json.link }}",
+ "type": "string"
+ },
+ {
+ "id": "b56b4d7d-9b6d-468f-a8c6-2ba9f2b13414",
+ "name": "contentSnippet",
+ "value": "={{ $json.contentSnippet }}",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 660,
+ 0
+ ],
+ "id": "bfc75237-1c35-4aac-91b5-ed15d022e881",
+ "name": "Edit Fields"
+ },
+ {
+ "parameters": {
+ "aggregate": "aggregateAllItemData",
+ "destinationFieldName": "news",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.aggregate",
+ "typeVersion": 1,
+ "position": [
+ 880,
+ 0
+ ],
+ "id": "78c29d9d-c0a2-454b-b60b-7e03e285a59e",
+ "name": "Aggregate"
+ },
+ {
+ "parameters": {
+ "promptType": "define",
+ "text": "=I'm creating a weekly digest from the latest AI articles for SMB executives. \nHelp me to pick 5 articles worth reading for these executives.\nOnly pick the ones that would be interesting for small and medium business owners.\n\n```\n{{ JSON.stringify($json.news) }}\n```",
+ "hasOutputParser": true
+ },
+ "type": "@n8n/n8n-nodes-langchain.chainLlm",
+ "typeVersion": 1.5,
+ "position": [
+ 1100,
+ 0
+ ],
+ "id": "dde88d75-8b33-445d-bbde-a04e0449519b",
+ "name": "Basic LLM Chain"
+ },
+ {
+ "parameters": {
+ "jsonSchemaExample": "{\n\t\"articles\": [{\n \"title\": \"\",\n \"link\": \"\"\n }]\n}"
+ },
+ "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
+ "typeVersion": 1.2,
+ "position": [
+ 1380,
+ 240
+ ],
+ "id": "58d9b332-f8f6-476f-8914-8d54f7330312",
+ "name": "Structured Output Parser"
+ },
+ {
+ "parameters": {
+ "fieldToSplitOut": "output.articles",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.splitOut",
+ "typeVersion": 1,
+ "position": [
+ 440,
+ 460
+ ],
+ "id": "e747196c-69b9-4ee1-a9b7-bbc4b0590364",
+ "name": "Split Out"
+ },
+ {
+ "parameters": {
+ "url": "={{ $json.link }}",
+ "options": {
+ "redirect": {
+ "redirect": {}
+ }
+ }
+ },
+ "type": "n8n-nodes-base.httpRequest",
+ "typeVersion": 4.2,
+ "position": [
+ 660,
+ 460
+ ],
+ "id": "2d0fcb22-8b61-4e9f-aed7-567f45a9aff3",
+ "name": "HTTP Request"
+ },
+ {
+ "parameters": {
+ "operation": "extractHtmlContent",
+ "extractionValues": {
+ "values": [
+ {
+ "key": "article",
+ "cssSelector": "article",
+ "skipSelectors": ".post-boilerplate,.boilerplate-before"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.html",
+ "typeVersion": 1.2,
+ "position": [
+ 880,
+ 460
+ ],
+ "id": "f19cfa14-88f8-41a0-a32d-234b9483ad01",
+ "name": "HTML"
+ },
+ {
+ "parameters": {
+ "aggregate": "aggregateAllItemData",
+ "destinationFieldName": "articles",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.aggregate",
+ "typeVersion": 1,
+ "position": [
+ 1100,
+ 460
+ ],
+ "id": "fc5dd714-3368-4461-9ac8-13d660d5c772",
+ "name": "Aggregate1"
+ },
+ {
+ "parameters": {
+ "promptType": "define",
+ "text": "=Create a LinkedIn post with the title \"Here is everything that happened in AI this week\" and use the articles below to create an engaging content for SMB business owners.\n\n<instructions>\n- Don't use any markdown for the LinkedIn post as it's not supported (no bold, heading etc.) Use clear text for formatting.\n- Make sure to add the link to the article under its summary.\n- Add a summary of the post (hook) to the beginning of the post. It should consist of 2 short sentences, and needs to grab the attention. Make sure to mention AI in it.\n- also make sure the news summaries explains why it's important for SMB business owners, make it one sentence.\n</instructions>\n\n<articles>\n{{ JSON.stringify($json.articles) }}\n</articles>"
+ },
+ "type": "@n8n/n8n-nodes-langchain.chainLlm",
+ "typeVersion": 1.5,
+ "position": [
+ 680,
+ 920
+ ],
+ "id": "c9a3c302-b0fb-4f01-9e42-8e5d3341ac8a",
+ "name": "Basic LLM Chain1"
+ },
+ {
+ "parameters": {
+ "promptType": "define",
+ "text": "=Rewrite the following linkedin post to match the style of the example post.\nMake sure to keep it as plain text.\n\n<ExamplePost>\n{{ $('Writing style').item.json.your_style }}\n</ExamplePost>\n\n<Article>\n{{ $json.text }}\n</Article>"
+ },
+ "type": "@n8n/n8n-nodes-langchain.chainLlm",
+ "typeVersion": 1.5,
+ "position": [
+ 1040,
+ 920
+ ],
+ "id": "5f50e681-33fe-4269-98ea-fd0da357207f",
+ "name": "Basic LLM Chain2"
+ },
+ {
+ "parameters": {
+ "operation": "sendAndWait",
+ "sendTo": "[email protected]",
+ "subject": "[action required] LinkedIn post approval is needed",
+ "message": "={{ $json.linkedin_post }}",
+ "responseType": "customForm",
+ "formFields": {
+ "values": [
+ {
+ "fieldLabel": "Do you approve the post?",
+ "fieldType": "dropdown",
+ "fieldOptions": {
+ "values": [
+ {
+ "option": "yes"
+ },
+ {
+ "option": "no - I'll add my change requests below"
+ }
+ ]
+ },
+ "requiredField": true
+ },
+ {
+ "fieldLabel": "Change requests",
+ "fieldType": "textarea",
+ "placeholder": "Add your change requests here"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.gmail",
+ "typeVersion": 2.1,
+ "position": [
+ 1260,
+ 1400
+ ],
+ "id": "8cc43d5a-aac3-46b1-9cd3-5125c0dfb3fb",
+ "name": "Gmail",
+ "webhookId": "1b16f0aa-aa5f-431f-8e85-247f4e981d6c",
+ "credentials": {
+ "gmailOAuth2": {
+ "id": "E1ofNfqugb4UykcT",
+ "name": "Gmail 2rum2room2"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "conditions": {
+ "options": {
+ "caseSensitive": true,
+ "leftValue": "",
+ "typeValidation": "strict",
+ "version": 2
+ },
+ "conditions": [
+ {
+ "id": "298e856c-87fa-4751-a235-eabed33f0f43",
+ "leftValue": "={{ $json.data['Do you approve the post?'] }}",
+ "rightValue": "yes",
+ "operator": {
+ "type": "string",
+ "operation": "equals",
+ "name": "filter.operator.equals"
+ }
+ }
+ ],
+ "combinator": "and"
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.if",
+ "typeVersion": 2.2,
+ "position": [
+ 1560,
+ 1400
+ ],
+ "id": "482855b9-b956-4764-a5c1-b91ac7b5f3c4",
+ "name": "If"
+ },
+ {
+ "parameters": {
+ "promptType": "define",
+ "text": "=Apply the modification requests on the following LinkedIn post. Besides applying the reqested modifications, return the same linkedin post.\n\nLinkedIn post:\n```\n{{ $('Edit Fields1').item.json.linkedin_post }}\n```\n\nChange requests:\n{{ $json.data['Change requests'] }}",
+ "hasOutputParser": true
+ },
+ "type": "@n8n/n8n-nodes-langchain.chainLlm",
+ "typeVersion": 1.5,
+ "position": [
+ 1180,
+ 1760
+ ],
+ "id": "9fe4e696-78b9-450c-8dfe-3534aa497cd2",
+ "name": "Basic LLM Chain3"
+ },
+ {
+ "parameters": {
+ "jsonSchemaExample": "{\n\t\"modified_post\": \"\"\n}"
+ },
+ "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
+ "typeVersion": 1.2,
+ "position": [
+ 1420,
+ 2000
+ ],
+ "id": "03742a64-3d46-40c1-a490-92a55a2f181d",
+ "name": "Structured Output Parser1"
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "a593cd1a-0603-4b52-9d1f-2f2f717651ff",
+ "name": "linkedin_post",
+ "value": "={{ $json.text }}",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 1020,
+ 1400
+ ],
+ "id": "095112d6-fad0-4cf0-9f9d-d19734f5865e",
+ "name": "Edit Fields1"
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "f2075dc4-d6b0-46d9-aad8-247c054432ec",
+ "name": "text",
+ "value": "={{ $json.output.modified_post }}",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 1560,
+ 1760
+ ],
+ "id": "e1ff2b2c-9cb8-44b4-aeae-94b4f54adbf1",
+ "name": "Edit Fields2"
+ },
+ {
+ "parameters": {
+ "person": "F_0mve6gG0",
+ "text": "={{ $('Edit Fields1').item.json.linkedin_post }}",
+ "additionalFields": {}
+ },
+ "type": "n8n-nodes-base.linkedIn",
+ "typeVersion": 1,
+ "position": [
+ 2140,
+ 1380
+ ],
+ "id": "d419be2a-b354-44b4-9983-8bb68109bb24",
+ "name": "LinkedIn",
+ "credentials": {
+ "linkedInOAuth2Api": {
+ "id": "sOxyu51vK3iNtauN",
+ "name": "LinkedIn account 3"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "model": {
+ "__rl": true,
+ "value": "gpt-4o",
+ "mode": "list",
+ "cachedResultName": "gpt-4o"
+ },
+ "options": {}
+ },
+ "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
+ "typeVersion": 1.2,
+ "position": [
+ 660,
+ 1420
+ ],
+ "id": "7ba465f4-e758-4840-b52d-d847fd93a626",
+ "name": "gpt-4o",
+ "credentials": {
+ "openAiApi": {
+ "id": "9z2BF40dqIRV3ovL",
+ "name": "OpenAI"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "model": {
+ "__rl": true,
+ "mode": "list",
+ "value": "gpt-4o-mini"
+ },
+ "options": {}
+ },
+ "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
+ "typeVersion": 1.2,
+ "position": [
+ 340,
+ 1400
+ ],
+ "id": "601a56de-b256-49ca-a7d2-b85bd4b207b3",
+ "name": "gpt-4o-mini",
+ "credentials": {
+ "openAiApi": {
+ "id": "9z2BF40dqIRV3ovL",
+ "name": "OpenAI"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "content": "# Gather news articles",
+ "height": 80,
+ "width": 920
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ 440,
+ -120
+ ],
+ "id": "8cac87c7-c554-4713-80bf-46766820f350",
+ "name": "Sticky Note"
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "3474133c-bf58-4e48-aa50-bcebd919dc5b",
+ "name": "your_style",
+ "value": "=Dude... Firecrawl is amazing. Turn any website into LLM-ready data? Yes please. I just made a llms-full.txt of my website (all 80 blog posts! 🥵) using a free account.\n\nI then threw that 250k token .txt file into Gemini for some analysis to...\n- review the ontology of my work and see the big picture\n- psychoanalyze myself (lol of course)\n\namazing, after that I was both feeling proud of myself (🤩) and self-conscious of how obvious my psychological profile is from my published work (😅) so I figured I better make some real progress while I had all this data and an open chat with plenty of headroom in Gemini's sweet sweet 2m context window.\n\nSo I exported my google search console data for the past 3 months to add some analytical context to the content, and threw that into gemini too. Now we're up to ~300k tokens.\n\nI asked it to analyze my SEO and deliver a prioritized plan for improving my strategy.\n\nAnd not only did it give me a really thoughtful overview of my content map, it also was ready to give me an operational plan for improving the overall footprint, my linking strategies, etc. it also gave me some great non-obvious recommendations.\n\nFrankly, this has proven to be extremely effective. Just a year or two ago, this level of SEO analysis & strategic planning would easily have cost me a couple thousand bucks.\n\nBut now... I can do it for free with Claude Desktop + Firecrawl's MCP server, and Gemini 2.0 for 2M context window. \n\nNow... I just need to implement the 2 week plan it wrote for capitalizing on my top performing blogs it affectionately titled \"Stop The Bleeding\" lol, I appreciate Gemini's sense of urgency for improving my funnel.\n\nIt's a pity Squarespace is so poorly positioned for AI augmentation. I 100% have to move away from this platform to something that I can power agentically. \n\nI've thought about Ghost CMS, or building something myself with Lovable. But it's hard to prioritize that at the moment. It's a big lift to migrate a website to a new platform, even in this day and age. There's an opportunity in there somewhere for a hustler.\n\nAnyways, go play with Firecrawl. Well worth it. And if you’ve got this far and you don’t follow me yet… well… you know what to do",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 20,
+ 0
+ ],
+ "id": "0503812a-e4c6-43b0-99e5-857f4c381bd4",
+ "name": "Writing style"
+ },
+ {
+ "parameters": {
+ "content": "# Edit your writing style",
+ "height": 340,
+ "width": 190,
+ "color": 3
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ -20,
+ -180
+ ],
+ "id": "3aea4f53-5956-44e0-b164-d9f70b997c7e",
+ "name": "Sticky Note1"
+ },
+ {
+ "parameters": {
+ "content": "# Download article content",
+ "height": 80,
+ "width": 760
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ 440,
+ 340
+ ],
+ "id": "f34a66e6-5531-4c05-a4fb-1d263c3b1ed5",
+ "name": "Sticky Note2"
+ },
+ {
+ "parameters": {
+ "content": "# Create LinkedIn post content",
+ "height": 80,
+ "width": 620
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ 680,
+ 800
+ ],
+ "id": "dcb97ccf-b847-45fd-ae1c-58139463e43d",
+ "name": "Sticky Note3"
+ },
+ {
+ "parameters": {
+ "content": "# Approval process",
+ "height": 80,
+ "width": 640
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ 1020,
+ 1280
+ ],
+ "id": "4ffe9955-6636-47fd-a7b1-58bb19d3e660",
+ "name": "Sticky Note4"
+ },
+ {
+ "parameters": {
+ "content": "# Edit the post",
+ "height": 80,
+ "width": 480
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ 1180,
+ 1640
+ ],
+ "id": "76c390ea-d297-4f52-a0aa-8b8e6f7832f9",
+ "name": "Sticky Note5"
+ },
+ {
+ "parameters": {
+ "content": "# Post to LinkedIn",
+ "height": 260,
+ "width": 320,
+ "color": 4
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ 2100,
+ 1300
+ ],
+ "id": "e1edc57e-0b54-4b6e-8f62-95b1653b6d2a",
+ "name": "Sticky Note6"
+ }
+ ],
+ "pinData": {},
+ "connections": {
+ "When clicking ‘Test workflow’": {
+ "main": [
+ [
+ {
+ "node": "Writing style",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "RSS Read": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Edit Fields": {
+ "main": [
+ [
+ {
+ "node": "Aggregate",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Aggregate": {
+ "main": [
+ [
+ {
+ "node": "Basic LLM Chain",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Structured Output Parser": {
+ "ai_outputParser": [
+ [
+ {
+ "node": "Basic LLM Chain",
+ "type": "ai_outputParser",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Basic LLM Chain": {
+ "main": [
+ [
+ {
+ "node": "Split Out",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Split Out": {
+ "main": [
+ [
+ {
+ "node": "HTTP Request",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "HTTP Request": {
+ "main": [
+ [
+ {
+ "node": "HTML",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "HTML": {
+ "main": [
+ [
+ {
+ "node": "Aggregate1",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Aggregate1": {
+ "main": [
+ [
+ {
+ "node": "Basic LLM Chain1",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Basic LLM Chain1": {
+ "main": [
+ [
+ {
+ "node": "Basic LLM Chain2",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Basic LLM Chain2": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields1",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Gmail": {
+ "main": [
+ [
+ {
+ "node": "If",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "If": {
+ "main": [
+ [
+ {
+ "node": "LinkedIn",
+ "type": "main",
+ "index": 0
+ }
+ ],
+ [
+ {
+ "node": "Basic LLM Chain3",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Structured Output Parser1": {
+ "ai_outputParser": [
+ [
+ {
+ "node": "Basic LLM Chain3",
+ "type": "ai_outputParser",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Edit Fields1": {
+ "main": [
+ [
+ {
+ "node": "Gmail",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Basic LLM Chain3": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields2",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Edit Fields2": {
+ "main": [
+ [
+ {
+ "node": "Edit Fields1",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "gpt-4o": {
+ "ai_languageModel": [
+ [
+ {
+ "node": "Basic LLM Chain2",
+ "type": "ai_languageModel",
+ "index": 0
+ },
+ {
+ "node": "Basic LLM Chain3",
+ "type": "ai_languageModel",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "gpt-4o-mini": {
+ "ai_languageModel": [
+ [
+ {
+ "node": "Basic LLM Chain1",
+ "type": "ai_languageModel",
+ "index": 0
+ },
+ {
+ "node": "Basic LLM Chain",
+ "type": "ai_languageModel",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Writing style": {
+ "main": [
+ [
+ {
+ "node": "RSS Read",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ }
+ },
+ "active": false,
+ "settings": {
+ "executionOrder": "v1"
+ },
+ "versionId": "4b26266d-4ec8-4de2-a5af-76d1074d70c3",
+ "meta": {
+ "templateCredsSetupCompleted": true,
+ "instanceId": "636db6b6ab21a21c6458e2137f340e33dc3e49f5a1c560c8d1e2372c227cf40e"
+ },
+ "id": "NePU5HW4xvTaFqIk",
+ "tags": []
+}
\ No newline at end of file
diff --git a/episode_4/google_deep_research.json b/episode_4/google_deep_research.json
new file mode 100644
index 0000000..5ed2f7b
--- /dev/null
+++ b/episode_4/google_deep_research.json
@@ -0,0 +1,846 @@
+{
+ "name": "Episode 4: deep research with Google",
+ "nodes": [
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "5c28393f-6e8b-425b-babb-22eac9ad7238",
+ "name": "GOOGLE_API_KEY",
+ "value": "YOUR_GOOGLE_API_KEY_COMES_HERE",
+ "type": "string"
+ },
+ {
+ "id": "7f935132-6cb7-43a4-ae87-77336bd2cf82",
+ "name": "GOOGLE_CUSTOM_SEARCH",
+ "value": "YOUR_CUSTOM_SEARCH_ID_COMES_HERE",
+ "type": "string"
+ },
+ {
+ "id": "a848bf0c-0a5f-4acc-9412-aebd93c84380",
+ "name": "top_results",
+ "value": "={{ $json.top_results ?? 3 }}",
+ "type": "number"
+ },
+ {
+ "id": "c52bbef3-c0a6-4017-a403-abaaee216895",
+ "name": "context",
+ "value": "={{ $json.context }}",
+ "type": "string"
+ },
+ {
+ "id": "ae883a9e-7207-48ef-ad1f-9c86076e0308",
+ "name": "num_search_terms",
+ "value": "={{ $json.num_search_terms ?? 2 }}",
+ "type": "number"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 120,
+ 0
+ ],
+ "id": "1e106508-ede6-48c3-aafb-c1706752739f",
+ "name": "configuration"
+ },
+ {
+ "parameters": {
+ "schemaType": "manual",
+ "inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"search_terms\": {\n \"type\": \"array\",\n \"description\": \"the google search terms\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\n \"search_terms\"\n ]\n}"
+ },
+ "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
+ "typeVersion": 1.2,
+ "position": [
+ 660,
+ 300
+ ],
+ "id": "f6348b29-9fe4-4689-a52d-23d296583840",
+ "name": "Structured Output Parser"
+ },
+ {
+ "parameters": {
+ "model": {
+ "__rl": true,
+ "mode": "list",
+ "value": "gpt-4o-mini"
+ },
+ "options": {}
+ },
+ "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
+ "typeVersion": 1.2,
+ "position": [
+ 1960,
+ 500
+ ],
+ "id": "ec4f2be0-26cb-4487-9ac5-c1ad18fc1e51",
+ "name": "OpenAI Chat Model",
+ "credentials": {
+ "openAiApi": {
+ "id": "9z2BF40dqIRV3ovL",
+ "name": "OpenAI"
+ }
+ }
+ },
+ {
+ "parameters": {
+ "fieldToSplitOut": "output.search_terms",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.splitOut",
+ "typeVersion": 1,
+ "position": [
+ 800,
+ 0
+ ],
+ "id": "d17a1616-2bc8-4a58-b30d-4649032a288a",
+ "name": "Split Out"
+ },
+ {
+ "parameters": {
+ "fieldToSplitOut": "items",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.splitOut",
+ "typeVersion": 1,
+ "position": [
+ 1240,
+ 0
+ ],
+ "id": "1a3111a8-807c-4509-958d-6a767df48e5f",
+ "name": "Split Out1"
+ },
+ {
+ "parameters": {
+ "operation": "extractHtmlContent",
+ "extractionValues": {
+ "values": [
+ {
+ "key": "data",
+ "cssSelector": "body",
+ "returnValue": "html"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.html",
+ "typeVersion": 1.2,
+ "position": [
+ 2120,
+ 0
+ ],
+ "id": "e931b456-0e8f-44ce-8000-564937182741",
+ "name": "HTML"
+ },
+ {
+ "parameters": {
+ "html": "={{ $json.data }}",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.markdown",
+ "typeVersion": 1,
+ "position": [
+ 2340,
+ 0
+ ],
+ "id": "6526f717-85ea-4ac7-8097-6ae36a3ca9be",
+ "name": "Markdown"
+ },
+ {
+ "parameters": {
+ "schemaType": "manual",
+ "inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"summary\": {\n \"type\": \"string\",\n \"description\": \"the summary of the content\"\n }\n },\n \"required\": [\n \"summary\"\n ]\n}"
+ },
+ "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
+ "typeVersion": 1.2,
+ "position": [
+ 3060,
+ 360
+ ],
+ "id": "095ea0dd-886c-40b2-a3e6-7a2f5a94c94e",
+ "name": "Structured Output Parser1"
+ },
+ {
+ "parameters": {
+ "schemaType": "manual",
+ "inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"relevant_to_context\": {\n \"type\": \"boolean\",\n \"description\": \"whether the researched content is relevant to the context\"\n }\n },\n \"required\": [\n \"relevant_to_article\"\n ]\n}"
+ },
+ "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
+ "typeVersion": 1.2,
+ "position": [
+ 3480,
+ 340
+ ],
+ "id": "b7053a6b-7fb1-4177-a7f5-b5116b4a1fdc",
+ "name": "Structured Output Parser2"
+ },
+ {
+ "parameters": {
+ "aggregate": "aggregateAllItemData",
+ "destinationFieldName": "research_results",
+ "options": {}
+ },
+ "type": "n8n-nodes-base.aggregate",
+ "typeVersion": 1,
+ "position": [
+ 4160,
+ 0
+ ],
+ "id": "e83603cf-4518-4a6f-8a40-63d156716db7",
+ "name": "Aggregate"
+ },
+ {
+ "parameters": {
+ "workflowInputs": {
+ "values": [
+ {
+ "name": "top_results",
+ "type": "number"
+ },
+ {
+ "name": "context"
+ },
+ {
+ "name": "num_search_terms",
+ "type": "number"
+ }
+ ]
+ }
+ },
+ "type": "n8n-nodes-base.executeWorkflowTrigger",
+ "typeVersion": 1.1,
+ "position": [
+ -200,
+ 0
+ ],
+ "id": "e4668d2b-3f0d-459a-b344-e7eb60ae8d3f",
+ "name": "When Executed by Another Workflow"
+ },
+ {
+ "parameters": {
+ "content": "# Configure\n\n- Google API key\n- Google custom search id",
+ "height": 400,
+ "color": 3
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ 60,
+ -180
+ ],
+ "id": "1b4dcb5f-b535-4f7b-a0a2-8ca1f58a1abe",
+ "name": "Sticky Note"
+ },
+ {
+ "parameters": {
+ "content": "# Google programmable search documentation\n\nhttps://developers.google.com/custom-search/v1/using_rest\nhttps://programmablesearchengine.google.com/controlpanel/all",
+ "height": 200,
+ "width": 620
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ -200,
+ -440
+ ],
+ "id": "fd43eabf-8bcb-4113-bfe0-72fe5a8bd7aa",
+ "name": "Sticky Note2"
+ },
+ {
+ "parameters": {
+ "promptType": "define",
+ "text": "=<Context>\n{{ $json.context }}\n</Context>\n\n<Instructions>\nI want to run a research on Google on the context above. \nHelp me to come up with search terms I can use.\nI need exactly {{ $json.num_search_terms }} search term(s) - no more no less. \nMake sure to be creative, and give me different ones so I can get diverse search results.\n</Instructions>",
+ "hasOutputParser": true
+ },
+ "type": "@n8n/n8n-nodes-langchain.chainLlm",
+ "typeVersion": 1.5,
+ "position": [
+ 440,
+ 0
+ ],
+ "id": "38489aa0-24c5-4d3a-a7d8-acaf6184682d",
+ "name": "create search terms"
+ },
+ {
+ "parameters": {
+ "url": "https://www.googleapis.com/customsearch/v1",
+ "sendQuery": true,
+ "queryParameters": {
+ "parameters": [
+ {
+ "name": "key",
+ "value": "={{ $('configuration').item.json.GOOGLE_API_KEY }}"
+ },
+ {
+ "name": "cx",
+ "value": "={{ $('configuration').item.json.GOOGLE_CUSTOM_SEARCH }}"
+ },
+ {
+ "name": "q",
+ "value": "={{ $json['output.search_terms'] }}"
+ },
+ {
+ "name": "num",
+ "value": "={{ $('configuration').item.json.top_results }}"
+ },
+ {
+ "name": "siteSearch",
+ "value": "reddit.com"
+ },
+ {
+ "name": "siteSearchFilter",
+ "value": "e"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.httpRequest",
+ "typeVersion": 4.2,
+ "position": [
+ 1020,
+ 0
+ ],
+ "id": "095ea50a-1a85-49cd-8ca1-037b3fe4d391",
+ "name": "search on Google",
+ "retryOnFail": true
+ },
+ {
+ "parameters": {
+ "conditions": {
+ "options": {
+ "caseSensitive": true,
+ "leftValue": "",
+ "typeValidation": "strict",
+ "version": 2
+ },
+ "conditions": [
+ {
+ "id": "c18ff56b-39fa-477c-a48d-bc65ad0a510d",
+ "leftValue": "={{ $json.mime }}",
+ "rightValue": "",
+ "operator": {
+ "type": "string",
+ "operation": "notExists",
+ "singleValue": true
+ }
+ }
+ ],
+ "combinator": "and"
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.filter",
+ "typeVersion": 2.2,
+ "position": [
+ 1460,
+ 0
+ ],
+ "id": "a0bf9dd5-b261-41c6-b7f7-fd5e3be63bc1",
+ "name": "remove documents"
+ },
+ {
+ "parameters": {
+ "url": "={{ $json.link }}",
+ "sendHeaders": true,
+ "headerParameters": {
+ "parameters": [
+ {
+ "name": "user-agent",
+ "value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.httpRequest",
+ "typeVersion": 4.2,
+ "position": [
+ 1680,
+ 0
+ ],
+ "id": "5eee0103-ae60-44ca-bf50-474b59bee085",
+ "name": "get the content of the link",
+ "retryOnFail": false,
+ "onError": "continueErrorOutput"
+ },
+ {
+ "parameters": {
+ "conditions": {
+ "options": {
+ "caseSensitive": true,
+ "leftValue": "",
+ "typeValidation": "strict",
+ "version": 2
+ },
+ "conditions": [
+ {
+ "id": "99cf6ac1-d77b-491c-86dc-44555032f5b0",
+ "leftValue": "={{ $json.error }}",
+ "rightValue": "",
+ "operator": {
+ "type": "object",
+ "operation": "notExists",
+ "singleValue": true
+ }
+ },
+ {
+ "id": "e6dd1301-acb8-4dc4-83d0-4d5b1a7f2036",
+ "leftValue": "={{ $json.data }}",
+ "rightValue": "",
+ "operator": {
+ "type": "string",
+ "operation": "exists",
+ "singleValue": true
+ }
+ }
+ ],
+ "combinator": "and"
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.filter",
+ "typeVersion": 2.2,
+ "position": [
+ 1900,
+ 0
+ ],
+ "id": "a906d541-333d-4462-b05f-7d91712de84f",
+ "name": "filter out the errors"
+ },
+ {
+ "parameters": {
+ "conditions": {
+ "options": {
+ "caseSensitive": true,
+ "leftValue": "",
+ "typeValidation": "strict",
+ "version": 2
+ },
+ "conditions": [
+ {
+ "id": "e70a34f7-b723-47fe-a62f-1a318c483959",
+ "leftValue": "={{ $json.data }}",
+ "rightValue": "",
+ "operator": {
+ "type": "string",
+ "operation": "notEmpty",
+ "singleValue": true
+ }
+ }
+ ],
+ "combinator": "and"
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.filter",
+ "typeVersion": 2.2,
+ "position": [
+ 2560,
+ 0
+ ],
+ "id": "cddcf869-b927-40d2-995c-6edde5b3a3e9",
+ "name": "filter empty results"
+ },
+ {
+ "parameters": {
+ "jsCode": "for (const item of $input.all()) {\n item.json.data = item.json.data.replace(/!\\[[^\\]]+\\]\\([^\\)]+\\)/g, \"\") // remove images\n item.json.data = item.json.data.replace(/\\[.*?\\]\\(.*?\\)/g, \"\") // remove links\n item.json.data = item.json.data.replace(/\\n{2,}/g, \"\") // remove extra new line characters\n}\n\nreturn $input.all();"
+ },
+ "type": "n8n-nodes-base.code",
+ "typeVersion": 2,
+ "position": [
+ 2780,
+ 0
+ ],
+ "id": "0040d2e5-e4a4-45ec-bd17-1b141d7335f9",
+ "name": "cleanup the markdown"
+ },
+ {
+ "parameters": {
+ "promptType": "define",
+ "text": "=I've collected research content using Google search.\n\nRead the research content, and analyze whether it is relevant to the context below.\nMake sure it's also useful, and contains relevant information for my context.\n\n<Context>\n{{ $('configuration').item.json.context }}\n</Context>\n\n<ResearchContentSummary>\n{{ $json.output.summary }}\n</ResearchContentSummary>",
+ "hasOutputParser": true
+ },
+ "type": "@n8n/n8n-nodes-langchain.chainLlm",
+ "typeVersion": 1.5,
+ "position": [
+ 3360,
+ 0
+ ],
+ "id": "b48c5545-db40-441b-8b5e-0176ba2db08b",
+ "name": "is it relevant?",
+ "retryOnFail": true
+ },
+ {
+ "parameters": {
+ "promptType": "define",
+ "text": "=Please summarize the following content for me. Make sure to capture all the information in a concise format. Don't miss anything important.\nIgnore generic website elements like cookie policies, etc.\n\n<Content>\n{{ $json.data }}\n</Content>",
+ "hasOutputParser": true
+ },
+ "type": "@n8n/n8n-nodes-langchain.chainLlm",
+ "typeVersion": 1.5,
+ "position": [
+ 3000,
+ 0
+ ],
+ "id": "cac5c1a6-4e23-48a7-8c27-5d46b3df8239",
+ "name": "summarize",
+ "retryOnFail": true
+ },
+ {
+ "parameters": {
+ "conditions": {
+ "options": {
+ "caseSensitive": true,
+ "leftValue": "",
+ "typeValidation": "strict",
+ "version": 2
+ },
+ "conditions": [
+ {
+ "id": "a72e5161-9b19-45fb-bb4f-5ae28d3da266",
+ "leftValue": "={{ $json.output.relevant_to_context }}",
+ "rightValue": "",
+ "operator": {
+ "type": "boolean",
+ "operation": "true",
+ "singleValue": true
+ }
+ }
+ ],
+ "combinator": "and"
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.filter",
+ "typeVersion": 2.2,
+ "position": [
+ 3720,
+ 0
+ ],
+ "id": "b82afced-720b-4da7-be3b-bbc2c3e12e75",
+ "name": "filter irrelevant"
+ },
+ {
+ "parameters": {
+ "assignments": {
+ "assignments": [
+ {
+ "id": "53e16d12-8a90-4cf8-85e2-6aa2ef2ae3af",
+ "name": "summary",
+ "value": "={{ $('summarize').item.json.output.summary }}",
+ "type": "string"
+ },
+ {
+ "id": "1ca9f5a5-0e9a-47e6-9fef-079367dc4769",
+ "name": "title",
+ "value": "={{ $('remove documents').item.json.title }}",
+ "type": "string"
+ },
+ {
+ "id": "11c33d6b-d23c-4bc6-9003-b8ca022b3ada",
+ "name": "link",
+ "value": "={{ $('remove documents').item.json.link }}",
+ "type": "string"
+ },
+ {
+ "id": "eea8547b-2e21-4b71-a9dc-74639d658485",
+ "name": "snippet",
+ "value": "={{ $('remove documents').item.json.snippet }}",
+ "type": "string"
+ }
+ ]
+ },
+ "options": {}
+ },
+ "type": "n8n-nodes-base.set",
+ "typeVersion": 3.4,
+ "position": [
+ 3940,
+ 0
+ ],
+ "id": "2655287a-bb57-4a25-baf3-bb0e1d37929c",
+ "name": "set fields to return"
+ },
+ {
+ "parameters": {
+ "content": "# You can replace OpenAI with Ollama!",
+ "height": 320,
+ "width": 420
+ },
+ "type": "n8n-nodes-base.stickyNote",
+ "typeVersion": 1,
+ "position": [
+ 1820,
+ 340
+ ],
+ "id": "e46b9e4b-12b2-44c1-91e9-755655b63d72",
+ "name": "Sticky Note1"
+ }
+ ],
+ "pinData": {},
+ "connections": {
+ "configuration": {
+ "main": [
+ [
+ {
+ "node": "create search terms",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Structured Output Parser": {
+ "ai_outputParser": [
+ [
+ {
+ "node": "create search terms",
+ "type": "ai_outputParser",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "OpenAI Chat Model": {
+ "ai_languageModel": [
+ [
+ {
+ "node": "create search terms",
+ "type": "ai_languageModel",
+ "index": 0
+ },
+ {
+ "node": "summarize",
+ "type": "ai_languageModel",
+ "index": 0
+ },
+ {
+ "node": "is it relevant?",
+ "type": "ai_languageModel",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Split Out": {
+ "main": [
+ [
+ {
+ "node": "search on Google",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Split Out1": {
+ "main": [
+ [
+ {
+ "node": "remove documents",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "HTML": {
+ "main": [
+ [
+ {
+ "node": "Markdown",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Markdown": {
+ "main": [
+ [
+ {
+ "node": "filter empty results",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Structured Output Parser1": {
+ "ai_outputParser": [
+ [
+ {
+ "node": "summarize",
+ "type": "ai_outputParser",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Structured Output Parser2": {
+ "ai_outputParser": [
+ [
+ {
+ "node": "is it relevant?",
+ "type": "ai_outputParser",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "Aggregate": {
+ "main": [
+ []
+ ]
+ },
+ "When Executed by Another Workflow": {
+ "main": [
+ [
+ {
+ "node": "configuration",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "create search terms": {
+ "main": [
+ [
+ {
+ "node": "Split Out",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "search on Google": {
+ "main": [
+ [
+ {
+ "node": "Split Out1",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "remove documents": {
+ "main": [
+ [
+ {
+ "node": "get the content of the link",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "get the content of the link": {
+ "main": [
+ [
+ {
+ "node": "filter out the errors",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "filter out the errors": {
+ "main": [
+ [
+ {
+ "node": "HTML",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "filter empty results": {
+ "main": [
+ [
+ {
+ "node": "cleanup the markdown",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "cleanup the markdown": {
+ "main": [
+ [
+ {
+ "node": "summarize",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "is it relevant?": {
+ "main": [
+ [
+ {
+ "node": "filter irrelevant",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "summarize": {
+ "main": [
+ [
+ {
+ "node": "is it relevant?",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "filter irrelevant": {
+ "main": [
+ [
+ {
+ "node": "set fields to return",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ },
+ "set fields to return": {
+ "main": [
+ [
+ {
+ "node": "Aggregate",
+ "type": "main",
+ "index": 0
+ }
+ ]
+ ]
+ }
+ },
+ "active": false,
+ "settings": {
+ "executionOrder": "v1"
+ },
+ "versionId": "dbac12ec-a4e8-42c3-9953-3f20fe89eabd",
+ "meta": {
+ "templateCredsSetupCompleted": true,
+ "instanceId": "636db6b6ab21a21c6458e2137f340e33dc3e49f5a1c560c8d1e2372c227cf40e"
+ },
+ "id": "1BshuXUDKNDhMzYS",
+ "tags": []
+}
\ No newline at end of file