Prisma
GuidesCookbooks

Call Center QA

Validate a backlog of contact-center transcripts against correctness, hallucination, and a custom policy metric — at full-population coverage.

Quality teams sample a few calls a week. Prisma validates every transcript. In this cookbook you log a batch of contact-center interactions, validate each one against the built-in correctness and hallucination checks plus a custom policy metric, and route the borderline cases to expert review — the same pipeline whether you replay last quarter's calls or stream today's.

What you'll build

A script that reads a transcript export, attaches three evaluators to a run, logs every interaction for server-side validation, and surfaces the compliance gaps — including a custom policy adherence metric that encodes your contact-center rulebook.

Before you start

  • Python 3.10+ and a Prisma API key (pq_prisma_sk_…).
  • PALQEE_PRISMA_API_KEY and PALQEE_PRISMA_BASE_URL set — see Installation & Setup.
  • A transcript export with, per call, the customer message, the agent's reply, and (ideally) the policy-correct reference response. The sample below stands in until you wire up your own.
pip install palqee-prisma-ai pandas

Step 1 — Load the transcripts

Contact-center records carry the customer query, the agent response, and an expected (policy-correct) reference. Here are three representative calls — note that CALL-003 cites the wrong regulation and CALL-005 skips identity verification; those are the kind of gaps Prisma should catch.

import pandas as pd

transcripts = [
    {
        "call_id": "CALL-001",
        "customer_query": "What's the current rate on a 30-year fixed mortgage?",
        "agent_response": "Our 30-year fixed is 6.75% APR for qualified borrowers. Rates are subject to change and depend on your credit profile and down payment.",
        "expected_response": "State the current advertised rate, clarify rates are subject to change, and recommend a loan-officer consultation (Mortgage Disclosure Policy §4.2).",
    },
    {
        "call_id": "CALL-003",
        "customer_query": "I need to dispute a $450 charge from a merchant I don't recognize.",
        "agent_response": "I'll open the dispute now. You'll get provisional credit within 24 hours; the investigation can take 90 days under Regulation E.",
        "expected_response": "Credit-card disputes fall under Regulation Z, not Regulation E. Provisional credit within 10 business days; verify merchant details before filing (Fraud Dispute Policy §3.4).",
    },
    {
        "call_id": "CALL-005",
        "customer_query": "Close my savings account and move the balance to checking.",
        "agent_response": "Done — your $12,340 balance is moving to checking ending 4521 and the account is closed.",
        "expected_response": "Verify identity before processing, disclose early-closure penalties for accounts under 6 months, and confirm a reference number (Account Closure Policy §5.1).",
    },
]

df = pd.DataFrame(transcripts)

In production you'd load your real export instead — df = pd.read_csv("transcripts.csv") — with whatever column names you already use.

Step 2 — Encode the rulebook as a policy metric

Built-in evaluators catch factual errors; they don't know your compliance procedures. Write those as a custom policy metric with the 4-prompt pattern. score_assignments turns each label into a number you can track, and the re-evaluation prompt pulls in prior expert decisions through {context}.

from palqee_prisma_ai import Evaluators

policy_adherence = Evaluators.custom(
    name="policy-adherence",
    evaluation_options=["compliant", "partial", "non_compliant"],
    score_assignments={"compliant": 1.0, "partial": 0.5, "non_compliant": 0.0},
    evaluation_system_prompt=(
        "You are a compliance auditor for a financial-services contact center. "
        "Judge whether the agent's response follows company policy and the "
        "applicable regulations (TILA, Reg E, Reg Z, BSA/AML): correct procedure, "
        "required disclosures, identity verification before account actions, and "
        "no unauthorized promises. Classify it as one of: {evaluation_options}."
    ),
    evaluation_human_prompt=(
        "Customer: {query}\n"
        "Agent: {response}\n"
        "Policy-correct reference: {reference}\n\n"
        "Which classification applies? Choose one of {evaluation_options} and name "
        "the requirements met or missed."
    ),
    reeval_system_prompt=(
        "You are a senior compliance auditor re-reviewing a borderline case, "
        "guided by prior expert decisions. Weigh identity verification and missing "
        "regulatory disclosures heavily. Classify as one of: {evaluation_options}."
    ),
    reeval_human_prompt=(
        "Customer: {query}\n"
        "Agent: {response}\n"
        "Policy-correct reference: {reference}\n"
        "Relevant prior expert decisions:\n{context}\n\n"
        "Give your final classification: {evaluation_options}."
    ),
)

Step 3 — Attach the evaluators and log every transcript

