A conversational AI that provides country information using OpenAI's GPT-5 mini model. The bot can answer basic questions from memory or fetch detailed information from documents when needed.
The bot knows basic facts about 10 countries and can have intelligent conversations:
- Quick answers: "What's the capital of France?" → "Paris"
- Deep dives: When you want more details, it fetches information from country documents
- Smart decisions: Automatically knows whether to answer from memory or look up documents
France, Spain, Japan, Germany, Italy, Brazil, India, China, USA, Australia
Each country has basic facts (capital, population, language, currency) in memory, plus detailed documents covering geography, history, culture, and economy.
- main.py - Chat interface where you talk to the bot
- bot.py - Makes decisions about how to answer your questions
- document_reader.py - Fetches detailed info from country files when needed
- models.py - Data structures for consistent responses
- data/countries/ - Detailed information files for each country
-
Setup:
python -m venv .venv .venv\Scripts\activate # Windows pip install openai instructor python-dotenv pydantic rich
-
Add your OpenAI API key to
.env:OPENAI_API_KEY=your-key-here -
Run:
python main.py
You: What's the capital of Spain?
Bot: The capital of Spain is Madrid. Would you like to know more about Spain?
You: Yes
Bot: What specifically would you like to know about Spain?
You: Tell me about Spanish food
Bot: [Fetches detailed information about Spanish cuisine from documents]
Simple function-based design using OpenAI's stateful Responses API:
- No classes, just clean functions
- Automatic conversation memory
- Structured responses with source citations
- Error handling for missing information
Run the integration tests to verify everything works:
python test_integration.py
python simple_integration_test.py- OpenAI GPT-5 mini with Responses API for stateful conversations
- Instructor for structured AI outputs
- Pydantic for data validation
- Python 3.11
✅ Stage 1: Single document system working
- Basic Q&A from memory
- Document fetching with citations
- Smart routing between memory and documents
🔄 Next: Multi-document comparisons ("Compare French and Spanish wine")