Prisma
GuidesHow-to Guides

Validations

Attach evaluators to a run so Prisma validates every ingested interaction — with ready-made checks or your own policy metrics

Prisma validates every interaction your workflows produce against the policies you define — automatically, at full-population coverage instead of sampling. Evaluators are how you tell Prisma what to check: attach them once in init() and it validates every interaction the run produces — with ready-made checks, your own policy metrics, or both. Those interactions can be human-agent work, AI output, or historical records — see how interactions reach Prisma.

Two kinds of evaluator:

  • Built-in evaluators — ready-made checks (correctness, hallucination). Attach by name.
  • Policy metrics — your definition of a compliant interaction, written with the 4-prompt pattern. This is Prisma's core building block.

Validation runs server-side

You don't call a validation function in your app. Once evaluators are attached, Prisma validates each interaction asynchronously, server-side, as it arrives — so you get full-population coverage with no added latency and no extra code in your request path.

Before you start

  • Interactions reaching Prisma — logged, traced, or batched (see below).
  • A Prisma API key and PALQEE_PRISMA_BASE_URL set. See Installation & Setup.

How interactions reach Prisma

Validation is independent of how interactions arrive. The evaluators you attach live on the run, and every ingestion path feeds the same validation engine — so you configure policy once and apply it to human-agent work, AI output, or historical records alike. Pick the path that fits your workflow:

  • Log human-workflow interactions — send the records your teams produce (contact-center transcripts, agent chat/email, case notes) to Prisma for policy validation. The primary path for human-agent oversight.
  • Trace an AI/LLM app — capture model calls with OpenTelemetry. See Instrumentation & Tracing.
  • Batch a dataset — validate a CSV of past interactions offline. See the Files & Jobs API.

Log human-workflow interactions

Attach your policy metrics to a run, then log each interaction — the customer message, the agent's reply, and an optional policy-correct reference. Prisma validates each one server-side, exactly as it does for traces.

import palqee_prisma_ai

session = palqee_prisma_ai.init(
    "contact-center-qa",
    run_name="weekly-qa-2026-w13",
    evaluators=[response_compliance, escalation_procedure],  # your policy metrics
    enable_logging=True,
)

logger = session.get_logger()

for transcript in transcripts:
    logger.log(
        query=transcript["customer_message"],
        response=transcript["agent_reply"],
        reference=transcript.get("expected_response"),  # optional
    )

session.end()  # flush buffered records

No separate response? Use the transcript as the query

When the unit you're reviewing is a whole conversation rather than a single turn, there's often no distinct "agent reply" to score. Pass the full transcript as query and leave response unset — only query is required. Your policy metric then reads {query} alone (the {response} placeholder is optional), judging the transcript as a whole.

Writing the policy metrics those interactions are checked against (response_compliance and friends) is covered in Policy Metrics.

Attach a built-in evaluator

Pass the evaluator's name to init(). Prisma applies it to every interaction on the run.

import palqee_prisma_ai

palqee_prisma_ai.init(
    "support-bot",
    evaluators=["correctness", "hallucination"],
)

The built-ins:

NameChecks
correctnessWhether the response is correct given the input (and reference, if provided).
hallucinationWhether the response contains claims unsupported by the input or reference.

Need to tune a built-in's rubric or options? Use the factory form instead of the bare string. You can override any of the four prompts — evaluation_system_prompt, evaluation_human_prompt, reeval_system_prompt, reeval_human_prompt — and evaluation_options; anything you leave out keeps Prisma's default.

from palqee_prisma_ai import Evaluators

palqee_prisma_ai.init(
    "support-bot",
    evaluators=[
        Evaluators.correctness(
            evaluation_system_prompt=(
                "You are a senior support-quality reviewer. Judge whether the "
                "agent's answer is factually correct for the customer's account "
                "context. Classify it as one of: {evaluation_options}."
            ),
            evaluation_human_prompt=(
                "Customer: {query}\n"
                "Agent: {response}\n"
                "Is the answer correct? Choose one of {evaluation_options}."
            ),
            evaluation_options=["correct", "incorrect"],
        ),
    ],
)

