How we combined a chatbot with a veterinary nutrition textbook to answer “is this food right for my pet?”
When a customer walks into a specialty pet food store, the best staff member they can talk to is one who knows two things simultaneously: what’s on the shelf right now, and why a particular food is actually good for their animal. That’s a hard combination to find in a single person — and it turns out to be an interesting problem to solve with AI.
This post walks through how we built a RAG (Retrieval-Augmented Generation) chatbot for a pet food company that can answer questions like “What should my 8 year old dog with knee joint pain eat?” with real, specific, science-backed answers drawn from the store’s actual inventory.
Most e-commerce chatbots fall into generic glorified keyword search — “you typed ‘senior dog’, here are products tagged ‘senior dog’”. They dont have the custom information about what the store holds.
What customers actually need is a system that can connect the nutritional science to the specific products available to buy today. That requires a knowledge base of what is actually good for your furry friend
The architecture centers on a single Pinecone vector index:
namespace: nutrition holds the vet nutrition textbook, chunked and embedded using the same pipeline. Each chunk carries metadata so the chatbot can cite its sources precisely.
Before the vector search fires, the query engine does a quick heuristic species detection pass. If the customer mentions “dog,” “puppy,” or “canine,” the inventory search adds a Pinecone metadata filter that restricts results to species: ["dog", "both"]. Same for cats.
Getting ChatGPT to behave correctly in this context required careful system prompt design. A few things that made a meaningful difference:
Explicitly labeling the two source types and instructing ChatGPT to cite them separately — product recommendations with prices and links, nutritional claims with chapter/section/page references.
A hard rule against medical diagnoses. The chatbot will explain nutrition science, but for anything that sounds like a health condition, it defers to the vet. This is both legally sensible and practically correct: a customer whose cat has kidney disease needs a vet, not a chatbot, making the primary call. The chatbot is not supposed to replace a real vets advice, and its important that we make that distinction clear.
Writing simple prompts, to ensure that the model is staying on topic
You are a helpful and informative chatbot that answers questions based on a speech or text passage.
Respond in a complete sentence and make sure that your response is easy to understand for everyone.
Maintain a friendly and conversational tone. If you do not know the answer, then respond with 'I don't know.' Do not assume or try to guess.
Provide proof based on the documents shared.
It’s not a replacement for an expert staff member. But it’s available at 2am, it never gets tired, and it doesn’t forget what it read in the textbook.
A few natural extensions from here: Personalization. Storing a customer’s pet profile (species, breed, age, known sensitivities) would allow the chatbot to pre-filter and weight results without the customer having to repeat themselves every conversation.
Including the specific information regarding the store, and then helping place the order all within a chatbot.
Some of the tools required to make this project work:
Python - Python is a programming language that lets you work quickly and integrate systems more effectively.
ChatGPT - ChatGPT is your AI chatbot for everyday use. Chat with the most advanced AI to explore ideas, solve problems, and learn faster.
LangChain - LangChain provides the engineering platform and open source frameworks developers use to build, test, and deploy reliable AI agents.