# Build document RAG system with Kimi-K2 and Gemini: n8n workflow

> Started by someone opening a chat with it. It calls services over plain HTTP rather than through connectors. It hands the judgement calls to Gemini.

Source: https://millionrounds.com/workflow/build-document-rag-system-with-kimi-k2-and-gemini (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Documents and files](https://millionrounds.com/workflows?category=Documents+and+files#library)

# Build document RAG system with Kimi-K2 and Gemini

Started by someone opening a chat with it. It calls services over plain HTTP rather than through connectors. It hands the judgement calls to Gemini. 25 steps, 1 loop or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: Gemini

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fbuild-document-rag-system-with-kimi-k2-and-gemini)

**25 steps** Large: read it before trusting it with anything live

**0** Branches: places the flow splits

**1** Loop or waits

**0** Services by connector: it calls them over plain HTTP

## The flow

Starts it 4 Model 4 Logic 7 Service 10

The steps in the order they run, from what starts it.

- 1 **When clicking ‘Execute workflow’** Manual trigger *Starts it*
- 2 **Create Collection** Qdrant *Service*
- 3 **When chat message received** Chat trigger *Starts it*
- 4 **Subworkflow Trigger** Execute Workflow trigger *Starts it*
- 5 **Google Gemini Chat Model1** Lm Chat Google Gemini *Model*
- 6 **Highway Code Manual1** Tool Workflow *Model*
- 7 **Highway Code Manual** Tool Workflow *Model*
- 8 **Test Questions** Set *Logic*
- 9 **Download Large Document** Http Request *Service*
- 10 **Create Summary Index** Qdrant *Service*
- 11 **Highway Code Expert** Agent *Model*
- 12 **Retrieval Vectors with Gemini-Embeddings-001** Http Request *Service*
- 13 **Highway Code MCP Server** Mcp trigger *Starts it*
- 14 **Split Out** Split Out *Logic*
- 15 **Extract from File** Extract From File *Service*
- 16 **Query Docs from Qdrant Vector Store** Qdrant *Service*
- 17 **Call Highway Code Manual Tool** Execute Workflow *Logic*
- 18 **Split Pages** Split Out *Logic*
- 19 **Kimi-K2 via Featherless ai** Featherless *Service*
- 20 **Kimi-K2 via Featherless.ai** Featherless *Service*
- 21 **Get Response** Set *Logic*
- 22 **Loop Over Items** Split In Batches *Logic*
- 23 **Chunk Ref** No Op *Logic*
- 24 **Retrieval Vectors with Gemini Embeddings 001** Http Request *Service*
- 25 **Add Docs To Qdrant Vector Store** Qdrant *Service*

## How it's built

- **Starts on:** Someone opening a chat with it
- **Steps:** 25, 1 loop or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Nothing by connector; it calls services over plain HTTP
- **Model:** Gemini

## Questions

What does it need to run?

An n8n account, and a key for Gemini. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone opening a chat with it.

Does it use AI?

Yes. It calls Gemini. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 25 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 25 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fbuild-document-rag-system-with-kimi-k2-and-gemini)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Workflows like it

Also documents and files, with the same services where possible, closest in size first.

- [**Document RAG & chat agent: Google Drive to Qdrant with Mistral** 25 steps · calls a model · Google Drive, Qdrant](https://millionrounds.com/workflow/document-rag-and-chat-agent-google-drive-to-qdrant-with-mist)
- [**Review contract risk and rewrite clauses with Groq** 25 steps · calls a model · Google Drive, Notion](https://millionrounds.com/workflow/review-contract-risk-and-rewrite-clauses-with-groq)
- [**Route legal contract risks with OpenAI and Slack** 25 steps · calls a model · n8n data table](https://millionrounds.com/workflow/route-legal-contract-risks-with-openai-and-slack)
- [**Extract text from Google Drive files to Google Sheets** 25 steps · Google Docs, Google Drive](https://millionrounds.com/workflow/extract-text-from-google-drive-files-to-google-sheets)
- [**Nightly n8n backup to Google Drive** 25 steps · Google Drive](https://millionrounds.com/workflow/nightly-n8n-backup-to-google-drive)
- [**Audit contract governance risk with OpenAI and Slack** 24 steps · calls a model · Email, Slack](https://millionrounds.com/workflow/audit-contract-governance-risk-with-openai-and-slack)
