Classify the broad topic first, then send a second question with labels for just that topic.
Input and workflow
Construct a second Choice from the children of the selected department. Retain the parent path so two leaves with similar titles remain distinguishable.
Request
{
"model": "ngila-judge",
"state": "My replacement power adapter is making a buzzing sound.",
"questions": {
"department": {
"type": "choice",
"instructions": "Select a department.",
"criteria": {
"Hardware": "",
"Software": "",
"Payments": ""
}
}
}
}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 replacement power adapter is making a buzzing sound.'
questions = {'department': {'type': 'choice',
'instructions': 'Select a department.',
'criteria': {'Hardware': '', 'Software': '', 'Payments': ''}}}
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.
parent = a["department"]["choice"]
child_options = taxonomy[parent]