{
  "name": "Rag Bot Tesla",
  "nodes": [
    {
      "parameters": {
        "public": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        0
      ],
      "id": "5f9b7e15-e123-48cf-9ee6-341e2e04233c",
      "name": "When chat message received",
      "webhookId": "de2ac704-e7d2-46e3-b718-c575b1d3e573"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "=You are an AI assistant specialized in analyzing Tesla's quarterly financial reports. Your primary task is to answer questions accurately and precisely using the vector database, which contains relevant documents (Q3 and Q4 reports).\n\nOnly provide information that you retrieve from the documents (or verified expert knowledge). If something is not included in the dataset or is unclear, clearly state that you do not have sufficient information.\n\nStructure of your responses:\n• Concise and to the point\n• Specific numbers and facts, when available\n• Clearly indicate which quarterly report (Q3 or Q4) the information comes from\n\nObjective:\nProvide users with reliable and quick insights into Tesla's quarterly financials without unnecessary details."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        220,
        0
      ],
      "id": "920e4882-0ce5-4d70-b974-3208c2d0785c",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o",
          "mode": "list",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        60,
        260
      ],
      "id": "202a1cb3-ff78-46d2-989b-a716ff297923",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "wWdCmHfuvziTkduw",
          "name": "OpenAi account 3"
        }
      }
    },
    {
      "parameters": {
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        200,
        260
      ],
      "id": "2c5d329e-776d-4342-872c-0e6ee25a70d7",
      "name": "Window Buffer Memory"
    },
    {
      "parameters": {
        "pineconeIndex": {
          "__rl": true,
          "value": "n8ncoursetsla",
          "mode": "list",
          "cachedResultName": "n8ncoursetsla"
        },
        "options": {
          "pineconeNamespace": "tslan8n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1,
      "position": [
        280,
        380
      ],
      "id": "60efb948-9a9f-4f96-ad2a-e50c8e6fec91",
      "name": "Pinecone Vector Store",
      "credentials": {
        "pineconeApi": {
          "id": "h6sffrT8YvLm0KA2",
          "name": "PineconeApi account 3"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        240,
        500
      ],
      "id": "0302444c-bd78-47b0-84ab-9a9827562fbb",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "id": "wWdCmHfuvziTkduw",
          "name": "OpenAi 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": [
        580,
        360
      ],
      "id": "b4353cf3-da46-4860-8e65-5a5d45f6e307",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "id": "wWdCmHfuvziTkduw",
          "name": "OpenAi account 3"
        }
      }
    },
    {
      "parameters": {
        "name": "tyla_q",
        "description": "Returns documents relatet to Tesla Q3 and Q4, the financials, outlook, marges and everything important from the earnings report"
      },
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "typeVersion": 1,
      "position": [
        380,
        220
      ],
      "id": "8ca3876f-47d3-46ad-b0ca-844736b760c4",
      "name": "tyla_q"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        740,
        240
      ],
      "id": "335b0315-fe8f-46df-a1c9-ddfd0b69aebf",
      "name": "Calculator"
    }
  ],
  "pinData": {},
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "ai_vectorStore": [
        [
          {
            "node": "tyla_q",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "tyla_q",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "tyla_q": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6bc32536-3c1e-40b8-aaef-e7cd996999ad",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "c0fc3202e0d7686fd80c309dae8df3a072650cceb18f2be2bb9798a3af0bf1cd"
  },
  "id": "gqriJVB1FlcKarX5",
  "tags": []
}