Console ↗

Python API reference

Use these methods and data types with the downloadable Python client.

Basic usagePass a string or a structured object as state and a dictionary of questions. Use stable names to retrieve the results.Advanced usageBound the number of simultaneous requests and preserve a record ID with each reply. A semaphore restricts how many background HTTP calls are in flight.Asynchronous clientAwait system_one_async inside an event loop. The adapter delegates blocking I/O to a worker thread; cancellation of the awaiting task does not cancel processing on the model host.Synchronous clientCreate one client using an environment key or pass api_key explicitly. The timeout is in seconds. models() lists IDs and system_one() returns the decoded response.QuestionsA question is a dict. Choice criteria define a finite catalog; a score uses an ordered list. Name the fields according to what the caller consumes.Extract text passagesUse a Span question to find people named in meeting notes. Resolve each path against the exact state sent to the model and slice at Unicode code-point offsets.AssetsRead JPEG or PNG bytes on the server and encode them as base64 for JSON transport. Reuse the same reference string in the request content.Answers and responsesAccess answers by key and check the primitive before interpreting its fields. Probability keys and legend keys are strings in decoded JSON.Common typesThe client sends JSON-compatible dictionaries, lists, strings, numbers, booleans and null. Convert dates to ISO strings and binary data to an asset before serialization.RetriesThe downloadable client sends one request per call. Consider a bounded retry for a transient read on the models endpoint. Repeating inference may consume credits if the first response was lost.ExceptionsHTTPError carries the HTTP status and an error body. URLError describes connection failures. Avoid logging request headers or raw private inputs.ConfigurationNGILA_API_KEY supplies the default credential. The default origin is https://api.ngila.ai and the HTTP timeout is 100 seconds. Supply the base URL only for an environment that you control.