AI system for optimizing animal diets
AI nutrition for animals solves the same problems as for humans: personalized diets based on breed, age, weight, activity, and medical conditions. Veterinary clinics and premium pet food brands (Royal Canin, Hill's) use ML to create personalized nutrition programs.
Personalizing your pet's diet
import numpy as np
from anthropic import Anthropic
def calculate_pet_nutrition_plan(pet: dict) -> dict:
"""
Расчёт персонального плана питания.
pet: species, breed, age_months, weight_kg, activity_level, health_conditions[]
"""
llm = Anthropic()
# Базовый метаболический расчёт (RER - Resting Energy Requirement)
# Формула: RER = 70 × weight^0.75 (для кошек/собак)
weight = pet.get('weight_kg', 5)
rer_kcal = 70 * (weight ** 0.75)
# MER (Maintenance Energy Requirement) = RER × activity factor
activity_factors = {
'sedentary': 1.2,
'low': 1.4,
'moderate': 1.6,
'high': 1.8,
'working': 2.0
}
activity = pet.get('activity_level', 'moderate')
mer_kcal = rer_kcal * activity_factors.get(activity, 1.6)
# Корректировка на статус
if pet.get('neutered'):
mer_kcal *= 0.85
if pet.get('age_months', 12) < 12:
mer_kcal *= 1.5 # Щенки/котята растут
# LLM для детального плана
response = llm.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=300,
messages=[{
"role": "user",
"content": f"""Create a personalized nutrition plan for this pet in Russian.
Pet: {pet.get('species')}, {pet.get('breed')}, {pet.get('age_months')} months old
Weight: {weight} kg, Activity: {activity}
Health conditions: {pet.get('health_conditions', ['none'])}
Calculated daily calories: {mer_kcal:.0f} kcal
Provide:
1. Daily caloric need with justification
2. Macronutrient breakdown (protein/fat/carbs %)
3. 2-3 specific food recommendations
4. Foods to avoid given health conditions
5. Feeding schedule (times and portions)
Be specific with gram amounts."""
}]
)
return {
'daily_kcal': round(mer_kcal),
'rer_kcal': round(rer_kcal),
'nutrition_plan': response.content[0].text,
'weight_status': 'ideal' if 0.9 < weight / pet.get('ideal_weight', weight) < 1.1 else 'review'
}
AI-based optimization of pet diets reduces the risk of nutritional diseases (obesity, urolithiasis, diabetes) by 25-35%. Personalized nutrition programs increase sales of premium pet food by 30-40%, ensuring owners buy what's right for their pet.







