An interactive chat application for a virtual bookstore built with Streamlit and Pydantic AI
- 💬 Interactive Chat: Converse naturally with the virtual assistant
- 📖 Book Search: Find books by title, author, or category
- 📋 Book Details: Get complete information about any book
- 🛒 Inline Purchase System: Process purchases directly in the chat
- 📧 Email Service: Automatic purchase confirmation (simulated)
- 📊 Popular Books: View best-selling titles
- 📖 PDF Books: Complete and standardized educational material
- 🧠 Conversation Memory: The AI remembers conversation context
- 🌍 Multilingual: Detects and responds in the user's language
/
├── main.py # Main application
├── requirements.txt # Python dependencies
├── README.md # Project documentation
├── Makefile # Development tasks
├── data/
│ ├── __init__.py # Data package
│ └── db.py # Database models and operations
├── helper/
│ ├── __init__.py # Helper package
│ └── email_service.py # Email services
├── ui/
│ ├── __init__.py # UI package
│ └── chat.py # Chat interface with inline purchases
└── ai/
├── __init__.py # AI package
└── bookstore_agent.py # Pydantic AI agent and tools
- Python 3.10 or higher
- pip (Python package installer)
-
Clone the repository:
git clone https://github.com/paulocoutinhox/pydanticai-store.git cd pydanticai-store -
Create a virtual environment (recommended):
# On macOS/Linux python3 -m venv .venv source .venv/bin/activate # On Windows python -m venv .venv .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
streamlit run main.py
-
Open your browser: The application will open automatically at
http://localhost:8501
Search for Books:
- "I want to buy the Angelologia book"
- "Search for systematic theology books"
- "Show me books by Pastor Paulo Coutinho"
View Details:
- "Details about the Cristologia book"
- "Tell me more about O Vale de Elá"
- "Information about Hermenêutica"
Popular Books:
- "Show me the most popular books"
- "What are the best sellers?"
- "Top 5 in the bookstore"
Make a Purchase:
- "I want to buy the História da Igreja book"
- "Buy Bibliologia"
- "Buy O Segredo da Prosperidade dos Judeus"
Get Help:
- "I need help"
- "How does the purchase work?"
- "What formats do you have?"
- Streamlit: Interactive web interface
- Pydantic AI: Conversational AI agent framework
- Google Gemini: Large language model
- Python: Primary programming language
- Angelologia - Estudo dos Anjos (R$ 10,00)
- Bibliologia - Doutrina das Escrituras (R$ 10,00)
- Cristologia - Estudo de Cristo (R$ 10,00)
- Escatologia - Estudo das Últimas Coisas (R$ 10,00)
- Hamartiologia - Estudo do Pecado (R$ 10,00)
- Pneumatologia - Estudo do Espírito Santo (R$ 10,00)
- Soteriologia e Eclesiologia - Salvação e Igreja (R$ 10,00)
- Teologia Própria - Teontologia - Estudo de Deus (R$ 10,00)
- Antigo Testamento - Estudo das Escrituras Hebraicas (R$ 10,00)
- Novo Testamento - Estudo das Escrituras Cristãs (R$ 10,00)
- Geografia Bíblica - Contexto Histórico e Cultural (R$ 10,00)
- O Vale de Elá - Quando Deus Planta em Vales (R$ 10,00)
- Exegese - Interpretação das Escrituras (R$ 10,00)
- Hermenêutica - Interpretação das Escrituras Sagradas (R$ 10,00)
- História da Igreja - Evolução e Impacto do Cristianismo (R$ 10,00)
- História e Cultura Judaica - Tradições e Costumes Bíblicos (R$ 10,00)
- Evangelismo e Missões - Estratégias e Práticas (R$ 10,00)
- Homilética - A Arte de Pregar e Comunicar (R$ 10,00)
- Religiões, Seitas e Heresias - Análise Crítica e Comparativa (R$ 10,00)
- O Segredo da Prosperidade dos Judeus - Princípios Judaicos para o Sucesso (R$ 10,00)
The application features a clean, focused interface with:
- Real-time chat with message history
- Inline purchase forms that appear when needed
- Conversation context management
- Simple and intuitive design
The system simulates sending purchase confirmation emails, displaying in the console:
- Recipient email
- Message subject
- Order number
- Purchase amount
Note: This is currently a simulation. For real email functionality, see the TODO comments in helper/email_service.py.
No environment variables are required for basic functionality. The application uses simulated data and services.
You can customize the application by:
- Adding more books to the database in
data/db.py - Implementing real email functionality in
helper/email_service.py - Modifying the AI agent's system prompt in
ai/bookstore_agent.py - Customizing the chat interface in
ui/chat.py
- Real database integration (PostgreSQL, MongoDB)
- Payment system integration
- Expanded theological book catalog
- User rating and review system
- Personalized recommendations
- Purchase history tracking
- Real email service integration
- User authentication system
We welcome contributions! Please feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
For development, you may want to install additional tools:
pip install blackThis project is licensed under the MIT License - see below for details:
MIT License
Copyright (c) 2025 Virtual Bookstore
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Contact the maintainers
- Streamlit for the amazing web framework
- Pydantic AI for the AI agent framework
- Google Gemini for the language model
- All contributors and users of this project
