How syedashhadibrar/actlens works
ActLens is a citation-grounded EU AI Act assistant with two user workflows: ask questions about the Act, or upload an internal policy for gap analysis. The chat path routes through an agent to hybrid retrieval, reranking, context preparation, and grounded answer generation; the response includes citations and retrieved passages for inspection. Separate ingestion builds and incrementally updates the searchable corpus. The README documents these capabilities; unsampled routes and subsystems are shown only at their existing enclosing paths, and uncertain internal wiring is omitted.
Main entry points: rag.py RAG pipeline · indexer.py Corpus indexer · hybrid.py Hybrid retrieval · App.tsx Chat workspace
Components 24
User workspace
- Chat workspace
frontend/src/App.tsx - API client
frontend/src/api/client.ts - Evidence inspector
frontend/src/components/inspector/EvidenceInspector.tsx
API and agents
- FastAPI app
backend/app/main.py - Chat and upload routes
backend/app/api/routes - Ingest endpoint
backend/app/api/routes/ingest.py - Agent router
backend/app/agents/orchestrator.py - Q&A agent
backend/app/agents/rag_agent.py - Gap analysis
backend/app/agents/gap_agent.py
Retrieval and indexing
- RAG pipeline
backend/app/pipeline/rag.py - Hybrid retrieval
backend/app/retrieval/hybrid.py - Vector index
backend/app/retrieval/vector_store.py - BM25 index
backend/app/retrieval/bm25_index.py - Cross-encoder ranker
backend/app/ranking/reranker.py - Corpus indexer
backend/app/ingestion/indexer.py - Document ingestion
backend/app/ingestion
Answer generation
- Context preparation
backend/app/processing/context.py - Grounded answer
backend/app/generation/answer.py - Agent runners
backend/app/agents/langchain
Model providers
- Provider registry
backend/app/core/providers/registry.py - Chat model adapters
backend/app/core/providers - Embedding adapter
backend/app/core/providers/hf_embedding_provider.py
Other components
- User
- Configured LLM
Connections 29
- User → Chat workspace: asks or uploads
- Chat workspace → API client: sends request
- API client → FastAPI app: calls API
- FastAPI app → Chat and upload routes: dispatches routes
- Chat and upload routes → Agent router: dispatches chat
- Agent router → Q&A agent: selects Q&A
- Agent router → Gap analysis: selects gap review
- Q&A agent → Agent runners: runs agent
- Gap analysis → Agent runners: runs agent
- Agent runners → RAG pipeline: retrieves evidence
- RAG pipeline → Hybrid retrieval: queries
- Hybrid retrieval → Vector index: searches vectors
- Hybrid retrieval → BM25 index: searches terms
- RAG pipeline → Cross-encoder ranker: reranks results
- RAG pipeline → Context preparation: prepares context
- RAG pipeline → Grounded answer: generates response
- Agent runners → Grounded answer: extracts citations
- Grounded answer → Provider registry: requests model
- Provider registry → Chat model adapters: selects adapter
- Chat model adapters → Configured LLM: calls model
- Hybrid retrieval → Embedding adapter: embeds query
- Embedding adapter → Provider registry: selected by
- Ingest endpoint → Corpus indexer: starts ingestion
- FastAPI app → Corpus indexer: loads indexes
- Corpus indexer → Document ingestion: loads and chunks
- Corpus indexer → Vector index: updates vectors
- Corpus indexer → BM25 index: updates terms
- Chat and upload routes → Chat workspace: returns answer and evidence
- Chat workspace → Evidence inspector: shows passages