{
  "name": "Local PDF RAG - 2 Chat (Corrected)",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "id": "50bba127-a6ac-4540-a036-9727d38a7f2e",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.2,
      "position": [
        -560,
        0
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "be1abafc-b359-4656-915a-c60cd71cd545",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        -240,
        0
      ]
    },
    {
      "parameters": {
        "model": "qwen3:4b",
        "options": {}
      },
      "id": "c834bd1d-0ff1-46a5-b3fa-6de856ae97ef",
      "name": "Ollama Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        -240,
        240
      ],
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolName": "pdf_knowledge_base",
        "toolDescription": "Search the uploaded PDF documents and use the retrieved passages to answer the user's question. If the requested information is not present in the uploaded PDFs, say that you could not find it in the uploaded documents.",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "local_pdf_rag"
        }
      },
      "id": "5713bba8-3495-4ee5-a5a2-1637588d7977",
      "name": "PDF Knowledge Base",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "typeVersion": 1.3,
      "position": [
        40,
        0
      ]
    },
    {
      "parameters": {
        "model": "nomic-embed-text",
        "options": {}
      },
      "id": "b95cd9fa-0a37-4106-a0a0-77c9098abe7c",
      "name": "Ollama Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOllama",
      "typeVersion": 1,
      "position": [
        40,
        300
      ],
      "credentials": {
        "ollamaApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "PDF Knowledge Base": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "PDF Knowledge Base",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "versionId": "4346abc9-aeea-4ab4-8b73-5b5c21d07a62",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}