π¬ Building an Agentic AI Movie Recommendation System
Using Graph Databases, Semantic Search, and Community Signals
Finding a movie that matches your mood or taste shouldn't feel like solving a puzzle. That's why we built an agentic AI movie recommendation system β a smart assistant that understands natural language queries and surfaces meaningful recommendations using a combination of graph reasoning, semantic similarity, and community discussions.
π Project Links
βοΈ Tech Stack
Hereβs a peek into the technologies powering this agentic movie recommendation system:
π§ AI & Backend Intelligence
FastAPI (Python)β High-performance API orchestrationLangChainβ LLM chain management, entity extraction & tool routingLLaMA 3.3β Core LLM for NER, sentiment understanding, and query parsingJina Embeddings v3β Converts text into vector space for semantic matchingQuadrantβ Vector database for similarity searchNeo4j Auraβ Graph database for movie relationships (genres, directors, etc.)Brave Searchβ Real-time web search for Reddit and Letterboxd integration
π Real-time Query Flow
Server-Sent Events (SSE)β Streams intermediate updates like:β Entity extracted: { "genre": "thriller", "director": "Nolan" }π Cypher query executed...π Vector search complete...
π¨ Frontend Framework
Viteβ Ultra-fast frontend bundler for blazing-fast dev experience
π§° State & Styling
nuqsβ Syncs search state to URL for sharable sessionszustandβ Lightweight and reactive state storeshadcn/uiβ Accessible UI components powered by RadixTailwind CSSβ Utility-first styling for consistent design
Let's break down how it works π
π§ Natural Language Understanding with LLMs
When a user enters a search query, we use an LLM (LLaMA 3.3) to process the text. The model performs Named Entity Recognition (NER) to extract important information like:
- π¬ Movie titles
- π¨βπ€ Actors / Directors
- π Years
- π Genres
- π Search modifiers (e.g., "Search Reddit", "Letterboxd")
πΈοΈ Querying the Graph Database (Neo4j)
If the query includes structured entities like genres, directors, or release years, we map the extracted elements into a prebuilt Cypher query to search our Neo4j movie graph.
π What's in the Graph?
- 49,369 nodes including movies, people, genres, and years
- 132,772 relationships, like:
ACTED_INDIRECTED_BYHAS_GENRERELEASED_IN
Example:
"Show me action movies directed by Christopher Nolan"
β Cypher query pulls all action genre movies with theDIRECTED_BYrelation pointing to Nolan.
𧬠Semantic Search for Similar Movies
If the user asks for movies similar to another movie, e.g.
"Show me movies like The Departed" β
we switch to semantic search.
How It Works:
- Extract the movie title (
The Departed) using NER. - Fetch its summary embedding from Quadrant DB (vector database).
- Perform cosine similarity search against other embedded movie summaries.
- Return the top N most similar results.
Embeddings are generated using
jina-embeddings-v3and stored in Quadrant.
π§βπ€βπ§ Community-Driven Discovery (Reddit + Letterboxd)
Our agent can also leverage online movie communities:
π Reddit Integration
If the query contains "Search Reddit", the agent:
- Uses Brave Search to find top
reddit.comlinks. - Scrapes comment threads from those posts.
- Uses the LLM to extract movie mentions from user comments.
π½οΈ Letterboxd Integration
For "Search Letterboxd", the agent:
- Finds top lists or reviews via Brave.
- Directly extracts movie names from curated Letterboxd lists (no scraping comments).
Query-to-Movie Semantic Search
We also support full-query semantic matching β ideal when the user describes the kind of movie they want without naming one.
Movies where the protagonist invents a time machine and travels back in time to his childhood to fix his mistakes
How it works:
- Embed the entire query using
jina-embeddings-v3. - Search the Quadrant vector database using cosine similarity.
- Fetch top-N most semantically similar movie summaries.
π§° Databases Used
1. Neo4j Graph Database
- Stores structured relationships between movies, people, genres, and time.
- Powers reasoning-style queries based on graph paths.
2. Quadrant Vector Database
- Stores dense embeddings of movie summaries.
- Enables similarity search using cosine distance.
π Bringing It All Together
This hybrid system empowers users to explore the movie world using just natural language. Whether you're searching by genre, similarity, director, or online opinions β the AI understands your intent and routes the query through the best tool for the job.
This is agentic AI in action β combining structured reasoning, semantic intelligence, and real-time web knowledge to help you find your next favorite film π₯πΏ