abdibrahem commited on
Commit
80f0300
·
1 Parent(s): a48daee
Files changed (1) hide show
  1. main.py +10 -7
main.py CHANGED
@@ -166,11 +166,15 @@ class HealthcareChatbot:
166
 
167
  ## Simple Decision Process
168
 
169
- **Step 1: Check Endpoint Match**
 
 
 
 
170
  - Read each endpoint description in the documentation
171
- - Check if the user query aligns with ANY endpoint's purpose/description
172
- - If YES → intent = "API_ACTION"
173
- - If NO → intent = "CONVERSATION"
174
 
175
  **Step 2: Extract Details (only if API_ACTION)**
176
  - Select the matching endpoint
@@ -181,19 +185,18 @@ class HealthcareChatbot:
181
  {{
182
  "intent": "CONVERSATION|API_ACTION",
183
  "confidence": 0.0-1.0,
184
- "reasoning": "Brief explanation of whether query matches any endpoint description",
185
  "endpoint": "/endpoint/path/or/null",
186
  "method": "HTTP_METHOD/or/null",
187
  "params": {{}},
188
  "missing_required": []
189
  }}
190
 
191
- Analyze the query against the endpoint descriptions and respond with the JSON format.
192
  """,
193
  input_variables=["user_query", "detected_language", "extracted_keywords",
194
  "sentiment_analysis", "endpoints_documentation"]
195
  )
196
-
197
  # CONVERSATION CHAIN - Handles conversational responses
198
  self.conversation_template = PromptTemplate(
199
  template="""
 
166
 
167
  ## Simple Decision Process
168
 
169
+ **Step 1: Understand User Need**
170
+ - What is the user trying to accomplish?
171
+ - What specific action or information do they need?
172
+
173
+ **Step 2: Check if Need Matches Any Endpoint**
174
  - Read each endpoint description in the documentation
175
+ - Check if the user's NEED can be fulfilled by ANY available endpoint
176
+ - If the user's need matches what an endpoint provides → intent = "API_ACTION"
177
+ - If no endpoint can fulfill the user's need → intent = "CONVERSATION"
178
 
179
  **Step 2: Extract Details (only if API_ACTION)**
180
  - Select the matching endpoint
 
185
  {{
186
  "intent": "CONVERSATION|API_ACTION",
187
  "confidence": 0.0-1.0,
188
+ "reasoning": "Brief explanation of user's need and whether any endpoint can fulfill this need",
189
  "endpoint": "/endpoint/path/or/null",
190
  "method": "HTTP_METHOD/or/null",
191
  "params": {{}},
192
  "missing_required": []
193
  }}
194
 
195
+ Analyze what the user needs, then check if any endpoint can fulfill that need. Respond with the JSON format.
196
  """,
197
  input_variables=["user_query", "detected_language", "extracted_keywords",
198
  "sentiment_analysis", "endpoints_documentation"]
199
  )
 
200
  # CONVERSATION CHAIN - Handles conversational responses
201
  self.conversation_template = PromptTemplate(
202
  template="""