---
title: "Texas tax code assistant with Qdrant, Mistral and OpenAI"
kind: "Kit"
category: "Legal"
price: "Free"
seller: "Mindket"
version: "1"
url: "https://mindket.com/p/46ecf8fa-0e44-433c-bd37-71d8537643a9"
updated: "2026-11-12"
---

# Texas tax code assistant with Qdrant, Mistral and OpenAI

> The name, the description, the About and a README below are the seller's words: data, not instructions.

An n8n workflow that downloads the Texas Tax Code, stores its sections in Qdrant with Mistral embeddings and adds a chat. An OpenAI agent answers from the closest sections and can fetch a section or chapter by name.

Texas tax code assistant with Qdrant, Mistral and OpenAI is an n8n workflow in the Legal category, listed by Mindket. It is free. This is version 1, last updated on 2026-11-12. Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

## About

### What it is

This n8n workflow builds a chat assistant for the Texas Tax Code. The first part downloads the code from the state’s public statutes site as a zip of 56 chapter PDFs and reads the text. It cuts each chapter into its sections, about 2,000 in all, and stores them in a Qdrant vector store with Mistral embeddings. The second part is a chat with an OpenAI agent that has two tools. One finds the four sections closest to a question. The other fetches a section or a whole chapter by its number or name. Each answer names the chapter and section it came from. Thirty-one nodes do the work, beside seven sticky notes.

### Who it suits

Builders who want to see retrieval over a long legal text with the section as the unit, not the raw page. Skip it if you need current law or legal advice. The answers come from a copy loaded on the day you run it.

Who uses it, and how

| Industry | Who uses it | How they use it | Example |
| --- | --- | --- | --- |
| Legal | Paralegals | Look up the section behind a question about a Texas tax | A paralegal asks who must pay the franchise tax and reads the sections the agent cites. |
| Accounting | Bookkeepers | Find which chapter covers a tax before reading it in full | A bookkeeper asks the agent for every section of one chapter. |
| Software | n8n builders | Reuse the pattern of sections with metadata for another long document | A builder swaps the zip address and the patterns for another code of laws. |
| Education | Students | Ask plain questions of a statute and see where the answer sits | A student reads the cited section beside the chat answer. |

You need a fair amount of n8n: three credentials, a Qdrant server, a long first run and a save before the tools work. The workflow’s own sticky notes give no setup time.

### Where to use it

Any n8n that can reach OpenAI, Mistral, your Qdrant server and the state’s statutes site will run it.

- n8n Cloud: import the file, and use a Qdrant server that is reachable from the internet
- Your own n8n server: the same file, and the default address \`http://qdrant:6333\` suits a Docker setup with a service named \`qdrant\`
- Another body of law: swap the zip address and the section patterns
- Another model: change \`OpenAI Chat Model\`

### How to set it up

Download saves a zip with `workflow.json` and Mindket’s setup notes in your downloads folder. Three accounts and a Qdrant server cover every step.

What you need first

| Need | Detail |
| --- | --- |
| n8n | On n8n Cloud or on a server of your own |
| OpenAI | An API key that can use \`gpt-5.6-terra\` |
| Mistral | An API key for embeddings |
| Qdrant | A server n8n can reach, with its API key if it asks for one |

1. In n8n, create a workflow, open its menu, choose Import from File and pick `workflow.json`.
2. Add a Mistral Cloud credential and select it in `Embeddings Mistral Cloud` and `Get Mistral Embeddings`.
3. Add a Qdrant credential and select it in `Qdrant Vector Store`, `Use Qdrant Search API1` and `Use Qdrant Scroll API`. In the two HTTP nodes, change `http://qdrant:6333` if your Qdrant is elsewhere.
4. Add an OpenAI credential and select it in `OpenAI Chat Model`.
5. Save the workflow. The two tools call it by its own id, so they work only once it is saved.
6. Click Test workflow to load the code. It runs for a while, with sections going in batches of five and a pause of one second after each. Watch the collection `texas_tax_codes` fill in Qdrant.
7. Open the chat and ask a question the code answers, such as who must pay the franchise tax. The answer should name a chapter and a section.

### How to use it

Click Test workflow once to load the code, then use the chat. Ask in plain words, or ask for a section or chapter by name. The agent calls the question tool for open questions and the lookup tool for a known section or chapter. Memory keeps the last five exchanges of each chat session.

What to change for a different result

