HerCare AI (PearlHack 2025 Winner)

Feb 2025GenAI / RAG

Summary

HerCare AI is an AI assistant that gives reliable, personalized support for menstrual health. It started at PearlHack 2025, where it won Best Use of AI (Infosys Foundation USA), and I later rebuilt it as version 2.0 with a production-style backend: a LangServe (FastAPI) API, a FAISS-powered RAG pipeline over curated medical articles, conversational memory for multi-turn chats, and Docker-based deployment.

Case study

The problem

Reliable information about menstrual and reproductive health is scattered, and general-purpose chatbots answer health questions without showing where the answer came from. I wanted an assistant whose answers are grounded in trusted medical sources, that handles natural follow-up questions, and that is clear about its limits.

Where it started

At the hackathon we had one weekend. Version 1 was a Streamlit app on Gemini 1.5 Flash: it matched each question against 14 curated question-and-answer pairs using TF-IDF similarity, returned the curated answer when the match was confident (similarity above 0.3), and otherwise fell back to Gemini with the last three turns of the chat. It won Best Use of AI, but it only covered questions close to those 14 pairs, and the fallback answers were not grounded in any source. Version 2 was a rebuild to fix exactly that.

How it works

  1. 1Ingest

    11 trusted pages (9 from NIH NICHD, plus ACOG and a peer-reviewed article), cleaned with BeautifulSoup

  2. 2Chunk

    Recursive text splitter, 500 characters with 50 overlap

  3. 3Embed & index

    OpenAI embeddings stored in a FAISS vector index

  4. 4Retrieve

    Top 4 most similar chunks for each question

  5. 5Generate

    GPT-4o at temperature 0; follow-ups are rewritten into standalone questions using chat memory

  6. 6Serve

    LangServe (FastAPI) API plus a Streamlit chat UI, containerized for Hugging Face Spaces

Key decisions

  • A small set of curated sources instead of the open web: less coverage, but every answer traces back to NIH or ACOG material.
  • Temperature 0, because health answers should be consistent from one run to the next.
  • Rewriting follow-up questions with the chat history, so a question like "what about after 40?" still retrieves the right passages.
  • A medical disclaimer on responses, pointing users to a licensed provider for personal advice.

What I would improve next

  • Add evaluation: a golden set of real user questions, scored for faithfulness and answer relevance with an LLM-as-a-judge, run before every prompt or model change.
  • Show citations: the chain already returns its source documents, so the UI should display them next to each answer.
  • Use per-user memory in the API: the server currently keeps one shared conversation memory, which a real multi-user deployment cannot do.
  • Move the HerCare persona and disclaimer into the answer-generation prompt; right now they are applied at the question-rewriting step.
  • Decline to answer when retrieval finds nothing relevant, instead of letting the model guess.

Highlights

  • RAG over a curated medical knowledge base with a FAISS vector store
  • Conversational memory for contextual, multi-turn conversations
  • LangServe (FastAPI) API with OpenAPI docs, plus a Streamlit chat interface
  • Works with Gemini or OpenAI models through LangChain
  • Containerized for deployment on Hugging Face Spaces
HackathonPearlHack 2025, UNC Chapel Hill
AwardWinner, Best Use of AI (Infosys Foundation USA)
StackPython, LangChain, LangServe, FastAPI, FAISS, Gemini / OpenAI, Streamlit, Docker

Want to talk about this project?

I'm always happy to chat about agents, RAG, and GenAI engineering.

Get in touch