Make a custom chatbot with Streamlit, Gemini, and ChromaDB! Slides linked here!
To set up the project, follow these steps:
-
Create a Virtual Environment:
python3 -m venv venv # for window .\venv\Scripts\activate # for mac/linux source venv/bin/activate pip install -r requirements.txt
-
Create google API key and add it to the .env file:
- Create a new project in the Google https://ai.google.dev/gemini-api/docs/api-key
- Click the get a gemini api key button
- Click create a new api key button
- Create a new api project if needed or select an existing one
- This will generate a API key, copy this key
- Create a new file named
.env
in the root of the project and add the following line:API_KEY=<YOUR_API_KEY>
-
Start Streamlit:
streamlit run chat.py
-
Customize the chatbot!:
- Select a dataset from
/data
and copy the file path to theFILE_PATH
variable inload_data.py
. Then runpython3 load_data.py
to load the data into chromadb. - Uncomment the chromadb lines at the top of
chat.py
to link the database. - Modify the
chat.py
file to customize the chatbot and make it your own! Use thequery_db
function to query the database and return results to the llm.
- Select a dataset from
- Ski shop chatbot
- Beanie baby personality test
- CSE course recommender
- Streamlit docs: https://streamlit.io/
- Chroma docs: https://docs.trychroma.com/
- Gemini docs: https://ai.google.dev/gemini-api/docs/quickstart?lang=python