n8n workflow template · 31 nodes · Mistral AI
Build a Tax Code Assistant with Qdrant, Mistral.ai and OpenAI is a free n8n workflow template that runs when another workflow calls it and works with Mistral AI, Qdrant and OpenAI. It has 31 nodes, 11 of them AI nodes (Mistral Cloud Embeddings, Default Data Loader, Recursive Character Text Splitter and Qdrant Vector Store). The notes inside the workflow say: “Join the Discord or ask in the Forum!” To run it, you add your own credentials for Mistral Cloud API, OpenAI API and Qdrant API.
The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.
Join the Discord or ask in the Forum!
Read more about handling Zip Files
Let's begin by pulling a zip file containing all the tax codes as separate PDF files. We can unzip on the fly with n8n's compression node.
Learn more about using AI Agents in n8n
For our chatbot, we'll use an AI agent node because we want to achieve more than one functionality. The first will be querying to relevant texts to answer a user's question and secondly, a direct search feature to pull full section text when requested.
Learn more about reading PDF Files
Rather than ingest the raw text of the PDF, we'll be a little more strategic and extract the tax code sections separately instead. Not only will this provide cleaner results, we'll also be able to fetch sections in isolation if required.
With raw PDF data, we may blur the boundaries between chapters and sections making later results hard to find, incoherent or misleading. Depending on your use-case, store your data in a way you intend to retrieve it!
Learn more about using AI Agents in n8n
Our Ask Tool will generate embeddings using Mistral.ai and query our Qdrant collection using the Qdrant Search API. Our Search Tool will use filter our Qdrant collection using the Qdrant Scroll API, matching on each doc's section metadata key.
Read more about using the Qdrant Vectorstore
We'll save our data into a Qdrant collection being mindful to use metadata to take full advantage of Qdrant's filtering capabilities later. Though not always required, since the tax code documents can be quite large we'll implement a loop here to throttle the number of tokens being processed as to not trip the Mistral.ai rate limits for embeddings.
The 31 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:
Configure your own credentials after importing. Create each credential in n8n, then select it in the node.
Do you need somewhere to run it? Read our guide to self-hosted n8n.
We can adapt this workflow to your apps, data and process, then deploy and support it.
Contact Us