DEV Community

Cover image for Rediscover Movies with Plotrix
Roshani Pahari
Roshani Pahari

Posted on

Rediscover Movies with Plotrix

Rediscover Movies with Plotrix: An AI-Powered Semantic Search Engine Built on MindsDB Knowledge Bases


Ever had a movie on the tip of your tongue, but could only remember a fleeting scene, a snippet of dialogue, or a general plot idea? Traditional search engines often fall short, leaving you frustrated. This is exactly the problem Plotrix aims to solve!

I recently participated in the MindsDB Quest 019, focused on stress-testing their newly released Knowledge Bases (KBs). My solution, Plotrix, is an AI-powered movie rediscovery platform that lets you find films by simply describing what you remember in natural language. Powered by MindsDB's cutting-edge semantic search, AI Tables, and Agents, Plotrix transforms fuzzy recollections into precise movie matches.


Why MindsDB Knowledge Bases?

MindsDB is an AI data solution that allows you to query data in natural language and SQL across various data sources. Their new Knowledge Bases provide semantic search capabilities, enabling you to store and retrieve information based on meaning rather than just keywords. This was the perfect fit for building a "remember-a-scene-find-a-movie" application.


Introducing Plotrix: Your Movie Memory Assistant

Plotrix is more than just a search engine; it's a comprehensive movie discovery experience. Here are its core features:

Plotrix Landing Page
The dynamic landing page of Plotrix showcasing its capabilities.

  • Semantic Plot Search: Describe a movie plot, a scene, or even a line of dialogue in natural language (e.g., "robot left on a deserted planet" or "teen hackers in a dream world") and get the top four most relevant movie matches.
  • AI-Generated Metadata: Plotrix enriches movie details with AI-generated data like directors, full cast, box-office performance, and similar titles, dynamically generated using MindsDB AI Tables.
  • Interactive Q&A Bot: Ask follow-up questions about any movie (e.g., "Who directed it?") and get intelligent, context-aware answers from our MindsDB Agent.

Plotrix Movie Expert Bot

  • Visual Discovery: Enhance your browsing with striking movie posters, streamlining the discovery process.

Plotrix Search Results

  • Advanced Filters: Refine your searches by applying filters such as country of origin and release year, leveraging MindsDB's metadata_columns.

Plotrix Movie Details


The Tech Stack: MindsDB at the Core

Plotrix is built with a robust and modern tech stack:

  • MindsDB (Docker Compose): The core engine for vector search Knowledge Bases, AI Tables, and Agents.
  • FastAPI (Python): The backend API.
  • React + Tailwind CSS: For a sleek and responsive user interface.
  • TMDB API & OpenAI API: For movie posters and LLM capabilities.

Building Plotrix: A Glimpse into MindsDB Integration

The MindsDB integration was central to Plotrix's functionality. Here’s how different MindsDB features were utilized:

1. Setting up the Knowledge Base

We connected MindsDB to a Google Sheet containing our movie plot dataset:

CREATE DATABASE movie_sheet
WITH ENGINE = "sheets",
PARAMETERS = {
  "spreadsheet_id": "<your_spreadsheet_id>",
  "sheet_name": "movie_data"
};
Enter fullscreen mode Exit fullscreen mode

Then, we created the plotrix_kb Knowledge Base for semantic search, specifying plot as the content column and origin, release_year, title, genre as metadata columns for filtering:

CREATE KNOWLEDGE_BASE plotrix_kb
USING
  embedding_model = {
    "provider": "openai",
    "model_name": "text-embedding-3-large",
    "api_key": "<your_openai_api_key>"
  },
  metadata_columns = ['origin', 'release_year', 'title', 'genre'],
  content_columns = ['plot'],
  id_column = 'unique_id';
Enter fullscreen mode Exit fullscreen mode

2. Semantic Search with Filters

The core of Plotrix's search functionality combines semantic queries with SQL filtering:

SELECT *
FROM plotrix_kb
WHERE content = 'A skilled thief who enters dreams to steal secrets but must plant an idea instead.'
  AND origin = 'American'
  AND release_year = 2010
LIMIT 5;
Enter fullscreen mode Exit fullscreen mode

3. MindsDB Jobs for Data Freshness

To keep the Knowledge Base updated, a MindsDB JOB periodically inserts new movie data:

CREATE JOB movie_schedule AS (
  INSERT INTO plotrix_kb
  SELECT unique_id, origin, release_year, title, plot, genre
  FROM movie_sheet.movie_data
  WHERE unique_id > 6936
)
EVERY 1 min;
Enter fullscreen mode Exit fullscreen mode

4. AI Tables and Agents for Enhanced Experience

MindsDB AI Tables (movie_info) dynamically generate enriched movie metadata, while MindsDB Agents (plotrix_bot) power the interactive Q&A bot, providing contextual answers to user queries.


Live Demo & GitHub Repository

Curious to see Plotrix in action?

🔗 Watch Full Demo on Loom
🔗 Plotrix GitHub Repository


Conclusion

Building Plotrix for MindsDB Quest 019 was an incredibly rewarding experience. MindsDB's Knowledge Bases offer a powerful yet straightforward way to implement complex semantic search capabilities. Plotrix demonstrates a practical use case, transforming how we interact with movie data by turning vague memories into precise results.


Acknowledgments

Top comments (0)