
International Research Journal of Engineering and Technology (IRJET) e-ISSN:2395-0056
Volume: 11 Issue: 05 | May 2024 www.irjet.net p-ISSN:2395-0072
MENTAL HEALTH ASSISTANT(CHATBOT) USING OPENAI API
Aatika1 , Ashi Bhagoria2 , Kumari Anu3 , Mr. Suresh Kumar4
1 Department of Information Technology, Engineering, Galgotias College of Engineering and Technology, Uttar Pradesh, India
2 Department of Information Technology, Engineering, Galgotias College of Engineering and Technology, Uttar Pradesh, India
3Department of Information Technology, Engineering, Galgotias College of Engineering and Technology, Uttar Pradesh, India
4Assistant Professor, Department of Information Technology, Engineering, Galgotias College of Engineering and Technology, Uttar Pradesh, India
Abstract - This research introduces InsightfulAI Mind Tracker, a mental health assistant that aims to develop a web application that provides individuals with an accessible tool to assess their mental health status using advanced NLP techniques and insights from medical literature. It goes beyond traditional assessment tools by offering nuanced insights and personalized recommendations, guiding users towards appropriate support and treatment options. The project utilizes technologies like the OpenAI API,Langchain library, and LLMs, with future plans to expand its features for real-time monitoring and integration with existing mental health care systems, offering a promising avenue for promoting mental well-being and fostering informed support-seeking behavior.
Key Words: Mental health, assessment, Natural Language Processing (NLP), InsightfulAI Mind Tracker, OpenAI API, Langchain library, Large Language Models (LLMs), real-time monitoring.
1.INTRODUCTION
In today’s society, mental health challenges have become increasingly prevalent, affecting individuals across diverse demographics. Recognizing the seriousness of this issue, ourprojectaimstotacklethecomplexitiesofassessingand monitoring mental health. Mental health issues often manifestsubtlyandcanbedifficulttoidentifyintheirearly stages. As a result, there is a critical need for accessible tools that empower individuals to proactively evaluate their mentalwell-being.
Introducing "InsightfulAI Mind Tracker," a cutting-edge web application designed to serve as a user-friendly and accessible tool for mental health assessment. Leveraging advanced Natural Language Processing (NLP) techniques andinsightsfromextensivemedicalliterature,InsightfulAI Mind Tracker provides users with a uanced understanding of their mental health status. Through a carefullycuratedsetofquestions,userscanengagewiththe application to assess various facets of their mental wellbeing,facilitatingearlydetectionofpotentialissues.
InsightfulAI Mind Tracker represents a significant advancement in the field of mental health technology by leveraging advanced NLP techniques[1] integrating medical literature and evidence-based practices, and utilizingpowerfultoolssuchastheOpenAIAPI,Langchain library,andLargeLanguageModels(LLMs).
The core objective of InsightfulAI Mind Tracker is to empower individuals with valuable insights into their mentalhealth, enabling them to make informed decisions about seeking appropriate support and treatment. By amalgamating technology, linguistics, and medical knowledge, InsightfulAI Mind Tracker aims to bridge the gapbetweenusersandmentalhealthawareness,promoting proactive self-assessment and fostering a culture of wellbeing[5].
The project's objectives include providing a simple and accessible tool for mental health assessment, integrating medicalliteratureforanalysis,managinghigh-dimensional vectordatabasesefficiently,anddesigninganintuitiveuser interface. Methodologies such as NLP, sentiment analysis, and advanced NLP techniques are used to achieve these objectives by analyzing user responses, understanding emotional context,deriving insights,and ensuringprivacy andsecurity[4].
InsightfulAI Mind Tracker is a promising tool that can revolutionize the landscape of mental health assessment and monitoring. It offers individuals a convenient and effective way to assess their mental well-being, enabling early detection of potential issues and guiding them towardsappropriatesupportandtreatment options.
Through its innovative use of technology and medical knowledge, InsightfulAIMindTrackerhasthe potential to significantly impact mental health awareness and care, promotingacultureofproactiveself-assessmentandwellbeing.

