Spaces:
Running
Running
Commit
·
daa6699
1
Parent(s):
471e87b
Update
Browse files
main.py
CHANGED
@@ -191,17 +191,22 @@ class HealthcareChatbot:
|
|
191 |
|
192 |
### Phase 3: Routing Decision Logic
|
193 |
|
194 |
-
**
|
195 |
-
|
196 |
-
|
197 |
-
-
|
198 |
-
-
|
199 |
-
|
200 |
-
|
201 |
-
-
|
202 |
-
-
|
203 |
-
|
204 |
-
|
|
|
|
|
|
|
|
|
|
|
205 |
|
206 |
### Phase 4: Technical Implementation
|
207 |
When API_ACTION is determined:
|
@@ -213,9 +218,10 @@ class HealthcareChatbot:
|
|
213 |
|
214 |
## Confidence Assessment
|
215 |
Rate your confidence (0.0-1.0) based on:
|
216 |
-
-
|
217 |
-
-
|
218 |
-
-
|
|
|
219 |
|
220 |
## Required Output Format
|
221 |
{{
|
@@ -231,11 +237,12 @@ class HealthcareChatbot:
|
|
231 |
}}
|
232 |
|
233 |
## Quality Assurance Rules
|
|
|
234 |
- Never fabricate endpoints not present in the documentation
|
235 |
-
-
|
236 |
-
-
|
237 |
-
-
|
238 |
-
-
|
239 |
|
240 |
Analyze the provided query using this comprehensive framework and respond with the specified JSON format.
|
241 |
""",
|
|
|
191 |
|
192 |
### Phase 3: Routing Decision Logic
|
193 |
|
194 |
+
**IMPORTANT: Default to API_ACTION when there's ANY potential endpoint match**
|
195 |
+
|
196 |
+
**API_ACTION Classification (PRIMARY):**
|
197 |
+
- User mentions ANY action that could relate to healthcare operations
|
198 |
+
- ANY request for information that might exist in the system
|
199 |
+
- Keywords indicating medical services, appointments, records, or healthcare data
|
200 |
+
- Even vague requests that could be interpreted as needing API data
|
201 |
+
- When user asks about anything related to their health, medical history, or healthcare services
|
202 |
+
- Any mention of booking, scheduling, checking, updating, or retrieving information
|
203 |
+
|
204 |
+
**CONVERSATION Classification (SECONDARY - Use ONLY when certain):**
|
205 |
+
- Pure greetings with no follow-up request (just "hello", "hi")
|
206 |
+
- Thank you messages with no additional requests
|
207 |
+
- Questions ONLY about the bot's capabilities with no data needs
|
208 |
+
- Completely unrelated topics (weather, sports, general knowledge)
|
209 |
+
- Clear goodbye messages with no pending requests
|
210 |
|
211 |
### Phase 4: Technical Implementation
|
212 |
When API_ACTION is determined:
|
|
|
218 |
|
219 |
## Confidence Assessment
|
220 |
Rate your confidence (0.0-1.0) based on:
|
221 |
+
- BIAS TOWARD API_ACTION: Start with 0.7 confidence for any healthcare-related query
|
222 |
+
- Increase confidence when specific actions or data requests are mentioned
|
223 |
+
- Only reduce confidence below 0.5 for pure conversational elements
|
224 |
+
- Healthcare context should maintain high confidence for API_ACTION
|
225 |
|
226 |
## Required Output Format
|
227 |
{{
|
|
|
237 |
}}
|
238 |
|
239 |
## Quality Assurance Rules
|
240 |
+
- **CRITICAL**: Favor API_ACTION over CONVERSATION when in doubt
|
241 |
- Never fabricate endpoints not present in the documentation
|
242 |
+
- When multiple endpoints could match, select the most appropriate one
|
243 |
+
- If unsure about parameters, still route to API_ACTION and list missing parameters
|
244 |
+
- Only use CONVERSATION for clearly non-actionable queries
|
245 |
+
- Healthcare-related queries should almost always be API_ACTION
|
246 |
|
247 |
Analyze the provided query using this comprehensive framework and respond with the specified JSON format.
|
248 |
""",
|