refs #739: govern Smilegate few-shot references

This commit is contained in:
devmrko
2026-07-28 12:17:21 +09:00
parent 6d98931ce1
commit 154572c885
7 changed files with 331 additions and 14 deletions

View File

@@ -363,7 +363,7 @@ class McpSseServiceTest {
this.topK = topK;
return new VectorSearchResult(question, topK, java.util.List.of(new VectorExample(
42L, "active user count", "SELECT COUNT(*) FROM APP_USER", "AU count",
"cohere.embed-v4.0", 0.12
"cohere.embed-v4.0", "SQL_TEMPLATE", "ANY", null, 0.12
)));
}
@@ -372,7 +372,7 @@ class McpSseServiceTest {
this.bearerToken = bearerToken;
this.question = question;
this.answerSql = answerSql;
return new VectorStoreResult(77L, question, "cohere.embed-v4.0");
return new VectorStoreResult(77L, question, "cohere.embed-v4.0", "DRAFT");
}
}

View File

@@ -17,6 +17,9 @@ class SelectAiFewShotPromptTest {
"SELECT COUNT(*) AS AU_COUNT FROM APP_USER",
"AU count",
"cohere.embed-v4.0",
"SQL_TEMPLATE",
"SINGLE",
"GAME_USER_MASTER",
0.01
))
);
@@ -29,4 +32,27 @@ class SelectAiFewShotPromptTest {
.contains("do not infer a default game")
.contains("Continue a game-neutral question with approved common objects");
}
@Test
void rendersNoTargetExamplesAsBoundaryRatherThanSqlPattern() {
String prompt = SelectAiService.composeFewShotPrompt(
"common user count without a game",
List.of(new QaVectorService.VectorExample(
5L,
"common user count without a game",
"SELECT CAST(NULL AS NUMBER) FROM DUAL WHERE 1 = 0",
"Do not select a game-scoped object when the target plan is NONE.",
"cohere.embed-v4.0",
"NO_TARGET",
"NONE",
null,
0.01
))
);
assertThat(prompt)
.contains("Boundary outcome")
.contains("Do not select a game-scoped object")
.doesNotContain("SELECT CAST(NULL AS NUMBER)");
}
}