Skip to main content

Medical Triage & Clinical RAG Engine

Project description

⭐ If Ella's RAG-based medical triage architecture gave you ideas — a star helps other health-AI builders find it. Takes 2 seconds.

ELLA

Medical Triage & Clinical RAG Engine


PyPI 96% Accuracy 90K Records NVIDIA NIM Pinecone Live Demo GitHub


Ella is a production-grade Retrieval-Augmented Generation (RAG) system purpose-built for medical triage. She ingests 90,000+ clinical text chunks, embeds them via NVIDIA NIM, stores them in Pinecone, and retrieves context-grounded answers through a multi-stage pipeline — eliminating hallucinations in healthcare workflows.

InstallQuick StartArchitectureLive DemoBenchmark


Install

pip install ella-sdk

Quick Start

from ella_medical import Ella

client = Ella()
response = client.query("What are the symptoms of a heart attack?")

print(response.intent)         # "TRIAGE"
print(response.response)       # Grounded clinical response

Usage

Basic Query

from ella_medical import Ella

client = Ella()
response = client.query("What are the symptoms of a heart attack?")

print(response.intent)              # "TRIAGE"
print(response.priority)            # Priority level
print(response.thought_process)     # Router's reasoning
print(response.response)            # Ella's response
print(response.retrieved_context)   # Retrieved medical documents

Multi-Turn Conversation

from ella_medical import Ella

client = Ella()

# First message
r1 = client.query("I have chest pain")

# Follow-up
r2 = client.query(
    "What about treatment options?",
    history=f"Patient: I have chest pain\nElla: {r1.response}"
)

print(r2.response)

Context Manager

from ella_medical import Ella

with Ella() as client:
    response = client.query("What are the symptoms of diabetes?")
    print(response.response)

Response Object

@dataclass
class QueryResponse:
    intent: str            # EMERGENCY | TRIAGE | BOOKING | GENERAL_INFO | CLOSING
    priority: str          # Priority level
    thought_process: str   # Router's reasoning
    justification: str     # Clinical justification
    response: str          # Ella's response
    retrieved_context: str # Retrieved medical documents

Live Demo


Architecture

                     ┌─────────────────────────────────────────────────────────────────────┐
                     │                        USER'S INPUT                                 │
                     └────────────────────────────┬────────────────────────────────────────┘
                                                  │
                                                  ▼
                     ┌─────────────────────────────────────────────────────────────────────┐
                     │  INTENT ROUTER (Groq llama-3.1-8b-instant + Pydantic Schema)        │
                     │  Classifies: EMERGENCY │ TRIAGE │ BOOKING │ GENERAL_INFO │ CLOSING  │
                     └────────────────────────────┬────────────────────────────────────────┘
                                                  │
                                   ┌──────────────┼──────────────┐
                                   ▼              ▼              ▼
                           ┌──────────┐  ┌──────────────┐  ┌──────────┐
                           │ EMERGENCY│  │    TRIAGE    │  │ BOOKING  │
                           │ GUARDRAIL│  │  RAG SEARCH  │  │ HANDLER  │
                           └──────────┘  └──────┬───────┘  └──────────┘
                                                │
                                                ▼
                     ┌─────────────────────────────────────────────────────────────────────┐
                     │                    RETRIEVAL PIPELINE                               │
                     │                                                                     │
                     │  ┌─────────────┐   ┌─────────────┐   ┌─────────────────────────┐    │
                     │  │  NVIDIA NIM │   │   BM25      │   │  CrossEncoder Reranker  │    │
                     │  │  Embeddings │ + │  Keyword    │ → │  ms-marco-MiniLM-L-6    │    │
                     │  │  (Semantic) │   │  Matching   │   │  (Top-10 → Top-3)       │    │
                     │  └──────┬──────┘   └──────┬──────┘   └───────────┬─────────────┘    │
                     │         │                 │                      │                  │
                     │         ▼                 ▼                      ▼                  │
                     │  ┌─────────────────────────────────────────────────────────────┐    │
                     │  │              PINECONE VECTOR DATABASE                       │    │
                     │  │         90,306 vectors • cosine • 1024 dimensions           │    │
                     │  └─────────────────────────────────────────────────────────────┘    │
                     └────────────────────────────┬────────────────────────────────────────┘
                                                  │
                                                  ▼
                     ┌─────────────────────────────────────────────────────────────────────┐
                     │  SYNTHESIS (Groq llama-3.1-8b-instant)                              │
                     │  Grounded response + clinical justification + source attribution    │
                     └────────────────────────────┬────────────────────────────────────────┘
                                                  │
                                                  ▼
                     ┌─────────────────────────────────────────────────────────────────────┐
                     │                       PATIENT RESPONSE                              │
                     └─────────────────────────────────────────────────────────────────────┘

Benchmark

Metric Value
Intent Accuracy 96.0%
Avg Latency 9.26s
Avg Retrieval Score 0.92
Records in DB 90,306
Intent Correct Total Accuracy
EMERGENCY 10 10 100%
TRIAGE 18 20 90%
BOOKING 10 10 100%
GENERAL_INFO 5 5 100%
CLOSING 5 5 100%

Tech Stack

Layer Technology Purpose
SDK ella-sdk (PyPI) Python client
Embeddings NVIDIA NIM (nv-embedqa-e5-v5) 1024-dim semantic vectors
Vector DB Pinecone (Serverless, AWS) Cosine similarity search
LLM Groq (llama-3.1-8b-instant) Intent classification + response generation
Reranker CrossEncoder (ms-marco-MiniLM-L-6-v2) Precision reranking
Orchestration LangChain + LangGraph Agent pipeline
Validation Pydantic Schema-validated outputs

License

MIT License — see LICENSE for details.


Built with ❤️ for healthcare AI

Stars

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ella_sdk-1.2.2.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ella_sdk-1.2.2-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

Details for the file ella_sdk-1.2.2.tar.gz.

File metadata

  • Download URL: ella_sdk-1.2.2.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ella_sdk-1.2.2.tar.gz
Algorithm Hash digest
SHA256 abb4e9d8c518ec039cd2ad3f8727c201017c264daee24d35a73aea3b18fceb8d
MD5 6eff477cf3a471fab202bf50d9e1b3bf
BLAKE2b-256 0f9c550b15c0c0436e5ef677382d1e0d8813992fc43048830cafc6e5d8ae8395

See more details on using hashes here.

File details

Details for the file ella_sdk-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: ella_sdk-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 37.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ella_sdk-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 45f2138ca03df3c4d51d5082b9b8c7ac277f753647d10a18b807f137c03aa60f
MD5 19160221cabb5da3f8eb17d2e3b363dc
BLAKE2b-256 7e9d80407fdbae7878d6f4d19c6a2217cb1935f4452f3150ef47b2cb572fcffb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page