Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoStream

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.

Highlights

  • 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

Architecture

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

Request lifecycle

  1. intent.py converts the message and recent context into a validated intent.
  2. graph.py routes the state to exactly one node.
  3. rag.py rewrites follow-ups and detects relevant destinations.
  4. hybrid_retrieval.py combines BM25 and ChromaDB results using reciprocal-rank fusion, then reranks them.
  5. Weak retrieval produces an explicit abstention rather than an invented answer.
  6. The generator uses retrieved evidence and returns citation metadata.
  7. memory.py stores 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.

Repository guide

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

Reproduce locally

Prerequisites

  • Python 3.11+
  • Git
  • An OpenAI API key
  • Internet access for models, embeddings, weather, and currency

1. Clone and create an environment

git clone https://github.com/Mrunali01/Autostream.git
cd Autostream
python -m venv .venv

Windows PowerShell:

.\.venv\Scripts\Activate.ps1

macOS/Linux:

source .venv/bin/activate

2. Install dependencies

python -m pip install --upgrade pip
python -m pip install -r requirements.txt

3. Configure the environment

Windows PowerShell:

Copy-Item .env.example .env

macOS/Linux:

cp .env.example .env

Set at least:

API_KEY=your_openai_api_key

Never commit .env; it is ignored.

4. Run AutoStream

Web application:

python -m streamlit run app.py

CLI:

python main.py

The first RAG request can take longer while embeddings and the persistent Chroma collection are initialized.

Verification

python -m unittest -v
python evaluate_retrieval.py
python evaluate_retrieval.py --live
python evaluate_answers.py

The normal retrieval benchmark and most unit tests use deterministic or mocked dependencies. --live and answer generation require a valid API key and network access.

Configuration

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

Reliability boundaries

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.

Current limitations

  • 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.

License

No license has been selected. Add one before accepting external contributions or reuse.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages