This is a simple chatbot that uses the Youtube API to search for videos and return 5 videos based on the user's query. The chatbot is built with Gemini's LLM API, Youtube API and Python's Typer library.
To install the required packages, run the following command:
pip install virtualenv
sudo virtualenv .venv
source .venv/bin/activate
pip install -r requirements.txt
To run the chatbot, run the following command:
python main.py
I started by first writing the code to get the Youtube API key and search for videos based on the user's query. I directly tried creating my own API wrapper but it was really messy and hard to maintain so I decided to use the Google API's Python client.
I then wrote the code to get the user's query and return the top 5 videos based on the query. I then used Gemini's LLM API to generate responses for the chatbot. Finally, I used Python's Typer library to create a CLI for the chatbot.
I tried to implement function calling but Gemini's LLM API was really hard to work with and it used to give the same function call response for any kind of question. There was also a way to use Python's client library for function calling but I didn't have enough time for it.
I also tried using Claude AI's LLM but it was really slow and since I did not have enough time, I decided to use Gemini's LLM API.
This project was built within a specific timeframe and sometimes the LLM hallucinates.
For best usage, please follow the following steps:
- Run the chatbot using the command
python main.py
- To search for videos, enter your query with the keyword "search" to search for videos
- To summarize a video, enter your query with the keyword "summarize" to summarize a video