Solon v4.0.2

solon-ai-talent-text2sql

</> markdown
2026年6月10日 下午10:52:39
<dependency>
    <groupId>org.noear</groupId>
    <artifactId>solon-ai-talent-text2sql</artifactId>
</dependency>

1、描述

Solon AI 才能扩展,提供 text2sql 能力的才能。。内置有 Text2SqlTalent

  • Text2SqlTalent: 智能 Text-to-SQL 专家才能。实现自然语言到结构化查询的桥接。

2、应用示例

可以根据业务情况,copy Text2SqlTalent 代码进一步定制。

Text2SqlTalent sqlTalent= new Text2SqlTalent(dataSource, "users", "orders", "order_refunds")
                .maxRows(50); // 限制返回行数,保护内存

ChatModel agent = ChatModel.of("https://api.moark.com/v1/chat/completions")
        .apiKey("***")
        .model("Qwen3-32B")
        .role("财务数据分析师")
        .instruction("你负责分析订单与退款数据。金额单位均为元。")
        .defaultTalentAdd(sqlTalent) // 注入 SQL 才能
        .build();

AssistantMessage resp = agent.prompt("去年消费最高的 VIP 客户是谁?")
        .call()
        .getMessage();