Skip to main content

Answer questions about documentation with BigQuery RAG and OpenAI

Workflow preview

Workflow preview
100%
Answer questions about documentation with BigQuery RAG and OpenAI preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

BigQuery RAG with OpenAI Embeddings This workflow demonstrates how to use Retrieval Augmented Generation (RAG) with BigQuery and OpenAI . By default, you cannot directly use OpenAI Cloud Models wit...

Best for

  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.chattrigger, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.memorybufferwindow, n8n-nodes-base.executeworkflowtrigger, @n8n/n8n-nodes-langchain.toolworkflow, n8n-nodes-base.stickynote, n8n-nodes-base.set

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Dataki.

Original n8n.io source

1.1 Workflow description

Title
Answer questions about documentation with BigQuery RAG and OpenAI
Workflow name
Answer questions about documentation with BigQuery RAG and OpenAI

BigQuery RAG with OpenAI Embeddings

This workflow demonstrates how to use Retrieval-Augmented Generation (RAG) with BigQuery and OpenAI.
By default, you cannot directly use OpenAI Cloud Models within BigQuery.

Try it

This template comes with access to a public BigQuery table that stores part of the n8n documentation (about nodes and triggers), allowing you to try the workflow right away:
n8n-docs-rag.n8n_docs.n8n_docs_embeddings

⚠️ Important: BigQuery uses the requester pays model. The table is small (~40 MB), and BigQuery provides 1 TB of free processing per month. Running 3–4 queries for testing should remain within the free tier, unless your project has already consumed its quota.
More info here: BigQuery Pricing

Why this workflow?

Many organizations already use BigQuery to store enterprise data, and OpenAI for LLM use cases.
When it comes to RAG, the common approach is to rely on dedicated vector databases such as Qdrant, Pinecone, Weaviate, or PostgreSQL with pgvector.
Those are good choices, but in cases where an organization already uses and is familiar with BigQuery, it can be more efficient to leverage its built-in vector capabilities for RAG.

Then comes the question of the LLM. If OpenAI is the chosen provider, teams are often frustrated that it is not directly compatible with BigQuery.
This workflow solves that limitation.

Prerequisites

To use this workflow, you will need:

  • A good understanding of BigQuery and its vector capabilities
  • A BigQuery table containing documents and an embeddings column
    • The embeddings column must be of type FLOAT and mode REPEATED (to store arrays)
  • A data pipeline that generates embeddings with the OpenAI API and stores them in BigQuery

This template comes with a public table that stores part of the n8n documentation (about nodes and triggers), so you can try it out:
n8n-docs-rag.n8n_docs.n8n_docs_embeddings

How it works

The system consists of two workflows:

  • Main workflow → Hosts the AI Agent, which connects to a subworkflow for RAG
  • Subworkflow → Queries the BigQuery vector table. The retrieved documents are then used by the AI Agent to generate an answer for the user.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 2 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.3

Block 3 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 4 - Simple Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 5 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 6 - BigQuery RAG OpenAI

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2.2

Block 7 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Set field - question

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 15 - OpenAI - Create Embedding

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 16 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - BigQuery - Vector Retriever - n8n docs

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 19 - Sticky Note9

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Documents retrieved

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 21 - Sticky Note10

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note11

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note12

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Set Field - Embedding

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

3. Summary Table

Workflow Answer questions about documentation with BigQuery RAG and OpenAI
Complexity advanced
Nodes 24
Categories AI RAG
Author Dataki
Published 03 Sept 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/8220/8220.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Answer questions about documentation with BigQuery RAG and OpenAI do?

BigQuery RAG with OpenAI Embeddings This workflow demonstrates how to use Retrieval Augmented Generation (RAG) with BigQuery and OpenAI . By default, you cannot directly use OpenAI Cloud Models wit...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your AI RAG use case.