refs #731: enrich Text2SQL prompts with QA examples

This commit is contained in:
devmrko
2026-07-24 15:59:41 +09:00
parent c8fa6af679
commit 3fcd699d92
7 changed files with 138 additions and 8 deletions

View File

@@ -196,7 +196,7 @@ class McpSseServiceTest {
private boolean showpromptCalled;
private CapturingSelectAiService() {
super(null, null, null, new ObjectMapper());
super(null, null, null, new ObjectMapper(), null);
}
@Override

View File

@@ -0,0 +1,30 @@
package com.cloudhandson.vpdbackoffice.service;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import org.junit.jupiter.api.Test;
class SelectAiFewShotPromptTest {
@Test
void includesVerifiedExamplesBeforeTheOriginalQuestion() {
String prompt = SelectAiService.composeFewShotPrompt(
"current active users",
List.of(new QaVectorService.VectorExample(
7L,
"active users by game",
"SELECT COUNT(*) AS AU_COUNT FROM APP_USER",
"AU count",
"cohere.embed-v4.0",
0.01
))
);
assertThat(prompt)
.contains("Verified few-shot examples")
.contains("SELECT COUNT(*) AS AU_COUNT FROM APP_USER")
.contains("Original user question:\ncurrent active users")
.contains("current approved object list and policy");
}
}