Inspiration

In today's fast-paced and often stressful world, the demand for accessible and effective mental health resources is more critical than ever. Modern lifestyles bring with them high expectations and relentless pressures, both professionally and personally, leading to increased stress, anxiety, and other mental health challenges. The constant connectivity and flow of information can overwhelm individuals, making it difficult to "disconnect" and manage stress effectively. Being exposed to these stressors in our daily lives we were inspired to create a software application to tackle this problem.

AI-driven mental health platforms, such as Earlent - the Mental Health Companion, can be a solution to addressing this growing need by providing scalable, immediate, and personalized support. These platforms leverage advanced AI to understand and respond empathetically to user inquiries, making mental health support accessible to anyone at any time, regardless of their location or the availability of local mental health services.

What it does

Earlent leverage modern cloud infrastructure and AI technologies to create an agent that serves as a supportive companion for individuals seeking mental health support. The app aims to provide empathetic interactions by understanding and responding to various mental health inquiries and discussions.

How we built it

  • Database: Azure Cosmos DB (v-core) for its robust, scalable database services to manage dynamic data requirements efficiently.
  • LLM: The Azure OpenAI platform was integrated for generating empathetic, context-aware responses through advanced AI models like GPT 3.5.
  • AI Services: Azure Speech Services enable users to interact with the platform using their voice, improving accessibility and user experience. Speech-to-text allowed users to input requests through speech, while text-to-speech provided responses audibly using window.speechSynthesis.
  • Frontend: React was chosen for its efficiency in building interactive user interfaces, with Vite used to optimize the development experience and MUI (Material-UI) to design a modern, user-friendly interface.
  • Backend: Flask was chosen to manage backend operations, including API routing and middleware functionalities, due to its lightweight and unopinionated structure.
  • Agentic Framework: LangChain was integrated to enhance the AI's functionality, enabling the AI to keep track of conversation history and use tools for web search, vector search and map services.
  • Services & Libraries: pywebpush allowed for real-time communication with users through web push notifications, facilitated by user subscriptions managed through the Subscription model. Flask-Mail was used to manage email communications within the app.
  • CI/CD Docker was used to containerize the application, ensuring consistency across different computing environments. Github Actions was used to optimize the deployment process by wiring it directly to Azure's web services.

Challenges we ran into

During the course of this project, we encountered a number of challenging situations.

Setting up, allocating and deploying Azure resources proved to be more time-consuming than anticipated. Having to work around quotas and limits was vexing at times, though it was valuable experience.

Since this was our first time working with Flask, it took some time to get familiarized with its patterns and structure, though thankfully the documentation and syntax carried us through.

One notable challenge was building an agent that would use tools to interact with the user with LangChain. LangChain contains an innovative architecture that allows AI models to be used as a "reasoning machine" and leverage tools, like web searching APIs and vector databases to produce a more informed response. While the LangChain documentation is easy to follow, it is also inconsistent with details, quality, and versioning, making it necessary to research and apply trial-and-error to produce the desired output and handle unexpected errors.

Working with services involving the Web Push API and speech-to-text was also a completely new experience that involved a learning overhead, but proved to be very informative as we become more familiar with the concepts.

Accomplishments that we're proud of

Out of all the implemented features, we are most proud of having an AI agent that can accurately read from the database to improve its context, recall information from earlier in the conversation, and use tools to provide the user mental health resources. We are also excited about having implemented voice functionalities into the chatbot, as we feel it improves the experience and allows users to better connect with the agent.

What we learned

This project provided a wealth of learning opportunities We not only learned how to integrate various Azure services and allocate resources, but also about the common practices in modern web development, both in the developing phase as well as the deployment phase. We learned about modern applied AI techniques such as RAG, vector search and agentic workflows, which were a cornerstone of our agent's design.

This project not only enhanced our technical skills but also provided the opportunity to appreciate of the importance of mental health awareness.

What's next for Earlent

While our hard work produced a functional mental health AI agent, we think there is much room for this project to grow. Our codebase structure can be improved to better align to best practices and promote an effective development experience in the future, including adding a test suite and further developing our CI/CD pipeline. We also have many ideas for additional features that could sadly not make it to the submission build, but we hope to work on in the future. These features include:

  • Multi-language support to make the app accessible to a broader audience and promote diversity.
  • Further enhancing our agentic workflow to allow the model to keep track of user's progression and improve personalization and provide insights to users in the form of a dashboard.
  • Build a knowledge base of mental health resources that the agent can refer to, as well as allow the user to "favorite" these resources.

Built With

  • azure
  • cosmosdb-for-mongodb
  • fastapi
  • langchain
  • openai
Share this project:

Updates