=======
An AI assistant webapp using Cohere's LLM models through a Next.js frontend and a FastAPI backend. It implements a Router Agent that can route user requests to the appropriate agent based on the content of the user's message. The available agents are:
- a Calendar Agent that calls on tools to modify the user's calendar using Google Calendar API
-
a Web Search Agent that can handle general information-seeking queries and uses Tavily Web Search APIs to ground its responses.
-
a Tutor Agent that can assist students with their school work and provide responses based on the user's stated learning level.
Additionally, the app also uses Notion API to retrieve pages and databases from the user's Notion workspace and a rich-text editor using Tiptap to aid in creating and editing Notion pages, but this is still in the early stages of development.
The prompt template for the tutor agent is based (with some modification)on the Tutor prompt available on Microsoft's Prompts for Education repository.
This project extends the Cohere Calendar Agent example and the Cohere Tools on Langchain example for web search and general purpose interactions with Cohere's Command R+ model.
Please note that as with all AI models, outputs may not be completely accurate or reliable. Cohere's models were chosen for this project for their commitment to responsible AI development, but as this area is still undergoing a lot of research, the models may still unintentionally generate content that is not appropriate.
- Node.js (version 14 or later)
- Python (version 3.7 or later)
- Google Cloud Platform account
- Cohere API key
- Tavily API key
- Notion API key
-
Clone the repository
git clone https://github.com/mcruz90/ai-need-help.git
-
Set up the frontend
cd frontend npm install
-
Set up the backend
cd backend pip install -r requirements.txt
-
Configure environment variables:
For the backend:
cd ai-assistant-backend cp .env.example .env
Edit the backend
.env
file and add the following information:COHERE_API_KEY
: Your Cohere API keyTAVILY_API_KEY
: Your Tavily API keyCORS_ORIGINS
: Comma-separated list of allowed origins for CORS (e.g.,http://localhost:3000
)
For the frontend:
cd ai-assistant cp .env.local.example .env.local
Edit the frontend
.env.local
file and add the following information:NEXT_PUBLIC_BACKEND_URL
: URL of your backend server (e.g.,http://localhost:8000
)NOTION_TOKEN
: Your Notion API key
-
Set up Google Calendar API:
- Go to the Google Cloud Console
- Create a new project/use existing project
- Enable the Google Calendar API for your project
- Create credentials (OAuth 2.0 Client ID) and download the
credentials.json
file - Place the
credentials.json
file in theai-assistant-backend
directory
-
Run the development server:
Frontend:
cd ai-assistant npm run dev
Backend:
cd ai-assistant-backend uvicorn main:app --reload
Open http://localhost:3000 with your browser to see the result.
- AI-powered chat assistant
- Google Calendar integration
- Voice input feature
- Copy functionality for AI responses
- Web search integration using Tavily API
- Notion integration for enhanced productivity
For a list of planned features and improvements, see TODO.md.
To learn more about the resources used in this project, check them out here:
- Next.js Documentation
- Google Calendar API Documentation
- Cohere API Documentation
- Cohere Calendar Agent Documentation
- Tavily API Documentation
- Cohere Tools on Langchain
- Notion API Documentation
- Tiptap Documentation
This project is licensed under the MIT License - see the LICENSE file for details.