Directory

← Back

Auto Form Filler

AutoFormFiller is a Java-based web application that uses Vaadin components and OpenAI GPT-3.5 (or provided AI webservice call) to automatically fill out forms based on user prompts.

Author

Rating

Popularity

100+

AutoFormFiller is a cutting-edge web application that harnesses the capabilities of OpenAI's GPT-3.5 to fill out forms automatically based on user prompts. These prompts can be derived from parsed emails, speech-to-text conversions, or users typing plain English in a text box. Developed on the Vaadin framework, AutoFormFiller seamlessly integrates with numerous Vaadin components such as TextField, ComboBox, Checkbox, DatePicker, and Grid. This innovative application is designed to enhance the efficiency and accuracy of data entry tasks while minimizing manual effort. Its adaptable and extensible architecture allows it to accommodate a wide range of use cases, making AutoFormFiller an indispensable tool for businesses and developers alike.

Sample code

In this code, you can see that each form field has an ID assigned using the setId() method. 
This is a crucial step for the GPT-3.5 based AutoFormFiller to function correctly. 
Setting an ID for each form field allows the GPT-3.5 model to recognize and map the corresponding data from the JSON response to the appropriate form fields.

package org.vaadin.addons.pandalyte.customerOrders;

import org.vaadin.addons.pandalyte.AutoFormFiller;

import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.formlayout.FormLayout;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.router.Route;

// This is the CustomerOrdersView class which represents the UI for creating customer orders.
@Route("customer-orders-example")
public class CustomerOrdersView extends VerticalLayout {

    public CustomerOrdersView() {
        setWidthFull();

        // Read the GPT_API_KEY from the environment variable.
        String apiKey = System.getProperty("GPT_API_KEY");

        // Create a form layout for the customer orders form.
        FormLayout customerOrdersForm = new FormLayout();

        // Add the name TextField and set its ID.
        TextField nameField = new TextField("Name");
        nameField.setId("name");
        customerOrdersForm.add(nameField);

        // Add the address TextField and set its ID.
        TextField addressField = new TextField("Address");
        addressField.setId("address");
        customerOrdersForm.add(addressField);

        // Add the phone TextField and set its ID.
        TextField phoneField = new TextField("Phone");
        phoneField.setId("phone");
        customerOrdersForm.add(phoneField);

        // Add the email TextField and set its ID.
        TextField emailField = new TextField("Email");
        emailField.setId("email");
        customerOrdersForm.add(emailField);

        // Create a grid to display order details.
        Grid<Order> orderGrid = new Grid<>(Order.class);
        orderGrid.removeAllColumns();
        orderGrid.addColumn(Order::getOrderNumber).setHeader("Order Number");
        orderGrid.addColumn(Order::getItemName).setHeader("Item Name");
        orderGrid.addColumn(Order::getOrderDate).setHeader("Order Date");
        orderGrid.addColumn(Order::getOrderStatus).setHeader("Order Status");
        orderGrid.addColumn(Order::getOrderTotal).setHeader("Order Total");
        orderGrid.setId("orders");

        // Add the order grid to the customer orders form.
        customerOrdersForm.add(orderGrid);

        // Initialize an AutoFormFiller instance with the customer orders form and the
        // API key.
        AutoFormFiller autoFormFiller = new AutoFormFiller(customerOrdersForm, apiKey);
        autoFormFiller.setId("supportProfile");

        // Add the AutoFormFiller instance to the layout.
        add(autoFormFiller);

        // Define a user prompt to describe the customer and order details.
// A use case could be transcribed text from a phone call. Or an email. Or user's input into a text area and having AutoFormFiller fill out the text for the user.
        String userPrompt = "I want to create a customer 'John Smith' who lives at "
                + "'1234 Elm Street, Springfield' and can be reached at phone number '555-1234' and "
                + "email 'johnsmith@example.com'. John has placed 3 orders. The first order "
                + "(Order Number 1001) contains 2 items of 'Smartphone' for a total of $1000, placed on "
                + "'2023-01-10' with a status of 'Delivered'. The second order (Order Number 1002) "
                + "includes 1 item of 'Laptop' with a total of $1500, placed on '2023-02-15' with a "
                + "status of 'In Transit'. The third order (Order Number 1003) consists of 5 items of "
                + "'Wireless Headphones' for a total of $500, placed on '2023-03-20' with a status of "
                + "'Cancelled'. Fill out the customer details and orders in the form.";

        // Create a "Process" button with a click listener.
        // When the button is clicked, it will call the autoFill method of the
        // AutoFormFiller instance
        // with the user prompt and the mapping instructions for filling the form.
        add(new Button("Process", event -> {
            autoFormFiller.autoFill(userPrompt,
                    "Fill out N/A in the JSON value if the user did not specify a value. "
                            + "Map 'total' to 'orderTotal' as a Double. "
                            + "Map 'status' to 'orderStatus'. "
                            + "Map 'orderNumber' to a string. "
                            + "Map 'item' to 'itemName'.");
        }));

    }
}

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Release Notes - AutoFormFiller v1.0.0

We are excited to announce the initial release of the AutoFormFiller! This innovative application leverages the power of GPT-3.5 to automatically fill out forms based on user prompts and instructions.

Features

  • AutoFormFiller Component: This release introduces the AutoFormFiller component that can be easily integrated into your Vaadin applications.
  • GPT-3.5 Model Integration: Harness the power of GPT-3.5 to process user prompts and fill out forms automatically.
  • Customizable GPT-3.5 Providers: Easily switch between GPT-3.5 providers by extending the AiServiceProvider interface.
  • Support for Common Vaadin Components: Built-in support for commonly used Vaadin components such as TextField, ComboBox, Checkbox, and DatePicker.
  • Grid Support: Automatically populate Grid components with data using GPT-3.5 generated responses.
  • User-friendly Interface: Provides a simple and intuitive interface for users to generate and fill out forms.
Released
2023-04-14
Maturity
STABLE
License
MIT License

Compatibility

Framework
Vaadin 23+
Browser
Browser Independent

Auto Form Filler - Vaadin Add-on Directory

AutoFormFiller is a Java-based web application that uses Vaadin components and OpenAI GPT-3.5 (or provided AI webservice call) to automatically fill out forms based on user prompts. Auto Form Filler - Vaadin Add-on Directory
AutoFormFiller is a cutting-edge web application that harnesses the capabilities of OpenAI's GPT-3.5 to fill out forms automatically based on user prompts. These prompts can be derived from parsed emails, speech-to-text conversions, or users typing plain English in a text box. Developed on the Vaadin framework, AutoFormFiller seamlessly integrates with numerous Vaadin components such as TextField, ComboBox, Checkbox, DatePicker, and Grid. This innovative application is designed to enhance the efficiency and accuracy of data entry tasks while minimizing manual effort. Its adaptable and extensible architecture allows it to accommodate a wide range of use cases, making AutoFormFiller an indispensable tool for businesses and developers alike.
Online