AutoStream is an India-focused conversational travel agent built with LangGraph, hybrid retrieval, ChromaDB, OpenAI models, and Streamlit. It answers destination questions, builds personalized itineraries, checks live weather, converts currencies, remembers named trips, cites its evidence, and abstains when its knowledge is insufficient.
The web experience uses a photographic slideshow with translucent navigation, trip controls, destination cards, and chat bubbles. A CLI is also included.
- Intent-aware LangGraph routing
- Section-aware ingestion of a Markdown travel corpus
- Hybrid BM25 and ChromaDB dense retrieval
- Reciprocal-rank fusion and lexical reranking
- Destination filtering and conversational query rewriting
- Grounded answers with sources and confidence details
- Personalized itineraries with Markdown download
- Open-Meteo weather and Frankfurter currency tools
- SQLite memory with multiple named trips per traveler
- Country-level clarification before broad itinerary generation
- Retrieval abstention and prompt-injection boundary tests
- Responsive slideshow/glass Streamlit UI with dark mode
Streamlit UI / CLI
│
▼
LangGraph: understand_query
│ conditional routing
├── travel knowledge ──┐
├── itinerary ─────────┤
├── weather ───────────┤
├── currency ──────────┤
├── conversation ──────┤
└── fallback ──────────┘
▼
response + sources
│
▼
SQLite named-trip memory
Knowledge and itinerary requests use this retrieval path:
data/raw/**/*.md
│
▼
front matter + heading parser
│
▼
section-aware, location-tagged chunks
│
├────▶ BM25 sparse ranking ─────────┐
│ │
└────▶ embeddings ▶ ChromaDB ───────┤
▼
reciprocal-rank fusion
│
lexical reranking + top-k
│
confidence / abstention gate
│
▼
grounded LLM response
intent.pyconverts the message and recent context into a validated intent.graph.pyroutes the state to exactly one node.rag.pyrewrites follow-ups and detects relevant destinations.hybrid_retrieval.pycombines BM25 and ChromaDB results using reciprocal-rank fusion, then reranks them.- Weak retrieval produces an explicit abstention rather than an invented answer.
- The generator uses retrieved evidence and returns citation metadata.
memory.pystores the latest messages under the selected traveler and named trip.
Each indexed chunk retains its source, title, country, region, state, city, destination, topic, section, source URL, and freshness metadata. The derived Chroma collection is created under data/processed/chroma/ and is not committed.
| Path | Responsibility |
|---|---|
app.py |
Streamlit request lifecycle |
ui_components.py |
Slideshow, glass UI, sidebar, chat, sources, downloads |
main.py |
Command-line interface |
graph.py |
LangGraph nodes and routing |
state.py |
Typed agent state |
intent.py |
Intent classification and entity extraction |
nodes.py |
RAG, itinerary, live-tool, conversation, and fallback nodes |
rag.py |
Query rewriting, retrieval coordination, grounding, citations |
ingestion.py |
Markdown parsing and section-aware chunking |
hybrid_retrieval.py |
BM25, reciprocal-rank fusion, reranking |
vector_store.py |
Chroma persistence and embeddings |
live_tools.py |
Weather and currency integrations |
memory.py |
SQLite conversation persistence |
llm.py |
OpenAI client and model calls |
config.py |
Environment-based settings |
data/raw/ |
Versioned India travel knowledge |
data/place_aliases.json |
City-to-state aliases |
assets/ |
Required slideshow and destination images |
evaluate_*.py |
Retrieval and answer evaluations |
test_*.py |
Automated tests |
- Python 3.11+
- Git
- An OpenAI API key
- Internet access for models, embeddings, weather, and currency
git clone https://github.com/Mrunali01/Autostream.git
cd Autostream
python -m venv .venvWindows PowerShell:
.\.venv\Scripts\Activate.ps1macOS/Linux:
source .venv/bin/activatepython -m pip install --upgrade pip
python -m pip install -r requirements.txtWindows PowerShell:
Copy-Item .env.example .envmacOS/Linux:
cp .env.example .envSet at least:
API_KEY=your_openai_api_keyNever commit .env; it is ignored.
Web application:
python -m streamlit run app.pyCLI:
python main.pyThe first RAG request can take longer while embeddings and the persistent Chroma collection are initialized.
python -m unittest -v
python evaluate_retrieval.py
python evaluate_retrieval.py --live
python evaluate_answers.pyThe normal retrieval benchmark and most unit tests use deterministic or mocked dependencies. --live and answer generation require a valid API key and network access.
| Variable | Default | Purpose |
|---|---|---|
API_KEY |
empty | OpenAI authentication |
CHAT_MODEL |
gpt-4o-mini |
Classification and generation model |
EMBEDDING_MODEL |
text-embedding-3-small |
Dense embedding model |
LLM_TIMEOUT_SECONDS |
20 |
API timeout |
LLM_MAX_RETRIES |
2 |
SDK retries |
LLM_MAX_TOKENS |
700 |
Response limit |
VECTOR_SCORE_THRESHOLD |
0.35 |
Retrieval confidence threshold |
MEMORY_DATABASE |
data/processed/memory.db |
SQLite memory path |
TRAVELER_ID |
local-cli |
Default traveler namespace |
LOG_LEVEL |
INFO |
Logging level |
RAG_DEBUG |
false |
Show retrieval diagnostics |
The bundled corpus is a curated planning reference, not a booking database. Only weather and reference currency conversion use live services. Always verify prices, availability, transport schedules, permits, closures, and advisories with the relevant official provider.
- The knowledge corpus is curated rather than automatically refreshed.
- Flights, hotels, maps, reservations, and payments are not integrated.
- The reranker is lexical rather than a learned cross-encoder.
- Itineraries are suggestions, not confirmed bookings.
- Prompt-injection tests are foundational, not a complete red-team suite.
No license has been selected. Add one before accepting external contributions or reuse.