Grounding Knowledge with sivaGPT: An Agentic RAG System
Large pre-trained language models store extensive factual knowledge within their weights, but complex or domain-specific texts—like Sanskrit scriptures—require strong grounding to prevent hallucinations. To address this, sivaGPT operates as an advanced agentic Retrieval-Augmented Generation (RAG) system built with the Vercel AI SDK.
Key Architectural Capabilities
- Tool Use & Function Calling: Rather than blindly retrieving context for every prompt, sivaGPT intelligently determines when a query requires factual grounding. It autonomously invokes the search tool to retrieve target verses from siva.sh before formulating a response.
- Explicit Control: Users can manually instruct sivaGPT to trigger a search call if they want forced citation retrieval for ambiguous or broad prompts.
- Query History & Context Awareness: Maintains stateful conversational memory, allowing users to ask follow-up questions, request deeper commentary, or refine verse analyses iteratively.
- Source-Grounded Prompting via
gpt-4o: When the search function is triggered, retrieved reference verses are dynamically injected into the system prompt of OpenAI’sgpt-4o, ensuring answers remain strictly anchored in digitized primary sources.
A Growing Corpus for Sanskrit Research
sivaGPT unifies the full digital ecosystem developed at siva.sh. By combining continuous scripture digitization with structured vector indexing, the agent delivers precise, natural-language answers backed by direct textual citations. As more Sanskrit literature is digitized and indexed, sivaGPT's retrieval accuracy and domain breadth will scale naturally alongside the platform.