RAG
Every agent response in Rosetta is backed by retrieved sources. These include your uploads, your account library, public medical databases, and live web search. Agents do not answer from memory alone.
Architecture
Source documents are split into passages, and each passage is converted into a vector that represents its meaning. A query is turned into a vector the same way. Retrieval returns the passages whose vectors are closest to the query vector (by cosine similarity), combined with keyword scoring so exact terms still count. That’s why a search for “heart failure treatment” can match a passage that says “HFrEF management”: the two mean roughly the same thing, so their vectors sit near each other.
Each source has an “included in ingest” toggle. Only included sources are indexed. Excluding a source removes it from retrieval without deleting it.
Semantic vs Keyword
Keyword Search (Traditional):
Keyword search looks for the exact words you typed. For clinicians, this is like searching a PDF for a medication name, lab name, diagnosis code, or phrase from a guideline. It is precise when the source uses the same wording as your query, but it can miss clinically equivalent language.
Query: "heart failure treatment"
Matches: Exact text "heart failure" AND "treatment"
Misses: "HFrEF management", "cardiac dysfunction therapy"Semantic Search (Rosetta):
Semantic search looks for meaning. Rosetta turns your question and each source passage into a numerical representation of clinical meaning, then retrieves passages with similar meaning. This helps when the note uses one phrase and the guideline uses another. For example, a clinician may ask about heart failure treatment, while the source says HFrEF management or GDMT for reduced EF.
Query: "heart failure treatment"
Matches: Any semantically similar concepts
- "HFrEF management"
- "cardiac dysfunction therapy"
- "GDMT for reduced EF"Source Types
- Local: sources attached to the current note. Good for uploads tied to a specific patient.
- Account: guidelines, protocols, and papers in your persistent library. Indexed once and available to every note on your account.
PubMed Integration
PubMed is a third source type. Unlike local and account sources, it is queried live:
- The agent rewrites your request into a PubMed search string.
- Top results come back with their abstracts and metadata.
- Those abstracts are embedded and mixed into the same retrieval pool as your local and account sources. Citations can come from any of the three.
Web Search
When a question needs current information that is not in your library or PubMed, the assistant can run a live web search through Tavily, which returns compact results with citations built for use by AI agents.
Web search needs its own key, set under Settings → Tavily web search or supplied through the VITE_TAVILY_API_KEY environment variable. Without a Tavily key the assistant skips web search and falls back to your other sources. As with every other source, results the assistant uses are cited in the response.
Usage Examples
Evidence Based Treatment
Add a guideline PDF to your Account library. Ask “heart failure reduced ejection fraction treatment” in a note. The agent retrieves guidance and generates a plan with citations from the uploaded PDF.
Literature Review
The agent searches PubMed for recent abstracts on a topic and generates a summary with current scoring criteria.
Institutional Protocols
Upload a hospital protocol to the Account library. Query it by name (e.g., “UCSF sepsis bundle timing”) and the agent returns the relevant details.