Choose an operation from your application’s catalog. Validate its arguments in code before calling the selected function.
Input and workflow
Resolve the selected name through an allowlist. Collect any missing arguments and confirm the intended calendar change before invoking a mutating operation.
Request
{
"model": "ngila-judge",
"state": "Move our weekly check-in to Friday.",
"questions": {
"operation": {
"type": "choice",
"instructions": "Which calendar operation fits?",
"criteria": {
"reschedule": "",
"create": "",
"cancel": "",
"none": ""
}
}
}
}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 = 'Move our weekly check-in to Friday.'
questions = {'operation': {'type': 'choice',
'instructions': 'Which calendar operation fits?',
'criteria': {'reschedule': '',
'create': '',
'cancel': '',
'none': ''}}}
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.
operation = a["operation"]["choice"]
needs_arguments = operation in {"create", "reschedule", "cancel"}