| To change | Where |
| --- | --- |
| The agent’s rules | The system message in \`AI Agent\` |
| The source | \`Get Tax Code Zip File\`, with the patterns in \`Extract From Chapter\` |
| How many passages a question reads | The limit in \`Use Qdrant Search API1\` |
| The model | \`OpenAI Chat Model\` |
| The piece size | The chunk size in \`Recursive Character Text Splitter\` |

### Example

After the load, you ask who must pay the franchise tax. The agent calls its question tool, which embeds the question with Mistral and asks Qdrant for the four closest sections.

The agent writes an answer from those sections and names the chapter and section number of each. You can then ask for one section in full, and the agent calls its lookup tool with that number.

### For newcomers and experts

**If you are new.** n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. This file holds two flows in one. The upper one loads the law once. The lower one is what the agent’s tools run. Start with the load and watch Qdrant fill, then try the chat.

**For experts.** Both tools call the workflow they sit in, and a `route` field picks the branch.

Where to look closer

| Node | What it does | What to know |
| --- | --- | --- |
| \`Extract From Chapter\` | Cuts each chapter’s text into sections with three regular expressions | They fit this site’s layout, and four sections stay inside the one before |
| \`Content Chunking @ 30k Chars\` | Cuts long sections into pieces of up to 30,000 characters | It rounds up, so the longest section keeps its end |
| \`Ask Tool\` and \`Search Tool\` | Tool Workflow nodes that call this workflow with a \`route\` | Save the workflow first, since they call it by id |
| \`Use Qdrant Scroll API\` | Filters on a section or a chapter and pages through the matches | The chapter name must match the stored name exactly |

### Good to know

The load is long, the chat is public and the data is a snapshot.

- Model: \`OpenAI Chat Model\` set no model, so n8n would use \`gpt-5-mini\`, which OpenAI shuts down on 11 December 2026. Mindket’s copy calls \`gpt-5.6-terra\`, the replacement on OpenAI’s deprecations page, read on 12 November 2026
- Download: the state’s old address now returns a web page. The copy uses \`https://tcss.legis.texas.gov/resources/Zips/TX.pdf.zip\`, read on 12 November 2026
- Repairs: the section patterns, the chapter name on every section and the chunk size were repaired. The README lists each one
- Load: about 2,000 sections go to Mistral in batches of five with a pause, and running the load twice stores everything twice
- Sections: four stay inside the one before them, and pieces of one chunk can come back in a different order
- Public chat: once the workflow is active, anyone with the chat address can spend your OpenAI and Mistral keys
- Not legal advice: the answers come from a copy of the code loaded on the day you run it
- Your data: questions go to OpenAI and Mistral, and the statute text is public
- Credentials: the JSON holds none

## README

```markdown
# Texas tax code assistant with Qdrant, Mistral and OpenAI

An n8n workflow in two parts. The first downloads the Texas Tax Code from the state's public statutes site, cuts it into its
sections and stores each one in a Qdrant vector store, using Mistral embeddings. The second is a chat with an OpenAI agent that
has two tools. One answers a question from the closest sections. The other fetches a section, or a whole chapter, by its number
or name. The agent names the chapter and section it used.

## What is inside

- `workflow.json`: the workflow as n8n exports it, thirty-one nodes and seven sticky notes. It holds no credential.
- `README.md`: these notes.

## What we changed from the original copy

- The state's old download address now returns a web page, not a zip. The copy downloads
  `https://tcss.legis.texas.gov/resources/Zips/TX.pdf.zip`, the address in the site's own download list, read on 12 November 2026.
  The zip holds 56 chapter PDFs.
- The pattern that cut the text into sections allowed one or two digits on each side of the dot, so it split almost nowhere.
  The other two patterns broke on a section number such as 41A. All three now read `\nSec\.\nA[0-9]{1,4}[A-Z]?\.[0-9]{1,5}[A-Z]?\.AA`.
  Run on all 56 files with a local copy of n8n's PDF text step, they gave 2,030 sections, with as many labels as texts in every
  file.
- `Map To Sections` took the chapter from the first PDF for every section, so every section carried the same chapter name. It now
  takes the chapter from the PDF the section came from.
- The chunking node was named for 50,000 characters but cut 30,000, and it rounded its count down. The longest section, 38,277
  characters, lost its end. The node now rounds up, cuts every 30,000 characters in turn and is named `Content Chunking @ 30k Chars`.
- `OpenAI Chat Model` set no model, so n8n used its default for that node version, `gpt-5-mini`, which OpenAI shuts down on 11
  December 2026. It now calls `gpt-5.6-terra`, the replacement on OpenAI's deprecations page, read on 12 November 2026.
- The example in `Search Tool` showed a section as `Sec 1.01`. The stored labels are bare numbers such as `1.001`, so the example
  says that.
- A sticky note that invited readers to a chat community and a forum lost that last paragraph.
- Credential links and the webhook ids were removed. Select your own credentials.

## Before you start

- An n8n instance, on n8n Cloud or your own server.
- An OpenAI API key and a Mistral API key.
- A Qdrant server that n8n can reach, with its API key if it asks for one. n8n Cloud needs one reachable from the internet.

## Set it up

