How ujala100/setu-guide works
Setu Guide is a stage-aware relationship-guidance API. The main workflow accepts consented context and either a quick-action intent or message, applies request controls, then routes through intent handling, retrieval, response generation and safety checks to a structured reply. The README documents caching, rate limits, mock/fallback behavior and external-provider configuration. The graph reflects sampled code and documented capabilities; unsampled internals are represented only where the README or SOURCE INDEX supports them.
Main entry points: orchestrator.py Guide orchestrator · chat.py Chat handler · main.py HTTP routes · pipeline.py Generation pipeline
Components 18
API and controls
- ASGI entry
app/main.py - HTTP routes
app/api/main.py - Chat handler
app/api/chat.py - Runtime settings
app/config.py - Rate limiter
app/api/ratelimit.py - Response cache
app/api/cache.py
Guidance workflow
- Guide schema
app/schemas/guide.py - Guide orchestrator
app/core/orchestrator.py - Intent router
app/core/router.py - Generation pipeline
app/core/pipeline.py - Template responder
app/core/responder.py - Prompt templates
app/core/prompts
Knowledge and safety
- Stage retrieval
app/rag/retriever.py - Knowledge chunks
app/rag/knowledge_base/kb_chunks.json - Safety guard
app/safety/guard.py
Generation and state
- LLM providers
app/core/llm_provider.py
Other components
- Express client
- LLM service
Connections 23
- Express client → HTTP routes: sends chat
README.md - ASGI entry → HTTP routes: exposes app
app/main.py - HTTP routes → Chat handler: dispatches chat
app/api/main.py - HTTP routes → Guide schema: validates request
app/api/main.py - HTTP routes → Runtime settings: loads settings
app/api/main.py - HTTP routes → Guide orchestrator: selects entry
app/api/main.py - Chat handler → Guide schema: handles models
app/api/chat.py - Chat handler → Runtime settings: reads settings
app/api/chat.py - Chat handler → Rate limiter: enforces limits
app/api/chat.py - Chat handler → Response cache: checks and stores
app/api/chat.py - Chat handler → Guide orchestrator: invokes entry
README.md - Guide orchestrator → Guide schema: uses request models
app/core/orchestrator.py - Guide orchestrator → Intent router: routes intent
app/core/orchestrator.py - Guide orchestrator → Stage retrieval: retrieves context
app/core/orchestrator.py - Guide orchestrator → Safety guard: checks safety
app/core/orchestrator.py - Guide orchestrator → Generation pipeline: generates reply
app/core/orchestrator.py - Guide orchestrator → Template responder: uses fallback
app/core/orchestrator.py - Generation pipeline → Intent router: routes intent
app/core/pipeline.py - Generation pipeline → LLM providers: requests generation
app/core/pipeline.py - Generation pipeline → Template responder: falls back
app/core/pipeline.py - Generation pipeline → Prompt templates: loads prompt
app/core/pipeline.py - LLM providers → LLM service: calls configured model
app/core/llm_provider.py - Stage retrieval → Knowledge chunks: ranks chunks