diff --git a/cdk/agents/lambda/traffic-generator/prompts.json b/cdk/agents/lambda/traffic-generator/prompts.json index 886547a5..234071b5 100644 --- a/cdk/agents/lambda/traffic-generator/prompts.json +++ b/cdk/agents/lambda/traffic-generator/prompts.json @@ -1,121 +1,114 @@ { "nutrition-queries": [ - "What should I feed my iguana?", "Can my dog eat rice?", - "Can my turtle eat lettuce?", - "What's the best diet for my gecko?", - "My bearded dragon needs supplements, which ones?", - "How often should I feed my tarantula?", - "What vegetables can my tortoise eat?", - "My chameleon is losing weight, diet help?", - "Can my frog eat crickets?", - "What's good nutrition for my axolotl?", - "My ferret won't eat, what should I do?", "What's the best food for indoor cats?", - "What should I feed my rabbit?", "My bird has diabetes, what diet do you recommend?", - "What supplements are good for joint health in horses?", - "Is chocolate toxic to pets?", - "My guinea pig won't eat, what should I do?", "Can dogs eat blueberries?", - "How often should I feed my ferret?", "What foods are toxic to birds?", "My hamster is overweight, help with diet plan", - "Can rabbits eat grapes?", - "My fish has swim bladder disease, what diet?", - "How much water should my reptile drink?", - "Can I give my bird human vitamins?", - "What's a good diet for a diabetic rabbit?", - "My horse has allergies, what food is safe?", - "My cat has diabetes, feeding schedule?", - "How do I transition my turtle to new food?", - "Can guinea pigs eat pellets meant for rabbits?", - "What's the best diet for weight loss in ferrets?", - "My iguana has diarrhea, what should I feed?", - "Are raw diets safe for birds?", - "What supplements help with arthritis in horses?", "Can hamsters eat sunflower seeds?", "My snake is refusing food, should I be worried?", "What's good for my dog's coat health?", - "What's the best food for baby rabbits?", "How do I know if my bird is dehydrated?", - "Can reptiles eat avocado?", - "My parrot won't stop begging for food", - "How often should senior rabbits eat?", "Can I feed my hamster table scraps?", "What's the difference between pellets and seeds for birds?", - "My turtle has bad breath, is it diet related?", "Can cats eat eggs?", - "Can guinea pigs eat fish?", - "What's the best diet for active horses?", - "My bearded dragon is constipated, what foods help?", - "How do I calculate portion sizes for my rabbit?", - "Can birds eat nuts?", - "What's good for a horse's coat health?", - "My ferret has pancreatitis, what diet?", - "Can turtles eat tuna?", - "What's the best food for indoor rabbits?", - "My bird is a picky eater, help!", "My dog won't eat dry food", "Can hamsters eat vegetables?", - "What supplements boost immune system in reptiles?", - "My rabbit has GI stasis, what helps?", "What should I feed my senior cat?", "Can my dog eat chicken?", "My cat won't drink water, help?", "What's the best diet for large breed dogs?", "Can cats eat tuna?", "My dog has sensitive stomach", - "What should I feed my chinchilla?", - "Can my hedgehog eat insects?", - "What supplements help with shedding in cats?", - "What's the best diet for my sugar glider?", - "My pet skunk needs nutrition advice", - "How often should I feed my capybara?", - "What vegetables can my pot-bellied pig eat?", "Can dogs eat peanut butter?", - "My wallaby is losing weight, diet help?", - "Can my kinkajou eat honey?", - "What's good nutrition for my fennec fox?", - "My prairie dog won't eat, what should I do?", - "What should I feed my miniature donkey?", "My cat is losing weight, help?", - "Can my coatimundi eat fruits?", - "What's the best diet for my alpaca?", - "My serval needs supplements, which ones?", - "How much should I feed my pygmy goat?", - "What's a good diet for my otter?", - "Can my raccoon eat dog food?", "What's the best diet for senior dogs?", - "What supplements help with my sloth's digestion?", - "My armadillo has dietary restrictions", - "What should I feed my baby opossum?", - "Can my porcupine eat vegetables?", - "What's the best food for my lemur?", - "My flying squirrel is picky, help!", - "Can cats eat cheese?", - "What supplements boost immune system in chinchillas?", - "Can my degu eat seeds?", - "What's good for digestive health in hedgehogs?", - "My marmoset has food allergies", - "How do I feed my pet crow?", - "What's the best diet for my peacock?", - "Can my toucan eat berries?", "My dog has kidney disease, diet help?", - "What supplements help with anxiety in sugar gliders?", - "My emu is getting old, diet changes?", - "What's good for my llama's coat health?", - "Can my muntjac deer eat hay?", "What's good for digestive health in cats?", - "What's the best diet for my axolotl?", - "How much should I feed my puppy?", "Can dogs eat carrots?", "My cat is overweight, diet plan?", "What supplements help with joint pain in dogs?", "Can cats eat salmon?", "My dog has allergies, what food is safe?", "Can cats eat yogurt?", - "What's the best diet for working dogs?" + "What's the best diet for working dogs?", + "Can cats eat cheese?", + "What supplements help with shedding in cats?", + "My bird is a picky eater, help!", + "Can birds eat nuts?", + "What supplements boost immune system in lizards?", + "My snake needs dietary supplements, which ones?", + "What's the best food for baby hamsters?", + "Can lizards eat vegetables?", + "My bird won't eat pellets, what should I do?", + "What's good nutrition for senior birds?", + "Can snakes eat frozen mice?", + "My hamster has diabetes, feeding schedule?", + "What vegetables can my lizard eat?", + "My bird has been losing weight, diet help?", + "Can I give my snake live prey?", + "What's the best diet for active cats?", + "My dog needs weight management food", + "Can birds eat seeds daily?", + "What supplements help with hamster coat health?", + "My lizard is constipated, what foods help?", + "Can cats eat fish daily?", + "What's the best food for indoor dogs?", + "My bird needs calcium supplements, which ones?", + "Can snakes eat eggs?", + "What's good for my hamster's digestive health?", + "My lizard won't eat greens, help!", + "Can dogs eat sweet potatoes?", + "What's the best diet for pregnant cats?", + "My bird has kidney issues, diet recommendations?", + "Can hamsters eat fruits?", + "What supplements help with snake shedding?", + "My cat has urinary issues, diet help?", + "What's the best food for working dogs?", + "Can lizards eat insects?", + "My dog is a picky eater, help!", + "What's good nutrition for breeding birds?", + "Can snakes eat fish?", + "My hamster won't drink water, help?", + "What vegetables are safe for lizards?", + "Can cats eat raw meat?", + "What's the best diet for puppy dogs?", + "My bird needs protein supplements, which ones?", + "Can hamsters eat commercial pellets?", + "What's good for snake digestive health?", + "My lizard is overweight, diet plan?", + "Can dogs eat quinoa?", + "What's the best food for senior cats?", + "My bird has liver issues, diet recommendations?", + "Can snakes eat rodents?", + "What supplements help with hamster joint health?", + "My cat needs hairball control food", + "What's the best diet for active dogs?", + "Can lizards eat commercial food?", + "My bird won't eat vegetables, help!", + "What's good nutrition for baby snakes?", + "Can hamsters eat grains?", + "My dog has food allergies, safe options?", + "What's the best food for indoor birds?", + "Can cats eat cooked chicken?", + "What supplements help with lizard bone health?", + "My snake is refusing frozen food, help!", + "What's good for my hamster's immune system?", + "Can dogs eat brown rice?", + "My cat needs dental health food", + "What's the best diet for molting birds?", + "Can lizards eat fruits?", + "My hamster has digestive issues, diet help?", + "What supplements help with snake nutrition?", + "Can cats eat turkey?", + "What's the best food for large breed dogs?", + "My bird needs vitamin supplements, which ones?", + "Can snakes eat chicken?", + "What's good nutrition for elderly hamsters?", + "My lizard needs hydration help, diet tips?", + "Can dogs eat oatmeal?", + "What's the best diet for indoor cats?" ], "non-nutrition-queries": [ "What are your clinic hours?", diff --git a/pet_clinic_ai_agents/nutrition_agent/nutrition_agent.py b/pet_clinic_ai_agents/nutrition_agent/nutrition_agent.py index 486729b5..4f7a1693 100644 --- a/pet_clinic_ai_agents/nutrition_agent/nutrition_agent.py +++ b/pet_clinic_ai_agents/nutrition_agent/nutrition_agent.py @@ -10,6 +10,9 @@ BEDROCK_MODEL_ID = "us.anthropic.claude-3-5-haiku-20241022-v1:0" NUTRITION_SERVICE_URL = os.environ.get('NUTRITION_SERVICE_URL') +# Available pet types in nutrition catalog +AVAILABLE_PET_TYPES = ["cat", "dog", "bird", "lizard", "snake", "hamster"] + agent = None agent_app = BedrockAgentCoreApp() @@ -18,6 +21,13 @@ def get_nutrition_data(pet_type): if not NUTRITION_SERVICE_URL: return {"facts": "Error: Nutrition service not found", "products": ""} + # Validate pet type before making API call + if pet_type.lower() not in [pt.lower() for pt in AVAILABLE_PET_TYPES]: + return { + "facts": f"We don't currently carry nutrition products for {pet_type}. Our nutrition catalog includes: {', '.join(AVAILABLE_PET_TYPES)}. Please contact our general veterinary team at (555) 123-PETS for specialized care recommendations.", + "products": "" + } + try: response = requests.get(f"{NUTRITION_SERVICE_URL}/{pet_type.lower()}", timeout=5) @@ -58,6 +68,10 @@ def get_nutritional_supplements(pet_type): @tool def create_order(product_name, pet_type, quantity=1): """Create an order for a recommended product. Requires pet_type and quantity.""" + # Validate pet type before processing order + if pet_type.lower() not in [pt.lower() for pt in AVAILABLE_PET_TYPES]: + return f"Sorry, we don't currently carry nutrition products for {pet_type}. Our nutrition catalog includes: {', '.join(AVAILABLE_PET_TYPES)}. Please contact our general veterinary team at (555) 123-PETS for specialized care recommendations." + data = get_nutrition_data(pet_type) if data['products'] and product_name.lower() in data['products'].lower(): order_id = f"ORD-{uuid.uuid4().hex[:8].upper()}" @@ -74,6 +88,10 @@ def create_nutrition_agent(): system_prompt = ( "You are a specialized pet nutrition expert at our veterinary clinic, providing accurate, evidence-based dietary guidance for pets. " "Never mention using any API, tools, or external services - present all advice as your own expert knowledge.\n\n" + f"IMPORTANT PET TYPE CONSTRAINTS:\n" + f"- Our nutrition catalog ONLY includes these pet types: {', '.join(AVAILABLE_PET_TYPES)}\n" + f"- For any pet types not in this list (puppy, llama, rabbit, toucan, flying squirrel, etc.), politely explain that we don't currently carry nutrition products for that specific pet type\n" + f"- Always suggest contacting our general veterinary team at (555) 123-PETS for specialized care recommendations for unsupported pet types\n\n" "When providing nutrition guidance:\n" "- Use the specific nutrition information available to you as the foundation for your recommendations\n" "- Always recommend the SPECIFIC PRODUCT NAMES provided to you that pet owners should buy FROM OUR PET CLINIC\n" diff --git a/pet_clinic_ai_agents/primary_agent/pet_clinic_agent.py b/pet_clinic_ai_agents/primary_agent/pet_clinic_agent.py index efc6128e..54d19bca 100644 --- a/pet_clinic_ai_agents/primary_agent/pet_clinic_agent.py +++ b/pet_clinic_ai_agents/primary_agent/pet_clinic_agent.py @@ -10,6 +10,9 @@ BEDROCK_MODEL_ID = "us.anthropic.claude-3-5-haiku-20241022-v1:0" +# Available pet types in nutrition catalog +AVAILABLE_PET_TYPES = ["cat", "dog", "bird", "lizard", "snake", "hamster"] + @tool def get_clinic_hours(): """Get pet clinic operating hours""" @@ -75,15 +78,21 @@ def consult_nutrition_specialist(query): "- Directing clients to appropriate specialists\n" "- Scheduling guidance\n" "- Basic medical guidance and when to seek veterinary care\n\n" - "IMPORTANT GUIDELINES:\n" - "- ONLY use the consult_nutrition_specialist tool for EXPLICIT nutrition-related questions (diet, feeding, supplements, food recommendations, what to feed, can pets eat X, nutrition advice)\n" - "- Delegate pet food product orders to the nutrition specialist using the consult_nutrition_specialist tool\n" + "IMPORTANT PET TYPE CONSTRAINTS:\n" + f"- Our nutrition specialist ONLY has products and information for these pet types: {', '.join(AVAILABLE_PET_TYPES)}\n" + "- NEVER recommend nutrition products or delegate nutrition questions for pet types not in this list\n" + "- For unsupported pet types (puppy, llama, rabbit, toucan, flying squirrel, etc.), politely explain that we don't currently carry nutrition products for that specific pet type\n" + "- Suggest they contact our general veterinary team at (555) 123-PETS for specialized care recommendations\n\n" + "NUTRITION DELEGATION GUIDELINES:\n" + "- ONLY use the consult_nutrition_specialist tool for EXPLICIT nutrition-related questions about SUPPORTED pet types\n" + "- Before delegating, verify the pet type is in our supported list\n" + "- Delegate pet food product orders to the nutrition specialist ONLY for supported pet types\n" "- DO NOT use the nutrition agent for general clinic questions, appointments, hours, emergencies, or non-nutrition medical issues\n" "- NEVER expose or mention agent ARNs in your responses to users\n" "- NEVER mention using tools, APIs, or external services - present all information as your own knowledge\n" "- When consulting the nutrition specialist, explain to the customer that you need to speak with our nutrition specialist\n" "- If the specialist returns an error or indicates unavailability, inform the customer that our specialist is currently unavailable\n" - "- For nutrition questions, always include a specific product recommendation and direct customers to purchase from our pet clinic\n" + "- For nutrition questions about supported pet types, always include a specific product recommendation and direct customers to purchase from our pet clinic\n" "- Always recommend purchasing products from our pet clinic\n" "- If a requested product is not available, politely inform the customer that we don't currently carry that item at our pet clinic\n" "- For medical concerns, provide general guidance and recommend scheduling a veterinary appointment\n"