How mozartmarin/hotel_ia_poc works
Project type and purpose
• This is a full-stack MVP: a conversational AI agent (chatbot) tailored for the hotel industry.
• It uses a Streamlit front-end, an LLM (Mistral) hosted by Ollama for natural-language processing, and PostgreSQL as its data store for reservations and occupancy metrics.
File structure
• Top-level directories:
• app/ – core application logic (initialization, health-check)
• db/ – database connection module
• frontend/ – Streamlit app entrypoint (agent.py)
• rag/ – prompt templates for retrieval-augmented generation
• tools/ – auxiliary logic (e.g., building SQL queries for perguntas.py)
• static/ – images, CSS, UI assets
• Requirements files indicate Python dependencies and a “full” variant for development.
• No separate microservices—this is a monolith but with clear layering.
Additional README insights
• The system flow is: user → Streamlit UI → agent.py → RAG pipeline → Ollama LLM → database (via SQL) → response.
• Dependencies: Python 3.10+, Ollama (local LLM), PostgreSQL.
a. Components
1. User (browser)
2. Streamlit front-end (frontend/agent.py + static UI)
3. Application layer (app/__init__.py, test_connection.py)
4. RAG prompt layer (rag/prompt.txt)
5. Tools module (tools/perguntas.py) for SQL generation
6. Database layer (PostgreSQL via db/connection.py)
7. LLM service (Ollama hosting the mistral model)
b. Relationships & data flow
• Browser sends HTTP requests to Streamlit server.
• Streamlit invokes agent.py, which:
• Reads user query
• Calls tools/perguntas to construct or parse DB queries
• Optionally queries PostgreSQL via db/connection.py
• Loads prompt template from rag/prompt.txt
• Sends combined prompt + context to Ollama LLM REST/Socket API
• Receives LLM-generated answer
• Renders response in the front-end
c. Architectural patterns
• Layered Monolith: separation into UI, application logic, data access, external AI service.
• RAG (Retrieval-Augmented Generation) for dynamic data fetching.
d. Key technologies
• Python 3.10, Streamlit, Ollama (Mistral model), psycopg2/SQLAlchemy (implied), PostgreSQL.