Console ↗

Parallel questions

Ask independent questions about one ticket in a single forward pass. Each answer has its own name.

Input and workflow

Keep the two signals independent. A duplicate-charge report can omit any request for a refund. Route it for investigation without assuming permission to issue money.

Request

{
  "model": "ngila-judge",
  "state": "My card was charged twice. Please refund one charge.",
  "questions": {
    "duplicate": {
      "type": "noul",
      "instructions": "Does the customer report a duplicate charge?"
    },
    "refund": {
      "type": "noul",
      "instructions": "Is the customer asking for a refund?"
    }
  }
}

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 = 'My card was charged twice. Please refund one charge.'
questions = {'duplicate': {'type': 'noul',
               'instructions': 'Does the customer report a duplicate charge?'},
 'refund': {'type': 'noul',
            'instructions': 'Is the customer asking for a refund?'}}

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.

signals = {name: answer["noul"] for name, answer in a.items()}

Browse cookbooks · System One request and response