An example LLM chatbot created with Cohere API and Streamlit
-
Fork and then clone this repository to a folder on your computer.
-
Open Visual Studio Code and then choose File > Open Folder... to open and edit the code.
-
Open the terminal window inside Visual Studio Code and type the following command to install the required Python packages.
pip install -r requirements.txt
-
Run the app by typing the following command in the terminal window.
streamlit run chatbot.py
A new browser window will open where you can interact with the chatbot.
Note
You will need to enter your Cohere API key in the sidebar for the chatbot to work.
- Make minor changes to the code, save and then run your app again to see what happens.
- Apply what you discovered working on your first LLM app to enhance the behaviour of the chatbot.
- Complete 'Module 4: Deployment' of the LLMU course on Cohere.com to create a different kind of LLM powered app with Cohere and Streamlit.
- Read the Streamlit Basics guide for clues to help you extend the UI of this app further.
- Turn it into a Retrieval Augmented Generation (RAG) app by connecting it to your own data using Langchain
- Use Streamlit secrets to securely pass your API key to the app without having to type it into the sidebar.
Caution
You should never include your API key in any code that you publish online, especially on GitHub. If someone copies your key they can access Cohere using your account without your permission. Creating a secret on Streamlit is the only way to publish your app to automatically use your API key without exposing it for the world to see.