International Research Journal of Engineering and Technology (IRJET) e-ISSN:2395-0056
Volume: 11 Issue: 05 | May 2024 www.irjet.net p-ISSN:2395-0072
2. LITERATURE WORK
[1] According to an article by Jean FBeaulieu, “Understanding the Power ofAssistant API, The OpenAI Assistant API offers a robust framework for building chatbots and AI assistantsAs the API continues to develop, it has the potential torevolutionize the way we interact with computers, making them more capable and responsivetoourneeds.
[2] With reference to OpenAI Documentation, The OpenAI Assistants API presents a comprehensive framework for developing advanced AI assistants capableofexecutingdiversetasks.Itis currently in beta, with ongoing enhancements to expand its functionality. The API allows developers to customize the personality and capabilities of their assistants by calling OpenAI's models with specificinstructions.
[3] According to Survey conducted over LLM in 2023 By Junyi Li, LLMs are neural network- based language models with billionsparameters, trained on large amounts of unlabeled text data using self-supervised learning. They represent a significant advancement in natural language processing (NLP) and AI, capable of learning complex patterns, language subtleties,andsemantic linkages
[4] In A bibliometric review of large language models researchfrom2017to2023,itwassuggestedthatIn the year 2020, OpenAI introduced GPT-3 as the successor to GPT-2. GPT- 3 was trained on an extensive collection of textual data and demonstrated the ability to generate text that exhibited a high degree of coherence and naturalness. Similar to GPT-1 and GPT-2, this modelalsoutilizestheTransformer architecture . GPT-3 wastrainedonadeepneuralnetworkwith anenormous 175 billion parameters, surpassingthesizeofanyother
[5] Adam Kolides wrote in his theory called Simulation Modelling Practice and Theory that The API provided by OpenAI offers access to GPT models that may be utilized for a wide range of textrelatedapplications.Itfacilitates many tasks such as coding, question and answer, analysis, and other related activities. The available models encompass a spectrum of options, spanning from gpt-4 to gpt-3.5-turbo, as well as many legacy variants. The Chat Completions API facilitates interactive dialogues by incorporating distinctrolessuchasuser,andassistance.
[6] According Shilpa Patil , Sentiment analysis involves determining the emotions or sentiments
conveyed in various types of data, particularly prevalent in today's social media platforms like Facebook, Instagram, Twitter, and WhatsApp. With the abundance of data available, it has become crucial to intelligently classify data as either genuine or malicious. This surge in social media data presents significant challenges toresearchers in social media analytics anddeeplearning.
[7] The paper Introduction to AI Chatbots by Anupama Vijayakumar , Aishwarya Gupta, Divya Hathwar” discusses the significant impact of modern technology, particularly chatbots, on society. Chatbots, which are software programs using natural language understanding, serve various functions beyond task completion, including entertainment, home automation, and business strategy advice. The paper proposes a classification system for chatbots based on market trends, usability, and specific requirements. Overall, chatbots represent a key advancement in artificial intelligence and machine learning, offering sophisticatedvirtualassistantcapabilities.
[8] The chatbot described in the text by M.S.Inamdar, Manisha Mhetre “Chatbot for Anxiety Disordered Patients” aims to address the issue of inaccurate health information found through internet searches by providing a user-friendly, natural languagebased interface. It serves as a virtual assistant, offering suggestions for dietary choices and providing a question and answer message board for users. The chatbot is designed to recognize various forms of greetings and adapt to different types of inputs. It also consistency in the information it provides. Overall, the chatbot represents a valuable tool for individuals seeking accurate health information and support for anxietyrelatedissues.
[9] According to Paul Azunre The field of Natural Language Processing (NLP) has undergone significant advancements, especially with the rise of deep learning around 2012, revolutionizing how machines interpret and process human language. Prior to this, NLP relied heavily on human-engineered features, which were time-consuming and limited in their ability to generalize to new tasks. Deep learning enabled automatic feature engineering, making NLP more accessible and adaptable to various tasks. However, traditional supervised learning approaches in NLP often require manual

