A CLI conversational chatbot playing the role of a Michelin-starred French chef. Runs entirely locally via Ollama.
Built as part of an LLM & agentic AI learning journey - 4th year Computer Science Engineering, INSA Rouen.
- Multi-turn conversation with full history memory
- Token-by-token streaming responses
resetcommand to clear conversation memorysavecommand to export conversation history as JSONquitcommand to exit- Configurable personality via
config.py - Robust API error handling
| Tool | Role |
|---|---|
| Python 3.12 | Language |
| Ollama | Local LLM inference |
| Mistral 7B | Language model |
| openai SDK | API client (Ollama-compatible) |
| python-dotenv | Environment variable management |
- Mac with Homebrew or equivalent
- Python 3.12+
git clone https://github.com/kawtareg/chatbot-cli
cd chatbot-clibrew install ollama
brew services start ollama
ollama pull mistralpython3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtpython3 main.pyEnter a query after >>>, quit to exit,
reset to clear memory, save to export the conversation.
>>> Bonjour, qui es-tu ?
>>> Donnes moi la recette de la blanquette de veau
>>> save
>>> reset
>>> quit
Saved conversations are stored in history/ as JSON files.
local-chatbot/
├── main.py # entry point
├── chatbot.py # chatbot logic (streaming, history, commands)
├── config.py # system prompt and model parameters
├── requirements.txt
├── history/ # saved conversations (git-ignored)
│ └── .gitkeep
└── .gitignore
Edit config.py to change the chatbot personality:
MODEL = "mistral" # or llama3, phi3, gemma...
TEMPERATURE = 0.3 # 0 = deterministic, 1 = creative
SYSTEM_PROMPT = """You are a Michelin-starred French chef..."""You can also swap mistral for any model available on Ollama:
ollama pull llama3
ollama pull phi3
ollama pull gemma- LLM API calls with the openai SDK
- Conversation history management (
messagesformat) - Token-by-token streaming
- Modular Python project structure
- JSON data persistence
- Robust error handling with
try/except
- RAG system to give the chef access to external recipes
- Agentic version capable of searching recipes online
Kawtar El Gueddari — GitHub · INSA Rouen Normandie
