Inspiration
People are becoming increasingly aware of the importance of mental health, but traditional interventions like talking therapy don't scale. Journaling is a popular and effective tool, but risks reinforcing negative self-narratives and is often a solitary activity that can feel very isolating.
What it does
DAIRY is an AI-powered journal that tries to address both of these problems by gently nudging users to relate positively to their day and to help put the day's experience in the context of their wider recent experiences.
How we built it
We built DAIRY using Claude 2. There are three main roles that DAIRY plays, each building on the technical foundation of the one before:
(1) Help the user reflect and reframe: DAIRY will read a diary entry, analyze it across five dimensions, and then play back an observation on the day perhaps with a suggested reframe or question for further reflection. It does this through a combination of prompt engineering techniques, including examples, light XML tagging, clear instructions to the model, and descriptions of the models persona and style. We generated synthetic diary entries for five personas, all with different life events and journaling styles, to drive our example-generation and testing for prompt-refinement.
(2) Helping the user put their day in a wider context: DAIRY helps a user understand how themes in today's entry are similar or different to other days. This helps users zoom out from their day-to-day and have a wider perspective on how those events fit into life more broadly. It does this similar prompt engineering techniques to entry analysis, combined with additional chain-of-thought reasoning and XML tagging to identify "similarities" and "differences" between the most recent entries and the past week, and to use this as the basis for a nuanced comparison. The "put in context" feature also always looks back at a full seven days of data to factor in any cyclicity in journaling habits.
(3) Helping the user look back at a full month: Here, DAIRY understands and interprets a full 30 days of diary entries. This takes advantage of Claude 2's long context window as it can handle a month's worth of even very long diary entries while still doing nuanced and sophisticated comparisons thanks to the chain-of-thought reasoning and XML tagging.
Challenges we ran into
We faced quite a few challenges building DAIRY:
(1) Tone being generically positive and unassertive: In the first iteration, DAIRY consistently gave quite generic, fluffy guidance and would always have a standard response style making a supportive statement followed by a journal prompt. This would resonate with some audiences, but our test users found it sometimes frustrating, patronizing and totally non action-oriented. To address this, we expanded our diary sample set to include a wider range of personas and journal examples, and more importantly adjusted our prompt to be more responsive to tone in the entry and changed our few-shot examples to better match the desired tone of our testers.
(2) Not being able to handle diverse journaling styles or personalities: Originally, we had just a single set of diary entries that we used for prompt engineering. To address this, we introduced a wider range of personas that had different journaling styles (in tone, length, word choices) and different life experiences (turbulent, balanced, boring). We also did our prompt-refinement with a greater range of prompts, ranging from long, flowery entries to extremely short, negative entries. Our personas included, for example: Brief Brooklyn, Lengthy Laurie, Changing Charlie.
(3) Struggling to give nuanced reflections across a month of diary entries: To begin with, DAIRY did quite generic comparisons of diary entries across days, for example speaking only about overall sentiment or "ups and downs", but not giving nuanced examples about what varied - or remained the same - across the month. To address this, we introduced more sophisticated chain-of-thought reasoning, using XML tags to document "similarities" and "differences" across entries. This was then used as the basis of journaling. Our prompt also was updated to find specific quotes to be included as examples in this "thinking" step, which both improved nuance and made the entry feel significantly more personal.
Accomplishments that we're proud of
Overall, our proudest moment was seeing the gentle, thoughtful response DAIRY gave in response to an especially negative diary entry from one of our made-up personas, "Brooklyn". The kindness and pragmatism of the response was actually genuinely moving.
I'm sorry you had such a difficult day. Looking back on your week, I see someone trying their best each day - caring for pets, pushing through work, finding small joys. You have strength even in hard moments. Tomorrow is a new day
What we learned
Overall, we learned a lot:
(1) How to build a front-end ... which in hindsight, taught us a lot about Hackathon team composition as well as how to make things work with what we know and what we can learn...
(2) Prompt-engineering with Claude 2, especially around the use of XML tags
(3) How to make the most of a long context window while retaining prompt quality and avoiding the risk of the "missing middle"
What's next for Project DAIRY
From here, we hope to build out a more robust UI for Project DAIRY, put in place a robust authentication layer, and redeploy on AWS so we can deploy to a wider range of users. Our feature roadmap includes introducing more sophisticated sentiment analysis to understand in a semi-structured way, as well as to better track goals and objectives over time.
Built With
- claude
- fastapi
- python
- streamlit
Log in or sign up for Devpost to join the conversation.