Trans Advice Agent

Overview:

TransAdviceAgent is an experimental, community-focused tool designed to surface information about transgender healthcare and related topics. Its purpose is to aggregate and summarize what community members have shared in documents, helping users explore different experiences, perspectives, and outcomes.

Please note that this is an amateur project and not a professional medical resource. Answers are limited to the documents included in the system — they may be incomplete, biased, or outdated. The system may also be slow, as it relies on multiple language model calls and hierarchical summarization.

Use this tool as one piece of community knowledge rather than medical advice. Always consult licensed healthcare providers and multiple sources when making decisions about your care.

For recommendation-type questions, data sources are often community forums like Reddit. If you know of any trans resources or communities that should be included, let me know!

If you have questions, feedback, or suggestions for improving this project, please reach out to me at sam@walking-stick.com.

Try It Out

How the Pipeline Works

TransAdviceAgent processes user questions through a multi-stage pipeline that transforms community-sourced documents into concise, fact-based answers. The system is designed to remain fully grounded in the documents and provide neutral, transparent summaries.

  1. Query Rewriting & Expansion
    The user’s original question is rewritten and expanded using Claude 3.5 Haiku to improve document retrieval. This step includes expanding abbreviations to full names (e.g., Dr RBL → Dr. Rachel Bluebond-Langner) and adding relevant synonyms for trans-related terms. The original query is preserved for later stages.
  2. Document Retrieval
    All documents are pre-chunked and stored in FAISS/SQLite. The rewritten query is used to retrieve the most relevant chunks using Maximal Marginal Relevance (MMR) to maximize diversity and coverage.
  3. Chunk Summarization
    Retrieved chunks are processed in batches by Claude 3.5 Haiku to generate summaries for each batch. Each summary captures only the content of the batch, preserving positive/negative details, counts, dates, and any disagreements present in the text.
  4. Summary Synthesis
    Summaries from all batches are combined hierarchically into a single, non-redundant summary. This step aggregates patterns, highlights frequently mentioned providers or procedures, and notes gaps or conflicting information in the documents.
  5. Final Answer
    The synthesized summary and the original user question are passed directly to Claude 3.5 Haiku to produce the final answer. The output is concise, neutral, document-grounded, and includes positives and negatives where present. If evidence is insufficient, the answer states this clearly without adding external guidance or advice.

You can view the full source code and contribute here: github.com/SamPease/TransAdviceAgent

Tech Stack:

  • Python — core programming language
  • FastAPI — backend API framework
  • Claude 3.5 Haiku — summarization and synthesis
  • SentenceTransformers (all-MiniLM-L6-v2) — local embeddings for data preparation
  • Hugging Face Inference API — runtime query embeddings
  • FAISS — vector index with Maximal Marginal Relevance (MMR) retrieval
  • SQLite — lightweight database for document and metadata storage
  • dotenv — environment variable management
  • GitHub Pages — static frontend hosting
  • Render — cloud hosting for the backend API
  • GitHub — version control and code hosting (view code)

Limitations & Future Work

TransAdviceAgent is an experimental, hobby project and has several limitations that users should be aware of:

  • Document Coverage: The system can only provide answers based on the documents in its database. If a topic, clinician, or procedure is not well-represented, the answer may be incomplete or indicate insufficient evidence.
  • Community Bias: Retrieved documents reflect the perspectives of those who chose to share their experiences. They may not represent the full range of outcomes or experiences for a given healthcare provider or procedure.
  • Latency: Because the system uses multiple LLM calls for summarization, synthesis, and answering, responses may be slow.
  • Abbreviation Expansion: Automatic expansion of initials to full clinician names is based on a curated mapping and context. Unmapped or ambiguous initials may lead to missed documents or incorrect matches.
  • No Medical Advice: The system summarizes community-sourced information and is not a substitute for professional medical guidance. Users should consult licensed providers for personal healthcare decisions.

Future Work:

  • Expand the document database to cover a wider range of clinicians, procedures, and locations.
  • Improve retrieval quality with additional techniques, such as sparse keyword search or hybrid dense-sparse approaches.
  • Incorporate provenance tracking for each fact in the final answer, showing exactly which documents contributed to which statements.
  • Optimize latency and scalability, including batching strategies and lighter-weight summarization models for faster responses.
  • Enhance abbreviation and synonym expansion using automated context-aware methods to reduce manual mapping and increase accuracy.