Call Ngila from a Python 3.9+ application with the downloadable client.
Set up
Download ngila.py and save it beside your script. Set NGILA_API_KEY in the environment that runs Python. The client uses urllib and asyncio from the standard library.
Send a request
from ngila import NgilaClient
client = NgilaClient()
questions = {"open": {"type": "noul", "instructions": "Is the desk open?"}}
result = client.system_one("The front desk is open until 6 pm.", questions)
print(result["answers"]["open"]["noul"])Handle the result
Read the answer matching your question key. Record usage.input_tokens for reporting. Network and HTTP failures are raised as standard Python exceptions.
Images
Encode the file as base64 and pass the assets dictionary to system_one. See Python asset examples.