This project is a conversational AI assistant designed to help users build n8n workflows. It uses a retrieval-augmented generation (RAG) approach to provide relevant information from the official n8n documentation.
- Interactive Chat: A command-line interface for interacting with the assistant.
- Conversation History: The assistant remembers the context of the conversation.
- Document Retrieval: The assistant retrieves relevant information from the n8n documentation to answer user questions.
- Sub-query Generation: The assistant can break down complex questions into smaller, more specific queries to improve retrieval accuracy.
The assistant is built using the following technologies:
- LangChain: A framework for developing applications powered by language models.
- LangGraph: A library for building stateful, multi-actor applications with LLMs.
- OpenAI: Used for generating embeddings for the documentation and for sub-query generation.
- Google Gemini: The primary language model for generating responses.
- PGVector: A PostgreSQL extension for vector similarity search, used as the vector store for the documentation.
- Docker: Used to run the PostgreSQL database with the PGVector extension.
- Python 3.x
- Docker
git clone <repository-url>
cd <repository-directory>Create a .env file in the root of the project and add the following environment variables:
OPENAI_API_KEY="your-openai-api-key"
GOOGLE_API_KEY="your-google-api-key"
DATABASE_URL="postgresql+psycopg://postgres:password@localhost:5432/ragdb"
EMBED_MODEL="text-embedding-3-small"
The project uses a PostgreSQL database with the PGVector extension to store the documentation embeddings. You can use the provided docker-compose.yml file to start a database instance.
docker-compose up -dThe setup.sh script will create a virtual environment and install the required Python packages.
bash setup.shThe assistant uses the official n8n documentation to answer questions. You need to download and ingest the documentation into the vector store.
First, activate the virtual environment:
source venv/bin/activateThen, run the following scripts:
python scripts/download_n8n_docs.py
python scripts/ingest_docs.pyTo start the interactive chat client, run the following command:
python main.pyYou can then start asking questions about how to build n8n workflows.
- To exit the chat, type
quitorexit. - To save the last assistant response to a PDF, type
/save.