How xvoxlabs/bhagavad_gita works
Speak with Krishna is a Bhagavad Gita chat and chapter-reading application. The primary workflow runs from a user message in the chat experience through the chat API and response pipeline, which interprets intent, retrieves relevant verses, validates guidance, and returns a reply; session history supports follow-up turns. Separate capabilities provide chapter reading and daily verses, speech input/output, and a talking avatar. Edges are limited to relationships shown in excerpts, the source index, or the README; unsampled subsystem internals are not expanded.
Main entry points: pipeline.ts Response pipeline · elevenlabs.ts Speech provider client · route.ts Chat API · corpus.ts Verse corpus
Components 25
User experience
- Chat experience
src/app/chat-screen.tsx - Sanctuary interface
src/app/sanctuary-screen.tsx - Chapter reader
src/app/gita/[chapter]/page.tsx - Daily verse
src/lib/daily.ts
Conversation and guidance
- Chat API
src/app/api/chat/route.ts - Response pipeline
src/lib/pipeline.ts - Language model
src/lib/llm.ts - Reply validation
src/lib/verify.ts - Safety checks
src/lib/safety.ts - Conversation sessions
src/lib/session.ts
Scripture and discovery
- Verse corpus
src/lib/corpus.ts - Verse retrieval
src/lib/retrieve.ts - Theme matching
src/lib/themes.ts - Chapter data
src/lib/chapters.ts
Voice and avatar
- Speech controls
src/app/use-speech.ts - Speech input API
src/app/api/stt/route.ts - Speech output API
src/app/api/tts/route.ts - Speech provider client
src/lib/elevenlabs.ts - Avatar engine
src/app/avatar/anam-engine.ts - Avatar session API
src/app/api/avatar/session/route.ts - Voice capabilities API
src/app/api/voice/route.ts
Other components
- Reader
- ElevenLabs
- Anam avatar service
- LLM service
Connections 30
- Reader → Chat experience: sends message
src/app/chat-screen.tsx - Chat experience → Chat API: submits turn
src/app/api/chat/route.ts - Chat API → Response pipeline: requests response
src/app/api/chat/route.ts - Chat API → Conversation sessions: loads and appends
src/app/api/chat/route.ts - Response pipeline → Language model: generates stages
src/lib/pipeline.ts - Response pipeline → Verse retrieval: selects verses
src/lib/pipeline.ts - Response pipeline → Reply validation: parses and checks
src/lib/pipeline.ts - Response pipeline → Safety checks: checks crisis
src/lib/pipeline.ts - Response pipeline → Conversation sessions: uses history
src/lib/pipeline.ts - Language model → LLM service: calls model
- Verse retrieval → Verse corpus: ranks verses
src/lib/retrieve.ts - Verse retrieval → Theme matching: matches themes
src/lib/retrieve.ts - Reply validation → Verse corpus: checks citations
src/lib/verify.ts - Reader → Chapter reader: reads chapters
src/app/gita/[chapter]/page.tsx - Chapter reader → Chapter data: loads chapter
src/app/gita/[chapter]/page.tsx - Chapter data → Verse corpus: uses verse data
src/lib/chapters.ts - Reader → Daily verse: opens daily verse
- Daily verse → Verse corpus: loads verse
src/lib/daily.ts - Reader → Sanctuary interface: speaks or types
src/app/sanctuary-screen.tsx - Sanctuary interface → Chat API: sends chat
- Sanctuary interface → Avatar engine: controls avatar
src/app/sanctuary-screen.tsx - Speech controls → Speech input API: transcribes audio
- Speech input API → Speech provider client: transcribes speech
src/app/api/stt/route.ts - Speech output API → Conversation sessions: finds reply
src/app/api/tts/route.ts - Speech output API → Speech provider client: streams audio
src/app/api/tts/route.ts - Speech provider client → ElevenLabs: requests speech
src/lib/elevenlabs.ts - Avatar engine → Avatar session API: requests session
src/app/avatar/anam-engine.ts - Avatar session API → Anam avatar service: creates session
- Avatar session API → Speech provider client: uses voice config
src/app/api/avatar/session/route.ts - Voice capabilities API → Speech provider client: checks availability
src/app/api/voice/route.ts