Console ↗

Self-consistency

Evaluate possible answers against the same evidence with independent probability estimates.

Input and workflow

Save the exact request and model identifier. Repeat the evaluation and compare the change in probability per key; separately measure correctness against labeled evidence.

Request

{
  "model": "ngila-judge",
  "state": {
    "source": "The return window is 14 days after delivery.",
    "answers": [
      "Two weeks after delivery",
      "Thirty days after purchase"
    ]
  },
  "questions": {
    "first_supported": {
      "type": "noul",
      "instructions": "Does the source support the first answer?"
    },
    "second_supported": {
      "type": "noul",
      "instructions": "Does the source support the second answer?"
    }
  }
}

Open request in Playground →

Run locally

Save ngila.py alongside your script and set NGILA_API_KEY. Save any linked input images in the same directory.

import json
from ngila import NgilaClient

state = {'source': 'The return window is 14 days after delivery.',
 'answers': ['Two weeks after delivery', 'Thirty days after purchase']}
questions = {'first_supported': {'type': 'noul',
                     'instructions': 'Does the source support the first '
                                     'answer?'},
 'second_supported': {'type': 'noul',
                      'instructions': 'Does the source support the second '
                                      'answer?'}}

response = NgilaClient().system_one(state, questions)
a = response["answers"]
print(json.dumps(a, indent=2, ensure_ascii=False))

Use the answers

The following application fragment uses a = response["answers"]. Supply any thresholds, lookup tables, or previous results from your workflow before applying it.

drift = {k: abs(v["noul"] - previous[k]["noul"]) for k,v in a.items()}

Browse cookbooks · System One request and response