DEV Community

shashank srivastava
shashank srivastava

Posted on

🐾 Building a PetCare AI Assistant with Gemini and RAG

πŸš€ Overview

As part of the Gen AI Intensive Course by Google & Kaggle, I built a PetCare AI Assistant β€” a conversational tool that helps pet owners get structured health advice based on their pet’s symptoms.

Rather than just prompting an LLM, I implemented a full Retrieval-Augmented Generation (RAG) pipeline using Gemini, vector search, and real veterinary PDFs. The assistant outputs actionable diagnostic advice in structured JSON format, with urgency level and recommended next steps.


πŸ’‘ The Problem

Most pet owners rely on scattered or unverified sources when their pet falls ill. The goal was to build an AI assistant that could understand a pet's symptoms and generate grounded, real-time advice β€” powered by GenAI and veterinary documents.


βœ… GenAI Capabilities Demonstrated

1.Few-shot Prompting
2.Document Understanding (PDFs)
3.Structured JSON Output
4.Retrieval-Augmented Generation (RAG)
5.Evaluation of output vs expert diagnosis


πŸ“‚ Dataset & Documents

I used real-world veterinary PDFs including:

  • Indian Government's Standard Treatment Guidelines (Livestock & Pets)
  • BSN Medical Veterinary Case Study Booklet
  • Veterinary Clinical Pathology reports (academic cases)

I extracted text using PyMuPDF, chunked it, and used semantic search with sentence-transformers.


🧠 Gemini + RAG Workflow

Here’s how it works:

  1. πŸ“ User submits a symptom query
  2. πŸ“š Most relevant document chunks are retrieved using embeddings
  3. 🧠 Gemini is prompted with few-shot examples + document context
  4. 🧾 Gemini generates a structured diagnosis like:
{
  "problem_category": "health",
  "preliminary_diagnosis": "Gastrointestinal upset likely due to spoiled food",
  "suggested_action": "Provide hydration, switch to bland diet, consult vet if persists",
  "recommended_services": ["Vet Consultation", "Diet Review"],
  "urgency": "Medium"
}


Enter fullscreen mode Exit fullscreen mode

πŸ”— Kaggle Notebook Link

https://www.kaggle.com/code/shashank0907/petcare-ai-assistant

Top comments (0)