Spaces:
Sleeping
Sleeping
Commit
·
fec2827
1
Parent(s):
61ff52b
Fix
Browse files
main.py
CHANGED
@@ -156,37 +156,37 @@ class HealthcareChatbot:
|
|
156 |
|
157 |
# Intent classification prompt
|
158 |
self.intent_classifier_template = PromptTemplate(
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
|
191 |
|
192 |
|
|
|
156 |
|
157 |
# Intent classification prompt
|
158 |
self.intent_classifier_template = PromptTemplate(
|
159 |
+
template="""
|
160 |
+
You are an intent classifier. Your job is simple: understand what the user wants and check if any API endpoint can do that.
|
161 |
+
|
162 |
+
User Message: {user_query}
|
163 |
+
Language: {detected_language}
|
164 |
+
API Endpoints: {endpoints_documentation}
|
165 |
+
|
166 |
+
Think step by step:
|
167 |
+
|
168 |
+
1. What does the user want from this message?
|
169 |
+
Read the user's message carefully. What is the user trying to say or accomplish? What would a human understand from this message?
|
170 |
+
|
171 |
+
2. Can any API endpoint fulfill what the user wants?
|
172 |
+
Look at each API endpoint. Does any endpoint do what the user is asking for? Be very precise - only say yes if there's a clear match.
|
173 |
+
|
174 |
+
Important rules:
|
175 |
+
- Focus ONLY on the current message, ignore conversation history for classification
|
176 |
+
- If the user is just talking, being social, or saying something casual, that's CONVERSATION
|
177 |
+
- Only choose API_ACTION if the user is clearly asking for something an API endpoint can do
|
178 |
+
- When you're not sure, choose CONVERSATION
|
179 |
+
|
180 |
+
Answer in this format:
|
181 |
+
{{
|
182 |
+
"intent": "API_ACTION" or "CONVERSATION",
|
183 |
+
"confidence": [0.0 to 1.0],
|
184 |
+
"reasoning": "What does the user want? Can any API do this?",
|
185 |
+
"requires_backend": true or false
|
186 |
+
}}
|
187 |
+
""",
|
188 |
+
input_variables=["user_query", "detected_language", "conversation_history", "endpoints_documentation"]
|
189 |
+
)
|
190 |
|
191 |
|
192 |
|