An interactive AI chatbot powered by Ollama and TinyLLaMA, served using FastAPI, and connected to a sleek custom frontend using HTML, CSS, and JavaScript.
- 💬 Chat with a local LLM (
tinyllama) using Ollama - 🌐 FastAPI backend with RESTful API
- 📁 Static frontend served via FastAPI
- 💾 Persistent chat history saved in
chatlog.json - 🔁 Reset conversation functionality
- 📜 View conversation history via endpoint
- Backend: FastAPI
- Frontend: HTML + CSS + JS
- Model Runtime: Ollama
- Model Used:
tinyllama(or any other compatible LLM via Ollama) - Others: Pydantic, Requests, CORS, JSON
- Inference pipelines
- Prompt logic
- Data persistence and session state
git clone https://github.com/yourusername/ai-agent-chatbot.git
cd ai-agent-chatbotpython -m venv venv
venv\Scripts\activate # On Windows
# source venv/bin/activate # On macOS/Linux
pip install -r requirements.txtInstall Ollama for your OS.
Then run:
ollama run tinyllama✅ Ensure Ollama is running in a separate terminal before starting FastAPI!
uvicorn main:app --reloadThe server starts at: http://localhost:8000
This project includes a chatlog-demo.json file to demonstrate the structure of saved conversations.
Note: Real-time chat logs are stored in chatlog.json, which is excluded from version control to protect user privacy.
Open your browser and visit:
http://localhost:8000/frontend/
You're ready to chat with your local AI! 🎉
AI-agent-chatbot/
├── frontend/
│ ├── index.html
│ └── script.js
├── main.py
├── chatlog.json
├── requirements.txt
└── README.md
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/chat |
Send a message to the chatbot |
| POST | /api/reset |
Clear chat history |
| GET | /api/history |
Get full chat history |
Click the "Reset" button in the UI or call:
curl -X POST http://localhost:8000/api/reset- Add multi-agent orchestration logic with role-based LLMs (e.g., Research Agent, Summarizer Agent)
- Integrate embeddings-based memory for personalized responses
- Lightweight UI with feedback metrics
Shreya H S Machine Learning & Cloud Enthusiast 🌙☁️🤖 Do Checkout - Medium Post
This project is open-source and free to use. Modify and build upon it as needed!