A context-aware movie recommendation chatbot that combines collaborative filtering with natural language processing to provide personalized movie recommendations.
- Personalized Recommendations: Uses the SAR (Simple Algorithm for Recommendation) model to provide personalized movie recommendations based on user ratings.
- Context-Aware: Understands different contexts (e.g., Valentine's Day, Halloween) and adjusts recommendations accordingly.
- Natural Language Interface: Powered by Google's Gemini AI for natural and engaging conversations.
- Smart Search: Search for movies by title or genre with intelligent filtering.
- User Preference Analysis: Analyzes user ratings to understand preferences and provide better recommendations.
- Fallback Mechanisms: Provides template-based responses when AI generation is unavailable.
movie_chatbot/
├── data/ # Data storage directory
├── models/ # Saved model files
├── notebooks/ # Jupyter notebooks for analysis
├── src/
│ ├── api/ # API interfaces (e.g., LLM)
│ ├── config/ # Configuration files
│ ├── models/ # Model implementations
│ └── utils/ # Utility functions
├── tests/ # Test files
├── requirements.txt # Project dependencies
└── README.md # Project documentation
- Clone the repository:
git clone https://github.com/DavidVart/First-Chatbot-Test.git
cd movie_chatbot- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
Create a
.envfile in the project root with:
GOOGLE_API_KEY=your_gemini_api_key_here
- Run the chatbot:
python src/main.pyOr with a specific API key:
python src/main.py --api-key your_api_key_here- Interact with the chatbot:
- Set your user ID: "I am user 123"
- Get recommendations: "Recommend some movies"
- Search for movies: "Find Star Wars movies"
- Get context-specific recommendations: "What are good movies for Halloween?"
- Get help: "help"
- Exit: "quit"
You: Hello!
Assistant: Hello! I'm your movie recommendation assistant. To get started, tell me your user ID or ask me to help you find movies!
You: I am user 123
Assistant: Great! I'll remember you as user 123. I can see you've rated 50 movies with an average rating of 3.8/5.
Here are some movies you've rated highly:
- The Shawshank Redemption (Drama): 5.0/5
- Pulp Fiction (Crime | Drama): 4.5/5
- The Matrix (Action | Sci-Fi): 4.5/5
Would you like me to recommend similar movies? Just ask!
You: What are some good movies for Halloween?
Assistant: Based on your preferences for suspense and drama, here are some Halloween-appropriate movies you might enjoy:
1. The Silence of the Lambs (Thriller | Crime) - A psychological thriller that will keep you on the edge of your seat
2. Alien (Sci-Fi | Horror) - Combines your interest in sci-fi with horror elements
3. The Thing (Horror | Sci-Fi) - Another sci-fi horror classic that matches your taste
4. Se7en (Crime | Thriller) - A dark thriller that aligns with your appreciation for crime dramas
5. The Sixth Sense (Mystery | Thriller) - A supernatural thriller with excellent storytelling
You: quit
Assistant: Goodbye! Hope to help you find more great movies next time! 👋
The chatbot's behavior can be customized through the configuration files in src/config/:
- Movie dataset size
- Recommendation model parameters
- Special contexts and their genre preferences
- LLM parameters
- Keyword lists for intent detection
pytest tests/- Update configuration in
src/config/config.py - Implement new functionality in appropriate module
- Add tests in
tests/directory - Update documentation
- recommenders: For recommendation algorithms
- google-generativeai: For natural language processing
- pandas: For data manipulation
- numpy: For numerical operations
- python-dotenv: For environment variable management
- pytest: For testing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.