This project is a simple movie recommendation system powered by a Large Language Model (LLM) like OpenAI's GPT. Instead of maintaining a local movie database, the system dynamically fetches recommendations based on user preferences.
- Personalized movie recommendations based on genre, language, mood, release year, and popularity.
- Utilizes OpenAI's API for up-to-date and diverse movie suggestions.
- Simple command-line interface for easy interaction.
- Python 3.7+
- OpenAI API key (You can get it from OpenAI)
-
Clone the repository:
git clone https://github.com/yourusername/movie-recommender-llm.git cd movie-recommender-llm -
Create and activate a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Set your OpenAI API key:
-
Option 1: Set it as an environment variable:
export OPENAI_API_KEY="your-api-key-here" # On Windows: set OPENAI_API_KEY=your-api-key-here
-
Option 2: Alternatively, you can hardcode your API key in
api_communicator.py:openai.api_key = "your-api-key-here"
-
-
Run the program:
python main.py
-
Follow the prompts: The program will ask you a series of questions about your movie preferences (e.g., genre, language, mood). Answer them to receive personalized recommendations.
-
View Recommendations: After answering the questions, the program will display a list of recommended movies based on your preferences.
Answer the following questions to get movie recommendations:
What genre do you prefer (e.g., Action, Comedy, Drama)? Comedy
Which language do you prefer (e.g., English, Hindi, Spanish)? English
What mood do you prefer (e.g., Happy, Sad, Suspense)? Happy
What is the minimum release year you'd like (e.g., 2000)? 2010
On a scale of 1-10, how popular do you want the movie to be? 8
Recommended Movies:
- The Grand Budapest Hotel
- Crazy Rich Asians
- The Intern
- La La Land
movie_recommender/
βββ main.py # Entry point to the program
βββ recommender.py # LLM-based recommendation logic
βββ user_input.py # Handles user input and questions
βββ api_communicator.py # Communicates with the LLM API
βββ utils.py # Helper functions for the project
βββ requirements.txt # Dependencies for the project
Feel free to fork this repository and submit pull requests. If you encounter any issues, please open an issue to discuss improvements.
This project is licensed under the MIT License.
Enjoy your personalized movie recommendations! π¬