AI Chatbot Development Journey

Over the past year, I explored how to make large language models truly useful in real-world applications. Starting from small experiments with fine-tuning Gemma 2 and Gemma 3 on custom datasets, I gradually evolved the project into a complete, production-grade AI chatbot platform.

My early work focused on training domain-specific models using around 1,000 custom question–answer pairs related to the village of Zavala and Apartments-Hvar.com. This initial dataset allowed me to understand how model adaptation, prompt design, and factual retrieval interact. The success of those first fine-tuned runs led to a broader architecture combining Retrieval-Augmented Generation (RAG) with deterministic logic for more reliable responses.

Core Technologies & Methods

The system uses SentenceTransformer embeddings and a FAISS vector index to deliver instant multilingual answers (Croatian and English). These RAG components are paired with Parameter-Efficient Fine-Tuning (PEFT) experiments such as LoRA, enabling efficient domain adaptation on modest hardware.

During development I also tested several model backends, from locally hosted Gemma variants to API-based solutions like Google Gemini 2.5 Flash Lite. This hybrid setup balances cost, speed, and accuracy—letting the chatbot automatically switch between self-hosted and cloud inference when needed.

From Prototype to Production

The final system runs on a FastAPI backend with integrated RAG retrieval, email automation for booking leads, reCAPTCHA security, and multilingual intent detection. It currently powers the booking assistant on Apartments-Hvar.com and my portfolio’s technical chatbot. This project represents my hands-on path from simple fine-tuning experiments to building full-scale AI systems ready for real users.

Key Capabilities Demonstrated Below

The screenshots below illustrate the chatbot’s practical intelligence and real-world performance, including:

  • Automatic Language Detection: The system seamlessly recognizes whether the user writes in Croatian or English—no manual language selection is needed.
  • Context-Aware Conversation Flow: The bot understands follow-up questions based on prior context. For example, after a user asks about the nearest gas station, the next message “How far is it?” is correctly linked to that same topic.
  • Smart Date Understanding: When users inquire about availability such as “Do you have something free for July?”, the chatbot automatically determines whether they are referring to the current or the next year based on the current date and conversation context.
  • Automated Booking Workflow: The system detects booking intent, verifies whether an email address was included, and guides the user accordingly. If an email is missing, it politely requests one before continuing.
  • Two-Way Email Confirmation: Once the user provides their email, the chatbot automatically sends confirmation messages to both the guest and the apartment owner, ensuring that reservation leads are handled instantly and reliably.
  • Fully Multilingual RAG Pipeline: All of the above capabilities operate equally well in Croatian and English, powered by multilingual sentence embeddings and contextual retrieval.

These examples, visible in the screenshots below, show how the AI chatbot combines language intelligence, reasoning, and automation to deliver a truly human-like and production-ready user experience.

AI Bot Screenshot 1
AI Bot Screenshot 2
AI Bot Screenshot 3
AI Bot Screenshot 4
AI Bot Screenshot 5
AI Bot Screenshot 6
AI Bot Screenshot 7
AI Bot Screenshot 8
AI Bot Screenshot 9
AI Bot Screenshot 10

System Architecture Diagram

 ┌─────────────────────────────────────────────────────────┐
 │                   Web Page (dcapps.net)                 │
 │─────────────────────────────────────────────────────────│
 │  • Displays AI Chatbot project page (aiBot.html)        │
 │  • Embeds JavaScript Chat Widget script                 │
 │  • Loads Google reCAPTCHA client API                    │
 │  • User interacts via chat bubble (launcher)            │
 └─────────────────────────────────────────────────────────┘
                 │
                 ▼
 ┌─────────────────────────────────────────────────────────┐
 │            JavaScript Chat Widget (Frontend)            │
 │─────────────────────────────────────────────────────────│
 │  • Lightweight JS app injected via                      │
 │  • Captures user messages & displays chat UI            │
 │  • Gets Google reCAPTCHA token                          │
 │  • Sends POST request to FastAPI backend                │
 │     → /chat/answer (Nautic)                             │
 │     → /api/dcapps/answer (dcapps)                       │
 │  • Includes: { question, user_id, ... }                 │
 └─────────────────────────────────────────────────────────┘
                 │ HTTPS (443)
                 ▼
 ┌─────────────────────────────────────────────────────────┐
 │             Apache Reverse Proxy (dariocaric.net)       │
 │─────────────────────────────────────────────────────────│
 │  • Handles HTTPS termination (SSL)                      │
 │  • Verifies allowed origins (CORS)                      │
 │  • Forwards requests to FastAPI services:               │
 │       - Port 8000 → Nautic Chatbot                      │
 │       - Port 8010 → DCApps Chatbot                      │
 │  • Handles CORS preflight (OPTIONS)                     │
 │  • Adds X-Forwarded-For headers (client IP)             │
 └─────────────────────────────────────────────────────────┘
                 │
                 ▼
 ┌─────────────────────────────────────────────────────────┐
 │                 FastAPI Backend (Python)                │
 │─────────────────────────────────────────────────────────│
 │ 🧠 Core Logic:                                          │
 │  • Auto language detection (HR / EN)                    │
 │  • Context tracking for follow-up questions             │
 │  • Detects booking intent & validates email             │
 │  • Sends confirmation emails to guest & owner           │
 │                                                         │
 │ 🔍 RAG (Retrieval-Augmented Generation):                │
 │  • SentenceTransformer + FAISS for vector search        │
 │  • Retrieves facts for LLM inference (multilingual)     │
 │                                                         │
 │ 📆 Booking Data Integration:                            │
 │  • Loads booked dates from CSV files                    │
 │  • Infers if user means current or next year            │
 │  • Matches apartment capacity via helper JSON           │
 │                                                         │
 │ 🔐 Security & Models:                                   │
 │  • Google reCAPTCHA verification per request            │
 │  • Backend: Gemini API (default) or self-hosted Llama   │
 └─────────────────────────────────────────────────────────┘
                 │
                 ▼
 ┌─────────────────────────────────────────────────────────┐
 │                 Data & Model Resources                  │
 │─────────────────────────────────────────────────────────│
 │ /opt/nautic/                                            │
 │  • answers.json → deterministic replies                 │
 │  • booking.json → apt. sources & capacities             │
 │  • facts.txt → HR & EN factual base                     │
 │                                                         │
 │ FAISS Indexes (in-memory):                              │
 │  • HR + EN passage embeddings (E5 multilingual)         │
 │                                                         │
 │ Cached booking CSV data (30-min TTL)                    │
 └─────────────────────────────────────────────────────────┘