{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "afffce32-7e15-4373-9d68-e61d614be431",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -592,
        -64
      ],
      "parameters": {
        "options": {},
        "formTitle": "upload files",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "file",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "361be9bf-8ebb-4011-a1ce-95027939ecdd",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "maxTries": 2,
      "position": [
        -368,
        -64
      ],
      "parameters": {
        "url": "https://api.assemblyai.com/v2/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization"
            }
          ]
        },
        "inputDataFieldName": "file"
      },
      "retryOnFail": true,
      "typeVersion": 4.3
    },
    {
      "id": "988ac454-e1df-4217-a99e-173ec1ad1d53",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -144,
        -64
      ],
      "parameters": {
        "url": "https://api.assemblyai.com/v2/transcript",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"audio_url\": \"{{$json.upload_url}}\",\n  \"speaker_labels\": true,\n  \"summarization\": true,\n  \"summary_type\": \"bullets\",\n  \"summary_model\": \"informative\"\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "a6e98d4c-6046-4588-a2f6-a93144c418b5",
      "name": "HTTP Request2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        304,
        -144
      ],
      "parameters": {
        "url": "=https://api.assemblyai.com/v2/transcript/{{$json.id}}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "3d306cb4-f9d2-4768-94ca-f8a02ad8a17f",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        80,
        -64
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "f5437308-69d7-4f0e-b257-d6077f3eaae1",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        528,
        -64
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b46b9be9-32b0-4422-a640-ad78f7c267a5",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "processing",
              "rightValue": "={{ $json.status }}"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "2eb66641-d751-4adb-9809-ece339d35752",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        752,
        -64
      ],
      "parameters": {
        "options": {},
        "operation": "toText",
        "sourceProperty": "text"
      },
      "typeVersion": 1.1
    },
    {
      "id": "f877e1a4-919a-466b-8baa-2afee7407cb5",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        960,
        -64
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "n8n-rag-chat-bot",
          "cachedResultName": "n8n-rag-chat-bot"
        }
      },
      "credentials": {
        "pineconeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "e3827ff9-003b-4244-a028-20a7fa1cf407",
      "name": "Embeddings Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        928,
        176
      ],
      "parameters": {},
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d8eeac46-86a4-46ee-a428-2b2d4f834630",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1136,
        384
      ],
      "parameters": {
        "options": {},
        "chunkOverlap": 100
      },
      "typeVersion": 1
    },
    {
      "id": "7eb43a01-b0b8-40c5-98ab-8503dfceec7a",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1056,
        176
      ],
      "parameters": {
        "options": {},
        "dataType": "binary",
        "textSplittingMode": "custom"
      },
      "typeVersion": 1.1
    },
    {
      "id": "7e34b6b0-256a-4ab7-9008-846fc737b63d",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1296,
        -64
      ],
      "parameters": {
        "columns": {
          "value": {
            "file": "={{ $('On form submission').item.json.file[0].filename }}",
            "status": "uploaded"
          },
          "schema": [
            {
              "id": "file",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "file",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/YOUR_AWS_SECRET_KEY_HERE-1ANVU/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1pYIgL3eDL7jWiVK9zEy2mM5S3tjnPdVxqM7K9-1ANVU",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/YOUR_AWS_SECRET_KEY_HERE-1ANVU/edit?usp=drivesdk",
          "cachedResultName": "audio file vectore store log"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.7
    },
    {
      "id": "d663ec34-de17-435a-84c0-fc6a3ff76c18",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -608,
        368
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "674fb954-c646-43ed-ad6c-6e534fe05ff6",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -320,
        368
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2.2
    },
    {
      "id": "ccc426e1-5543-4f2a-8e35-935b9f9c9413",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -384,
        592
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9bb9d925-51b1-4a92-b9e9-3ca4a1d1ebf5",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -256,
        592
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "1e9ed193-8e4a-4514-b765-7d0c31b2d157",
      "name": "Pinecone Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        -128,
        592
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "topK": 5,
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "audio-summaries",
          "cachedResultName": "audio-summaries"
        },
        "toolDescription": "retrieve info from this database for user conversation."
      },
      "credentials": {
        "pineconeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "d2ccb4f7-b4b7-4d09-b876-7dd55b9b920b",
      "name": "Embeddings Google Gemini1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        -48,
        800
      ],
      "parameters": {},
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9fc9e413-8774-4c47-a70c-97a0e969eda6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1312,
        -160
      ],
      "parameters": {
        "width": 592,
        "height": 752,
        "content": "#### Transcribe Audio, Summarize with AI, and Chat\n\n### How it works\n1. An audio file is uploaded via a form.\n2. The workflow sends the audio to AssemblyAI for transcription, speaker labeling, and summarization into bullet points.\n3. The full transcript is then chunked, embedded using Google Gemini, and stored in a Pinecone vector database for future retrieval.\n4. A record of the uploaded file is added to a Google Sheet.\n5. Separately, an AI chatbot can answer questions by retrieving relevant information from the Pinecone vector database using Google Gemini.\n\n### Setup\n- [ ] Connect your AssemblyAI API key.\n- [ ] Connect your Pinecone API key and specify your Pinecone index for audio summaries.\n- [ ] Connect your Google Gemini (PaLM) API account.\n- [ ] Connect your Google Sheets account and specify the spreadsheet and sheet name for logging with column named file and status."
      },
      "typeVersion": 1
    },
    {
      "id": "c3ef4984-c8c7-4d25-a613-bbc6373007d4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        288
      ],
      "parameters": {
        "color": 7,
        "width": 800,
        "height": 672,
        "content": "## chatbot with context of audio files"
      },
      "typeVersion": 1
    },
    {
      "id": "c1f0f6cc-cd75-47a4-9aea-c704637f11be",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 288,
        "content": "## 1. upload file to AssemblyAi for stt"
      },
      "typeVersion": 1
    },
    {
      "id": "8eee8d24-65b5-45dc-92fc-5a57bcca8208",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -208
      ],
      "parameters": {
        "color": 7,
        "width": 832,
        "height": 384,
        "content": "## 2. get transcripts and prepare to upload in vector store\n"
      },
      "typeVersion": 1
    },
    {
      "id": "961ef001-840c-4710-98da-b22fa44618b7",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 592,
        "height": 704,
        "content": "## 3. Upload to vectore store and log everything"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "HTTP Request2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request2": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini1": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  }
}