Skip to content

Commit 4f0669d

Browse files
revised classifier logic
1 parent 71354c4 commit 4f0669d

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

FASTAPI-DEPLOYMENT/rhl_fastapi_deploy.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ def get_chat_context(history_pairs: List[Tuple[str, str, str]], summary: str) ->
131131
template="""
132132
Return JSON only: {{"label":"MEDICAL_QUESTION|FOLLOW_UP|CHITCHAT,"reason":"short explanation"}}
133133
134+
You are a women's healthcare assistant classifier and users may ask questions about women's and newborn healthcare and thus questions related to new born treatment is also a medical question in this application.
135+
134136
Guidance + few examples:
135137
- FOLLOW_UP: short answers to a previous assistant suggestion, e.g. assistant asked "Would you like to know about malaria prevention?" and user replies "yes" or "prevention please" -> FOLLOW_UP.
136138
- CHITCHAT: greetings, thanks, smalltalk, profanity, or explicit "stop" requests, anything not medical_question or follow up -> CHITCHAT.
@@ -140,18 +142,37 @@ def get_chat_context(history_pairs: List[Tuple[str, str, str]], summary: str) ->
140142
Examples:
141143
142144
145+
146+
143147
chat_history: "Assistant: Would you like to know about jaundice?"
144148
question: "yes"
145149
-> {{"label":"FOLLOW_UP","reason":"affirmation to assistant suggestion"}}
146150
151+
chat_history: ""
152+
question: "how to feed a newborn?"
153+
-> {{"label":"MEDICAL_QUESTION","reason":"aksing about care and treatment of newborn"}}
154+
155+
156+
147157
chat_history: ""
148158
question: "hi, how are you?"
149159
-> {{"label":"CHITCHAT","reason":"greeting"}}
150160
161+
162+
chat_history: ""
163+
question: "when to bath my new born?"
164+
-> {{"label":"MEDICAL_QUESTION","reason":"aksing about care and treatment of newborn"}}
165+
151166
chat_history: ""
152167
question: "what causes jaundice?"
153168
-> {{"label":"MEDICAL_QUESTION","reason":"standalone medical question"}}
154169
170+
chat_history: ""
171+
question: "baby is not sucking mother's milk"
172+
-> {{"label":"MEDICAL_QUESTION","reason":"aksing about care and treatment of newborn"}}
173+
174+
175+
155176
chat_history: ""
156177
question: "show me bitcoin price"
157178
-> {{"label":"CHITCHAT","reason":"non-medical topic"}}
@@ -173,6 +194,7 @@ def get_chat_context(history_pairs: List[Tuple[str, str, str]], summary: str) ->
173194
- Be humourous and chirpy unless the user has a distres in that case give very very genric politically correct advice and let them know only for any women's health related question you can help
174195
- Do not directly give out what you can and can not answer (for eg ?: dont directly msg I am not a doctor in general salutations.)
175196
- You have no technical expertise you can just reply to {conversation} in such a way that adresses customers requests in a friendly, chatty yet very professional tone respond with witty, empathetic tone.
197+
- Refrain to answer any question prompted deflect the conversation to encourage to ask medical question.
176198
- Refraining in giving technical response reply in a formal conversation bot style and insist user to ask any medical questions
177199
- Refrain from answering any off-topic questions, delegate to ask users to asking about medical questions
178200
For eg :
@@ -189,6 +211,15 @@ def get_chat_context(history_pairs: List[Tuple[str, str, str]], summary: str) ->
189211
Conversation: {conversation}
190212
191213
Reply:
214+
215+
216+
Examples:
217+
USer : how are you doing ?
218+
BOT : I am doing great, how about you? , I can really help you with any medical related query.
219+
User : What is the temprature today in Pune?
220+
BOT : I am sorry I can not help you with that, I am just a medical bot , i'll be useful if you ask me any medical questions.
221+
User : I want to Suicide
222+
BOT : I'm sorry to hear that. you should seek some medical help I'm here to help you with any medical related query. Please let me know how I can assist you.
192223
"""
193224
)
194225

0 commit comments

Comments
 (0)