This repository contains a demo application showcasing the integration with Cohere. Below is a detailed explanation of the contents, architecture, and instructions on how to run the application.
The architecture diagram above illustrates the flow and components of the application:
- User Interface (UI): The main entry point of the application is
ui.py
. This script handles user interactions and displays the results. - Backend Processing: The backend processes the data received from the UI, interacts with the Cohere API, and returns the processed results.
To run the application, follow these steps:
-
Clone the Repository:
git clone https://github.com/mongodb-partners/MongoDB_Cohere.git cd Cohere-demo
-
Install Dependencies: Ensure you have Python installed. Then, install the required packages:
pip install pymongo python-dotenv cohere streamlit
-
Set Up Environment Variables: Create a
.env
file in the root directory and add the necessary environment variables:COHERE_API_KEY = <COHERE_API_KEY> HF_TOKEN = <HUGGING_FACE_TOKEN> MONGO_URI = <MONGODB_URI>
-
Run the Application: Execute the main file to start the application:
streamlit run ui.py
The application uses the following environment variables, which should be defined in the .env
file:
COHERE_API_KEY
: Your API key for accessing Cohere's services.HF_TOKEN
: Your Hugging Face token for accessing Hugging Face's services.MONGO_URI
: The URI for connecting to your MongoDB database.
This README provides a comprehensive guide to understanding and running the Cohere demo application. For any issues or contributions, please refer to the repository's issue tracker or submit a pull request.