A multi-turn travel chatbot powered by the OpenAI Chat Completions API. Acts as a virtual Parisian expert for Peterman Reality Tours, answering a series of travel questions while maintaining full conversation history across turns.
- System prompts — defining an assistant persona
- Multi-turn memory — appending each question and answer to
messagesso the model has full context on every call - Chat Completions API — structured
messageslist withuser/assistant/systemroles
User: How far away is the Louvre from the Eiffel Tower (in miles) if you are driving?
System: Ah, what a wonderful question! The Louvre Museum and the Eiffel Tower are both iconic
landmarks in the heart of Paris...
User: Where is the Arc de Triomphe?
System: The Arc de Triomphe stands majestically at the western end of the Champs-Élysées...
1. Clone the repo
git clone https://github.com/your-username/travel-chatbot-using-api.git
cd travel-chatbot-using-api2. Install dependencies
pip install -r requirements.txt3. Add your OpenAI API key
cp .env.example .env
# open .env and replace "your-key-here" with your actual key4. Run
python Travel_Chatbot_Using_API.pyYou can swap OpenAI for any local model from Hugging Face served via Ollama.
1. Install Ollama — ollama.com/download
2. Pull a model
ollama pull llama33. Set env vars in your .env
USE_LOCAL=true
OLLAMA_MODEL=llama3
4. Run — same command, no API key required
python Travel_Chatbot_Using_API.pyOllama exposes an OpenAI-compatible endpoint at http://localhost:11434/v1, so the same code works with zero changes.
- Python 3.8+
- OpenAI API key (get one here) — or Ollama for local models