Volume: 11 Issue: 05 | May 2024 www.irjet.net
labeling of large datasets, which can betedious and limiting. Transfer learning offersa solution by allowing the transfer of knowledge from one setting to another, improving efficiency and performance.
[10]Elizabeth D Liddy suggested that Natural language processing (NLP) offers both theoretical frameworks and practical implementations for a wide range of applications. Any application involving text can benefit from NLP techniques. Commonapplications of NLP include information retrieval, where systems retrieve relevant information from text; information extraction, which involves recognizing and extractingkeyinformationsuchasnames,locations, and organizations from large text collections; question-answering, which provides direct answers to user queries; summarization, which condenses large textsintoshorter,coherent summaries; machine translation, which translates text from one language to another; and dialogue systems, which facilitate human-like interactionsbetweenusersandmachines International Research Journal of Engineering and Technology (IRJET)
[11] According to Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova Language model pre- training is crucial for enhancing natural language processing tasks. This includes tasks at both the sentence and token levels, such as natural language
inference, paraphrasing, named entity recognition, and question answering. Two primary approaches for leveraging pretrained language representations are the feature- based and fine-tuning methods. The feature-based approach, like ELMo, integrates pre-trained representations as additional features into task-specific architectures. In contrast, the fine-tuningapproach, exemplified by GPT, fine-tunes all pre- trained arameters on downstream tasks with minimal task-specificparameters
[12] According to Jianmo Ni, Gustavo Hernández Ábrego Text-to-Text transfer transformers (T5) have gained popularity for their competitive performance and ease of use in various tasks requiring text-to-text mappings. T5 utilizes an encoder-decoder transformer model pre-trained on an unsupervised span corruption task. This model has been successfully applied to numerous NLP tasks, but extracting highquality text representations from T5 remains relatively unexplored. This work explores three strategies for extracting sentence representationsfromT5:
[13] The main findings of the research by Sanna Järveläe, and Dragan Gaševicf. are centered around the intersection and artificial intelligence (AI). The research emphasizes the importance of measuring and supporting SRL using multimodal data and advanced data analytic techniques. It introduces a SelfRegulated Learning Process, Multimodal Data, and Analysis (SMA) grid to map research in these areas, highlighting the complexity of measuring SRL and the challenges in combining different data streamstoassessSRLprocesses.
[14] The chapter in Liming Zhu’s study “AI and ethics operationalizing responsible AI. Humanity Driven AI discusses the challenges of operationalizing ethical AI principles and emphasizes the importance of building and maintaining public trust in AI for sustainable innovation. It highlights the need for responsible AI design and development to address ethical and legal concerns, focusing on human values. Despite the issuance of numerous ethical AI principles and guidelines, there remains a gap in ensuring the trustworthiness of AI systems. The chapter proposes an integrated view that covers high-level ethical AI principles, the general notion of trust/trustworthiness, and product/process support to improve trust andtrustworthinessinAI.
[15] Monalisa Das and Sanjeev KumarPrasad discusses in their study of , “A Chatbot System For Mental Health Care” the role of AIpowered chatbots in mental health support, highlighting their ability to provide relief to people suffering from anxiety, depression, or stress through daily conversations and cognitive behavioral therapy (CBT) methods. These chatbots act as conversational agents, bridging the gap between users and mental health resources. They offer a cost-effective and accessible solution, especially in areas with a shortage of mental health professionals.Despite the significant number of peoplesufferingfrom mental illness globally, many do not seek help due to various reasons,including lack of awareness or resources. Chatbots can serve as real-time support systems, offering guidance and motivation to individuals in need

