Skip to main content

Overview

This guide gets you from zero to evaluating healthcare AI in under 5 minutes. You’ll:
  1. Install the Rubric SDK
  2. Get your API key
  3. Log a sample patient call
  4. View results in the dashboard
Prerequisites: Python 3.8+ or Node.js 16+

Step 1: Install the SDK

pip install rubric

Step 2: Get Your API Key

  1. Sign up at app.rubric.ai
  2. Navigate to Settings → API Keys
  3. Click Create API Key
  4. Copy your key (starts with gr_live_ or gr_test_)
Keep your API key secure. Never commit it to version control or expose it in client-side code.
Set your API key as an environment variable:
export RUBRIC_API_KEY="gr_live_your_key_here"

Step 3: Log Your First Call

from rubric import Rubric

client = Rubric()  # Uses RUBRIC_API_KEY env var

# Log a patient triage call
client.calls.log(
    project="my-first-project",
    
    transcript=[
        {
            "speaker": "agent",
            "text": "Thank you for calling. How can I help you today?",
            "start": 0.0,
            "end": 3.2
        },
        {
            "speaker": "patient",
            "text": "I've been having chest pain since this morning. It's pretty bad.",
            "start": 3.8,
            "end": 8.1
        },
        {
            "speaker": "agent",
            "text": "I'm sorry to hear that. Can you describe the pain? Where exactly is it located?",
            "start": 8.5,
            "end": 13.0
        },
        {
            "speaker": "patient",
            "text": "It's right in the center of my chest, like pressure. And my left arm feels weird.",
            "start": 13.5,
            "end": 19.2
        }
    ],
    
    ai_decision={
        "triage_level": "emergency",
        "extracted_symptoms": ["chest_pain", "arm_pain"],
        "red_flags": ["cardiac_symptoms"],
        "recommended_action": "call_911"
    }
)

print("✅ Call logged successfully!")

Step 4: View in Dashboard

  1. Open app.rubric.ai
  2. Navigate to your project
  3. Click on Logs to see your call
  4. View the AI decision breakdown

Step 5: Run an Evaluation

Now let’s run automated evaluators on your logged data:
# Create an evaluation
evaluation = client.evaluations.create(
    name="My First Evaluation",
    project="my-first-project",
    
    evaluators=[
        {
            "type": "triage_accuracy",
            "config": {
                "levels": ["emergency", "urgent", "routine"]
            }
        },
        {
            "type": "red_flag_detection",
            "config": {
                "protocols": ["chest_pain"]
            }
        }
    ]
)

print(f"Evaluation started: {evaluation.id}")

# Wait for results
results = client.evaluations.wait(evaluation.id)

print(f"Triage Accuracy: {results.metrics['triage_accuracy']}%")
print(f"Red Flag Recall: {results.metrics['red_flag_recall']}%")

What’s Next?

Common Issues

Make sure you’ve set the RUBRIC_API_KEY environment variable, or pass it directly:
client = Rubric(api_key="gr_live_xxx")
Projects are created automatically on first log. If you’re getting this error, check your project name for typos.
The free tier has a limit of 100 requests/minute. Upgrade for higher limits or add retry logic.