2 templates found
Category:
Author:
Sort:

Build a tax code assistant with Qdrant, Mistral.ai and OpenAI

This n8n workflows builds another example of creating a knowledgebase assistant but demonstrates how a more deliberate and targeted approach to ingesting the data can produce much better results for your chatbot. In this example, a government tax code policy document is used. Whilst we could split the document into chunks by content length, we often lose the context of chapters and sections which may be required by the user. Our approach then is to first split the document into chapters and sections before importing into our vector store. Additionally, using metadata correctly is key to allow filtering and scoped queries. Example Human: "Tell me about what the tax code says about cargo for intentional commerce?" AI: "Section 11.25 of the Texas Property Tax Code pertains to "MARINE CARGO CONTAINERS USED EXCLUSIVELY IN INTERNATIONAL COMMERCE." In this section, a person who is a citizen of a foreign country or an en..." How it works The tax code policy document is downloaded as a zip file from the government website and its pages are extracted as separate chapters. Each chapter is then parsed and split into its sections using data manipulation expressions. Each section is then inserted into our Qdrant vector store tagged with its source, chapter and section numbers as metadata. When our AI Agent needs to retrieve data from our vector store, we use a custom workflow tool to perform the query to Qdrant. Because we're relying on Qdrant's advanced filtering capabilities, we perform the search using the Qdrant API rather than the Qdrant node. When the AI Agent, needs to pull full wording or extracts, we can use Qdrant's scroll API and metadata filtering to do so. This makes Qdrant behave like a key-value store for our document. Requirements A Qdrant instance is required for the vector store and specifically for it's filtering functionality. Mistral.ai account for Embeddings and AI models. Customising this workflow Depending on your use-case, consider returning actual PDF pages (or links) to the user for the extra confirmation and to build trust. Not using Mistral? You are able to replace but note to match the distance and dimension size of Qdrant collection to your chosen embedding model.

JimleukBy Jimleuk
10429

Generate PDF documents from HTML with PDF Generator API, Gmail and Supabase

Who’s this for 💼 This template is designed for teams and developers who need to generate PDF documents automatically from HTML templates. It’s suitable for use cases such as invoices, confirmations, reports, certificates, or any custom document that needs to be created dynamically based on incoming data. What this workflow does ⚙️ This workflow automates the full lifecycle of document generation, from request validation to delivery and storage. It is triggered by a POST webhook that receives structured JSON data describing the requested document and client information. Before generating the document, the workflow validates the client’s email address using Hunter Email Verification to prevent invalid or mistyped emails. If the email is valid, the workflow loads the appropriate HTML template from a Postgres database, fills it with the incoming data, and converts it into a PDF using PDF Generator API. Once the PDF is generated, it is sent to the client via Gmail, uploaded to Supabase Storage, and the transaction is recorded in the database for tracking and auditing purposes. How it works 🛠️ Receives a document generation request via a POST webhook. Validates the client’s email address using Hunter. Generates a PDF document from an HTML template using PDF Generator API. Sends the PDF via Gmail and uploads it to Supabase Storage. Stores a document generation record in the database. How to set up 🖇️ Before activating the workflow, make sure all required services and connections are prepared and available in your n8n environment. Create a POST webhook endpoint that accepts structured JSON input. Add Hunter API credentials for email verification. Add PDF Generator API credentials for HTML to PDF conversion. Prepare a Postgres database with tables for HTML templates and document generation records. Set up Gmail or SMTP credentials for email delivery. Configure Supabase Storage for storing generated PDF files. Requirements ✅ PDF Generator API account Hunter account Postgres database Gmail or SMTP-compatible email provider Supabase project with Storage enabled How to customize the workflow 🤖 This workflow can be adapted to different document generation scenarios by extending or modifying its existing steps: Add extra validation steps before document generation if required. Extend delivery options by sending the generated PDF to additional services or webhooks. Enhance security by adding document encryption or access control. Add support for additional document types by storing more HTML templates in the database. Modify the database schema or queries to store additional metadata related to generated documents. Adjust the data mapping logic in the Code node to match your input structure.

Marián DanašBy Marián Današ
113
All templates loaded