TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Nandini-13/PsycheIT/llms.txt
Use this file to discover all available pages before exploring further.
/classify endpoint is the analytical core of PsycheIT. It accepts a raw, free-text message typed by a student and runs it through an in-memory Naive Bayes classifier trained on labelled mental health topics. The response tells the frontend which intent was detected with the highest confidence — enabling the chatbot to route conversations to the right support content, suggest coping strategies, or escalate to a human counselor.
Endpoint
Request Body
The student’s free-text message to be classified. Must be a non-empty string. Passing a missing field,
null, or a non-string value returns a 400 error.Response Fields
The single top-ranked intent label predicted by the classifier. One of:
greeting, academic, family, social, sleep, anxiety, highrisk, depression, general, counselor.An ordered array of the top 3 classification objects, ranked by descending log-probability score.
Example Request
Example Response
Intent Reference
The classifier recognises ten intent labels. The table below describes each intent and lists representative phrases that trigger it.| Intent | Description | Example Phrases |
|---|---|---|
greeting | Casual openers and introductory messages | ”Hi”, “Hello”, “Hey there”, “Good morning” |
academic | Stress, pressure, or struggles related to studies and exams | ”I’m failing my exams”, “Too much pressure from assignments”, “Grades are bad” |
family | Issues arising from family relationships or home environment | ”My parents are fighting”, “I feel unsupported at home”, “Family stress” |
social | Loneliness, peer relationships, bullying, or social isolation | ”I have no friends”, “People ignore me”, “I feel left out on campus” |
sleep | Sleep disturbances, insomnia, or exhaustion | ”I can’t sleep”, “I keep waking up at night”, “I feel exhausted all the time” |
anxiety | Worry, panic, nervousness, or physical symptoms of anxiety | ”I feel anxious”, “My heart races”, “I’m constantly worried about everything” |
highrisk | Expressions of self-harm, suicidal ideation, or crisis-level distress | ”I want to hurt myself”, “I don’t want to live”, “Everything feels hopeless” |
depression | Persistent sadness, low mood, loss of interest, or hopelessness | ”I feel empty”, “Nothing makes me happy”, “I’ve lost motivation for everything” |
general | Vague or mixed emotional distress that doesn’t fit a specific category | ”I don’t feel okay”, “Something is wrong with me”, “I’m not doing well” |
counselor | Explicit requests to speak with or be referred to a counselor | ”I want to talk to someone”, “Can I speak to a counselor?”, “I need help” |
Error Responses
| Status | Body | Cause |
|---|---|---|
| 400 | { "error": "missing message" } | The message field is absent, null, or not a string. |
How the Classifier Works
The Naive Bayes classifier is powered by
natural.BayesClassifier from the natural NLP library. At server startup, labelled training documents covering all 10 intent categories are added to the classifier and train() is called once, building the model entirely in memory. There is no persistence — the model is retrained from scratch on every server restart. No student messages are stored or used to retrain the model.