pass previous tool context into few-shot query
This commit is contained in:
@@ -144,6 +144,10 @@ public class McpSseService {
|
||||
if (fewShotNl2SqlToolName().equals(toolView.name())) {
|
||||
addStringProperty(properties, "scopeGameKey",
|
||||
"선택 사항입니다. game_scope_resolve가 반환한 SUPPORTED gameKey만 전달하세요.", 128);
|
||||
ObjectNode plan = properties.putObject("queryPlan");
|
||||
plan.put("type", "object");
|
||||
plan.put("description", "앞 단계 game_query_plan의 구조화된 결과입니다.");
|
||||
plan.putObject("additionalProperties").put("type", "object");
|
||||
}
|
||||
required.add("prompt");
|
||||
}
|
||||
@@ -207,8 +211,9 @@ public class McpSseService {
|
||||
response = queryTool
|
||||
? selectAiService.generateAndExecute(token, prompt)
|
||||
: fewShotNl2SqlTool
|
||||
? selectAiService.generateAndExecute(token, prompt,
|
||||
arguments.path("scopeGameKey").asText(""))
|
||||
? selectAiService.generateAndExecute(token, prompt,
|
||||
arguments.path("scopeGameKey").asText(""),
|
||||
arguments.path("queryPlan"))
|
||||
: selectAiService.generatePrompt(token, prompt);
|
||||
}
|
||||
} catch (VpdTokenAccessDeniedException ignored) {
|
||||
|
||||
@@ -115,6 +115,13 @@ public class SelectAiService {
|
||||
return response;
|
||||
}
|
||||
|
||||
public JsonNode generateAndExecute(
|
||||
String bearerToken, String prompt, String scopeGameKey, JsonNode priorToolContext) {
|
||||
String context = priorToolContext == null || priorToolContext.isMissingNode()
|
||||
|| priorToolContext.isNull() ? "" : "\n[PREVIOUS TOOL RESULT]\n" + priorToolContext;
|
||||
return generateAndExecute(bearerToken, prompt + context, scopeGameKey);
|
||||
}
|
||||
|
||||
private GameContext resolveGameContext(String bearerToken, String question) {
|
||||
try {
|
||||
List<GameCatalogVectorService.GameCandidate> candidates =
|
||||
|
||||
Reference in New Issue
Block a user