Skip to content

Commit 1514e2e

Browse files
committed
fix: prompt builder misleading LLM to return free text amongst A2UI messages
1 parent 9bde5d3 commit 1514e2e

9 files changed

+9
-9
lines changed

packages/genui/lib/src/facade/prompt_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ To update an existing UI:
311311
_fenced('''
312312
When constructing UI, you must output a VALID A2UI JSON object representing one of the A2UI message types ($_operationsFormatted).
313313
- You can treat the A2UI schema as a specification for the JSON you typically output.
314-
- You may include a brief conversational explanation before or after the JSON block if it helps the user, but the JSON block must be valid and complete.
314+
- The JSON block must be valid and complete.
315315
- Ensure your JSON is fenced with ```json and ```.
316316
''', sectionName: 'OUTPUT FORMAT'),
317317
);

packages/genui/test/facade/prompt_builder_test.golden/all_operations_with_dataModel_false.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ To update an existing UI:
119119
-----OUTPUT_FORMAT_START-----
120120
When constructing UI, you must output a VALID A2UI JSON object representing one of the A2UI message types (`createSurface`, `updateComponents`, `deleteSurface`).
121121
- You can treat the A2UI schema as a specification for the JSON you typically output.
122-
- You may include a brief conversational explanation before or after the JSON block if it helps the user, but the JSON block must be valid and complete.
122+
- The JSON block must be valid and complete.
123123
- Ensure your JSON is fenced with ```json and ```.
124124
-----OUTPUT_FORMAT_END-----
125125

packages/genui/test/facade/prompt_builder_test.golden/all_operations_with_dataModel_true.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ To update an existing UI:
121121
-----OUTPUT_FORMAT_START-----
122122
When constructing UI, you must output a VALID A2UI JSON object representing one of the A2UI message types (`createSurface`, `updateComponents`, `deleteSurface`, `updateDataModel`).
123123
- You can treat the A2UI schema as a specification for the JSON you typically output.
124-
- You may include a brief conversational explanation before or after the JSON block if it helps the user, but the JSON block must be valid and complete.
124+
- The JSON block must be valid and complete.
125125
- Ensure your JSON is fenced with ```json and ```.
126126
-----OUTPUT_FORMAT_END-----
127127

packages/genui/test/facade/prompt_builder_test.golden/create_and_update_with_dataModel_false.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ To update an existing UI:
117117
-----OUTPUT_FORMAT_START-----
118118
When constructing UI, you must output a VALID A2UI JSON object representing one of the A2UI message types (`createSurface`, `updateComponents`).
119119
- You can treat the A2UI schema as a specification for the JSON you typically output.
120-
- You may include a brief conversational explanation before or after the JSON block if it helps the user, but the JSON block must be valid and complete.
120+
- The JSON block must be valid and complete.
121121
- Ensure your JSON is fenced with ```json and ```.
122122
-----OUTPUT_FORMAT_END-----
123123

packages/genui/test/facade/prompt_builder_test.golden/create_and_update_with_dataModel_true.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ To update an existing UI:
119119
-----OUTPUT_FORMAT_START-----
120120
When constructing UI, you must output a VALID A2UI JSON object representing one of the A2UI message types (`createSurface`, `updateComponents`, `updateDataModel`).
121121
- You can treat the A2UI schema as a specification for the JSON you typically output.
122-
- You may include a brief conversational explanation before or after the JSON block if it helps the user, but the JSON block must be valid and complete.
122+
- The JSON block must be valid and complete.
123123
- Ensure your JSON is fenced with ```json and ```.
124124
-----OUTPUT_FORMAT_END-----
125125

packages/genui/test/facade/prompt_builder_test.golden/create_only_with_dataModel_false.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ IMPORTANT: DO NOT update or modify surfaces created in previous turns. If the UI
116116
-----OUTPUT_FORMAT_START-----
117117
When constructing UI, you must output a VALID A2UI JSON object representing one of the A2UI message types (`createSurface`, `updateComponents`).
118118
- You can treat the A2UI schema as a specification for the JSON you typically output.
119-
- You may include a brief conversational explanation before or after the JSON block if it helps the user, but the JSON block must be valid and complete.
119+
- The JSON block must be valid and complete.
120120
- Ensure your JSON is fenced with ```json and ```.
121121
-----OUTPUT_FORMAT_END-----
122122

packages/genui/test/facade/prompt_builder_test.golden/create_only_with_dataModel_true.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ IMPORTANT: DO NOT update or modify surfaces created in previous turns. If the UI
118118
-----OUTPUT_FORMAT_START-----
119119
When constructing UI, you must output a VALID A2UI JSON object representing one of the A2UI message types (`createSurface`, `updateComponents`, `updateDataModel`).
120120
- You can treat the A2UI schema as a specification for the JSON you typically output.
121-
- You may include a brief conversational explanation before or after the JSON block if it helps the user, but the JSON block must be valid and complete.
121+
- The JSON block must be valid and complete.
122122
- Ensure your JSON is fenced with ```json and ```.
123123
-----OUTPUT_FORMAT_END-----
124124

packages/genui/test/facade/prompt_builder_test.golden/update_only_with_dataModel_false.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ To update an existing UI:
109109
-----OUTPUT_FORMAT_START-----
110110
When constructing UI, you must output a VALID A2UI JSON object representing one of the A2UI message types (`updateComponents`).
111111
- You can treat the A2UI schema as a specification for the JSON you typically output.
112-
- You may include a brief conversational explanation before or after the JSON block if it helps the user, but the JSON block must be valid and complete.
112+
- The JSON block must be valid and complete.
113113
- Ensure your JSON is fenced with ```json and ```.
114114
-----OUTPUT_FORMAT_END-----
115115

packages/genui/test/facade/prompt_builder_test.golden/update_only_with_dataModel_true.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ To update an existing UI:
111111
-----OUTPUT_FORMAT_START-----
112112
When constructing UI, you must output a VALID A2UI JSON object representing one of the A2UI message types (`updateComponents`, `updateDataModel`).
113113
- You can treat the A2UI schema as a specification for the JSON you typically output.
114-
- You may include a brief conversational explanation before or after the JSON block if it helps the user, but the JSON block must be valid and complete.
114+
- The JSON block must be valid and complete.
115115
- Ensure your JSON is fenced with ```json and ```.
116116
-----OUTPUT_FORMAT_END-----
117117

0 commit comments

Comments
 (0)