RAG Chatbot for GitHub API Documentation using Pinecone and OpenAI - n8n Workflow

Build a powerful RAG chatbot using this specialized n8n workflow template. Leverage Pinecone and OpenAI to index and query the GitHub OpenAPI specification for instant answers.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Developers and API Managers: Who need quick, natural language access to complex API specifications.
AI/ML Engineers: Interested in implementing scalable RAG knowledge bases.
n8n Automation Specialists: Looking for advanced examples using LangChain n8n nodes, vector databases, and AI agents.
Technical Writers: Seeking to automate documentation Q&A using a proven n8n workflow.

Overview

Managing vast technical documentation, like complex API specifications, can be challenging. This advanced n8n workflow solves this by implementing a Retrieval-Augmented Generation (RAG) system, turning static documentation into a dynamic, chat-enabled knowledge base. This particular n8n template focuses on the GitHub OpenAPI specification.

The automation is split into two phases: Indexing and Querying. The indexing phase uses a manual n8n trigger to fetch the documentation, split it into chunks, generate embeddings via the OpenAI n8n node, and store these vectors in Pinecone. The querying phase uses an n8n chat trigger to receive user questions, which the AI Agent n8n node orchestrates, querying Pinecone for relevant context before formulating an accurate response using a powerful Large Language Model (LLM). This setup demonstrates the full power of building sophisticated AI solutions using standard n8n nodes and specialized LangChain tools.

How it Works

This comprehensive n8n workflow operates in two distinct, interconnected processes:

1. Indexing and Setup

This process is initiated manually via the 'When clicking Test workflow' n8n trigger. Its purpose is to prepare the knowledge base:

  1. Fetch Documentation: An HTTP Request n8n node downloads the raw GitHub OpenAPI specification JSON file.

  2. Load and Split: The Default Data Loader node processes the JSON. The data is then efficiently broken down into manageable chunks using the Recursive Character Text Splitter n8n node.

  3. Generate Embeddings: The Generate Embeddings n8n node (powered by OpenAI) converts these text chunks into numerical vectors.

  4. Vector Storage: The primary Pinecone Vector Store n8n node inserts these vectors into the specified Pinecone index ('n8n-demo'), completing the knowledge base setup.

2. Chat and Retrieval (RAG)

This process is initiated by a user message via the 'When chat message received' n8n trigger:

  1. Orchestration: The AI Agent n8n node takes control, using the OpenAI Chat Model for reasoning and the Window Buffer Memory n8n node for conversational context.

  2. Tool Use: The Agent is configured with a Vector Store Tool n8n node. When a question requires external knowledge, the Agent calls this tool.

  3. Querying Pinecone: The Vector Store Tool directs the query to the Pinecone Vector Store (Querying) n8n node. It first uses the Generate User Query Embedding n8n node to vectorize the user's question.

  4. Retrieval and Generation: Pinecone retrieves the most relevant documentation chunks. A secondary OpenAI Chat Model n8n node uses these retrieved chunks (the context) alongside the user's query to generate a highly accurate, grounded answer, which is then passed back to the user.

Installation Guide

To use this complex n8n workflow and access its powerful RAG capabilities, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON data and paste it into your n8n instance using the 'Import from JSON' option.

  2. Credentials Setup: This n8n workflow requires two sets of credentials:

OpenAI API Key: Configure an OpenAI credential for the embedding and chat models used in several n8n nodes.
Pinecone API Key: Configure a Pinecone credential.

  1. Pinecone Index Preparation: Ensure you have a Pinecone index named n8n-demo in your account, or modify the Pinecone Vector Store n8n node parameters to match your existing index name.

  2. Indexing the Data: Run the workflow manually by clicking the 'Execute Workflow' button or the 'Test workflow' trigger to load the GitHub specification data into Pinecone. This must be done successfully before the chatbot can function.

  3. Activation: Once indexing is complete, set the main n8n workflow to 'Active' to enable the chat trigger endpoint.

Node Details

When clicking ‘Test workflow’ (n8n trigger): A manual n8n trigger used solely to initiate the one-time indexing process.
HTTP Request (n8n node): Fetches the raw OpenAPI specification from the official GitHub repository URL.
Default Data Loader (n8n node): Loads and prepares the fetched JSON content for subsequent processing.
Recursive Character Text Splitter (n8n node): Essential for RAG. It splits the large documentation file into smaller, searchable text chunks.
Generate Embeddings & Generate User Query Embedding (OpenAI Embeddings n8n nodes): Uses OpenAI to create vector representations for the documentation chunks (indexing) and the user's input (querying).
Pinecone Vector Store (n8n node): Used in two modes. The first instance handles the insert of the generated vectors during indexing. The second instance (Pinecone Vector Store (Querying)) handles the query operations.
When chat message received (n8n trigger): The webhook n8n trigger that listens for and processes user messages, initiating the RAG pipeline.
AI Agent (n8n node): The core intelligence. It uses the LLM, memory, and tools to reason about the user's intent and decide whether to use the RAG tool.
Window Buffer Memory (n8n node): Maintains the context of the conversation, allowing the AI Agent to remember previous messages.
Vector Store Tool (n8n node): Exposes the Pinecone database as a callable tool for the AI Agent, allowing it to retrieve knowledge when needed. This is a crucial n8n node in RAG implementations.


  • OpenAI Chat Model (n8n node): The primary LLM (likely GPT 4o-mini) used by the AI Agent for decision-making and synthesizing the final output. The consistent use of the OpenAI n8n node ensures quality generation.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by

Full-stack developer with 5+ years streamlining healthcare processes. Proficient in NodeJS, VueJS, MongoDB, PostgreSQL, Kubernetes, and n8n. Ready to optimize your workflows – book a consult via my link.

Featured*