Rank rental listings against a guest’s written preferences.
Prepare the input
Keep the user request and the record it applies to in separate fields. Repeat the same question for each record in the workflow.
Model request
{
"model": "ngila-judge",
"state": {
"request": "A quiet room near the station, with a desk.",
"source": "The studio overlooks a courtyard, has a desk and is a five-minute walk from the station."
},
"questions": {
"decision": {
"type": "score",
"instructions": "How well does the listing satisfy the requested features?",
"criteria": [
"Conflicts with a requirement",
"Some features match",
"All named features match"
]
}
}
}Run locally
Save ngila.py next to your script and set NGILA_API_KEY.
import json
from ngila import NgilaClient
state = {'request': 'A quiet room near the station, with a desk.',
'source': 'The studio overlooks a courtyard, has a desk and is a five-minute '
'walk from the station.'}
questions = {'decision': {'type': 'score',
'instructions': 'How well does the listing satisfy the requested '
'features?',
'criteria': ['Conflicts with a requirement',
'Some features match',
'All named features match']}}
response = NgilaClient().system_one(state, questions)
a = response["answers"]
print(json.dumps(a, indent=2, ensure_ascii=False))Wire the application
Keep one immutable listing ID per row. Read records on a server, score the description with the same rubric, and write the score and confidence into separate columns. Preserve the sheet’s original ordering when writing back.