Sutra: Building a Chatbot That Only Answers From My Own Site
Sutra is the AI assistant on this site. It answers only from the site's own content, links to real pages, captures project leads, and keeps working within free API limits with a Gemini-to-Groq fallback.
Built for
My own product

- The challenge
- I wanted a chat assistant that never invents facts about me, stays inside free AI tiers, and still behaves politely when the quota runs out.
- Stack & my role
- Next.js 16, React 19, TypeScript, Prisma, MySQL, Google Gemini API, Groq API, Resend
- The result
- Sutra answers from live site content, retries with a fuller prompt only when needed, tracks per-model usage, falls back to a second model, and shows a friendly message when both are exhausted. Project enquiries become emailed leads with the transcript.
Most website chatbots have the same two problems. They answer from whatever the model happens to remember, so they invent things, and they fall over the moment a free API quota runs out. I wanted an assistant for this portfolio that did neither: it should only say what the site actually says, and it should still behave politely when the AI has nothing left to give. That became Sutra, the assistant you can open in the corner of this site.
The first version was a single chat box and one big prompt. It worked, but it taught me the real constraint quickly: free model tiers have small per-minute token limits, and a prompt stuffed with every project, post, testimonial and service is expensive to send on every question.
So Sutra builds its knowledge from the site's own database instead of a hand-written FAQ. Experience, projects, skills, services and testimonials are turned into a compact prompt and cached for a few minutes, which means an edit in the admin shows up in the chatbot without a deploy. A lean version of that prompt handles most questions. When the model reports that the lean version doesn't contain the answer, Sutra retries once with the longer one, plus the most relevant long write-ups, before it admits it doesn't know.
The second half of the work was making it safe to leave running. Replies come back as strict JSON: the text, a list of link IDs, whether to offer the lead form, and whether the answer was found on the site. Links are only ever chosen from an allowlist of real pages, so the model can't invent a URL. It never shares an email address or phone number, never quotes a price, and treats whatever the visitor types as data rather than instructions.
Gemini is the primary model and Groq is the fallback. Each has its own rolling per-minute and per-day counter, with a cooldown after a rate-limit response. If both are out, the visitor gets a short, friendly note to try again in a moment instead of an error.
When someone describes a project, Sutra offers a short lead form. The details and the conversation transcript are saved to the admin inbox and emailed to me, and the visitor gets a confirmation.
What I'd tell a team building something similar: keep the knowledge in the same place your content already lives, treat the model's quota as a budget you manage, and decide up front what the assistant must never say. The chat box is the easy part.
Gallery
Kind words
Don't just take my word for it
Notes from teammates and client stakeholders I've worked alongside.
Had the pleasure of working closely with Sanjiv, and he is an exceptional leader who seamlessly bridges high-level strategy with deep technical execution.
Sanjiv excels in technical problem-solving—when complex, high-stakes engineering or architectural challenges arise, he is the person you want in the room. He approaches problems analytically, quickly getting to the root cause and devising elegant, scalable solutions.
Beyond his technical acumen, Sanjiv is a standout leader in solution delivery and team management. He has a proven ability to align cross-functional teams, streamline processes, and keep project milestones on track without sacrificing quality. His clear communication, structured approach, and genuine investment in supporting team members make him a trusted partner and a pillar on any team.
I highly recommend Sanjiv to any organization looking for a strong technical strategist and reliable leader who consistently delivers results.

Aman Kumar Sinha(LinkedIn profile, opens in a new tab)
Senior Product Manager at Merkle Sokrati · Oct 2026




