npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@matheusprm-nodes/n8n-nodes-tool-vector-store-custom-prompt

v0.1.9

Published

n8n community node for Vector Store QA Tool with customizable prompt

Readme

n8n-nodes-tool-vector-store-custom-prompt

npm version License: MIT

A custom n8n community node that extends the Vector Store Question Answer Tool with editable prompt templates. This node allows you to customize the QA prompt used in RAG (Retrieval-Augmented Generation) workflows, providing more control over how AI agents answer questions using vector stores.

Features

  • Customizable Prompt Template - Edit the QA prompt via UI (unlike the original node)
  • Two Prompt Modes - Support for both "stuff" (PromptTemplate) and "chat" (ChatPromptTemplate) modes
  • Strict Mode - Prevents AI from making inferences and requires explicit evidence from context
  • Source Return - Optional return of document sources with metadata
  • Full LangChain Integration - Uses VectorDBQAChain with StuffDocumentsChain
  • AI Tool Compatible - Works seamlessly with n8n AI Agents

Installation

Install this node in your n8n instance:

npm install n8n-nodes-tool-vector-store-custom-prompt

Usage

Basic Setup

  1. Add the Vector Store QA Tool (Custom Prompt) node to your workflow
  2. Connect a Vector Store node to the first input
  3. Connect a Language Model (Chat Model) to the second input
  4. Configure the node parameters:
    • Description: Describe what data is in your vector store (e.g., "imóveis, bairros e empreendimentos")
    • Limit (Top-K): Number of documents to retrieve (default: 4)
    • Prompt Template: Your custom QA prompt (must include {context} and {question})
    • Strict Mode: Enable to prevent AI inferences (recommended)

Connecting to AI Agent

  1. Add an AI Agent node to your workflow
  2. Enable the tool from the Vector Store QA Tool node
  3. The tool will be available with a sanitized name based on your node name

Example Prompt Template

Você é um assistente de QA (perguntas e respostas) que responde com base APENAS no contexto fornecido.

REGRAS CRÍTICAS:
1) Use SOMENTE as informações presentes no CONTEXTO.
2) Se a resposta não estiver explicitamente no CONTEXTO, responda exatamente: "Não encontrei essa informação no contexto disponível."
3) NÃO inferir bairros/regiões próximas, "na região", "perto de", "equivalentes" ou similares, a menos que o CONTEXTO cite isso explicitamente.
4) NÃO inventar códigos/IDs de imóveis e NÃO supor características que não estejam no CONTEXTO.
5) Se a pergunta exigir filtros (ex.: bairro X, 3 quartos, 2 vagas), só traga itens que tenham esses critérios explícitos no CONTEXTO.

CONTEXTO:
{context}

PERGUNTA:
{question}

RESPONDA de forma direta, curta e objetiva.

Node Parameters

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | Description | string | "imóveis, bairros e empreendimentos" | Description of the vector store content (used in tool description) | | Limit (Top-K) | number | 4 | Maximum number of documents to retrieve in similarity search | | Prompt Mode | options | "stuff" | Prompt mode: "stuff" (PromptTemplate) or "chat" (ChatPromptTemplate) | | Document Variable Name | string | "context" | Variable name in template that receives the context (must match {context} in prompt) | | Strict Mode | boolean | true | When enabled, injects reinforcements to prevent inference and require explicit evidence | | Return Sources | boolean | false | When enabled, returns a SOURCES section with document metadata | | Prompt Template | string | (see default above) | Editable prompt used to combine documents from vector store |

Differences from Original Node

| Aspect | Original toolVectorStore | This Node | |--------|---------------------------|-----------| | Prompt | Fixed LangChain default (not editable) | Editable via UI | | Customization | Limited | Full control over instructions, tone, response format | | Use Cases | Generic | Specific business needs (e.g., real estate, internal docs) |

Requirements

  • n8n: Version 1.0.0 or higher
  • langchain: ^0.3.0 (peer dependency)
  • @langchain/core: ^0.3.0 (peer dependency)

Development

Prerequisites

  • Node.js v22 or higher
  • npm

Setup

# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode
npm run dev

# Lint code
npm run lint

Troubleshooting

Node doesn't appear in n8n

  1. Make sure you ran npm install
  2. Check that the node is listed in package.json under n8n.nodes
  3. Restart n8n
  4. Check console for error messages

"Cannot find module 'langchain'"

This usually means langchain dependencies are not installed. Ensure you have:

  • langchain ^0.3.0
  • @langchain/core ^0.3.0

These should be available in your n8n environment.

Invalid prompt template

The node validates that your prompt template includes:

  • {context} (or the name configured in "Document Variable Name")
  • {question} (required in "stuff" mode)

Make sure both placeholders are present in your template.

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions:

Related