Skip to content

feat: show confidence level on AI field marker - #9901

Open
tomivirkki wants to merge 12 commits into
mainfrom
feat/form-ai-marker-confidence
Open

feat: show confidence level on AI field marker#9901
tomivirkki wants to merge 12 commits into
mainfrom
feat/form-ai-marker-confidence

Conversation

@tomivirkki

Copy link
Copy Markdown
Member

Summary

  • A reviewer checking AI-filled values wants to see at a glance which ones the model itself was unsure about. With source tracking enabled, the model already reports a confidence level per filled value, and the AI field marker is the default place to show it.
  • The marker shows the level only when the model reported one: a value without a level means the model did not judge itself, not that it was unsure, so no indicator is shown for it. A refill without a source clears the indicator from the reused marker.
  • No new public API: the marker reflects the source data the controller already tracks.

Depends on #9900 and vaadin/web-components#12436.

Fixes https://github.com/orgs/vaadin/projects/103/views/3?pane=issue&itemId=226179925

🤖 Generated with Claude Code

tomivirkki and others added 12 commits August 18, 2026 14:49
Data model for AI source tracking, shared by all controllers: the
snippets the model read, their page and rectangle when the source has
them, and a confidence level.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Opt-in via FormAIController.setSourceTrackingEnabled. When on, the
fill_form tool description asks the LLM to wrap each value it fills in
an envelope carrying the snippets it read, their locations, and a
confidence level. The reported source is available from
FieldValueChangeEvent.getFieldSource and
FormAIController.getFieldSource, can be restored after a reload with
restoreFieldSource, and lasts as long as the field holds the value it
was reported with. Bad source data is dropped and logged, never
blocking the value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Line-removal and operator mutation over the feature's changed lines
found untested behavior: rect and page boundary values, the page-region
location without a rect, object-shaped extracts, drop-path logging,
null-guard messages, stale-source cleanup on value revert, and
ValueSource extracts normalization.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A fill_form write carrying no source kept the field's earlier entry,
and when the written value matched the one that source was recorded
with, getFieldSource described the new write with a citation it never
had. Every successful write now replaces the source, clearing it when
none was reported.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A page number beyond the int range truncated to its low 32 bits in
asInt() and could pass the range check as a wrong page. Whole-number
floats (e.g. 2.0) are now accepted, consistent with how integer fields
convert values.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Stale entries were dropped only when getFieldSource read them, so an
application consuming sources through the change event alone — or a
field edited and then removed from the form — accumulated entries for
the life of the controller. Behavior of the getters is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The enum said "source" where the wording the LLM sees says
"document"; a reader comparing the two saw different meanings for the
same level.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
When source tracking is on and the model reported a confidence level
for a filled value, the automatic field marker now shows it via the
marker's confidence indicator.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A fill that writes the value the field already had fires no change
event and is never re-marked, but it does replace the source — a marker
kept from an earlier turn kept showing a level the new source did not
include.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

^ Conflicts:
^	vaadin-ai-components-flow-parent/vaadin-ai-extensions-flow/src/main/java/com/vaadin/flow/component/ai/form/FormAIController.java
@tomivirkki
tomivirkki force-pushed the feat/form-ai-marker-confidence branch from e49c5ed to a8a5348 Compare August 18, 2026 12:52
@sonarqubecloud

Copy link
Copy Markdown

Base automatically changed from feat/form-ai-source-tracking to main August 20, 2026 06:03
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.

1 participant