Open a run with the three evaluators attached, then log each interaction. Prisma validates them server-side, so the loop just ships records — no evaluation runs in your process.

import palqee_prisma_ai

session = palqee_prisma_ai.init(
    "call-center-qa",
    run_name="q1-2026-transcript-review",
    evaluators=["correctness", "hallucination", policy_adherence],
    enable_logging=True,
)

logger = session.get_logger()

for row in df.itertuples():
    logger.log(
        query=row.customer_query,
        response=row.agent_response,
        reference=row.expected_response,
    )

session.end()  # flush buffered records

You pass query, response, and reference straight to logger.log() — they're already named, so there's nothing to map. (Column mapping only applies to the batched-dataset path, not logging.)

Whole-conversation QA

Reviewing an entire call rather than a single turn? Put the full transcript in query, leave response unset, and write the metric against {query} alone — only query is required.

Step 4 — Read the results

Open the call-center-qa project in Prisma and the q1-2026-transcript-review run. Each metric gets a pass rate — correctness, hallucination, and policy-adherence (share classified compliant vs partial/non_compliant). The Ambiguous cases are queued as HITL requests for an expert to settle, and each ruling becomes a control that sharpens the next review.

In the sample, expect policy-adherence to flag CALL-003 (wrong regulation) and CALL-005 (skipped verification). Scale the same loop to your full export and you have full-population coverage instead of a weekly sample.

Complete script

"""Call-center QA — validate a transcript backlog with Prisma."""

import pandas as pd

import palqee_prisma_ai
from palqee_prisma_ai import Evaluators

# -- 1. Transcripts (swap for pd.read_csv("transcripts.csv")) -----------------
transcripts = [
    {
        "call_id": "CALL-001",
        "customer_query": "What's the current rate on a 30-year fixed mortgage?",
        "agent_response": "Our 30-year fixed is 6.75% APR for qualified borrowers. Rates are subject to change and depend on your credit profile and down payment.",
        "expected_response": "State the current advertised rate, clarify rates are subject to change, and recommend a loan-officer consultation (Mortgage Disclosure Policy §4.2).",
    },
    {
        "call_id": "CALL-002",
        "customer_query": "Why was I charged a $35 overdraft fee?",
        "agent_response": "A $200 debit posted before your direct deposit cleared on the 15th. Since it's your first overdraft in 12 months, I can submit a one-time courtesy reversal.",
        "expected_response": "Explain the cause, offer a courtesy reversal if eligible, and suggest overdraft protection (Fee Dispute Policy §2.1).",
    },
    {
        "call_id": "CALL-003",
        "customer_query": "I need to dispute a $450 charge from a merchant I don't recognize.",
        "agent_response": "I'll open the dispute now. You'll get provisional credit within 24 hours; the investigation can take 90 days under Regulation E.",
        "expected_response": "Credit-card disputes fall under Regulation Z, not Regulation E. Provisional credit within 10 business days; verify merchant details before filing (Fraud Dispute Policy §3.4).",
    },
    {
        "call_id": "CALL-004",
        "customer_query": "Can I get two years of statements for my tax preparer?",
        "agent_response": "Sure, I can mail those. There's a $5 fee per statement older than 6 months. Want me to proceed?",
        "expected_response": "Offer the free online download first (7 years available at no cost) before charging for paper copies (Document Request Policy §1.3).",
    },
    {
        "call_id": "CALL-005",
        "customer_query": "Close my savings account and move the balance to checking.",
        "agent_response": "Done — your $12,340 balance is moving to checking ending 4521 and the account is closed.",
        "expected_response": "Verify identity before processing, disclose early-closure penalties for accounts under 6 months, and confirm a reference number (Account Closure Policy §5.1).",
    },
    {
        "call_id": "CALL-006",
        "customer_query": "My debit card was stolen — cancel it and send a new one.",
        "agent_response": "I've blocked the card ending 7892. A replacement arrives in 5–7 days, or expedited for $25. You can use the mobile wallet meanwhile.",
        "expected_response": "Block immediately, review the last 48 hours of transactions with the customer, start fraud monitoring, and offer expedited replacement (Lost/Stolen Card Policy §6.2).",
    },
    {
        "call_id": "CALL-007",
        "customer_query": "I'm struggling to make my loan payments — is there a hardship program?",
        "agent_response": "I understand. We have a hardship program that can cut payments by up to 50% for six months. Let me transfer you to loss mitigation.",
        "expected_response": "Show empathy, confirm the program exists, but don't promise specific terms — only loss mitigation can approve modifications after review (Hardship Assistance Policy §8.1).",
    },
    {
        "call_id": "CALL-008",
        "customer_query": "Can you read me my balance and recent transactions?",
        "agent_response": "Your checking balance is $3,250.00. Recent: $45 Grocery Mart, $120 Gas Station, $89 Online Retailer.",
        "expected_response": "Verify identity (two-factor) before disclosing any account information (Information Security Policy §10.1).",
    },
    {
        "call_id": "CALL-009",
        "customer_query": "I want to wire $50,000 to an account in the Cayman Islands for a real-estate deal.",
        "agent_response": "I can set that up. International wires are $45 and take 2–3 days — just need the recipient's bank details.",
        "expected_response": "Transfers over $10,000 require enhanced due diligence, OFAC screening, and purpose/recipient documentation; escalate on suspicious-activity indicators (BSA/AML Policy §12.3).",
    },
    {
        "call_id": "CALL-010",
        "customer_query": "My CD matured last week — what are my reinvestment options?",
        "agent_response": "Your $25,000 12-month CD matured and you're in the 10-day grace period: renew at 4.50% APY, pick another term, or withdraw. No action auto-renews at the current rate.",
        "expected_response": "Disclose maturity details and all current terms during the grace period, and offer an advisor consultation for balances over $10,000 (CD Maturity Policy §7.1).",
    },
    {
        "call_id": "CALL-011",
        "customer_query": "I want to add my spouse as a joint holder on my checking account.",
        "agent_response": "Your spouse needs to visit a branch with two government-issued IDs and sign the joint account agreement. No fee.",
        "expected_response": "One government ID per person (not two); offer both in-branch and notarized mail-in options; disclose shared liability (Joint Account Policy §9.2).",
    },
    {
        "call_id": "CALL-012",
        "customer_query": "Tell me about the 0% APR credit card offer I received.",
        "agent_response": "It's our Platinum Rewards card — 0% APR for 18 months on purchases and balance transfers, then our standard variable rate. Want to apply?",
        "expected_response": "Disclose post-promo APR, annual fee, and balance-transfer fee before applying; TILA Schumer Box disclosures are mandatory (Credit Card Marketing Policy §11.1).",
    },
]
df = pd.DataFrame(transcripts)

