How techwithtim/productiongraderagpythonapp works
Purpose and Entry Points
This is a compact Python document-vectorization/retrieval project. Its source layout indicates a pipeline that loads data, represents it with shared types, persists/searches vectors, and exposes either a script or Streamlit interface.
• Script entry point: main.py
• Interactive UI entry point: streamlit_app.py
• Package/runtime definition: pyproject.toml
Application Orchestration
main.py is the likely control-plane entry point for initializing the document pipeline or executing queries. streamlit_app.py is a separate presentation boundary, likely invoking the same loading/vector-store capabilities for user-driven interaction.
• main.py
• streamlit_app.py
The repository has no visible service/API layer or frontend asset tree; Streamlit is the apparent user-facing runtime.
Document Ingestion
data_loader.py defines the source-data boundary. It likely converts external or local document inputs into application-level records before indexing. This is the place to change supported input formats, extraction behavior, chunking inputs, or source metadata.
• data_loader.py
• custom_types.py
Domain Contracts
custom_types.py is the shared contract boundary between ingestion, vector persistence, and callers. Its types likely carry document text, metadata, IDs, query results, or similar transport objects. Changes here can affect both the script and Streamlit paths.
• custom_types.py
• data_loader.py
• vector_db.py
Vector Storage and Retrieval
vector_db.py is the storage adapter boundary. The checked-in storage identifies Qdrant as the vector database implementation and indicates a collection named docs. The adapter should isolate Qdrant client calls, collection lifecycle, upserts, and similarity-search result mapping from the rest of the application.
• vector_db.py
• qdrant_storage/collections/docs/config.json
• qdrant_storage/collections/docs/0/shard_config.json
Primary flow is expected to be: source documents → data_loader.py → shared records in custom_types.py → embeddings/vector writes through vector_db.py → retrieval results returned to main.py or streamlit_app.py.
Persistence Boundary
qdrant_storage/ is local, stateful Qdrant persistence rather than application source. It contains collection metadata, shard write-ahead logs, payload storage, and vector segments. It must be treated as durable runtime data: deleting or replacing it changes indexed content.
• qdrant_storage/collections/docs/0/wal
• qdrant_storage/collections/docs/0/segments/62205516-fdd8-4d26-ae0e-bc9c79076f59/vector_storage/vectors/chunk_0.mmap
• qdrant_storage/collections/docs/0/segments/62205516-fdd8-4d26-ae0e-bc9c79076f59/payload_storage/page_0.dat
Runtime and External Dependencies
The project targets Python, with version selection in .python-version and dependency/environment resolution in pyproject.toml and uv.lock. Material infrastructure consists of Streamlit for the interactive runtime and local Qdrant-backed vector persistence. No cloud service, remote database, or external embedding provider can be confirmed from the provided tree.
• .python-version
• pyproject.toml
• uv.lock
Main entry points: config.json docs collection · data_loader.py Document loader · vector_db.py Vector DB adapter · main.py Script entry
Components 12
Runtime
- Script entry
main.py - Streamlit UI
streamlit_app.py - Python environment
pyproject.toml
Document Pipeline
- Source documents
- Document loader · Converts source inputs into application records.
data_loader.py - Shared records · Document and retrieval types shared across pipeline boundaries.
custom_types.py - Vector DB adapter · Owns collection lifecycle, upserts, and similarity search mapping.
vector_db.py
Local Vector Persistence
- docs collection
qdrant_storage/collections/docs/config.json - Shard configuration
qdrant_storage/collections/docs/0/shard_config.json - Write-ahead log
qdrant_storage/collections/docs/0/wal - Vector segments
qdrant_storage/collections/docs/0/segments/62205516-fdd8-4d26-ae0e-bc9c79076f59/vector_storage/vectors/chunk_0.mmap - Payload segments
qdrant_storage/collections/docs/0/segments/62205516-fdd8-4d26-ae0e-bc9c79076f59/payload_storage/page_0.dat
Connections 14
- Python environment → Script entry: defines runtime
- Python environment → Streamlit UI: defines runtime
- Script entry → Document loader: loads documents
- Streamlit UI → Document loader: loads documents
- Source documents → Document loader: ingested by
- Document loader → Shared records: creates records
- Shared records → Vector DB adapter: indexes and queries
- Script entry → Vector DB adapter: runs retrieval
- Streamlit UI → Vector DB adapter: runs retrieval
- Vector DB adapter → docs collection: manages and searches
- docs collection → Shard configuration: contains shard
- docs collection → Write-ahead log: records writes
- docs collection → Vector segments: stores vectors
- docs collection → Payload segments: stores payloads