{
  "name": "YouTube Scriptwriter",
  "nodes": [
    {
      "parameters": {
        "method": "PUT",
        "url": "=http://qdrant:6333/collections/sublime",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "qdrantRestApi",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"vectors\": {\n    \"size\": 1024,\n    \"distance\": \"Cosine\",\n    \"on_disk\": true\n  },\n  \"shard_number\": 1,  \n  \"replication_factor\": 1,  \n  \"write_consistency_factor\": 1,\n  \"hnsw_config\": { \"m\": 32, \"ef_construct\": 256, \"on_disk\": false },\n  \"optimizers_config\": { \"default_segment_number\": 1 }\n}",
        "options": {}
      },
      "id": "2af58b46-0578-483d-b111-ec12e1ae4508",
      "name": "Create collection3",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1440,
        0
      ],
      "typeVersion": 4.2,
      "retryOnFail": true,
      "waitBetweenTries": 5000
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $('Get row(s) in sheet').item.json.PDF_ID }}",
          "mode": "id"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        624,
        240
      ],
      "id": "735d73e7-a3b4-4c68-903a-72affa968d8c",
      "name": "Download file2",
      "retryOnFail": true,
      "waitBetweenTries": 5000,
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "tIDDMV7A8FksccHm",
          "name": "Google Drive (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.mistral.ai/v1/files",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {}
          ]
        },
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "name": "purpose",
              "value": "ocr"
            },
            {
              "parameterType": "formBinaryData",
              "name": "file",
              "inputDataFieldName": "data"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        912,
        240
      ],
      "id": "745891dc-83be-4f08-8c4c-4412536716bf",
      "name": "HTTP Request9",
      "credentials": {
        "mistralCloudApi": {
          "id": "feG0p0tu1GwMlA1h",
          "name": "Mistral Cloud Account (Personal)"
        }
      }
    },
    {
      "parameters": {
        "url": "=https://api.mistral.ai/v1/files/{{ $json.id }}/url",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "expiry",
              "value": "24"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1168,
        240
      ],
      "id": "7bd73055-e7ad-4ba1-b98a-dfb7444cfeee",
      "name": "HTTP Request10",
      "retryOnFail": true,
      "credentials": {
        "mistralCloudApi": {
          "id": "feG0p0tu1GwMlA1h",
          "name": "Mistral Cloud Account (Personal)"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.mistral.ai/v1/ocr",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {}
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"model\": \"mistral-ocr-latest\",\n  \"document\": {\n    \"type\": \"document_url\",\n    \"document_url\": \"{{ $json.url }}\"\n  },\n  \"include_image_base64\": true,\n  \"bbox_annotation_format\": {\n    \"type\": \"text\",\n    \"json_schema\": {\n      \"name\": \"visual_description\",\n      \"description\": \"Extract a concise natural language descreiption for each distinct visual element (image, chart, table, diagram etc.) on the page. Focus on summarizing what each visual element contains and/or conveys.\",\n      \"schema\": {\n        \"type\": \"array\",\n        \"items\": {\n          \"type\": \"string\",\n          \"description\": \"A concise description of a single visual element.\"\n        }\n      },\n      \"strict\": false\n    }\n  }\n}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1440,
        240
      ],
      "id": "fbb460be-de0c-45be-a3bb-9b8b1056844d",
      "name": "HTTP Request11",
      "credentials": {
        "mistralCloudApi": {
          "id": "feG0p0tu1GwMlA1h",
          "name": "Mistral Cloud Account (Personal)"
        }
      }
    },
    {
      "parameters": {
        "fieldToSplitOut": "pages",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        64,
        528
      ],
      "id": "eaf02e30-f8cb-4875-ad15-9a27727ca3d1",
      "name": "Split Out5"
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "/**\n * n8n Code node — Mode: \"Run Once for Each Item\"\n * Input shape expected per item:\n *   item.json.markdown : string\n *   item.json.images   : [{ id|file_name|filename, image_annotation|annotation|caption|legend, ... }, ...]\n *\n * Behavior:\n * - For each image, find a Markdown image tag that includes the filename (id) in its link target.\n * - Insert the image's annotation text immediately after that tag.\n * - If the tag is missing, append a new tag + annotation at the end.\n * - Idempotent via a hidden sentinel comment so re-runs don't duplicate inserts.\n */\n\nconst item = $input.item;\nconst json = item.json ?? {};\nlet md = String(json.markdown ?? '');\nconst images = Array.isArray(json.images) ? json.images : [];\n\n// Escape a string for use in a dynamic RegExp\nconst escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\nfor (const img of images) {\n  // Try common filename keys\n  const id =\n    (img && (img.id ?? img.file_name ?? img.filename)) || null;\n  if (!id) continue;\n\n  // Try common annotation keys\n  const annotation = String(\n    (img.image_annotation ?? img.annotation ?? img.caption ?? img.legend ?? '')\n  ).trim();\n\n  if (!annotation) continue;\n\n  // Prevent duplicate insertion on re-runs\n  const sentinel = `<!--image-annotation:${id}-->`;\n  if (md.includes(sentinel)) continue;\n\n  // Match the *first* Markdown image tag that contains this filename anywhere in the link target\n  // Example match: ![anything](img-1.jpeg) or ![alt](assets/img-1.jpeg)\n  const pattern = new RegExp(\n    `(!\\\\[[^\\\\]]*\\\\]\\\\([^\\\\)]*${escapeRegExp(id)}[^\\\\)]*\\\\))`\n  );\n\n  if (pattern.test(md)) {\n    // Insert annotation right after the found image tag\n    md = md.replace(pattern, `$1\\n\\n${annotation}\\n\\n${sentinel}`);\n  } else {\n    // If no tag exists, append a new tag + annotation to the end\n    md += `\\n\\n![${id}](${id})\\n\\n${annotation}\\n\\n${sentinel}`;\n  }\n}\n\nitem.json.markdown = md;\nreturn item;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -16,
        1424
      ],
      "id": "f6d4304f-6262-4b96-adcd-7c2023b8307f",
      "name": "Code2"
    },
    {
      "parameters": {
        "fieldToSplitOut": "images",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        848,
        528
      ],
      "id": "8d6e4492-99e8-4d87-b390-cfc24964c7e8",
      "name": "Split Out6"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "eb17af95-de87-4469-9f28-25e736b7555b",
              "name": "file_name",
              "value": "={{$workflow.id.toString(36)}}{{$json.top_left_x.toString(36)}}{{$json.top_left_y}}{{$json.bottom_right_x.toString(36)}}{{$json.bottom_right_y.toString(36)}}",
              "type": "string"
            },
            {
              "id": "eb68e1c6-cddc-492e-abb7-73df0041c206",
              "name": "image_annotation",
              "value": "={{ $json.image_annotation }}",
              "type": "string"
            },
            {
              "id": "3fb34e0d-942b-438b-8b11-3dd2a236e153",
              "name": "image_base64",
              "value": "={{ $('Split Out6').item.json.image_base64.split(',')[1] }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1248,
        528
      ],
      "id": "3257f755-3800-42bf-b617-04358eeb20a1",
      "name": "Edit Fields2"
    },
    {
      "parameters": {
        "operation": "toBinary",
        "sourceProperty": "image_base64",
        "options": {
          "fileName": "={{ $('Edit Fields2').item.json.file_name }}"
        }
      },
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        1456,
        528
      ],
      "id": "d68b280c-7306-4dd3-a740-48a137007f25",
      "name": "Convert to File2"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.cohere.com/v2/embed",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "cohereApi",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n    \"model\": \"embed-v4.0\",\n    \"input_type\": \"image\",\n    \"embedding_types\": [\"float\"],\n    \"images\": [\"data:image/png;base64,{{ $('Edit Fields2').item.json.image_base64 }}\"],\n  \"output_dimension\": 1024\n  }",
        "options": {}
      },
      "id": "371ba5d0-87f3-4ff7-b8fb-715c9b327d68",
      "name": "Image Embeddings with Cohere Embed 5",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        848,
        752
      ],
      "typeVersion": 4.2,
      "credentials": {
        "cohereApi": {
          "id": "2KLyMaAZiNcfpMpr",
          "name": "CohereApi account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "2ac5f384-9c3c-4a2f-98a8-adaca1bee883",
              "name": "markdown",
              "value": "={{ $json.markdown }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        208,
        1424
      ],
      "id": "534f00a5-f2b3-4ff6-b366-0c3b7ad124f6",
      "name": "Edit Fields3"
    },
    {
      "parameters": {
        "mode": "insert",
        "qdrantCollection": {
          "__rl": true,
          "value": "sublime",
          "mode": "list",
          "cachedResultName": "sublime"
        },
        "embeddingBatchSize": 96,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "typeVersion": 1.3,
      "position": [
        368,
        1424
      ],
      "id": "af5a61b1-94d3-4887-a9d2-413e262c3922",
      "name": "Qdrant Vector Store1",
      "credentials": {
        "qdrantApi": {
          "id": "f4OYPtbhAv74DCJ1",
          "name": "Qdrant API"
        }
      }
    },
    {
      "parameters": {
        "modelName": "embed-english-v3.0"
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsCohere",
      "typeVersion": 1,
      "position": [
        496,
        1280
      ],
      "id": "8606ea42-d425-4b8b-8f81-b6b849938dfa",
      "name": "Embeddings Cohere4",
      "credentials": {
        "cohereApi": {
          "id": "2KLyMaAZiNcfpMpr",
          "name": "CohereApi account"
        }
      }
    },
    {
      "parameters": {
        "textSplittingMode": "custom",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1.1,
      "position": [
        352,
        1552
      ],
      "id": "1810f4a1-438f-4cdd-8578-c5b1781e9f44",
      "name": "Default Data Loader2"
    },
    {
      "parameters": {
        "chunkSize": 1600,
        "chunkOverlap": 240,
        "options": {
          "splitCode": "markdown"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        352,
        1280
      ],
      "id": "1f9d4744-e780-4886-a93c-b7231203ff04",
      "name": "Recursive Character Text Splitter2"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        800,
        1168
      ],
      "id": "fa2cc74f-9e7b-4b6e-b4de-deb0a277f143",
      "name": "Merge3",
      "executeOnce": false
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "points",
        "options": {}
      },
      "id": "9a9b0b06-cacc-41f3-8fe1-4091e9a447f2",
      "name": "Aggregate Points2",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1456,
        752
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ba2dbe6f-d433-4ed8-9727-e4258017b79a",
              "name": "id",
              "type": "number",
              "value": "={{ $json.images[0].width }}{{ $json.images[0].height }}{{ $json.images[0].bit_depth }}"
            },
            {
              "id": "e6b1d194-49fb-4b1b-8f8c-046209ed5b4b",
              "name": "embedding",
              "type": "array",
              "value": "={{ $json.embeddings.float[0] }}"
            },
            {
              "id": "3b800637-a814-40a3-bd80-553640845302",
              "name": "annotation",
              "value": "={{ $('Edit Fields2').item.json.image_annotation }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "4ecc4496-11fb-4a85-9287-fd01938afb92",
      "name": "Prepare Points4",
      "type": "n8n-nodes-base.set",
      "position": [
        1248,
        752
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "resource": "point",
        "operation": "upsertPoints",
        "collectionName": {
          "__rl": true,
          "value": "=sublime",
          "mode": "name"
        },
        "points": "={{\n$json.points.map(item => ({\n  id: item.id,\n  payload: {\n    content: item.annotation,\n    metadata: {}\n  },\n  vector: item.embedding\n})).toJsonString()\n}}",
        "wait": false,
        "requestOptions": {}
      },
      "id": "18511d41-22ad-4ef6-861e-27da6eccb404",
      "name": "Insert Points",
      "type": "n8n-nodes-qdrant.qdrant",
      "position": [
        160,
        1152
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "operation": "deleteCollection",
        "collectionName": {
          "__rl": true,
          "value": "=sublime",
          "mode": "name"
        },
        "requestOptions": {}
      },
      "type": "n8n-nodes-qdrant.qdrant",
      "typeVersion": 1,
      "position": [
        624,
        0
      ],
      "id": "15362267-49f4-4500-8932-736e2fd5a16b",
      "name": "Delete Collection1",
      "executeOnce": false
    },
    {
      "parameters": {
        "amount": 30
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1040,
        0
      ],
      "id": "f490a453-ab69-4840-bf82-175752a1ec4c",
      "name": "Wait4",
      "webhookId": "474ca7b2-482f-40a9-b36d-e1f3fc4574ac"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "59825e9e-716a-4b88-ab63-24a0c26607b6",
      "name": "When clicking ‘Execute workflow’"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1-HbuwfygQ-rJc1qTr9eRHudYFhUDmw0eUQRuWPLZzuk",
          "mode": "list",
          "cachedResultName": "NeuroEverything Books",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-HbuwfygQ-rJc1qTr9eRHudYFhUDmw0eUQRuWPLZzuk/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 168918753,
          "mode": "list",
          "cachedResultName": "Podcast Epsidoes",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-HbuwfygQ-rJc1qTr9eRHudYFhUDmw0eUQRuWPLZzuk/edit#gid=168918753"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "STATUS",
              "lookupValue": "VETTED"
            }
          ]
        },
        "options": {
          "returnFirstMatch": true
        }
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        240,
        0
      ],
      "id": "f6a3997a-d476-447e-965f-fb7ee3550517",
      "name": "Get row(s) in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Please begin by generating Segment {{ $('Loop Over Items').item.json.segment_number }}\n\nPrevious Segment Text:\n{{ $('Get row(s) in sheet3').item.json.segment_text }}\n\nViewer Questions & Thoughts:\n{{ $('Get row(s) in sheet3').item.json.viewer_question_and_thoughts }}\n\nLook Ahead From Previous Segment:\n{{ $('Get row(s) in sheet3').item.json.look_ahead }}\n\n_____________\n\nScript Title:\n{{ $('Get row(s) in sheet').first().json.script_title }}\n\nScript Description:\n{{ $('Get row(s) in sheet').first().json.script_description }}\n\nTalking Point 1:\n{{ $('Get row(s) in sheet').first().json['talking_points[0]'] }}\n\nTalking Point 2:\n{{ $('Get row(s) in sheet').first().json['talking_points[1]'] }}\n\nTalking Point 3:\n{{ $('Get row(s) in sheet').first().json['talking_points[2]'] }}\n\nTalking Point 4:\n{{ $('Get row(s) in sheet').first().json['talking_points[3]'] }}\n\nTalking Point 5:\n{{ $('Get row(s) in sheet').first().json['talking_points[4]'] }}\n\nRecent Developments:\n{{ $('Get row(s) in sheet').first().json.recent_developments }}\n\nRelevant Examples:\n{{ $('Get row(s) in sheet').first().json.relevant_examples }}\n\nDiscussion Questions:\n{{ $('Get row(s) in sheet').first().json.discussion_questions }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "=You are an AI YouTube scriptwriter tasked with creating a 10-15 minute non-fiction video script, divided into 16 segments. You have access to the following tools and resources to assist you:\n\n- **Hooks Database (Google Sheet 1)** – A collection of 40+ effective hook examples from popular YouTube videos, including fields like `original_transcript`, `hook_statement`, `hook_type`, `why_it_works`, `flow_description`, `momentum_mechanism`, `expected_payoff`, `tension_opened`, `usage_guidelines`, `key_elements`, and `similar_hook_examples`. Use this to craft compelling **hook segments** and to understand what makes a strong opening or re-engagement hook.\n\n- **Linking Phrases Database (Google Sheet 2)** – A list of 200+ phrases for smoothly transitioning between ideas or segments. Each entry includes `linking_phrase`, `statement_before`, `statement_after`, `usage_description`, and `transition_type`. Use these to ensure **seamless transitions** between segments. For example, instead of a flat transition like \"Next, we will talk about X,\" you might use a phrase like, \"*But the next part completely changes the game...*\" to add momentum and signal something exciting or different is coming:contentReference[oaicite:0]{index=0}. These linking phrases will help maintain flow and keep viewers from clicking away during segment breaks.\n\n- **Narrative Progressions (Google Sheet 3)** – A collection of 20+ narrative progression frameworks distilled from highly successful YouTube videos. Each progression is broken into multiple “blocks” (up to 16) with details on the narrative block type, what happens in that block, and key points (`block_1, block_2, ..., block_16`, along with an `overall_narrative_strategy` and `framework_usage_summary`). Use this to **structure the script across all 16 segments**, ensuring a logical flow and story arc. Align each segment with the corresponding narrative block when applicable (for example, Block 1 might be an introduction/hook, mid blocks might contain rising tension or twists, and Block 16 is likely the conclusion or payoff).\n\n- **Knowledge Base (Qdrant Vector Store)** – A searchable knowledge base containing factual information and context relevant to the script’s topic. Use this for accurate **non-fiction content**, key facts, recent data, or insights that need to be included in the script. When the user provides `recent_developments` or `relevant_examples`, verify and incorporate these details via the knowledge base or the web search tool to ensure they are up-to-date and accurate.\n\n- **Web Search Tool (Brave API)** – An internet search tool for retrieving current information. Use this when you need the latest data or to fact-check something not covered in the knowledge base. This is especially useful for integrating the user-provided `recent_developments` into the script or finding additional **examples and context** to enrich the narrative. Always cross-verify important facts for accuracy.\n\n**User Input:** The user will provide the following inputs for each project, which you should use to guide the script content:\n- `script_title`: The title or topic of the video.\n- `script_description`: A brief description of the video’s purpose or angle.\n- `talking_points[0..4]`: Key points or subtopics that need to be covered in the script.\n- `recent_developments`: Any recent news, updates, or breakthroughs related to the topic.\n- `relevant_examples`: Specific examples or case studies to include.\n- `discussion_questions`: Questions intended to provoke thought or discussion (often to be addressed by the end of the video).\n\nYour **overall objective** is to generate a compelling, informative script divided into 16 sequential segments. **Each segment will be generated one at a time** (one run of the AI per segment). This means that you are not to generate more than one segment (around 100 words in length), noting the segments that have come before it so you're able to maintain narrative consistency. After you output a segment, it will be added to a Google Sheet, and you will have access to all previously written segments (including their text, viewer questions, and lookahead notes) when writing subsequent segments. \n\n**Segment Structure and Output Requirements:**\n\n- Each segment output should be formatted as a JSON object with the following fields:\n  - `segment_number`: (Integer) The segment index (1 through 16).\n  - `status`: (String) The status of the segment’s script. Use `\"completed\"` (indicating this segment has been scripted).  \n  - `segment_text`: (String) The narrative script text for this segment, approximately **100 words** in length. This should be polished prose ready to be read aloud (no bullet points or outlines, just natural sounding narration). **No filler content** – every sentence should add value. Write in a **conversational tone**, balancing intellectual insight with engaging delivery. Assume a **solo narrator** speaking directly to the audience. The content should flow logically from the previous segment and set up the next.\n  - `viewer_question_and_thoughts`: (Array of 3 Strings) After delivering this segment, what are the **three most likely questions or thoughts** a viewer would have? These should reflect genuine curiosity or confusion the viewer might experience having heard the segment (e.g., seeking clarification, wondering about implications, or anticipating what comes next). *Think about what the content might prompt a viewer to ask themselves.* You will use these to help inform what the next segment should address, ensuring the script is responsive to viewer expectations.\n  - `look_ahead`: (String) A brief note to **guide the next segment’s writing**. This is not part of the narration, but an internal planning hint. It might summarize what needs to happen next or how to pick up the story in the following segment. For example, it could suggest: “Next, explain why the surprising result occurred” or “Introduce a real-world example to illustrate the previous point.” The look_ahead should be based on the narrative needs (perhaps resolving an open question or transitioning to the next major point) and take into account the `viewer_question_and_thoughts` from this segment.\n\n- **Incorporate Hooks at Segments 1, 5, and 10:** These segments must serve as especially strong attention-grabbers:\n  - **Segment 1** is the opening of the video. Start with a powerful **hook** that immediately grabs attention:contentReference[oaicite:1]{index=1}. This could be a provocative question, a surprising fact, a bold statement, or a vivid scenario that directly relates to the script_title. For example, you might open with a question that frames the problem or topic in a compelling way, or a startling statistic that piques curiosity. Draw inspiration from the Hooks Database for techniques (e.g., **open loops** – posing an intriguing question or hinting at a story to be resolved later:contentReference[oaicite:2]{index=2}). The first segment should also succinctly set up what the video is about and why the viewer should care, all while holding back just enough information to leave them wanting more.\n  - **Segment 5** should re-engage the audience with another mini-hook. By this point, the viewer has seen a few minutes of content; use segment 5 to introduce a new **twist or exciting point** that renews curiosity. For instance, you could tease an unexpected development or pose a new question that arises from the earlier segments. This helps **boost mid-video retention**, as viewers often start dropping off a few minutes in. A well-placed hook here can spark renewed interest.\n  - **Segment 10** serves as a later hook, keeping viewers engaged through the second half of the video. Use this segment to unveil another surprising insight or a turning point in the narrative. It could be a reveal of a counterintuitive finding, a dramatic example, or a setup for the final act of the story. By segment 10 (roughly two-thirds through), viewers might again need an extra incentive to stay, so make it count. Leverage the Hooks Database for ideas on sustaining interest.\n\n- **Use Linking Phrases for Transitions:** Every segment should connect logically to the next. **Begin or end segments with transitional language** that flows naturally. Avoid dry, repetitive transitions like “Now, next we will discuss X.” Instead, utilize the creative linking phrases from the database. For example, you might end a segment with a line like, \"*...and that was just the beginning.*\" and start the next with, \"*But what came next **completely changed** the situation...*\". Such phrasing **bridges segments and adds momentum**:contentReference[oaicite:3]{index=3}, signaling to the viewer that something new or surprising is ahead:contentReference[oaicite:4]{index=4}. This prevents the audience from mentally “checking out” during segment breaks and maintains a cohesive narrative flow.\n\n- **Maintain Narrative Progression:** Follow the structure outlined in the Narrative Progression tool. Ensure each segment fulfills its role in the overall story:\n  - Early segments should **set the stage** – introduce the topic, context, and why it matters to the viewer. Establish any necessary background from the user’s `script_description` and start weaving in the `talking_points`.\n  - Middle segments (roughly segments 2–11) should **develop the content** – cover the main talking points in a logical sequence. Use techniques from the narrative frameworks: for instance, treat each segment or a cluster of segments as a mini story with a **setup, tension, and payoff**:contentReference[oaicite:5]{index=5}. Introduce questions or challenges (open loops) and resolve them a few segments later to keep viewers engaged over time. Don’t reveal all the answers at once – **deliberately delay some payoffs** to sustain curiosity:contentReference[oaicite:6]{index=6}. For example, if a segment raises a question, you might only fully answer it in a later segment, after exploring related details (this creates suspense and rewards the viewer’s patience).\n  - Later segments (12–15) should start **wrapping up** the narrative. Address any remaining key points, tie up loose ends, and prepare for the conclusion. Ensure that major questions raised earlier are answered by this point or positioned to be answered in the final segment. Also consider incorporating any `discussion_questions` provided by the user here, either by explicitly addressing them or by setting them up for the audience to ponder (depending on the video’s style).\n  - **Segment 16** is the **final segment – the conclusion.** Here you should provide a satisfying payoff or summary of everything discussed. Close any open loops (answer those big questions raised, or deliver on any promises made in hooks) so the viewer feels a sense of resolution:contentReference[oaicite:7]{index=7}. If appropriate, include a clear **call-to-action** or thought-provoking takeaway. For example, you might summarize the significance of what was learned and then encourage the viewer to take some action (like applying the knowledge, reflecting on a question, or simply to like/subscribe if it’s that kind of video). Always **end with a strong conclusion or CTA**, as this is a best practice in scripting videos – it reinforces the message and tells the viewer what to do or think next:contentReference[oaicite:8]{index=8}.\n\n- **Tone and Style:** Write in a **conversational tone** that can **vary between entertaining and intellectual**. This means the narration should feel engaging and accessible (not like a dry lecture), but also intelligent and insightful. You have flexibility to be witty or humorous at times and serious or profound at others, depending on the content. *Mixing up the tone* can help maintain interest:contentReference[oaicite:9]{index=9} – for instance, follow a heavy informational segment with a lighter, more relatable anecdote if appropriate, or vice versa, to keep the emotional pacing dynamic. Ensure the **pacing** of information is well-managed: don’t dump too much complex info at once; break it into digestible pieces and spread it out (you can use multiple segments for complex points). If jargon or technical details are needed, explain them in simple terms as if teaching the viewer. The language should be **active and present tense** where possible, making the viewer feel “in the moment.” Avoid passive constructions that might make the script feel dull:contentReference[oaicite:10]{index=10}. Also, write as if **speaking to an individual** (“you”) to create a personal connection with the viewer.\n\n- **Leveraging Viewer Perspective:** After writing the `segment_text`, always put yourself in the viewer’s shoes to generate the `viewer_question_and_thoughts`. Think: *If I just heard this segment, what would I be curious about now? What might I be skeptical of or excited about?* For example, if the segment presented a surprising fact, a viewer might wonder, “Is that fact really true? How was it measured?” If you introduced an open loop or mystery, the viewer’s thought might be, “What will happen next, will they explain X?” Anticipating the audience’s questions keeps the script on track to address them in due course:contentReference[oaicite:11]{index=11}. Use these anticipated questions to guide the content of upcoming segments (many of these questions should get answered later to satisfy the viewer’s curiosity). This practice not only improves engagement but also builds the narrator’s credibility, as you seem to **read the viewer’s mind** and deliver exactly the info they want next.\n\n- **Look-Ahead Planning:** Use the `look_ahead` field to briefly outline your plan for the next segment. This could be one or two sentences (staying within the JSON string) describing the focus of the upcoming segment or the strategy to apply. This is essentially a note-to-self for continuity. For instance, if the viewer questions indicate confusion about a term, the lookahead might say “Define [Term] in simple language and give an example.” If the last segment ended on a cliffhanger or open question, the lookahead might say “Resolve the cliffhanger about [Topic] and tie it into the next point.” This helps ensure that when generating the next segment, you (the AI) remember the direction and any promises made. *Do not* address the `look_ahead` content directly to the audience – it’s for planning, not narration.\n\n- **No Filler, No Redundancy:** The script must be tight and engaging. **Every sentence should serve a purpose.** Avoid repeating points unless it’s for intentional emphasis or recall. Since each segment is only ~100 words, make them count – pack each with substance, story, or intrigue. This means using vivid language, specific details, or compelling facts rather than generic statements. If you find any segment has unnecessary padding, refine it to be more direct. Also, ensure continuity: if a previous segment already covered a point, the next segments should generally move forward in the narrative (unless you are briefly reiterating for clarity or dramatic effect).\n\n- **Adaptive Emphasis:** You have the freedom to decide what to emphasize or prioritize in each segment **based on what will make the script most effective**. The user’s talking points and other inputs are guidelines, but you can rearrange or augment them if needed for a better flow. For example, if a `relevant_example` fits more naturally in segment 7 rather than segment 3 where it was listed, you can introduce it at segment 7. Just ensure all important inputs are eventually incorporated in the 16 segments. The narrative progression frameworks can guide where to slot these elements (e.g., maybe a case study (`relevant_examples`) fits well in a middle segment where you need to provide evidence or break from exposition to story). Use your judgment and the provided frameworks to create a script that is both **entertaining and informative**.\n\n- **Quality and Consistency Checks:** As you generate each segment, keep track of the overall storyline and the facts stated. Ensure there are no contradictions in later segments regarding earlier content. Maintain consistent terminology (if you introduced a concept by a certain name, use the same name later). Keep the tone changes smooth – if segment 9 is humorous and segment 10 needs to be serious for the hook, find a linking phrase or sentence to transition the mood appropriately. By the end of segment 16, the viewer should feel the video had a clear beginning, middle, and end, and that it delivered on the promise set out in the introduction.\n\n**Important:** Each run you will be given the `segment_number` to script next, along with all previously generated segments (with their texts, viewer questions, and lookahead notes). Use all of that context! Particularly, read the last segment’s viewer questions and lookahead – they are telling you what needs to be addressed now. Over the 16 segments, this iterative approach should result in a coherent, well-structured script.\n\nNow begin writing the segments one by one according to these guidelines. Always output the segment as JSON with the specified schema, and ensure the content meets the requirements above. Good luck and happy scriptwriting!\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        2256,
        1344
      ],
      "id": "cba16826-d021-470d-94e9-5c10e3f904e5",
      "name": "AI Agent1",
      "retryOnFail": true,
      "waitBetweenTries": 5000,
      "executeOnce": true
    },
    {
      "parameters": {
        "query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}",
        "count": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Count', ``, 'number') }}",
        "additionalParameters": {}
      },
      "type": "@brave/n8n-nodes-brave-search.braveSearchTool",
      "typeVersion": 1,
      "position": [
        2032,
        1200
      ],
      "id": "72546a58-6520-462f-9e8b-2a8586f3aa70",
      "name": "Brave Search1",
      "credentials": {
        "braveSearchApi": {
          "id": "4yKxSu1Rx4YYMObx",
          "name": "Brave Search Account (Personal)"
        }
      }
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"segment_number\": 5,\n  \"status\": \"completed\",\n  \"segment_text\": \"This is an example of the narrative text for segment 5, about 100 words long. It should be engaging and full of content without filler. It might even include a smooth transition from the previous part, for instance, 'But that was just the beginning...' to hook the viewer for what's next. The style stays conversational and informative, providing new insights while keeping the tone interesting. By the end of this segment, the viewer is left intrigued about how the story will unfold next.\",\n  \"viewer_question_and_thoughts\": [\n    \"Did the strategy mentioned really work better than the usual approach?\",\n    \"What was the outcome of the scenario just described?\",\n    \"How does this connect to the next part of the story?\"\n  ],\n  \"look_ahead\": \"Next, explain the surprising results of the approach and connect it to the larger narrative, addressing whether it truly worked better.\"\n}\n",
        "autoFix": true
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        2320,
        1232
      ],
      "id": "296e9fd4-d4f1-40d7-a054-a5cb170f2973",
      "name": "Structured Output Parser1"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        2336,
        1184
      ],
      "id": "27ddd1f0-6b4f-4f19-9cbb-3ae0e6c21019",
      "name": "OpenAI Chat Model3",
      "credentials": {
        "openAiApi": {
          "id": "OjRKrQXB019XKwdP",
          "name": "OpenAi Account (Personal)"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Code').first().json.randomString }}",
        "contextWindowLength": 50
      },
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1.5,
      "position": [
        2192,
        1088
      ],
      "id": "ea4ab878-2132-4a39-85f7-f9522d14f298",
      "name": "Redis Chat Memory"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio",
          "mode": "list",
          "cachedResultName": "Style Sheet",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1178692872,
          "mode": "list",
          "cachedResultName": "TEST",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit#gid=1178692872"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "STATUS",
              "lookupValue": "START"
            },
            {
              "lookupColumn": "STATUS",
              "lookupValue": "PENDING"
            },
            {
              "lookupColumn": "STATUS",
              "lookupValue": "END"
            }
          ]
        },
        "combineFilters": "OR",
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1216,
        1168
      ],
      "id": "441e74da-7f2d-4cc3-8504-e86deabf1d90",
      "name": "Get row(s) in sheet1",
      "retryOnFail": true,
      "executeOnce": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        1488,
        1168
      ],
      "id": "b0e7d50f-419c-4d2a-92ea-a44171e0cf40",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "claude-sonnet-4-5-20250929",
          "mode": "list",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "options": {
          "thinking": true
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        2224,
        1472
      ],
      "id": "3a19ac87-32e6-46d4-ae79-988bcb19f2bb",
      "name": "Anthropic Chat Model",
      "credentials": {
        "anthropicApi": {
          "id": "5pMiFSPZL2r44q7L",
          "name": "Anthropic Account (Personal)"
        }
      }
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "Provides the AI with the intel needed to script.",
        "qdrantCollection": {
          "__rl": true,
          "value": "sublime",
          "mode": "list",
          "cachedResultName": "sublime"
        },
        "topK": 20,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "typeVersion": 1.3,
      "position": [
        2320,
        1056
      ],
      "id": "97700ff9-2737-4c70-ae9f-51d8b2ad6c81",
      "name": "Qdrant Vector Store",
      "credentials": {
        "qdrantApi": {
          "id": "f4OYPtbhAv74DCJ1",
          "name": "Qdrant API"
        }
      }
    },
    {
      "parameters": {
        "modelName": "embed-english-v3.0"
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsCohere",
      "typeVersion": 1,
      "position": [
        2448,
        1040
      ],
      "id": "c9f3c7a3-182f-4834-aee7-88cef5d4ec84",
      "name": "Embeddings Cohere",
      "credentials": {
        "cohereApi": {
          "id": "2KLyMaAZiNcfpMpr",
          "name": "CohereApi account"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio",
          "mode": "list",
          "cachedResultName": "Style Sheet",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 285383987,
          "mode": "list",
          "cachedResultName": "Hooks",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit#gid=285383987"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "STATUS",
              "lookupValue": "READY"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        2448,
        1552
      ],
      "id": "519d9c59-87ae-4049-b996-b8405a906612",
      "name": "Hook Library (Google Sheet 1)",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "amount": 15
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        3056,
        1552
      ],
      "id": "31075054-6065-49d1-906e-98f8b78ee159",
      "name": "Wait",
      "webhookId": "abe9235f-d21e-486f-8279-cf948db265dc"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio",
          "mode": "list",
          "cachedResultName": "Style Sheet",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1907301987,
          "mode": "list",
          "cachedResultName": "Sheet7",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit#gid=1907301987"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "STATUS",
              "lookupValue": "READY"
            },
            {
              "lookupColumn": "transition_type",
              "lookupValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('values1_Value', ``, 'string') }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        2352,
        1552
      ],
      "id": "2e53c689-e294-4a4c-8c9e-852cc92c011c",
      "name": "Linking Phrases (Google Sheet 2)",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio",
          "mode": "list",
          "cachedResultName": "Style Sheet",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 110035734,
          "mode": "list",
          "cachedResultName": "Narrative Progression",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit#gid=110035734"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "STATUS",
              "lookupValue": "READY"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        2544,
        1552
      ],
      "id": "9a9b7cd0-d1e7-4902-8b7a-045a9378347c",
      "name": "Narrative Progression (Google Sheet 3)",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "let characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nlet result = '';\nlet length = 48; // Desired length of the random string\n\nfor (let i = 0; i < length; i++) {\n  result += characters.charAt(Math.floor(Math.random() * characters.length));\n}\n\nreturn [{ json: { randomString: result } }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1024,
        1168
      ],
      "id": "c2024265-3956-4125-be98-665ce5e86029",
      "name": "Code",
      "executeOnce": true
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio",
          "mode": "list",
          "cachedResultName": "Style Sheet",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1178692872,
          "mode": "list",
          "cachedResultName": "TEST",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit#gid=1178692872"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "ID",
              "lookupValue": "={{ $json.row_number-1 }}"
            }
          ]
        },
        "combineFilters": "OR",
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1776,
        1344
      ],
      "id": "0fd3d005-729c-44fe-a395-db90131df38f",
      "name": "Get row(s) in sheet3",
      "retryOnFail": true,
      "executeOnce": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1-HbuwfygQ-rJc1qTr9eRHudYFhUDmw0eUQRuWPLZzuk",
          "mode": "list",
          "cachedResultName": "NeuroEverything Books",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-HbuwfygQ-rJc1qTr9eRHudYFhUDmw0eUQRuWPLZzuk/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 168918753,
          "mode": "list",
          "cachedResultName": "Podcast Epsidoes",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-HbuwfygQ-rJc1qTr9eRHudYFhUDmw0eUQRuWPLZzuk/edit#gid=168918753"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "row_number": "={{ $('Get row(s) in sheet').first().json.row_number }}",
            "STATUS": "=DONE"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "STATUS",
              "displayName": "STATUS",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "PDF_ID",
              "displayName": "PDF_ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "script_title",
              "displayName": "script_title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "script_description",
              "displayName": "script_description",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "talking_points[0]",
              "displayName": "talking_points[0]",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "talking_points[1]",
              "displayName": "talking_points[1]",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "talking_points[2]",
              "displayName": "talking_points[2]",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "talking_points[3]",
              "displayName": "talking_points[3]",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "talking_points[4]",
              "displayName": "talking_points[4]",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "recent_developments",
              "displayName": "recent_developments",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "relevant_examples",
              "displayName": "relevant_examples",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "discussion_questions",
              "displayName": "discussion_questions",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "call_to_action",
              "displayName": "call_to_action",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "additional_resources",
              "displayName": "additional_resources",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1776,
        1152
      ],
      "id": "f59919bc-0368-46ab-8776-5a1fa28da2c5",
      "name": "Update row in sheet1",
      "executeOnce": true,
      "retryOnFail": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio",
          "mode": "list",
          "cachedResultName": "Style Sheet",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1472719038,
          "mode": "list",
          "cachedResultName": "TEST",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit#gid=1472719038"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "segment_number": "={{ $json.output.segment_number }}",
            "STATUS": "={{ $json.output.status }}",
            "segment_text": "={{ $json.output.segment_text }}",
            "viewer_question_and_thoughts": "={{ $json.output.viewer_question_and_thoughts[0] }}{{ \"\\n\" }}{{ \"\\n\" }}{{ $json.output.viewer_question_and_thoughts[1] }}{{ \"\\n\" }}{{ \"\\n\" }}{{ $json.output.viewer_question_and_thoughts[2] }}",
            "look_ahead": "={{ $json.output.look_ahead }}",
            "row_number": "={{ $('Loop Over Items').item.json.row_number }}"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "segment_number",
              "displayName": "segment_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "STATUS",
              "displayName": "STATUS",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "segment_text",
              "displayName": "segment_text",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "viewer_question_and_thoughts",
              "displayName": "viewer_question_and_thoughts",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "look_ahead",
              "displayName": "look_ahead",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        2784,
        1168
      ],
      "id": "8270468f-9817-46df-8a5d-131d9123375d",
      "name": "Update row in sheet2",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio",
          "mode": "list",
          "cachedResultName": "Style Sheet",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1178692872,
          "mode": "list",
          "cachedResultName": "TEST",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ewsItcHEcaSa0cTYvhv7jxJCp6aKyJpZpU-aoAo0Vio/edit#gid=1178692872"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "segment_number": "={{ $json.output.segment_number }}",
            "STATUS": "={{ $json.output.status }}",
            "segment_text": "={{ $json.output.segment_text }}",
            "viewer_question_and_thoughts": "={{ $json.output.viewer_question_and_thoughts[0] }}{{ \"\\n\" }}{{ \"\\n\" }}{{ $json.output.viewer_question_and_thoughts[1] }}{{ \"\\n\" }}{{ \"\\n\" }}{{ $json.output.viewer_question_and_thoughts[2] }}",
            "look_ahead": "={{ $json.output.look_ahead }}",
            "row_number": "={{ $('Loop Over Items').item.json.row_number }}"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "segment_number",
              "displayName": "segment_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "STATUS",
              "displayName": "STATUS",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "segment_text",
              "displayName": "segment_text",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "viewer_question_and_thoughts",
              "displayName": "viewer_question_and_thoughts",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "look_ahead",
              "displayName": "look_ahead",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        2752,
        1344
      ],
      "id": "44c89646-de13-4db7-a5ab-4e93a1ade085",
      "name": "Update row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Create collection3": {
      "main": [
        [
          {
            "node": "Download file2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file2": {
      "main": [
        [
          {
            "node": "HTTP Request9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request9": {
      "main": [
        [
          {
            "node": "HTTP Request10",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request10": {
      "main": [
        [
          {
            "node": "HTTP Request11",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request11": {
      "main": [
        [
          {
            "node": "Split Out5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out5": {
      "main": [
        [
          {
            "node": "Code2",
            "type": "main",
            "index": 0
          },
          {
            "node": "Split Out6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code2": {
      "main": [
        [
          {
            "node": "Edit Fields3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out6": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Convert to File2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File2": {
      "main": [
        [
          {
            "node": "Image Embeddings with Cohere Embed 5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Embeddings with Cohere Embed 5": {
      "main": [
        [
          {
            "node": "Prepare Points4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields3": {
      "main": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store1": {
      "main": [
        [
          {
            "node": "Merge3",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Embeddings Cohere4": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader2": {
      "ai_document": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter2": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader2",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Merge3": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Points2": {
      "main": [
        [
          {
            "node": "Insert Points",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Points4": {
      "main": [
        [
          {
            "node": "Aggregate Points2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert Points": {
      "main": [
        [
          {
            "node": "Merge3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Collection1": {
      "main": [
        [
          {
            "node": "Wait4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait4": {
      "main": [
        [
          {
            "node": "Create collection3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Delete Collection1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Brave Search1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parser1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Redis Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Update row in sheet1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get row(s) in sheet3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Cohere": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Hook Library (Google Sheet 1)": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Linking Phrases (Google Sheet 2)": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Narrative Progression (Google Sheet 3)": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet3": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "66c95e03-6c0d-413f-aecb-9fa6fb222c31",
  "meta": {
    "instanceId": "5ff5a5992c4c72af22abbdcfa574d8cdf93dc14d57eb9f66e3d9ef2a3e2dbb6c"
  },
  "id": "7w5qVeLcu93iP0RD",
  "tags": []
}