You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
st.markdown("<h1 style='text-align: center; color: white;'>🐕 Dog Breed Assistant 🦮</h1>", unsafe_allow_html=True)
56
-
st.markdown("<h3 style='text-align: center; color: white;'>Your Friendly Guide to Dog Breeds</h3>", unsafe_allow_html=True)
57
-
st.markdown("<h3 style='text-align: center; color: red;'> This chatbot uses open source model Phi due to its smaller size and faster response time</h3>", unsafe_allow_html=True)
st.error(f"Rate limit exceeded! ⏳ Please wait {remaining_time} seconds before sending another message! This is to prevent abuse and overload my server. This rate limit is applied to all users. Resend you query to continue and Thanks for your patience!")
73
+
st.error(f"Rate limit exceeded! ⏳ Please wait {remaining_time} seconds before sending another message!")
91
74
returnNone
92
75
93
-
# Check if query is dog-related
94
-
ifnotis_dog_related(query):
95
-
return"I am a dog breed expert assistant. I can only answer questions about dogs and dog breeds. Please ask me about dogs! 🐕"
76
+
# Check if query is math-related
77
+
# if not is_math_related(query):
78
+
#return "I am a math assistant. I can only help with mathematical questions and calculations. Please ask me about math! 🔢"
96
79
97
80
st.session_state.last_query_time=current_time
98
81
99
-
withst.spinner('🐾 Fetching response... Thank you for your patience! 🐕'):
100
-
context="""You are a dog breed expert assistant. You must ONLY answer questions about dogs and dog breeds.
101
-
If the question is not about dogs, respond with "I am a dog breed expert assistant. I can only answer questions about dogs and dog breeds."
102
-
103
-
These are the columns in the data:
104
-
Breed Name,Detailed Description Link,Dog Size,Dog Breed Group,Height,"Avg. Height, cm",Weight,"Avg. Weight, kg",Life Span,"Avg. Life Span, years",Adaptability,Adapts Well To Apartment Living,Good For Novice Owners,Sensitivity Level,Tolerates Being Alone,Tolerates Cold Weather,Tolerates Hot Weather,All Around Friendliness,Affectionate With Family,Kid-Friendly,Dog Friendly,Friendly Toward Strangers,Health And Grooming Needs,Amount Of Shedding,Drooling Potential,Easy To Groom,General Health,Potential For Weight Gain,Size,Trainability,Easy To Train,Intelligence,Potential For Mouthiness,Prey Drive,Tendency To Bark Or Howl,Wanderlust Potential,Physical Needs,Energy Level,Intensity,Exercise Needs,Potential For Playfulness
82
+
withst.spinner('🔢 Computing... Thank you for your patience!'):
83
+
context="""You are a math assistant. You must ONLY answer questions about mathematics.
84
+
If the question is not about math, or about how to solve a math problem, respond with "I am a math assistant. I can only help with mathematical questions."
105
85
106
-
The data contains ratings on a scale of 1-5 for columns (Adaptability, Adapts Well To Apartment Living, Good For Novice Owners, Sensitivity Level, Tolerates Being Alone, Tolerates Cold Weather, Tolerates Hot Weather, All Around Friendliness, Affectionate With Family, Kid-Friendly, Dog Friendly, Friendly Toward Strangers, Health And Grooming Needs, Amount Of Shedding, Drooling Potential, Easy To Groom, General Health, Potential For Weight Gain, Size, Trainability, Easy To Train, Intelligence, Potential For Mouthiness, Prey Drive, Tendency To Bark Or Howl, Wanderlust Potential, Physical Needs, Energy Level, Intensity, Exercise Needs, Potential For Playfulness) where:
107
-
- 5 is the BEST/HIGHEST score (excellent)
108
-
- 4 is ABOVE AVERAGE
109
-
- 3 is AVERAGE
110
-
- 2 is BELOW AVERAGE
111
-
- 1 is the WORST/LOWEST score (poor)
86
+
Example questions:
87
+
- What is the square root of 16?
88
+
- How do I solve the equation 2x + 3 = 7?
89
+
- What is the sum of 10 and 5?
90
+
- What is the product of 3 and 4?
91
+
- What is the difference between 10 and 5?
112
92
113
93
Important rules:
114
-
1. NEVER answer questions that are not about dogs
115
-
2. Do not mention the data or ratings in your response
116
-
3. If unsure, say "Sorry, I don't know the answer to that question"
117
-
4. Keep responses focused only on dogs and dog breeds
118
-
5. Be friendly and helpful, but stay strictly within dog-related topics
94
+
1. NEVER answer questions that are not about math
95
+
2. Show your work step by step
96
+
3. If unsure, say "Sorry, I don't know how to solve this problem"
97
+
4. Use proper mathematical notation
98
+
5. Be precise and accurate
99
+
6. Explain concepts clearly
100
+
7. If the question involves complex calculations, break them down
101
+
8. Use LaTeX notation for complex mathematical expressions
0 commit comments