# Document Q&A system with Voyage-Context-3 and MongoDB Atlas: n8n workflow

> Started by someone opening a chat with it, and works across MongoDB. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/document-q-and-a-system-with-voyage-context-3-and-mongodb-at (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)

# Document Q&A system with Voyage-Context-3 and MongoDB Atlas

Started by someone opening a chat with it, and works across MongoDB. It hands the judgement calls to OpenAI. 43 steps, 5 loops or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fdocument-q-and-a-system-with-voyage-context-3-and-mongodb-at)

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

**0** Branches: places the flow splits

**5** Loops or waits

**1** Service it connects to

## The flow

Starts it 3 Model 7 Logic 24 Service 9

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

- 1 **When clicking ‘Execute workflow’** Manual trigger *Starts it*
- 2 **Subworkflow Trigger** Execute Workflow trigger *Starts it*
- 3 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 4 **When chat message received** Chat trigger *Starts it*
- 5 **Fetch Document By Page Number** Mongo Db Tool *Service*
- 6 **Set Variables** Set *Logic*
- 7 **Loop Over Items** Split In Batches *Logic*
- 8 **Generate Clarifying Questions** Information Extractor *Model*
- 9 **Get Query** Set *Logic*
- 10 **RAG Agent** Open Ai *Model*
- 11 **Clear Collection** Mongo Db *Service*
- 12 **Page Ref** No Op *Logic*
- 13 **Split Questions** Split Out *Logic*
- 14 **Respond to User** Chat *Model*
- 15 **Import Research Paper** Http Request *Service*
- 16 **Chunk Page Text** Code *Logic*
- 17 **Combine Content & Metadata** Set *Logic*
- 18 **Loop Over Questions** Split In Batches *Logic*
- 19 **Extract from File** Extract From File *Service*
- 20 **Voyage-Context-3 Embeddings** Http Request *Service*
- 21 **Insert Document Page** Mongo Db *Service*
- 22 **Aggregate Answers** Aggregate *Logic*
- 23 **Query Ref** No Op *Logic*
- 24 **Split Pages** Split Out *Logic*
- 25 **Split Out** Split Out *Logic*
- 26 **Merge** Merge *Logic*
- 27 **Quick Confirmation** Chat *Model*
- 28 **Wait for Answer** Chat *Model*
- 29 **Add Page Number** Set *Logic*
- 30 **For Each Group** Split In Batches *Logic*
- 31 **Done** Set *Logic*
- 32 **Voyage-Context-3 Embeddings1** Http Request *Service*
- 33 **Batch 10** Split In Batches *Logic*
- 34 **No Operation, do nothing** No Op *Logic*
- 35 **Split Out1** Split Out *Logic*
- 36 **Perform Similarity Search** Mongo Db *Service*
- 37 **Call Embeddings Subworkflow** Execute Workflow *Logic*
- 38 **Combine Content & Vectors** Set *Logic*
- 39 **Aggregate** Aggregate *Logic*
- 40 **Wait** Wait *Logic*
- 41 **Insert Documents Vectors** Mongo Db *Service*
- 42 **Quick Update** Chat *Model*
- 43 **Aggregate1** Aggregate *Logic*

## How it's built

- **Starts on:** Someone opening a chat with it
- **Steps:** 43, 5 loops or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** MongoDB
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own MongoDB account, and a key for OpenAI. 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 OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 43 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 43 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%2Fdocument-q-and-a-system-with-voyage-context-3-and-mongodb-at)
- **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.

## Connects to

Each opens the other workflows that use it.

[MongoDB](https://millionrounds.com/workflows?service=MongoDB#library)

## Workflows like it

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

- [**Insert a document in MongoDB** 3 steps · MongoDB](https://millionrounds.com/workflow/insert-a-document-in-mongodb)
- [**Insert document into MongoDB** 3 steps · MongoDB](https://millionrounds.com/workflow/insertar-documento-en-mongodb)