International Research Journal of Engineering and Technology (IRJET) e-ISSN:2395-0056
Volume: 11 Issue: 05 | May 2024
[16] An Article named as “Do mental health chatbots work? ” , emphasizes the convenienceandcost-effectivenessofusingAIpowered chatbots for mental health services. These chatbots, such as Woebot and Wysa, provide accessible help at any time, reducing barrierstotherapy.Hybridmodels,likeJoyable and Talkspace, combine web- based tools with coaching or professional therapy, offering a more personalized approach. While these platforms cannot fully replace traditional oneon- one therapy, they serve as a valuable pathway to care, especially for those who cannot afford or access traditional therapy. Overall, AI chatbots have become an integral part of the mental healthlandscape, providing convenient and affordable mental health support.
[17] The study investigates the design and effectiveness of text-based healthcare chatbots (THCB) in supporting patients and health professionals in therapeutic settings beyond on-site consultations. They present an open-source THCB system designed for a childhood obesity intervention, showing promising results with respect to intervention adherence, scalability, and user experience. The THCBs,named Anna andLukas,weredesigned to represent peers of the patients, using appropriateinformalempathicfeedback.
[18] Thechatbottherapist namedFlow,developed by medical device company Flow,offers daily chat conversations, self-help techniques, mood tracking, videos, meditation, and mental exercises to help users manage depression. It emphasizes the importance of sleep, exercise, nutrition, and meditation in recovery, using personalized responses based on behavioral therapy. Flowaims to provide accessible and early intervention for depression, offering anonymity and a nonjudgmental approach that many users find comforting. The chatbot can be used in conjunction with the Flow brain stimulation headset, which has shown promising results in reducing depression symptoms with fewer side effects than antidepressants. Flow is seeking NHS integration and has received investment forfurtherexpansion
www.irjet.net p-ISSN:2395-0072
[19] The study aimed to design a conversational sequence for a brief motivational interview delivered by a web-based text messaging application (chatbot) to help graduate students cope with stress. The sequence incorporated motivational interviewing (MI)skills and focused on both technical and relational aspects of MI. Thirty graduate students participated in the study, which included a survey and a semi-structured interview. Analysis of the interviews revealed themes related to the process of the conversational experience, its impact, and the needs for improvement.Overall,thestudy demonstrated the potential effectiveness of using a chatbot for delivering MI-based interventions for mental health concernslikestressamong graduatestudents
3. PROPOSED METHOD
The chapter discussing the design and implementation of the model provides a comprehensive overview of the system configuration and software requirements used in the project. It delves into the specifics of the front-end developmentstack,includingReact,TailwindCSS,andVite, highlighting their roles and integration within the project[7].
3.1. System Configuration
Thesystemisconfiguredtoutilizearangeofsoftwaretools and technologies to facilitate development and deployment. The primary development software is Vite,
chosen for its efficiency and modern approach to frontend build processes. Developer tools include VS Studio Code,apopularcodeeditorknownforitsversatilityand robust features. The technologies used in the project encompass both front-end and back-end components, with React and Tailwind CSS serving as the primary front-end technologies, while Streamlit, Langchain, and theOpenAIAPIformtheback-endinfrastructure[8]
3.2. Software Requirements
Vite: Vite is a build tool that provides a fast and efficientdevelopment experience,particularlysuitedfor modern front-end frameworks like React. It offers features such as hot module replacement (HMR) and optimized build processes, enhancing the developer workflow.
VS Studio Code: VS Studio Code is a widely used code editorknownforitslightweightyetpowerfulfeatures.It supports various programming languages and provides extensions for additional functionality, making it a popularchoiceamongdevelopers.

