How zahidpichen/wander-chat works
1. Repository shape
This repo is currently a Python-first backend service for an AI travel assistant. The tree shows a single runtime entrypoint, app.py, plus a local document corpus in dataset/ and prebuilt retrieval artifacts in knowledge_base/. The README mentions a Next.js frontend, but that frontend is not present in the tree you provided.
2. Primary application boundary
app.py is the main orchestration layer. It likely exposes the API surface, handles chat requests, coordinates retrieval, calls the LLM, and returns the final response. In architecture terms, this is the central control plane for the assistant.
3. Local knowledge sources
The dataset/ folder contains Kerala tourism PDFs such as:
- ernakulam.pdf
- alappuzhahrj28.pdf
- munnar-e-brochure.pdf
- Thiruvananthapuram-E-Brochure.pdf
These are the authoritative local content sources for the assistant’s domain knowledge.
4. Precomputed retrieval layer
The knowledge_base/ directory contains:
- chunk_store.pkl
- vectorstore.index
These indicate an offline-built RAG index. The PDFs are split into chunks, embedded, and stored in a FAISS-style vector index, with the chunk metadata serialized separately. This is the main data boundary between raw documents and runtime answering.
5. Runtime retrieval flow
At request time, the backend should:
1. Receive a user travel question.
2. Search the vector index for relevant chunks from the local Kerala corpus.
3. Attach the retrieved context to the prompt.
4. Generate a response with the LLM.
This is the core “local knowledge -> semantic retrieval -> answer synthesis” pipeline.
6. Live information augmentation
The README states the assistant also uses Tavily API for live web search. That means the architecture has two knowledge paths:
- Static/local RAG for brochure and tourism content
- Dynamic web search for live events, festivals, shops, and current updates
The backend likely decides when to rely on each path based on query intent.
7. LLM generation boundary
The model layer uses Google Gemini 2.0 Flash via OpenRouter. So the repository is not hosting its own model; it is an orchestration client that sends prompts plus retrieved context to an external LLM API and consumes the generated text.
8. Conversation memory
The README says the assistant maintains short-term conversation history. That implies the backend keeps recent messages in memory within the request/session flow so follow-up questions can be resolved without reintroducing full context every time.
9. Domain behavior split
The assistant is described as operating in two phases:
- Discovery: recommend destinations based on interests
- Planning: generate itineraries, budgets, and local recommendations
This is an application-level state distinction, probably implemented through prompt logic or request classification rather than separate services.
10. Configuration and secrets
.env is the configuration boundary for API keys and runtime settings. Based on the README, it likely holds OpenRouter and Tavily credentials, and possibly other service settings used by app.py.
11. Offline build vs online serving
The presence of prebuilt indices in knowledge_base/ suggests a two-stage architecture:
- Build/ingestion stage: parse PDFs, chunk content, embed text, write index files
- Serving stage: load the index and answer queries through the API
The checked-in artifacts mean the service can start without rebuilding the corpus every time.
12. Tooling and implementation style
The project is intentionally lightweight: pure Python, FastAPI, and direct integrations rather than a larger agent framework. The README explicitly says it avoids LangChain-style abstractions, which means the main logic is likely concentrated in app.py with a small number of focused dependencies from requirements.txt.
13. What to draw in an architecture diagram
A clear diagram should show:
- User/client on one side
- app.py / FastAPI backend in the center
- Local PDF corpus and FAISS-style vector store as the retrieval subsystem
- OpenRouter/Gemini as the generation subsystem
- Tavily as the live search subsystem
- .env as configuration input
The key architectural idea is that Wanderchat is a retrieval-augmented travel assistant that blends local brochure knowledge with live web search, then synthesizes answers through an external LLM.
Main entry points: app.py App · vectorstore.index Vector Index · dataset PDF Corpus · chunk_store.pkl Chunk Store
Components 15
Runtime
Serving path for chat requests and response synthesis
- User · Traveler asking questions or planning trips
- App · Main orchestration layer for chat, retrieval, and answer generation
app.py - History · Short-term chat context used for follow-up questions
- Query Router · Selects between discovery, planning, local retrieval, and live search paths
- RAG Synthesizer · Combines retrieved context with the user question for final response generation
Knowledge
Local tourism corpus and prebuilt retrieval artifacts
- PDF Corpus · Authoritative Kerala brochure sources used for offline knowledge
dataset - Ernakulam · Regional tourism brochure content
dataset/ernakulam.pdf - Alappuzha · Regional tourism brochure content
dataset/alappuzhahrj28.pdf - Munnar · Regional tourism brochure content
dataset/munnar-e-brochure.pdf - Thiruvananthapuram · Regional tourism brochure content
dataset/Thiruvananthapuram-E-Brochure.pdf - Vector Index · Semantic search index over chunked brochure text
knowledge_base/vectorstore.index - Chunk Store · Serialized chunk text and metadata backing retrieval results
knowledge_base/chunk_store.pkl
External APIs
Third-party services used at query time
- Tavily Search · Live web search for current events, updates, and local services
- OpenRouter · Hosts Gemini 2.0 Flash access used for answer generation
Config
Repository-level runtime settings
- Env Vars · Secrets and runtime configuration for external services
.env
Connections 14
- User → App: chat request · User submits a travel question
- Env Vars → App: configure · App reads API keys and runtime settings
- App → History: retain · Keeps short-term conversation history
- App → Query Router: classify · Chooses the appropriate knowledge and generation path
- Query Router → Vector Index: semantic search · Retrieves relevant brochure chunks from the vector index
- Vector Index → Chunk Store: lookup metadata · Maps nearest neighbors back to chunk text and source info
- Query Router → Tavily Search: live search · Fetches current information when the query needs freshness
- Query Router → RAG Synthesizer: assemble context · Prepares the answer prompt from history, retrieval, and search results
- PDF Corpus → Vector Index: build index · Offline PDFs are split and embedded into the retrieval store
- PDF Corpus → Chunk Store: chunk text · Document text and source metadata are serialized for runtime lookup
- RAG Synthesizer → OpenRouter: generate · Sends prompt plus context to the external LLM
- OpenRouter → App: response · Returns synthesized answer text
- Tavily Search → RAG Synthesizer: search results · Adds fresh web snippets into the final prompt
- App → User: answer · Returns the travel recommendation or itinerary