Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public ToolResultBlock getTableSchema(
columnSemanticService.getMergedTableSchema(
datasource.getId(), tableName);
return ToolResultBlock.text(
SemanticUtils.formatTableSchema(tableName, columns));
SemanticUtils.formatTableSchema(tableName, columns)
+ ToolCallConstants.METRIC_CALIBER_REMINDER);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ public ToolResultBlock getTables(
dataSourceService.getDatasourceForSession(ctx.sessionId());
return ToolResultBlock.text(
JsonUtils.getJsonCodec()
.toJson(
tableSemanticService.listMergedTablesByDomains(
dataSource.getId(), domains)));
.toJson(
tableSemanticService.listMergedTablesByDomains(
dataSource.getId(), domains))
+ ToolCallConstants.METRIC_CALIBER_REMINDER);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ private ToolCallConstants() {

public static final String SUCCESS = "SUCCESS";

/**
* 追加在 get_tables / get_table_schema 的返回结果末尾。模型写 SQL 前基本必看表结构,
* 在那个时机提醒「先确认指标口径」比在 system prompt 里说更准——此时它正准备动笔。
* 数据源没定义任何指标时,get_metric_caliber 会回「未定义」,模型自然跳过。
*/
public static final String METRIC_CALIBER_REMINDER =
"""
If the question involves a business metric, call get_metric_caliber to confirm its \
caliber before writing SQL.\
""";

public static final String SEPARATOR = ": ";

public static final String SUCCESS_PREFIX = SUCCESS + SEPARATOR;
Expand Down
Loading