Skip to content

docs: update form filler article based on value options refactor#5754

Open
ugur-vaadin wants to merge 1 commit into
mainfrom
docs-update-form-filler-article-based-on-value-options-refactor
Open

docs: update form filler article based on value options refactor#5754
ugur-vaadin wants to merge 1 commit into
mainfrom
docs-update-form-filler-article-based-on-value-options-refactor

Conversation

@ugur-vaadin

Copy link
Copy Markdown
Contributor

This PR updates the form filler article based on value options API refactor.

Follow-up to vaadin/flow-components#9564

@github-actions

Copy link
Copy Markdown

Preview Deployment

This PR has been deployed for preview.

URL: https://docs-preview-pr-5754.fly.dev

Changed pages

Added content is highlighted in green; removed content is marked in red on each page.

Built from 62e3298

Selection fields like [classname]`ComboBox`, [classname]`Select`, [classname]`MultiSelectComboBox`, and [classname]`CheckboxGroup` take a value from a known set. [methodname]`fieldValueOptions()` registers that set with the controller, and the labels are presented to the LLM as the field's choices. When the LLM picks a label, the controller resolves it to the field's value type and writes the result to the field.
Selection fields like [classname]`ComboBox`, [classname]`Select`, [classname]`MultiSelectComboBox`, and [classname]`CheckboxGroup` take a value from a known set. [methodname]`fieldValueOptions()` registers that set with the controller.

The registration carries the field's domain items. The controller renders each item to an LLM-facing label through the field's own [methodname]`setItemLabelGenerator()`. When the LLM picks a label, the controller applies the same labeler to the registered items and writes the matching one back.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The registration carries the field's domain items. The controller renders each item to an LLM-facing label through the field's own [methodname]`setItemLabelGenerator()`. When the LLM picks a label, the controller applies the same labeler to the registered items and writes the matching one back.
The registration carries the field's domain items. The controller renders each item into an LLM-facing label through the field's own [methodname]`setItemLabelGenerator()`. When the LLM picks a label, the controller applies the same labeler to the registered items and writes the matching one back.

ValueOptions.forField(projectField).options(projects));
----

The LLM sees project names. When it picks one, the controller writes the matching [classname]`Project` instance to the field.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The LLM sees project names. When it picks one, the controller writes the matching [classname]`Project` instance to the field.
In the above example, the LLM sees project names. When it picks one, the controller writes the matching [classname]`Project` instance to the field.

----

The converter runs once per chosen label, and the resolved values are written to the field as a set.
The selected items are written to the field as a set, in the order the LLM returned them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The selected items are written to the field as a set, in the order the LLM returned them.
The selected items are written to the field as a set, in the order returned by the LLM.

.itemLabelGenerator(Project::code));
----

The explicit generator overrides the field's for both the labels surfaced to the LLM and the lookup that resolves a chosen label back to an item. The field's UI continues to render through its own generator.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The explicit generator overrides the field's for both the labels surfaced to the LLM and the lookup that resolves a chosen label back to an item. The field's UI continues to render through its own generator.
The explicit generator overrides both the labels surfaced to the LLM and the lookup that resolves a chosen label back to an item. The field's UI continues to render through its own generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants