Inspiration

Our inspiration for this project comes from first-hand counseling for the Trevor Project.

It is estimated that there are over 1.8 million LGBTQ young people across the United States that seriously consider suicide every year. As a response to this crisis, the Trevor Project was founded in 1998 with the mission to end suicide among LGBTQ youth. Through this project, thousands of counselors across the country have trained to provide information & support to LGBTQ young people 24/7, all year round, through call, text, and chat.

However, as counselors, we noticed quite a few problems with the counselor tooling.

First, we have to search for context on contacts who have interacted with The Trevor Project in the past and try to synthesize it in real-time.

Second, we dig through numerous Trevor resources to ensure our responses follow strict Trevor guidelines.

Third, during each session, we have to break away from the chat to search for location-specific resources and their contacts.

And lastly, while maintaining a meaningful real-time conversation with the patient, we also need to discreetly file digital paperwork with over 50 fields in a Salesforce case.

These issues grow even worse during understaffed overnight shifts with counselors managing up to 3 patients at once. In response to these problems, we've built a Counselor Copilot that performs the aforementioned tasks for counselors so that they can increase their quality of care to focus on their conversations with youth in crisis. With Trevor Copilot, we enable counselors to focus on people rather than on paperwork, ultimately getting us closer to the goal of ending suicide among all LGBTQ young people.

What it does

Trevor Copilot automates laborious tasks for counselors in real-time so that they can focus on their conversations with youth in crisis. The tasks Trevor Copilot automates include:

  1. Retrieving and synthesizing patient data from complex PDFs in real-time
  2. Drafting responses for counselors that follow The Trevor Project guidelines
  3. Sharing Trevor resources related to draft responses
  4. Searching for location-specific resources for patients
  5. Sharing location-specific resources with patients via email
  6. Filling out Salesforce cases for patients
  7. Summarizing interactions with patients in Salesforce

Each of these tasks not only distracts counselors from the conversations they’re having with youth in crisis but also wastes precious time. With Trevor Copilot, an AI Agent completes these tasks when they are required and without any prompting from counselors, frictionlessly providing much more bandwidth for counselors and ultimately leading to higher-quality conversations with patients.

How we built it

The Trevor Project’s patient data in Salesforce is stored in complex PDFs and normally very difficult to extract. To solve this problem, we used LlamaParser to extract patient data in real-time and then provide a summary of that data to counselors as context at the beginning of each conversation.

After that, we used a LlamaIndex agent to monitor the conversation and - based on the conversation context - deploy the right tool. Tools at the agent’s disposal include:

  1. Escalating the conversation to a supervisor
  2. Suggesting a response and related resources based on The Trevor Project’s guidelines
  3. Searching the web for location-specific resources and sending the resources to the patient

For tool #2, we created a vector database (Astra DB) that contains 10s of The Trevor Project’s documents, which highlight key guidelines for counselors based on different scenarios and situations that they may face. We used RAG to retrieve resources relevant to the conversation, and we used ChatGPT to draft a response for the counselor based on those resources, both of which are essential due to the sensitive nature of the conversation.

Lastly, we used the conversation content to fill out a form with key Salesforce fields (e.g. name, age, city, state), as well as to summarize the conversation.

Challenges we ran into

Getting data from complex PDFs is usually very challenging. We tried several PDF tools available online, which did not work for our purposes. Finally, when we tried LlamaParser, we were able to get data from complex patient PDFs extracted and in a usable format.

In addition, given the sensitive nature of the conversation, it was challenging to get suggested responses from ChatGPT without triggering their guardrails. To get around that, we used RAG on official Trevor Project documentation and used ChatGPT to synthesize the information found in those documents to generate suggested responses. Plus, because we used RAG, we were able to link the specific resources that were referenced in the creation of the responses.

Separately, when we first started to use the AI Agent, it was difficult to point the agent to use the correct tool in the correct situation. To deal with this, we broke the problem down into two components: determining the risk level of the conversation, and then determining which tool to use based on that risk level. In this way, it was easy to get the agent to use the correct tool in the correct situation.

Refining the form-filling feature was also challenging and required some prompt engineering to ensure that the feature accurately ported information from the conversation to fields in our Salesforce form.

Lastly, teamwork was challenging because we had 5+ people working on the same python file; next time, we'll make sure to break up the application into modular chunks to make it easier to manage dependencies.

Accomplishments that we're proud of

We designed an end-to-end workflow that could be applied in real-life scenarios to a very meaningful problem. The suggestions from the agent are quite good and verified by a real Trevor Project counselor, who was impressed by the quality of the suggestions. In addition, what we’ve built makes the end-to-end conversation frictionless, and we used many different tools to make that happen.

What we learned

On the AI-end, we employed LlamaIndex’s agents to extract information from complex PDFs with LlamaParse, learning about agents, vector databases with RAG, and implementing LlamaIndex along the way. On the front-end, we utilized Streamlit, learning about session state to store and persist state for optimized shared variables.

What's next for Counselor Copilot

We'd like to add more functionality to the Copilot based on counselor requests by chatting with more people at The Trevor Project. In addition, we’d like to see how well the Copilot could function in other scenarios (e.g. 911 operators; therapists; psychiatrists; psychologists; etc.). We think that what we’ve built could be an extremely powerful tool in any situation with a provider and an at-risk patient, and we’re very excited to see how we can improve people’s lives with what we’ve built.

Built With

  • astradb
  • bentoml
  • llamaindex
  • llamaparse
  • openai
  • python
  • streamlit
Share this project:

Updates