abdibrahem commited on
Commit
daa6699
·
1 Parent(s): 471e87b
Files changed (1) hide show
  1. main.py +25 -18
main.py CHANGED
@@ -191,17 +191,22 @@ class HealthcareChatbot:
191
 
192
  ### Phase 3: Routing Decision Logic
193
 
194
- **CONVERSATION Classification:**
195
- - User query does NOT align with any available endpoint functionality
196
- - General inquiries that don't require specific data operations
197
- - Conversational elements without actionable requests
198
- - Queries that cannot be fulfilled through the documented API capabilities
199
-
200
- **API_ACTION Classification:**
201
- - User query clearly aligns with at least one endpoint's described functionality
202
- - Request involves specific data operations (create, read, update, delete)
203
- - Query contains actionable elements that match endpoint capabilities
204
- - Required or optional parameters can be extracted from the user input
 
 
 
 
 
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
- - Clarity of user intent (0.3 weight)
217
- - Strength of endpoint alignment (0.4 weight)
218
- - Parameter availability and accuracy (0.3 weight)
 
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
- - Never assume parameter values not explicitly provided by the user
236
- - Always cross-reference endpoint descriptions with user intent
237
- - Provide detailed reasoning that demonstrates thorough analysis
238
- - Default to CONVERSATION when endpoint alignment is uncertain or weak
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
  """,