This is a starter project for an LLM-based chat app, designed for you to get a running start on your Hackathon project. It provides a simple chat interface and an LLM-powered backend that acts like a customer support bot.
Features:
- A complete API (written in Python) with persistent chats, a knowledge base, and LLM integration (courtesy of Opper).
- A frontend (written in React) that provides a chat interface for users to interact with the API.
- A portable dev env with hot reload (courtesy of Polytope) that makes it easy to iterate and collaborate on your solution. One command and you and all your team members are up and running with the same environment.
There are lots of directions you can take this project. Here are a few suggestions:
- The bot is very unhelpful! Work with the prompts to see if you can make it do something useful.
- Expand on the knowledge base, or replace it with something different.
- The bot hallucinates a lot! Try to make it more reliable.
- Make sure you can run containers (on macOS we recommend OrbStack).
- Installed Polytope (on macOS run
brew install polytopelabs/tap/polytope-cli). - Clone this repo:
git clone https://github.com/aeriksson/hackathon-chatbot-starter.git my-project && cd my-project - Go to https://opper.ai/ and get yourself an API key
- Store the API key:
pt secret set opper-api-key YOUR_OPPER_API_KEY - Run the stack:
pt run stack - Open the UI: http://localhost:8000
- Start building something!
You'll need Docker or OrbStack to run the app. You can install Docker from here and OrbStack from here.
On macOS:
brew install polytopelabs/tap/polytope-cliFor installation on Windows and Linux, see the docs.
To run the app, clone this repository and navigate to the project directory:
git clone https://github.com/aeriksson/hackathon-chatbot-starter.git my-project
cd my-projectNext, sign up for https://opper.ai/ (it's free and gives you access to all the major LLMs - no credit card required!), create an API key, and store it using the Polytope CLI:
pt secret set opper-api-key YOUR_OPPER_API_KEYFinally, run the following command to start the app:
pt run stackThen open the UI at http://localhost:8000. On first load, this can take a little while to start up while dependencies are downloaded.
API documentation is automatically generated and can be found at http://localhost:3000/redoc.
This app has two main components:
- The API - A Python FastAPI backend that handles chat session management, knowledge base querying, and Opper AI integration
- The UI - A React TypeScript frontend that provides the user interface
The API is defined in api/src/api/routes.py. Example usage:
# Create a new chat session
curl -X POST http://localhost:3000/api/chats -H "Content-Type: application/json" -d '{}'
# Get chat details (replace UUID with the one from previous response)
curl http://localhost:3000/api/chats/550e8400-e29b-41d4-a716-446655440000
# Send a message and get a response
curl -X POST http://localhost:3000/api/chats/550e8400-e29b-41d4-a716-446655440000/messages \
-H "Content-Type: application/json" \
-d '{"content": "What is your return policy?"}'
# Get chat history
curl http://localhost:3000/api/chats/550e8400-e29b-41d4-a716-446655440000/messages
# Search knowledge base
curl 'http://localhost:3000/api/knowledge-base/search?query=warranty'This project uses Polytope to run and orchestrate all your services and automation.
Polytope is the easiest way to build, run, and iterate on your software. It gives you a unified interface for running all your services and workflows (CI, DataOps, MLOps, DevOps, ...) - on your machine, in the cloud or on-prem.
This template uses Opper AI for LLM response generation and knowledge base integration.
Learn more about the Opper SDK on GitHub and in the official documentation.