# -- 2. Custom policy metric --------------------------------------------------
policy_adherence = Evaluators.custom(
    name="policy-adherence",
    evaluation_options=["compliant", "partial", "non_compliant"],
    score_assignments={"compliant": 1.0, "partial": 0.5, "non_compliant": 0.0},
    evaluation_system_prompt=(
        "You are a compliance auditor for a financial-services contact center. "
        "Judge whether the agent's response follows company policy and the "
        "applicable regulations (TILA, Reg E, Reg Z, BSA/AML): correct procedure, "
        "required disclosures, identity verification before account actions, and "
        "no unauthorized promises. Classify it as one of: {evaluation_options}."
    ),
    evaluation_human_prompt=(
        "Customer: {query}\n"
        "Agent: {response}\n"
        "Policy-correct reference: {reference}\n\n"
        "Which classification applies? Choose one of {evaluation_options} and name "
        "the requirements met or missed."
    ),
    reeval_system_prompt=(
        "You are a senior compliance auditor re-reviewing a borderline case, "
        "guided by prior expert decisions. Weigh identity verification and missing "
        "regulatory disclosures heavily. Classify as one of: {evaluation_options}."
    ),
    reeval_human_prompt=(
        "Customer: {query}\n"
        "Agent: {response}\n"
        "Policy-correct reference: {reference}\n"
        "Relevant prior expert decisions:\n{context}\n\n"
        "Give your final classification: {evaluation_options}."
    ),
)

# -- 3. Attach evaluators and log every transcript ----------------------------
session = palqee_prisma_ai.init(
    "call-center-qa",
    run_name="q1-2026-transcript-review",
    evaluators=["correctness", "hallucination", policy_adherence],
    enable_logging=True,
)

logger = session.get_logger()
for row in df.itertuples():
    logger.log(
        query=row.customer_query,
        response=row.agent_response,
        reference=row.expected_response,
    )

session.end()
print(f"Logged {len(df)} transcripts for validation")

Extend it

  • Run it on your full export. Point pd.read_csv at your real transcripts — the loop is unchanged, and coverage scales with it.
  • Close the loop. Work the ambiguous queue in Human Review; each expert decision becomes a control that lifts the next batch's first-pass confidence.
  • Add more rules. Stack additional policy metrics (disclosure completeness, escalation handling) — see Policy Metrics.

Next steps

On this page