refs #739: guide no-target few-shot SQL generation

This commit is contained in:
devmrko
2026-07-28 12:49:46 +09:00
parent 5ac9f5d591
commit 0a27ce9cd5
3 changed files with 17 additions and 4 deletions

View File

@@ -447,7 +447,12 @@ public class SelectAiService {
if ("NO_TARGET".equals(example.referenceKind())
|| "OBJECT_UNAVAILABLE".equals(example.referenceKind())) {
String boundary = truncate(example.answer(), MAX_FEW_SHOT_SQL_CHARS);
return boundary.isBlank() ? "" : prefix + "Boundary outcome:\n" + boundary + "\n\n";
String answerSql = truncate(example.answerSql(), MAX_FEW_SHOT_SQL_CHARS);
if (boundary.isBlank() || answerSql.isBlank()) {
return "";
}
return prefix + "Boundary rule:\n" + boundary
+ "\nVerified boundary SQL template:\n" + answerSql + "\n\n";
}
String answerSql = truncate(example.answerSql(), MAX_FEW_SHOT_SQL_CHARS);
return answerSql.isBlank() ? "" : prefix + "Verified SQL template:\n" + answerSql + "\n\n";

View File

@@ -55,8 +55,9 @@ class SelectAiFewShotPromptTest {
);
assertThat(prompt)
.contains("Boundary outcome")
.contains("Boundary rule")
.contains("Do not select a game-scoped object")
.doesNotContain("SELECT CAST(NULL AS NUMBER)");
.contains("SELECT CAST(NULL AS NUMBER)");
}
}