Movie Recommendation Chatbot Using RAG, Qdrant & n8n

This tutorial walks you through building a movie recommendation chatbot powered by Retrieval-Augmented Generation (RAG). We'll use Qdrant as the vector database and n8n to orchestrate the workflows.

Prerequisites

  • Free accounts on:

    • Qdrant Cloud

    • n8n Cloud or a self-hosted n8n instance

  • OpenAI API key (or another embedding service)

  • A movie dataset (CSV or JSON) containing fields like title, description, genre, etc.

Step 1: Prepare Your Movie Dataset

  1. Obtain a movie dataset from sources like IMDb or Kaggle.

  2. Make sure each movie record includes:

    • title

    • description

    • Optional fields like genre, release_year, etc.

  3. Save the dataset in CSV or JSON format.

Step 2: Configure Qdrant Vector Database

  1. Log into your Qdrant Cloud account.

  2. Create a new collection with these settings:

    • Name: movies

    • Distance metric: Cosine

    • Vector size: 1536 (to match OpenAI embeddings)

  3. Keep track of your:

    • API key

    • Collection name

    • Endpoint URL

Step 3: Build Data Ingestion Workflow in n8n

  1. Open n8n and create a workflow named Ingest Movies to Qdrant.

  2. Add these nodes in order:

    • Read CSV or HTTP Request (to load your dataset)

    • AI Embedder (use OpenAI embeddings to vectorize movie info)

    • Qdrant Upsert (insert vectors and metadata into Qdrant)

  3. Map each movie’s title and description to generate its embedding.

  4. Attach metadata like genre and release year to each vector.

  5. Run the workflow to upload your movie data into Qdrant.

Step 4: Create the Recommendation Chatbot Workflow

  1. In n8n, create a new workflow called Movie Chatbot RAG.

  2. Add these nodes:

    • Webhook (to receive user queries via HTTP POST)

    • AI Embedder (convert user input into an embedding vector)

    • Qdrant Search (find nearest movie vectors based on query)

    • AI Summarizer/LLM (generate movie recommendations from results)

    • Respond (return the recommended movies as a response)

  3. Example user prompt:
    “I like action-packed sci-fi movies with time travel.”

  4. Use the query embedding to perform a nearest-neighbor search in Qdrant.

  5. Return the top N movie recommendations with titles and descriptions.

Step 5: Test and Deploy

  1. Trigger your chatbot workflow using the webhook URL and try various prompts.

  2. Adjust parameters such as:

    • Number of nearest neighbors returned

    • AI prompt templates for summarizing results

  3. Deploy your workflows and make the webhook URL publicly accessible (secure it with authentication).

  4. Optionally, connect the webhook to a frontend chat UI for user interaction.

Security Best Practices

  • Store API keys in environment variables.

  • Protect your webhook with authentication or IP whitelisting.

  • Implement rate limiting to avoid abuse.

Summary of Steps

Optional Enhancements

  • Use Qdrant’s payload filtering to filter recommendations by genre or year.

  • Add user feedback (thumbs up/down) to improve recommendations.

  • Support multiple languages using translation APIs.