Code Monkey home page Code Monkey logo

moviegpt's Introduction

πŸŽ₯ MovieGPT: A Gen AI Movie Recommender

version ChatGPT python FastAPI ruff poetry LlamaIndex


AI Powered Movie Recommendations

MovieGPT leverages the power of Generative AI in order to provide relevant movie recommendations based on user input. In order to achieve that, it relies on the following components:

πŸ“š Open Source Data: we rely on movie data provided by Wikipedia, such as: movie summaries, genres, actor names and so on. This data is converted to embeddings for further indexing in a Vector Database.

πŸ• Retrieval Augmented Generation (RAG): we use a Vector Database and semantic search in order to guarantee relevant results. This way, we limit the context that is provided to large language models when generating movie recommendations, hence reducing the risk of hallucinations in the process.

πŸ€– ChatGPT: we use ChatGPT for formatting the responses with movie recommendations in a human-like fashion.

Architecture

The diagram below describes the architecture of MovieGPT in high level:

Getting started

With Docker (recommended)

πŸ€– Set up your OpenAI API Token:

export OPENAI_API_TOKEN=#YOUR_TOKEN

πŸ‹ Build the Docker image:

make docker

πŸƒβ€β™‚οΈ Run the container:

make run
         __   __  _______  __   __  ___   _______  _______  _______  _______ 
        |  |_|  ||       ||  | |  ||   | |       ||       ||       ||       |
        |       ||   _   ||  |_|  ||   | |    ___||    ___||    _  ||_     _|
        |       ||  | |  ||       ||   | |   |___ |   | __ |   |_| |  |   |  
        |       ||  |_|  ||       ||   | |    ___||   ||  ||    ___|  |   |  
        | ||_|| ||       | |     | |   | |   |___ |   |_| ||   |      |   |  
        |_|   |_||_______|  |___|  |___| |_______||_______||___|      |___|  
    
INFO:root:Starting web server...
INFO:     Started server process [29]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)

πŸ•ΈοΈ Open the API docs and try it out: http://localhost:8000/docs

Without Docker (Pure Python)

⚠️ Before proceeding, make sure you are using Python 3.10.12. We strongly recommend pyenv:

pyenv install 3.10.12
pyenv shell 3.10.2 #Voila!

🏠 Install poetry:

pip install poetry

πŸ—οΈ Activate the Poetry environment and install dependencies:

cd src && poetry shell && poetry install

πŸŽ₯ Run MovieGPT:

> poetry run moviegpt

Usage: moviegpt [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  data   Downloads WikiData for movies.
  index  Creates a VectorDB Index based on Movie Metadata in JSON.
  query  Queries the VectorDB using Semantic Similarity and outputs movie...
  web    Runs our MovieGPT RAG App and exposes it through Fast API.

πŸͺœ Run the following steps:

poetry run moviegpt data && \
poetry run index && \
poetry run web

πŸ•ΈοΈ Open the API docs and try it out: http://localhost/docs

CLI Mode

  • CLI mode is also available. To run it, after you've installed dependencies, simply run: moviegpt
  • If everything was installed correctly, you should be presented with the following welcome screen:
Usage: moviegpt [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  data   Downloads WikiData for movies.
  index  Creates a VectorDB Index based on Movie Metadata in JSON.
  query  Queries the VectorDB using Semantic Similarity and outputs movie...
  web    Runs our MovieGPT RAG App and exposes it through Fast API.

Sample API request & response

Running the Docker container or moviegpt web after ingesting the data and creating the vector index will expose moviegpt through a FastAPI web interface:

Development

  • Unit tests are run using pytest and tox.
  • To run unit tests, simply run: tox
  • For formatting: tox -e fix
  • For linting: tox -e lint

Documentation

TODO

moviegpt's People

Contributors

rafaelpierre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.