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
{
"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
}
]
}<link rel="stylesheet" href="https://ai.form.io/uag-js/uag-js.css">
<script src="https://cdn.jsdelivr.net/npm/@formio/js@5.6.1/dist/formio.full.min.js"></script>
<!-- Registers @formio/uag-js with this UAG: forms tagged uag save through it, and get Agent Input and the chat. -->
<script src="https://ai.form.io/uag-js/uag.use.js"></script>
<div id="form"></div>
<script>
Formio.createForm(document.getElementById('form'), 'https://uag.form.io/example-choose-from-options');
</script>Try it
Start the live examples
The examples call real models. Starting them signs you in as a temporary guest of the examples' project, for every example; what you enter is deleted after a day.
Not supported without a license
This demo needs a license (LICENSE_KEY) that includes the UAG, or a 30-day free trial project on portal.form.io. This deployment has neither: it serves an Open Source project, or its UAG is unlicensed.
The chat widget examples work everywhere, with no license.