Console ↗

Simple memory system

Separate a durable preference from a one-off instruction before adding it to a profile.

Input and workflow

Write a preference only when the user expressed a durable intention. Store its scope with its source and let the user correct it later.

Request

{
  "model": "ngila-judge",
  "state": "Use a window seat for this flight only.",
  "questions": {
    "durable": {
      "type": "noul",
      "instructions": "Did the passenger state a preference for future bookings?"
    },
    "scope": {
      "type": "choice",
      "instructions": "Which time span applies?",
      "criteria": {
        "this trip": "",
        "future trips": "",
        "unclear": ""
      }
    }
  }
}

Open request in Playground →

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 = 'Use a window seat for this flight only.'
questions = {'durable': {'type': 'noul',
             'instructions': 'Did the passenger state a preference for future '
                             'bookings?'},
 'scope': {'type': 'choice',
           'instructions': 'Which time span applies?',
           'criteria': {'this trip': '', 'future trips': '', 'unclear': ''}}}

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.

remember = a["durable"]["noul"] >= threshold and a["scope"]["choice"] == "future trips"

Browse cookbooks · System One request and response