Class FormFiller

java.lang.Object
com.vaadin.flow.ai.formfiller.FormFiller

public class FormFiller extends Object
FormFiller component that using AI ChatGPT fills automatically from a natural language input text a component or group of components (layout).
Components supported:
  • TextField
  • EmailField
  • PasswordField
  • NumberField
  • IntegerField
  • BigDecimalField
  • DatePicker
  • TimePicker
  • DateTimePicker
  • TextArea
  • Checkbox
  • CheckboxGroup
  • RadioButtonGroup
  • ComboBox
  • MultiSelectComboBox
  • Grid
To make a component available for the FormFiller, the component must have an id, and it should be meaningful to be understood by the AI module.

TextField textField = new TextField();
textField.setId("name");

FormLayout fl = new FormLayout();
fl.add(textField);

FormFiller formFiller = new FormFiller(fl);
formFiller.fill("My name is John");

The text field will be filled with "John".
Author:
Vaadin Ltd.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FormFiller(com.vaadin.flow.component.Component target)
    Creates a FormFiller with default llmService, empty field instructions and empty context instructions.
    FormFiller(com.vaadin.flow.component.Component target, LLMService llmService)
    Creates a FormFiller with empty context instructions and empty context instructions with the given llmService.
    FormFiller(com.vaadin.flow.component.Component target, List<String> contextInstructions)
    Creates a FormFiller with default llmService and empty field instructions.
    FormFiller(com.vaadin.flow.component.Component target, Map<com.vaadin.flow.component.Component,String> componentInstructions)
    Creates a FormFiller with default llmService and empty context instructions.
    FormFiller(com.vaadin.flow.component.Component target, Map<com.vaadin.flow.component.Component,String> componentInstructions, List<String> contextInstructions)
    Creates a FormFiller with default llmService.
    FormFiller(com.vaadin.flow.component.Component target, Map<com.vaadin.flow.component.Component,String> componentInstructions, List<String> contextInstructions, LLMService llmService)
    Creates a FormFiller to fill the target component or group of components (layout) and includes additional instructions for the AI module (i.e.: field format, field context, etc...)
  • Method Summary

    Modifier and Type
    Method
    Description
    fill(String input)
    Fills automatically the target component analyzing the input source
    Map<com.vaadin.flow.component.Component,String>
     
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FormFiller

      public FormFiller(com.vaadin.flow.component.Component target, Map<com.vaadin.flow.component.Component,String> componentInstructions, List<String> contextInstructions, LLMService llmService)
      Creates a FormFiller to fill the target component or group of components (layout) and includes additional instructions for the AI module (i.e.: field format, field context, etc...)
      Parameters:
      target - the target component or group of components (layout) to fill
      componentInstructions - additional instructions for the AI module (i.e.: field format, field explanation, etc...). Use these instructions to provide additional information to the AI module about a specific field when the response of the form filler is not accurate enough.
      contextInstructions - additional instructions for the AI module (i.e.: target language, vocabulary explanation, etc..). Use these instructions to provide additional information to the AI module about the context of the input source in general.
      llmService - the AI module service to use. By default, this service would use OpenAI ChatGPT.
      Throws:
      ExperimentalFeatureException - when the FeatureFlags.FORM_FILLER_ADDON feature is not enabled
    • FormFiller

      public FormFiller(com.vaadin.flow.component.Component target, Map<com.vaadin.flow.component.Component,String> componentInstructions, List<String> contextInstructions)
      Creates a FormFiller with default llmService. Check FormFiller for more information.
    • FormFiller

      public FormFiller(com.vaadin.flow.component.Component target, Map<com.vaadin.flow.component.Component,String> componentInstructions)
      Creates a FormFiller with default llmService and empty context instructions. Check FormFiller for more information.
    • FormFiller

      public FormFiller(com.vaadin.flow.component.Component target, List<String> contextInstructions)
      Creates a FormFiller with default llmService and empty field instructions. Check FormFiller for more information.
    • FormFiller

      public FormFiller(com.vaadin.flow.component.Component target)
      Creates a FormFiller with default llmService, empty field instructions and empty context instructions. Check FormFiller for more information.
    • FormFiller

      public FormFiller(com.vaadin.flow.component.Component target, LLMService llmService)
      Creates a FormFiller with empty context instructions and empty context instructions with the given llmService. Check FormFiller for more information.
  • Method Details

    • fill

      public FormFillerResult fill(String input)
      Fills automatically the target component analyzing the input source
      Parameters:
      input - Text input to send to the AI module
      Returns:
      result of the query including request and response
    • getComponentInstructions

      public Map<com.vaadin.flow.component.Component,String> getComponentInstructions()
    • getContextInstructions

      public List<String> getContextInstructions()
    • getMapping

      public ComponentUtils.ComponentsMapping getMapping()