Examples menu

Examples / Fill in forms

Choose from a set of options

The AI picks a choice field's option from the person's words, using a description of what each option means.

When the AI fills a select or radio field, it can only pick one of the field's options, never write something else. It also says how sure it is (see Leave unsure answers to the person).

Before picking an option, the AI checks whether the text says anything about the field at all, using the field's label as the question. So write the label as a question the text itself answers ("What is it about?", not "Which team should handle it?"); otherwise the AI may decide the text does not mention it and leave the field empty.

Option labels alone are often too short to choose well. uagOptionDescriptions adds a sentence to each option saying what it covers, as you would explain it to someone filling in the form; for example, Billing: "Payments, charges, refunds, receipts and prices." It is a JSON object from each option's value to its description.

Try the samples. Each fits a single option, but only once you read the option descriptions: a receipt with the wrong amount is Billing, and an export that comes out empty is Product. How urgent is it? works the same way.

Turn it on

json
{
  "title": "Example: Choose from a set of options",
  "name": "exampleChooseFromOptions",
  "path": "example-choose-from-options",
  "type": "form",
  "display": "form",
  "tags": [
    "uag"
  ],
  "properties": {
    "description": "A general request, routed to the team that handles it."
  },
  "components": [
    {
      "type": "textarea",
      "key": "description",
      "label": "Describe your request",
      "input": true,
      "placeholder": "Tell us what you need, in your own words.",
      "rows": 4,
      "validate": {
        "required": true
      },
      "properties": {
        "uag": "route",
        "uagField": "input"
      }
    },
    {
      "type": "radio",
      "key": "team",
      "label": "What is it about?",
      "input": true,
      "values": [
        {
          "label": "Billing",
          "value": "billing"
        },
        {
          "label": "Access",
          "value": "access"
        },
        {
          "label": "Product",
          "value": "product"
        },
        {
          "label": "General",
          "value": "general"
        }
      ],
      "properties": {
        "uag": "route",
        "uagOptionDescriptions": "{\"billing\": \"Payments, charges, refunds, receipts and prices.\", \"access\": \"Signing in, passwords, locked accounts and permissions.\", \"product\": \"How something works, what it can do, errors in it, and ideas to improve it.\", \"general\": \"Anything else, such as opening hours or how to reach a person.\"}"
      }
    },
    {
      "type": "radio",
      "key": "urgency",
      "label": "How urgent is it?",
      "input": true,
      "values": [
        {
          "label": "Low",
          "value": "low"
        },
        {
          "label": "Normal",
          "value": "normal"
        },
        {
          "label": "Urgent",
          "value": "urgent"
        }
      ],
      "properties": {
        "uag": "route",
        "uagOptionDescriptions": "{\"low\": \"Nothing is blocked; an answer within a week is fine.\", \"normal\": \"Something is harder than it should be; an answer within a day or two.\", \"urgent\": \"Work is stopped, or a deadline is close.\"}"
      }
    },
    {
      "type": "button",
      "key": "submit",
      "label": "Submit",
      "action": "submit",
      "input": true
    }
  ]
}

Try it

Samples:
Example: Choose from a set of options

Read about it in the developer docs