🎬Movie Recommender Agent

This documentation provides a detailed guide on how to implement a Movie Recommendation Agent using the OpenAGI framework. The system interacts with users to gather their movie preferences and offers personalized recommendations based on their input.

Installation

Before you begin, make sure to install the OpenAGI library. You can do this by running the following command:

pip install openagi

Importing Necessary Libraries

The following libraries are required to set up the Movie Recommendation System:

from openagi.actions.files import WriteFileAction, ReadFileAction
from openagi.actions.tools.ddg_search import DuckDuckGoSearch
from openagi.actions.tools.webloader import WebBaseContextTool
from openagi.agent import Admin
from openagi.llms.azure import AzureChatOpenAIModel
from openagi.memory import Memory
from openagi.planner.task_decomposer import TaskPlanner
from openagi.worker import Worker
from rich.console import Console
from rich.markdown import Markdown

Environment Setup

Start by configuring the environment variables necessary for Azure OpenAI services. This setup includes specifying the base URL, deployment name, model name, API key, and API version. These variables authenticate and enable access to Azure OpenAI services.

Workers Used

1. User Input Collector

The User Input Collector is tasked with gathering movie preferences from the user. It asks the user to provide 2-3 movies they enjoy and to specify the genres or themes associated with those movies. The collector confirms the gathered input with the user before moving on to the recommendation phase.

2. Movie Recommender

The Movie Recommender uses the user’s preferences to suggest similar films. It analyzes the input from the User Input Collector, searches for related movies using the DuckDuckGo search tool, and ranks the recommendations based on similarity and popularity. The output is a structured list of recommended movies with brief descriptions.

3. Recommendation Review Specialist

The Recommendation Review Specialist ensures the relevance and clarity of the movie recommendations. This worker reviews the descriptions for engagement, suggests additional movies if necessary, and finalizes the presentation format for optimal user readability.

Admin

The Admin orchestrates the workflow by assigning tasks to the various workers. It coordinates the interaction between the User Input Collector, Movie Recommender, and Recommendation Review Specialist, ensuring a smooth and efficient process.

Execution

The script is then executed to collect user preferences and generate movie recommendations. The results are displayed in a structured format, making them easy to read and engaging for the user.

On running this code user input is collected :

Output

The output of the script is displayed using the following command:

Sample Output

Conclusion

This documentation illustrates how to use the OpenAGI framework to build an interactive movie recommendation system. By effectively gathering user preferences and leveraging search tools, the system delivers personalized movie suggestions that enhance user engagement and satisfaction.

Last updated