This content originally appeared on DEV Community and was authored by Chijioke Osadebe
This is a submission for the Open Source AI Challenge with pgai and Ollama
What I Built | FilmGuru
FilmGuru is an AI movie recommendation engine designed to help you discover the perfect film from a curated database of over 8,000 IMDb movies. Whether you’re in the mood for another mind-bender after watching Inception or just want to try something similar to the last masterpiece you enjoyed, FilmGuru’s got you covered!
Why FilmGuru?
Ever found yourself scrolling endlessly, unable to decide on your next movie? FilmGuru solves that by understanding what you enjoyed in your last watch and recommending something with a similar vibe. Think of it as your personal movie guru! With FilmGuru, a recommendation isn’t just a list—it’s a hand-picked suggestion designed to turn "meh" into "2 hours of pure bliss."
Here’s a sneak peek at a recommendation! With FilmGuru, finding your next favorite film is as easy as pressing play.
Demo
You can try the app out here
Thank you for exploring FilmGuru!
Tools Used
NextJS
pgai
pgvector
pgvectorizer
CijeTheCreator / filmguru-frontend
Frontend for FilmGuru
This is a submission for the Open Source AI Challenge with pgai and Ollama
What I Built | FilmGuru
FilmGuru is an AI movie recommendation engine designed to help you discover the perfect film from a curated database of over 8,000 IMDb movies. Whether you’re in the mood for another mind-bender after watching Inception or just want to try something similar to the last masterpiece you enjoyed, FilmGuru’s got you covered!
Why FilmGuru?
Ever found yourself scrolling endlessly, unable to decide on your next movie? FilmGuru solves that by understanding what you enjoyed in your last watch and recommending something with a similar vibe. Think of it as your personal movie guru! With FilmGuru, a recommendation isn’t just a list—it’s a hand-picked suggestion designed to turn "meh" into "2 hours of pure bliss."
Here’s a sneak peek at a recommendation! With FilmGuru, finding your next favorite film is as easy…
This is a submission for the Open Source AI Challenge with pgai and Ollama
What I Built | FilmGuru
FilmGuru is an AI movie recommendation engine designed to help you discover the perfect film from a curated database of over 8,000 IMDb movies. Whether you’re in the mood for another mind-bender after watching Inception or just want to try something similar to the last masterpiece you enjoyed, FilmGuru’s got you covered!
Why FilmGuru?
Ever found yourself scrolling endlessly, unable to decide on your next movie? FilmGuru solves that by understanding what you enjoyed in your last watch and recommending something with a similar vibe. Think of it as your personal movie guru! With FilmGuru, a recommendation isn’t just a list—it’s a hand-picked suggestion designed to turn "meh" into "2 hours of pure bliss."
Here’s a sneak peek at a recommendation! With FilmGuru, finding your next favorite film is as easy…
FilmGuru’s journey begins with my movie database, a CSV file sourced from Kaggle, containing 8,000 movie records with details like descriptions, year, and other metadata. Here’s how it all comes together:
I started by uploading the CSV to Timescale as a new service, which took just 2 minutes to complete.
Using the SQL editor, I added a primary key column to the table—this is crucial for utilizing Timescale’s pgvector functionality.
I then used pgai with OpenAI’s embedding model (small) to generate embeddings instantly across the entire database, creating a vector representation for each movie entry to allow FilmGuru to find the best matches based on your preferences.
The original CSV file included fields for title, description, year, duration, rating, and stars, among others. I kept only these essential fields, discarding the rest. Since the movie descriptions were quite lengthy, I divided them into chunks, adding key contextual fields to each chunk to retain as much relevant information as possible.
sync function Vectorizer() {
try {
await pool.query(
`
SELECT ai.create_vectorizer(
'public.imdb_numbered_votes'::regclass,
embedding=>ai.embedding_openai('text-embedding-3-small', 1536, api_key_name=>'OPENAI_API_KEY'),
chunking=>ai.chunking_recursive_character_text_splitter('description'),
formatting=>ai.formatting_python_template('title: $title description: $chunk, year: $year, duration: $duration, rating: $rating, stars: $stars')
);
`,
);
return { status: "success" };
} catch (error) {
console.log(error);
return { status: "failed" };
}
}
Behind the Scenes of Your Recommendation Journey
When you enter a prompt (like "I want something like Inception"), it’s sent to the backend server.
The server uses pg AI to create a unique embedding for your query with the help of OpenAI's text-embedding-3-small, transforming it into a vector.
FilmGuru then uses pgvector to search the database for movies with similar embeddings, delivering the closest match as your next recommendation.
It’s seamless, fast, and incredibly fun!
Final Thoughts
The project came up smooth. I only had one dependency in my back end. That was the pg library for postgres. Kinda cool that I could build the entire backend just with one library.
I’m planning to add an agent that fetches images for each movie, making recommendations even more visually engaging. Stay tuned!
All the Extensions
This content originally appeared on DEV Community and was authored by Chijioke Osadebe
Chijioke Osadebe | Sciencx (2024-11-11T01:04:45+00:00) FilmGuru: Your AI-Powered Movie Companion 🎬. Retrieved from https://www.scien.cx/2024/11/11/filmguru-your-ai-powered-movie-companion-%f0%9f%8e%ac/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.