AutomationFlowsAI & RAG › Medical Q&a Chatbot for Urology Using RAG with Pinecone and Gpt-4o

Medical Q&a Chatbot for Urology Using RAG with Pinecone and Gpt-4o

ByHoangSP @hoangsp on n8n.io

This template provides an AI-powered Q&A assistant for the Urology domain using Retrieval-Augmented Generation (RAG). It uses Pinecone for vector search and GPT-4o for conversational responses.

Chat trigger trigger★★★★☆ complexityAI-powered15 nodesChat TriggerAgentOpenAI ChatMemory Buffer WindowTool Vector StorePinecone Vector StoreOpenAI Embeddings
AI & RAG Trigger: Chat trigger Nodes: 15 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #3670 — we link there as the canonical source.

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "q07AalYfXfiMc0p2",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Medical Q&A Assistant for Urology using RAG with Pinecone and GPT-4o",
  "tags": [],
  "nodes": [
    {
      "id": "58bf7bd0-00c7-4d7a-98f3-e18d053afa9f",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        100,
        -20
      ],
      "parameters": {
        "public": true,
        "options": {},
        "initialMessages": "Dr. Hiep - Urologist - Phone: 090xxxxxxx\nInformation provided by a certified urologist\n\n"
      },
      "typeVersion": 1.1
    },
    {
      "id": "6f689a95-9b4b-45c1-b407-023b05610ed9",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        540,
        -20
      ],
      "parameters": {
        "text": "=Input content: {{ $json.chatInput }}",
        "options": {
          "systemMessage": "=You are an AI expert specializing in Andrology and Urology.\n\nYour role is to provide user-friendly, medically relevant answers **based entirely on information gathered from the Vector Database**.\n\n\u26a0\ufe0f DO NOT create or assume any outside or fabricated information.\n\n\ud83d\udde3\ufe0f Tone & Style:\n- \u2705 Clear, simple and informative\n- \ud83e\uddd1\u200d\u2695\ufe0f Friendly and easy to understand for non-physician users\n- \u274c Avoid overly clinical or doctor-to-doctor language\n\n\ud83d\udccc Response guidelines:\n- Look at the information content of the previously asked KH for each answer, to synthesize information and make accurate suggestions\n- \u274c Do not speculate or make assumptions\n- \u2705 Use only verified vector-based data (collected context)\n- \ud83d\udcdd Format your response with bullet points with emojis/symbols:\n- \ud83d\udccc Common causes: ...\n- \ud83d\udc8a Symptoms may include: ...\n- \u26a0\ufe0f Note: ...\n- \ud83d\udeab DO NOT provide a treatment plan or prescription medicine\n\n\u2753After answering, gently ask 1\u20132 follow-up questions to gather more context for the user. Avoid the stiff Q&A style \u2014 use friendly, caring expressions such as:\n- \"Have you tried anything to relieve the discomfort?\"\n- \"Can you share how long you've had this condition?\"\nUse open-ended questions, such as: Are there any other issues that you're concerned about that we'd like you to address.\n\nLeave the customer:\n- Would you like me to summarize the issues you're describing, and send the content back to you...\nWhen the customer wants to see the doctor or make an appointment, send the information:\n\ud83d\udc68\u200d\u2695\ufe0f To make an appointment, you can:\n\nContact Dr. Hiep directly, CK II - Andrology - Urology. Zalo: 0777471932\nHave information about the symptoms you are experiencing ready to help your doctor better understand your condition.\n\n\ud83d\udeab If the vector data does not include relevant information:\nReply politely:\n**\"I do not have enough information to answer this question at this time. Please consider consulting another reliable source or a medical professional.\"**\n\n\u2705 **Always end your response with a professional Call to Action (CTA):\n\nT\u00f4i l\u00e0 tr\u1ee3 l\u00fd AI. \u0110\u1ec3 \u0111\u01b0\u1ee3c t\u01b0 v\u1ea5n chuy\u00ean m\u00f4n, vui l\u00f2ng li\u00ean h\u1ec7 v\u1edbi:\nB\u00e1c s\u0129 Hi\u1ec7p, CK II Ti\u1ebft ni\u1ec7u - Nam Khoa\nZalo: 0777471932\n\ud83c\udf10 **Always reply in Vietnamese.**\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "8e0a08fa-9063-4cce-b982-650d54b1dd68",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        460,
        200
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d9399f27-3fa5-499a-89d2-d3b3aa8ff467",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        620,
        200
      ],
      "parameters": {
        "sessionKey": "={{ $json.sessionId }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "6af61985-4453-48ac-9e5a-ea7e5482374a",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1100,
        480
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "034fea52-646f-4146-908c-e6128d1f764f",
      "name": "Answer questions with a vector store",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        900,
        220
      ],
      "parameters": {
        "name": "Knowledge",
        "topK": 10,
        "description": "Urology & Andrology Dataset"
      },
      "typeVersion": 1
    },
    {
      "id": "4ab86662-617a-4592-b008-062ca5f9cfa7",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        700,
        380
      ],
      "parameters": {
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "namkhoaa2z",
          "cachedResultName": "namkhoaa2z"
        }
      },
      "credentials": {
        "pineconeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "6e14d1c6-7615-4f2c-84e5-67b94d37d8c9",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        720,
        640
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "06831eef-7986-4b56-8eef-94180cfe9a57",
      "name": "\ud83d\udfe2 Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        -20
      ],
      "parameters": {
        "content": "\ud83d\udfe2 Trigger: Activated when a user sends a new message to the chatbot.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "671e8c95-1585-42cb-9fb7-046266b1eef9",
      "name": "\ud83e\udde0 AI Agent Logic",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        420,
        -120
      ],
      "parameters": {
        "width": 500,
        "height": 260,
        "content": "\ud83e\udde0 Main AI logic: Receives user input, gathers context, and generates a friendly response.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "dc0ddbe5-0025-4998-99a8-4d67c954b6da",
      "name": "\ud83e\udd16 GPT-4o Model",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        200
      ],
      "parameters": {
        "content": "\ud83e\udd16 Uses GPT-4o-mini to understand and generate conversation based on context.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a58774f9-9b3c-4e8d-b829-77f1ba8763bf",
      "name": "\ud83e\udde0 Session Memory",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1000,
        360
      ],
      "parameters": {
        "content": "\ud83d\udcac Renders final answer using GPT-4o-mini based on retrieved knowledge.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2be54256-0caf-4fe5-9dbc-5ac0db5223bc",
      "name": "\ud83d\udcda Vector Store Search",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        160
      ],
      "parameters": {
        "content": "\ud83e\udde0 Stores user session context to support multi-turn dialogue.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "87e3319f-a466-4e04-942f-bf32d681f32b",
      "name": "\ud83e\udde9 Pinecone Search",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        380
      ],
      "parameters": {
        "content": "\ud83d\udcda Connects to the medical vector database (RAG) to search for relevant documents.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "fc8c0d2d-9975-41b0-9732-42660e648610",
      "name": "\ud83e\uddec Embeddings",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        620
      ],
      "parameters": {
        "content": "\ud83e\uddec Transforms input into embeddings for Pinecone to use in vector search.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "68ff049a-9917-47de-b3a0-2edf29614efb",
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "ai_vectorStore": [
        [
          {
            "node": "Answer questions with a vector store",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Answer questions with a vector store": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This template provides an AI-powered Q&A assistant for the Urology domain using Retrieval-Augmented Generation (RAG). It uses Pinecone for vector search and GPT-4o for conversational responses.

Source: https://n8n.io/workflows/3670/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow acts as a 24/7 sales agent, engaging leads across WhatsApp, Instagram, Facebook, Telegram, and your website. It intelligently transcribes audio messages, answers questions using a knowle

Chat Trigger, Memory Postgres Chat, Tool Workflow +20
AI & RAG

Advanced Ai Demo Presented At Ai Developers 14 Meetup. Uses slack, stickyNote, textSplitterRecursiveCharacterTextSplitter, embeddingsOpenAi. Chat trigger; 39 nodes.

Slack, Text Splitter Recursive Character Text Splitter, OpenAI Embeddings +14
AI & RAG

Advanced Ai Demo (Presented At Ai Developers #14 Meetup). Uses slack, stickyNote, textSplitterRecursiveCharacterTextSplitter, embeddingsOpenAi. Chat trigger; 39 nodes.

Slack, Text Splitter Recursive Character Text Splitter, OpenAI Embeddings +14
AI & RAG

Workflow 2358. Uses slack, textSplitterRecursiveCharacterTextSplitter, embeddingsOpenAi, documentDefaultDataLoader. Chat trigger; 39 nodes.

Slack, Text Splitter Recursive Character Text Splitter, OpenAI Embeddings +14
AI & RAG

2358. Uses slack, textSplitterRecursiveCharacterTextSplitter, embeddingsOpenAi, documentDefaultDataLoader. Chat trigger; 39 nodes.

Slack, Text Splitter Recursive Character Text Splitter, OpenAI Embeddings +14