International Research Journal of Engineering and Technology (IRJET) e-ISSN:2395-0056
Volume: 11 Issue: 05 | May 2024 www.irjet.net p-ISSN:2395-0072
React: React is a JavaScript library for building user interfaces, particularly well-suited for creating dynamic and interactive web applications. Its component-basedarchitecture and virtual DOM make it a powerful toolforfront-enddevelopment.
Tailwind CSS: Tailwind CSS is a utility-first CSS framework that allows developers to build custom designs by composing utility classes directly in HTML.It provides a flexible and efficient way to style webapplications, without the need for writing custom CSS.
Streamlit:StreamlitisaPythonlibraryusedforbuilding interactive web applications for data science and machine learning. It simplifies the process of creating web- based interfaces for data analysis and visualization.
Langchain: Langchain is a language modeling library that provides advanced natural language processing (NLP) capabilities. It is used in the project forprocessingandanalyzingtextdata,enabling theimplementationofAI-poweredfeatures.
OpenAI API: The OpenAI API is used for integrating AI capabilities into the project, such as natural language processing and machine learning. It provides access to powerful language models that can generate human-like text and perform various language-relatedtasks[2].
3.3.Front-end Development
The front-end development process involves setting up a newReactprojectusingVite,installingdependencies,and configuring the environment. React components are then developed to create the user interface, with Tailwind CSS used for styling[11]. The integration of React Router enablesclient-sideroutingfornavigatingbetweendifferent viewswithintheapplication.
3.4.Back-end Development
Streamlit, LangChain, and the OpenAI API are powerful tools that can be integrated into your project to enhance its functionalityanduserexperience.Here'sa briefoverview ofhoweachofthesetoolsworksandhowtheycanbeused inyourproject:
Streamlit: Streamlit is an open-source Python library that simplifies the process of creating web applications for machine learning and data science projects. It provides a simple API that allows you to build interactive web apps directly from Python scripts. With Streamlit, you can quicklyprototypeanditerateonyourideas,generatedata visualizations,andcustomizethelayoutandstylingofyour app[4].
Langchain: Langchain is an open source library used for building applications based on large language models (LLMs). LLMs are deep-learning models that are pretrained on large amounts of data and can generate responsesto user queries. LangChain provides tools and abstractions to improve the customization, accuracy, and relevancyoftheinformationgeneratedbyLLMs.Itallows developers to build new prompt chains, customize existing templates, and access new data sets without retrainingthemodels.


Fig 1:FlowchartforProposedMethodology
3.5. Implementation
The implementation phase includes writing code for the various components of the system, integrating APIs, and ensuring the functionality meets the project requirements.The use of React and Tailwind CSS allows forthe creation of a responsive and visually appealing user interface, while Streamlit, Langchain, and the OpenAIAPIprovidethenecessaryback-endfunctionality forprocessingandanalyzingdata.
4. LIMITATIONS AND FUTURE SCOPE
It is very crucial to recognize the challenges and opportunities that will shape our journey in the field of Mental Health. These constraints, though demanding, provide avenues for innovation and advancement, ensuring that we navigate this intricate landscape with careandprecision.
4.1.
Limitations
1. Data Integerity and Security: Safeguarding sensitive information like mental health data involves implementing robust encryption methods, access controls, and compliancewith regulations such as HIPAA or GDPR. Anonymizing and aggregating data appropriately is essential to protect individual identities.
© 2024, IRJET | Impact Factor value: 8.226 | ISO 9001:2008 Certified Journal | Page1174

International Research Journal of Engineering and Technology (IRJET) e-ISSN:2395-0056
Volume: 11 Issue: 05 | May 2024 www.irjet.net p-ISSN:2395-0072
2. Ethical Considerations: Ensuring the chatbot is unbiased, provides accurate information, and avoids harm or misinformation is paramount. Clear guidelines and oversight are necessary to address these ethical concerns throughout development and deployment.
3. Accuracy and Reliability: Thorough testing, validation, and ongoing monitoring are necessary to ensure the chatbot's responses are accurate and reliable, particularly for mental health assessmentsoradvice.[12]
4. Clinical Validation: Navigating the regulatory pathway for clinical validation and collaboration with healthcare the technology in clinical practice.
5. User Engagement and Interaction: Designing thechatbotformeaningfulinteractionsandempathetic support is key. Incorporating features like sentiment analysis can help gauge user emotions and adjust responsesaccordingly.
6. Integration with Existing Systems: Collaborating with healthcare providers and IT teamsto integrate the chatbot with existingsystems andworkflowsis essentialfor itseffectiveness.
4.2. Future Scopes
1. Integrating Multi-Modal Data: Incorporating multimodal data to enhance the overall accuracy and reliabilityofthechatbot'sresponses.
2. Continuing Model Refinement: Ongoing refinement of chatbot's algorithms and models by exploring state-of- the-art deep learningarchitecturesandalgorithms.
3. Validation and Collaboration: Collaborating with medical professionals for clinical validation and integrationintoclinicalworkflows[10].
IncorporationofExplainability:Enhancingmodel interpretabilitytofostertrustandaidintheacceptance ofautomateddiagnostictoolsinclinicalsettings.
4. Learning and Adaptation: Implementing mechanisms for continuous learning and adaptationofthemodelovertime.
5. Global Accessibility: Ensuring compatibility with different MRI machines, data formats, and healthcaresystemsforglobalaccessibility.
RESULTS









