# Retrieve and answer Gmail email queries with Llama and Qdrant: n8n workflow

> Started by an arriving email, and works across Gmail and Google Drive. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/retrieve-and-answer-gmail-email-queries-with-llama-and-qdran (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [AI assistants](https://millionrounds.com/workflows?category=AI+assistants#library)

# Retrieve and answer Gmail email queries with Llama and Qdrant

Started by an arriving email, and works across Gmail and Google Drive. It hands the judgement calls to OpenAI. 21 steps, 1 branch: 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%2Fretrieve-and-answer-gmail-email-queries-with-llama-and-qdran)

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

**1** Branch: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 2 Model 1 Logic 8 Service 10

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

- 1 **Google Drive Trigger** Google Drive trigger *Starts it*
- 2 **Gmail Trigger** Gmail trigger *Starts it*
- 3 **Download file** Google Drive *Service*
- 4 **Fetch Collection Name** Code *Logic*
- 5 **Fields Preparation** Set *Logic*
- 6 **Extract from File** Extract From File *Service*
- 7 **Check If Collection Exists** Qdrant *Service*
- 8 **Query Embedding** Http Request *Service*
- 9 **Collection Name Fetch** Code *Logic*
- 10 **Data Fetch** Set *Logic*
- 11 **If** If *Logic*
- 12 **Merge** Merge *Logic*
- 13 **Data Preprocessing** Code *Logic*
- 14 **Delete Collection** Qdrant *Service*
- 15 **Create Collection** Qdrant *Service*
- 16 **Similarity Search** Qdrant *Service*
- 17 **Embedding Generation** Http Request *Service*
- 18 **Message a model** Open Ai *Model*
- 19 **Upsert Points** Qdrant *Service*
- 20 **Email Format** Set *Logic*
- 21 **Send Repy Email** Gmail *Service*

## How it's built

- **Starts on:** An arriving email
- **Steps:** 21, with 1 branch
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Google Drive
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Gmail and Google Drive accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an arriving email.

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 21 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 21 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%2Fretrieve-and-answer-gmail-email-queries-with-llama-and-qdran)
- **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.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Google Drive](https://millionrounds.com/workflows?service=Google+Drive#library)

## Workflows like it

Also ai assistants, with the same services where possible, closest in size first.

- [**Agile project generator with ClickUp and OpenAI** 21 steps · calls a model · ClickUp, Gmail](https://millionrounds.com/workflow/agile-project-generator-with-clickup-and-openai)
- [**Design and apply Gmail label systems with OpenAI** 21 steps · calls a model · Gmail](https://millionrounds.com/workflow/design-and-apply-gmail-label-systems-with-openai)
- [**Parse Gmail inbox and transform into Todoist tasks with OpenAI** 21 steps · calls a model · Email, Gmail](https://millionrounds.com/workflow/parse-gmail-inbox-and-transform-into-todoist-tasks-with-open)
- [**Route IAM events with OpenAI and Slack** 21 steps · calls a model · Gmail, n8n data table](https://millionrounds.com/workflow/route-iam-events-with-openai-and-slack)
- [**Turn HR news into policy update tasks and a weekly Gmail digest** 21 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/turn-hr-news-into-policy-update-tasks-and-a-weekly-gmail-dig)
- [**Automated project kickoff with Dropbox MCP and OpenAI** 22 steps · calls a model · Gmail](https://millionrounds.com/workflow/automated-project-kickoff-with-dropbox-mcp-and-openai)
