How shubhamharkare/codesearch-ai works
CodeSearch AI answers questions about React documentation, grounding responses in retrievable sections and declining unsupported questions. The user workflow runs from the Streamlit client through the FastAPI ask route into the answer pipeline: optional follow-up condensation and cache lookup, retrieval/reranking, abstention, then local LLM generation and citation validation. A separate ingestion workflow fetches and chunks the documentation into a versioned dense/BM25 index. Admin endpoints expose health and index status. The README documents these main flows; monitoring and explanation modules are present, but their runtime wiring was not sampled.
Main entry points: pipeline.py Answer pipeline · build.py Index builder · handle.py Live index handle · routes_admin.py Admin routes
Components 25
Client and API
- Streamlit UI
codesearch/ui/streamlit_app.py - HTTP client
codesearch/ui/api_client.py - FastAPI routes
codesearch/api/routes_ask.py
Answer workflow
- Answer pipeline
codesearch/pipeline.py - Follow-up rewrite
codesearch/retrieval/condense.py - Tiered answer cache
codesearch/cache/tiered.py - Exact cache
codesearch/cache/exact.py - Redis
- Hybrid retrieval
codesearch/retrieval/hybrid.py - Reranking
codesearch/retrieval/rerank.py - Abstention gate
codesearch/retrieval/abstain.py - Ollama generation
codesearch/generation/llm.py - Citation validation
codesearch/generation/citations.py
Ingestion and index
- Live index handle
codesearch/index/handle.py - Chroma vectors
codesearch/index/vector_store.py - BM25 index
codesearch/index/bm25.py - Documentation fetch
codesearch/ingest/fetch.py - Section chunking
codesearch/ingest/chunker.py - Index builder
codesearch/ingest/build.py - Index manifest
codesearch/ingest/manifest.py
Operations and observability
- Admin routes
codesearch/api/routes_admin.py - Answer explanations
codesearch/explain - Monitoring
codesearch/monitoring
Shared contracts
- Answer and chunk data
codesearch/schemas.py
Other components
- Question asker
Connections 26
- Question asker → Streamlit UI: asks
README.md - Streamlit UI → HTTP client: sends request
codesearch/ui/streamlit_app.py - HTTP client → FastAPI routes: calls HTTP
README.md - FastAPI routes → Answer pipeline: invokes
codesearch/api/main.py - Answer pipeline → Follow-up rewrite: rewrites follow-up
codesearch/pipeline.py - Answer pipeline → Tiered answer cache: checks and stores
codesearch/pipeline.py - Tiered answer cache → Exact cache: uses exact tier
codesearch/cache/tiered.py - Exact cache → Redis: reads and writes
codesearch/cache/exact.py - Answer pipeline → Hybrid retrieval: retrieves chunks
codesearch/pipeline.py - Hybrid retrieval → Live index handle: reads snapshot
codesearch/retrieval/hybrid.py - Live index handle → Chroma vectors: opens store
codesearch/index/handle.py - Live index handle → BM25 index: opens index
codesearch/index/handle.py - Answer pipeline → Reranking: reranks candidates
codesearch/pipeline.py - Answer pipeline → Abstention gate: checks scope
codesearch/pipeline.py - Answer pipeline → Ollama generation: generates answer
codesearch/pipeline.py - Answer pipeline → Citation validation: validates citations
codesearch/pipeline.py - Documentation fetch → Section chunking: supplies documents
codesearch/ingest/build.py - Section chunking → Index builder: provides chunks
codesearch/ingest/build.py - Index builder → Chroma vectors: builds dense index
codesearch/ingest/build.py - Index builder → BM25 index: builds lexical index
codesearch/ingest/build.py - Index builder → Index manifest: writes version metadata
codesearch/ingest/build.py - Admin routes → Live index handle: reports readiness
codesearch/api/routes_admin.py - Admin routes → Index manifest: returns index metadata
codesearch/api/routes_admin.py - Answer pipeline → Answer explanations
- Answer pipeline → Monitoring
- Answer pipeline → Answer and chunk data: returns answer data
codesearch/pipeline.py