International Research Journal of Engineering and Technology (IRJET) e-ISSN:2395-0056
Volume: 11 Issue: 05 | May 2024 www.irjet.net
6. CONCLUSION
The InsightfulAI Mind Tracker project represents a cutting-edge approach to mental health assessment and support, leveraging advanced technologies and methodologiestoprovideuserswithacomprehensive and personalized experience. By integrating Natural Language Processing (NLP) techniques, insights from medicalliterature,andpowerfultoolsliketheOpenAI API, Langchain library, and Large Language Models (LLMs), the project aims to revolutionize how individuals assess and monitor their mental wellbeing.
The project's objectives include developing a userfriendly web application for mental health assessment, integrating medical literature for analysis,managinghigh-dimensionalvectordatabases efficiently, and designing an intuitive userinterface. Through the use of NLP, sentiment analysis, and advanced NLP techniques, InsightfulAI Mind Tracker seeks to empower users with valuable insights into their mental health, enabling themto make informed decisions about seeking appropriate support and treatment.
One of the key strengths of the InsightfulAI Mind Tracker project is its focus on personalized recommendations and nuanced insights, going beyondtraditional assessment tools to offer a more holisticapproach to mental health assessment. By combining technology, linguistics, and medical knowledge, the project aims to bridge the gap between users and mental health awareness, promoting proactive self-assessmentandfosteringa cultureofwell-being.
Further , the project plans to expand its features for real- time monitoring and integration with existing mental health care systems, offering a promising avenuefor promoting mental well-being and fostering informedsupport-seekingbehavior.Throughcontinued refinement and collaboration with healthcare professionals, InsightfulAI Mind Tracker has the potential to significantly impact mental health awareness and care, making it a valuable tool for individualsseekingtoimprovetheirmentalwell-being.
REFERENCES
[1] https://platform.openai.com/docs/assistants/howit-works [DOCUMENTATION BYOPENAIAPI]
[2]AStep-By-StepGuideto creatingyourownassistant chatbotusingOpenAI’s Assistant APIandReact
p-ISSN:2395-0072
[3] “Automating Customer Serviceusing LangChaiN” By Keivalya Pandya, Submitted to the 3rd International Conference on “Women in Science & Technology: Creating Sustainable Career” 28 -30 December,2023
[4] ChatbotforAnxietyDisorderedPatientVolume22, Issue4,2022.IssnNo:0012-2440PageNo:248.
[5] Jianmo Ni, Gustavo Hernández Ábrego, Noah Constant, Ji Ma, Keith B Hall, Daniel Cer, and YinfeiYang. “Scalable sentence encoders from pre-trainedtext-to-textmodels”,2021
[6]Monalisa Das, Sanjeev Kumar Prasa , "A ChatbotSystemForMentalHealthCare"
[7]Liming Zhu, Xiwei Xu, Qinghua Lu, Guido Governatori, and Jon Whittle. “AI and ethics— operationalizing responsible AI. Humanity DrivenAI:, pages15–33,2022
[8]Paul Azunre. “Transfer learning for natural languageprocessing”.SimonandSchuster,2021
[9]S. Price, “New chatbot therapist to help combatdepressionunveiled”2019
[10]S.H. Park, J. Choi, S. Lee, C. Oh, C. Kim, S. La, J. Lee, “Designing a Chatbot for a Brief Motivational Interview on Stress Management: Qualitative Case Study”, Vol 21, No.42019
[11]Zhao et al., Junyi Li , “ A survey of large languagemodels2023”.
[12]Jean F Beaulieu ,“Understanding thePower of AssistantAPI”
[13]D. Browne, M. Arthur; and M. Slozberg, “Do mentalhealthchatbotswork?”,2018
[14]Elizabeth D Liddy. “Natural language processing”.2001
[15]T. Kowatsch, M. Nißen, CHI Shih, D. Rüegger, D.Volland,“Text-based healthcare chatbots supportingpatientandhealthprofessionalteams