AI Movie Recommender Agent (RAG with Qdrant & OpenAI)
Integrates with:
Overview
Unlock Personalized Movie Discovery with this AI Agent
This AI Agent provides intelligent movie recommendations through a conversational interface. It leverages a Retrieval Augmented Generation (RAG) architecture, combining the power of OpenAI's language models with a Qdrant vector database for efficient similarity searches. Initially, it processes a movie dataset (e.g., from a CSV file via GitHub), generates embeddings for movie descriptions using OpenAI, and stores them in Qdrant. When you chat with the agent, it understands your preferences, uses a custom tool to query the Qdrant database for relevant movies (considering both positive and negative examples you might provide), and then presents you with personalized recommendations.
Key Features & Benefits
- AI-Powered Recommendations: Uses OpenAI's
gpt-4o-mini
(or other configurable models) for natural language understanding andtext-embedding-3-small
for creating rich semantic embeddings of movie data. - RAG Architecture: Enhances recommendation quality by retrieving relevant movie information from a specialized Qdrant vector store before generating a response.
- Conversational Interface: Interact with the agent via chat to get movie suggestions based on your described likes and dislikes.
- Vector Database Integration: Utilizes Qdrant for storing and efficiently querying movie embeddings, enabling fast and scalable similarity searches.
- Customizable Data Ingestion: Easily adapt the workflow to load movie data from your preferred sources. The example uses GitHub to fetch a CSV of movie data.
- Tool-Based Retrieval: Employs an n8n workflow tool to perform complex retrieval logic against the Qdrant database, including positive and negative preference handling using OpenAI embeddings.
- Memory: Remembers previous parts of the conversation for contextual recommendations using Window Buffer Memory.
Use Cases
- B2C e-commerce & Media: Enhance streaming platforms or movie review sites with an AI chatbot for personalized movie/show suggestions, boosting user engagement and discovery.
- B2B SaaS: Offer a template for developers to build custom RAG-based recommendation engines for various content types (e.g., articles, products, internal documents) within their applications.
- Solopreneurs/Founders: Quickly deploy a proof-of-concept for a personalized recommendation feature in their apps or as a standalone service.
- Community Platforms: Integrate a movie recommendation bot into Discord servers or forums to foster discussion and engagement around films.
Prerequisites
- An n8n instance (Cloud or self-hosted).
- OpenAI API Key with access to embedding models (e.g.,
text-embedding-3-small
) and chat models (e.g.,gpt-4o-mini
). - Qdrant instance (Cloud or self-hosted) with API URL and, if applicable, API Key. You'll need to create a collection configured for the embedding dimension of your chosen OpenAI model (e.g., 1536 for
text-embedding-3-small
). - (Optional) GitHub credentials if using the provided example for loading initial movie data.
Setup Instructions
- Download the n8n workflow JSON file.
- Import the workflow into your n8n instance.
- Data Ingestion (Run Once to populate Qdrant):
a. Configure the 'GitHub' node if using the sample movie CSV. Alternatively, replace this section to load your movie data from another source.
b. Ensure the 'Extract from File' and 'Default Data Loader' nodes correctly process your data structure.
c. Set up your OpenAI API credentials in the 'Embeddings OpenAI' node.
d. Configure the 'Qdrant Vector Store' node (labeled 'Uploading data to Qdrant') with your Qdrant URL, collection name (e.g.,
imdb
in the example node), and API key (if required). The collection must be pre-created in Qdrant with the correct vector dimensions matching your OpenAI embedding model. e. Manually execute the workflow starting from the 'When clicking ‘Test workflow’' trigger to ingest and embed your movie data into Qdrant. - AI Agent & Recommendation Tool Configuration:
a. Configure the 'OpenAI Chat Model' node (connected to the 'AI Agent' node) with your OpenAI API credentials.
b. The 'Call n8n Workflow Tool' node (named
movie_recommender
) is configured to call this same workflow to fetch recommendations. Ensure its 'Workflow ID' parameter matches this workflow's ID (a58HZKwcOy7lmz56
). c. Update the HTTP Request nodes within the tool's logic: i. 'Embedding Recommendation Request with Open AI' and 'Embedding Anti-Recommendation Request with Open AI': Ensure your OpenAI credentials are selected and the embedding model is correct. ii. 'Calling Qdrant Recommendation API' and 'Retrieving Recommended Movies Meta Data': Update the Qdrant URL and collection name (e.g.,imdb_1000_open_ai
in the example HTTP nodes) to point to your Qdrant instance and the collection populated in step 3d. Important: Ensure the collection name used here for querying matches the one used for ingestion. iii. Select your Qdrant API credentials for these HTTP Request nodes if your Qdrant instance requires authentication. - Activate the workflow. You can then interact with the AI Movie Recommender via the 'When chat message received' trigger (e.g., using n8n's chat interface or by sending POST requests to its webhook URL).
Want your own unique AI agent?
Talk to us - we know how to build custom AI agents for your specific needs.
Schedule a Consultation