refs #731: enrich Text2SQL prompts with QA examples
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user