Skip to main content

Overview

Rubric’s observability features let you capture every AI decision in production. This gives you visibility into what your models are doing and creates the foundation for evaluation and improvement.
This guide assumes you’ve already created a project in Rubric.

Install the SDK

pip install rubric

Initialize the Client

from rubric import Rubric

client = Rubric(api_key="gr_live_xxxxxxxx")
Store your API key in environment variables, not in code. Use RUBRIC_API_KEY and the SDK will pick it up automatically.

Log Your First Call

For voice triage applications, log the full conversation with the AI’s decision:
client.calls.log(
    project="patient-triage",
    
    # Audio recording (optional)
    audio_url="https://storage.example.com/calls/call_123.wav",
    
    # Transcript with speaker labels
    transcript=[
        {"speaker": "agent", "text": "How can I help you today?", "start": 0.0, "end": 2.1},
        {"speaker": "patient", "text": "I've been having chest pain.", "start": 2.5, "end": 5.8},
        {"speaker": "agent", "text": "I understand. When did this start?", "start": 6.0, "end": 8.2}
    ],
    
    # The AI's triage decision
    ai_decision={
        "triage_level": "urgent",
        "extracted_symptoms": ["chest_pain"],
        "confidence": 0.92
    },
    
    # Optional metadata for filtering
    metadata={
        "patient_id": "pat_12345",
        "call_duration": 180,
        "model_version": "v2.1.0"
    }
)

Log Clinical Notes

For documentation assistants, log the generated note:
client.notes.log(
    project="visit-summarizer",
    
    # Source transcript/input
    input_text="Patient presents with persistent cough for 2 weeks...",
    
    # Generated clinical note
    output={
        "soap_note": {
            "subjective": "Patient reports 2-week history of...",
            "objective": "VS: BP 120/80, HR 72...",
            "assessment": "1. Acute bronchitis...",
            "plan": "1. Supportive care..."
        },
        "icd_codes": ["J20.9"]
    },
    
    # Expected output for evaluation (optional)
    expected={
        "icd_codes": ["J20.9", "R05"]
    }
)

View Logs in Dashboard

Once you’ve logged some data, head to the Rubric Dashboard to:
  • Browse individual logs with full context
  • Filter by status, score, or metadata
  • Identify patterns in AI behavior
  • Flag logs for human review
Logs Dashboard

Next Steps