Examples / Fill in forms
Fill a form from a description
A person describes what they need in their own words, and the form's other fields fill themselves in from it.
Agent Input, part of the UAG's browser library @formio/uag-js, reads what the person wrote in one field (Describe your request) and fills in the rest of the form from it. You choose which fields it fills by giving each one the same task name in its uag property (here fill), and you mark the field to read with uagField: "input".
The AI only fills the fields in; the person can change any of them. Nothing is saved until the person checks the form and submits it, and the form's own validation applies to every value, whoever entered it.
Try it: type a request and click outside the box, or pick a sample, to see the form fill in. The What the UAG did panel beside the form shows the request to the UAG and what the AI returned for each field.
Turn it on
{
"title": "Example: Fill a form from a description",
"name": "exampleFillFromDescription",
"path": "example-fill-from-description",
"type": "form",
"display": "form",
"tags": [
"uag"
],
"properties": {
"description": "A general request: who sent it, when, what it is about, and the amount involved, filled in from the sender's own description."
},
"components": [
{
"type": "textarea",
"key": "description",
"label": "Describe your request",
"placeholder": "Tell us what you need, in your own words.",
"rows": 4,
"input": true,
"validate": {
"required": true
},
"properties": {
"uag": "fill",
"uagField": "input"
}
},
{
"type": "textfield",
"key": "name",
"label": "Name",
"input": true,
"validate": {
"required": true
},
"properties": {
"uag": "fill"
}
},
{
"type": "email",
"key": "email",
"label": "Email",
"input": true,
"validate": {
"required": true
},
"properties": {
"uag": "fill"
}
},
{
"type": "select",
"key": "topic",
"label": "Topic",
"input": true,
"dataSrc": "values",
"data": {
"values": [
{
"label": "Question",
"value": "question"
},
{
"label": "Problem",
"value": "problem"
},
{
"label": "Request",
"value": "request"
},
{
"label": "Feedback",
"value": "feedback"
}
]
},
"validate": {
"required": true
},
"properties": {
"uag": "fill"
}
},
{
"type": "day",
"key": "date",
"label": "Date it happened",
"input": true,
"properties": {
"uag": "fill"
}
},
{
"type": "currency",
"key": "amount",
"label": "Amount involved",
"currency": "USD",
"input": true,
"properties": {
"uag": "fill"
}
},
{
"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-fill-from-description');
</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.