Skip to main content
When you call client.judge(), you get back a Ruling object containing the verdict and all supporting evidence.

Example

ruling = client.judge(
    claim="I live in San Francisco. My cat Sally lives with me.",
    sources=[
        TextSource(id="cat-name", text="I have a cat called Sally."),
        TextSource(id="living", text="Sally and I live in a small apartment."),
    ],
)

Top-level verdict

ruling.verdict  # Verdict.NOT_ENOUGH_INFO
The overall verdict is conservative:
  • SUPPORTS - all statements are supported
  • REFUTES - any statement is refuted
  • NOT_ENOUGH_INFO - otherwise
In this example, the claim about San Francisco has no evidence, so the overall verdict is NOT_ENOUGH_INFO.

Statements

Each claim is decomposed into individual statements:
for statement in ruling.statements:
    print(f"{statement.text}: {statement.verdict}")

# I live in San Francisco.: Verdict.NOT_ENOUGH_INFO
# My cat Sally lives with me.: Verdict.SUPPORTS
The span attribute maps back to the original claim:
claim = "I live in San Francisco. My cat Sally lives with me."
for statement in ruling.statements:
    original_text = claim[statement.span[0]:statement.span[1]]
    print(f"'{original_text}' -> {statement.verdict}")
statement.text is not necessarily identical to claim[span[0]:span[1]]. Gateway may rephrase for clarity—for example, “The sky is clear and blue” might yield a statement with text “The sky is blue” while the span points to the full original phrase.

Influences

Each statement’s verdict is based on evidence from your sources:
for statement in ruling.statements:
    print(f"\n{statement.text}")
    for influence in statement.influences:
        print(f"  - {influence.text} (from {influence.source.id})")
Output:
I live in San Francisco.
  (no influences)

My cat Sally lives with me.
  - I have a cat called Sally. (from cat-name)
  - Sally and I live in a small apartment. (from living)

Locating evidence in sources

For TextInfluence objects, the span attribute gives the exact character positions:
from gateway import TextInfluence

for statement in ruling.statements:
    for influence in statement.influences:
        if isinstance(influence, TextInfluence):
            source_text = influence.source.text
            evidence = source_text[influence.span[0]:influence.span[1]]
            print(f"Evidence: '{evidence}'")