The same prompt placeholders apply as for policy metrics: {query} is required in either human prompt.

Policy metrics

A policy metric is a custom evaluator that encodes a rule you define — not a generic score. You write it with Evaluators.custom() and the 4-prompt pattern: two prompts for the first-pass validation, two for re-validation of borderline cases, plus the evaluation_options it can return and a score_assignments value for each.

from palqee_prisma_ai import Evaluators

billing_policy = Evaluators.custom(
    name="billing-resolution",
    evaluation_options=["compliant", "non_compliant"],
    score_assignments={"compliant": 1.0, "non_compliant": 0.0},
    evaluation_system_prompt=(
        "You are a contact-center QA reviewer. A response is compliant only if the "
        "agent acknowledges the customer's issue AND states a concrete next step. "
        "Classify the response as one of: {evaluation_options}."
    ),
    evaluation_human_prompt=(
        "Customer: {query}\n"
        "Agent: {response}\n"
        "Does the response comply with the policy? Choose one of {evaluation_options}."
    ),
    reeval_system_prompt=(
        "You are re-reviewing a borderline case, guided by prior expert decisions. "
        "Classify the response as one of: {evaluation_options}."
    ),
    reeval_human_prompt=(
        "Customer: {query}\n"
        "Agent: {response}\n"
        "Relevant prior expert decisions:\n{context}\n"
        "Give your final classification: {evaluation_options}."
    ),
)

Two rules to remember: evaluation_options holds 2–5 unique labels and never includes ambiguous (Prisma adds and scores that one itself, routing low-confidence cases to a human); score_assignments maps every option to a value from 0.0 to 1.0, which is what turns labels into a metric you can track.

Writing effective prompts, the full placeholder reference, and worked policy metrics for regulated industries live in Policy Metrics — the canonical guide to authoring them. For the thinking behind the two-pass design and how expert decisions feed back as metamemory, see Policy Metrics (concept) and Human Review.

Mix built-ins and policy metrics

evaluators takes any combination of names and custom configs:

palqee_prisma_ai.init(
    "support-bot",
    evaluators=["correctness", billing_policy],
)

Map dataset columns

An evaluator works from up to three fields: query (the only required one), plus an optional response and reference. How Prisma finds them depends on the ingestion path, and only one path needs you to configure anything:

  • Traces carry their fields by convention. Instrumentors emit them as span attributes (input.value, output.value, input.reference for OpenInference), and Prisma reads them automatically — OpenInference and OpenLLMetry alike. Nothing to map.
  • Logged interactions pass query, response, and reference straight to logger.log(). Already named — nothing to map.
  • Batched datasets are your columns, with your names. If they aren't already query / response / reference, tell Prisma which column is which with an input_mapping on init():
from palqee_prisma_ai import InputMapping

palqee_prisma_ai.init(
    "contact-center-qa",
    evaluators=[response_compliance],
    input_mapping=InputMapping(
        query="customer_message",   # your CSV column names
        response="agent_reply",
        reference="expected_response",
    ),
)

For per-evaluator mapping — different columns per metric, or composing one field from several columns — pass input_mapping={...} to Evaluators.custom().

Update evaluators on a running session

init() returns a PrismaSession. To change the evaluators attached to the current run without restarting, build a new config and update it:

session = palqee_prisma_ai.init("support-bot", evaluators=["correctness"])
# … later …
session.update_evaluation_config(my_updated_config)

See the results

Open your project in Prisma. Each interaction appears under Validations; the Ambiguous column flags ones Prisma couldn't decide. Ambiguous cases become HITL Requests for expert review, and those decisions are catalogued under Controls — the metamemory reused on later validations.

Troubleshooting

SymptomCause
Unknown evaluator type '…'Only correctness and hallucination are valid as strings. For your own rules use Evaluators.custom(...).
evaluation_human_prompt must contain {query}Both human prompts must include the {query} placeholder.
'ambiguous' … should not be includedRemove ambiguous from evaluation_options — Prisma adds it automatically.
Options rejectedYou need 2–5 unique options (case-insensitive).
No validations appearTraces aren't arriving — check Instrumentation first. Evaluators only run on interactions Prisma receives.

Next steps

On this page