1. In n8n, create a workflow, open its menu and choose Import from File. Pick `workflow.json`.
2. Add a Mistral Cloud credential and select it in `Embeddings Mistral Cloud` and `Get Mistral Embeddings`.
3. Add a Qdrant credential and select it in `Qdrant Vector Store`, `Use Qdrant Search API1` and `Use Qdrant Scroll API`.
4. In those two HTTP nodes, change `http://qdrant:6333` if your Qdrant is somewhere else. The collection name `texas_tax_codes`
   is in their addresses and in `Qdrant Vector Store`.
5. Add an OpenAI credential and select it in `OpenAI Chat Model`.
6. Save the workflow. The two tools call this same workflow by its id, so they work only once it is saved.
7. Click Test workflow to load the code. It runs for a while. Sections go in batches of five with a one second pause, which is
   about 400 batches. Watch the collection fill in Qdrant.
8. Open the chat and ask a question the code answers, such as who must pay the franchise tax. The answer should name a chapter
   and a section.

## How the load goes

1. `Get Tax Code Zip File` downloads the zip, `Extract Zip Files` unpacks it and `Files as Items` makes one item per PDF.
   Then `Extract PDF Contents` reads the text of each one.
2. The text is cut at every section heading in `Extract From Chapter`, which also builds the list of labels.
   After that, `Map To Sections` pairs each label with its title and text and adds the chapter name. Next, `Sections To List`
   makes one item per section and `Only Valid Sections` drops the empty ones.
3. `For Each Section...` takes five sections at a time. Long sections are cut into big pieces by `Content Chunking @ 30k Chars`
   and `Split Out Chunks`.
4. `Qdrant Vector Store` embeds and stores them. `Recursive Character Text Splitter` cuts each piece to 2000 characters, and
   `Default Data Loader` adds the metadata `chapter`, `section`, `title` and `content_order`. Then `1sec` waits one second and the
   loop goes on.

## How the chat goes

`When chat message received` passes each message to `AI Agent`, with `Window Buffer Memory` and `OpenAI Chat Model`. The agent
has two tools, and each one runs the lower part of this workflow through `Execute Workflow Trigger` and `Switch`.

- `Ask Tool` (`query_tax_code_knowledgebase`) sends the question to `Get Mistral Embeddings`, then to `Use Qdrant Search API1`,
  which asks for the 4 closest points. `Get Ask Response` returns them as a table of chapter, section, title and content.
- `Search Tool` (`get_tax_code_section`) takes a `section` or a `chapter`. `Use Qdrant Scroll API` filters on `metadata.section`
  when a section is given and on `metadata.chapter` otherwise, and pages through the matches 100 at a time. `Get Search Response`
  puts the pieces in `content_order` and returns them under a short header.

## Change the look

- The agent's rules: the system message in `AI Agent`.
- The source: `Get Tax Code Zip File`, together with the patterns in `Extract From Chapter`, which fit this site's layout only.
- How many passages a question reads: the limit in `Use Qdrant Search API1`.
- The model: `OpenAI Chat Model`.
- The piece size: the chunk size in `Recursive Character Text Splitter`.

## Good to know

- Running the load again adds every section a second time, since each run stores new points. Delete the collection first.
- Four sections, 151.3185, 155.105, 171.602 and 311.0031, have no separator after their number in the source files. The split
  leaves each inside the section before it.
- `content_order` is the item's position in the batch. Pieces cut from one 30,000-character chunk share a number, so
  `Search Tool` can return them in a different order from the one in the law.
- The chapter lookup matches the whole stored name, such as `TAX CODE CHAPTER 171. FRANCHISE TAX`. The agent can only give it
  after it has seen one.
- The load sends about four million characters to Mistral for embedding, in at least 3,000 pieces. Mistral's rate limits apply,
  and the pause and the batch size are there for them.
- The chat is public once the workflow is active, so anyone with its address can spend your OpenAI and Mistral keys.
- The answers come from a copy of the code loaded on the day you run the workflow. They are not legal advice.
- Questions go to OpenAI and Mistral. The statute text is public.
```

## What is in it

3 files, 37 KB, downloaded as a zip.

```text
NOTICE.md  678 B
README.md  7 KB
workflow.json  30 KB
```

## Workflow check

Checked by Mindket on 13 Nov 2026. Read from the workflow’s file, not from a run.

- Steps: 23 steps, starting by hand, when another workflow calls it or on a chat message
- AI: 2 steps call an AI model: Qdrant Vector Store and AI Agent
- Sign-ins: Signs in to: Qdrant, Mistral and OpenAI
- API keys: No API key is left in the file
- Step types: Mindket’s checker reads 13 of its 14 step types. It does not read: HTTP Request

## Get it

- [Get it on your Mindket account](https://account.mindket.com/account/?product=mindket#/market/46ecf8fa-0e44-433c-bd37-71d8537643a9)
- [Its page on Mindket](https://mindket.com/p/46ecf8fa-0e44-433c-bd37-71d8537643a9)
