Solon v4.0.2

solon-ai-talent-web

</> markdown
2026年6月10日 下午11:03:08
<dependency>
    <groupId>org.noear</groupId>
    <artifactId>solon-ai-talent-web</artifactId>
</dependency>

1、描述

Solon AI 才能扩展,提供 web 才能。内置有:

Talent说明适用场景
WebCrawlerDriverTalent网页爬取,将 HTML 转为 LLM 友好的 Markdown(需要定置)获取指定 URL 的网页内容
WebSearchDriverTalent实时联网搜索,返回结构化搜索结果(需要定置)检索互联网上的最新信息
CodeSearchTalent基于 Exa Code Mcp 的代码搜索获取编程相关的代码示例和文档
WebfetchTalentWeb 抓取工具 (类似 curl)获取网页内容
WebsearchTalentWeb 搜索工具 (基于 Exa Mcp 实现)获取编程相关的代码示例和文档

2、应用示例

  • WebCrawlerDriverTalent
import org.noear.solon.ai.chat.ChatModel;
import org.noear.solon.ai.talents.crawler.WebCrawlerDriverTalent;
import org.noear.solon.ai.talents.search.WebSearchDriverTalent;

// 创建网页爬取 Talent(使用 Jina 驱动)
WebCrawlerDriverTalent crawler = new WebCrawlerDriverTalent(
        WebCrawlerDriverTalent.JINA, "your-jina-api-key");

// 使用 Firecrawl 驱动
WebCrawlerDriverTalent crawler2 = new WebCrawlerDriverTalent(
        WebCrawlerDriverTalent.FIRECRAWL, "your-firecrawl-api-key");

// 构建智能体
ChatModel agent = ChatModel.of("https://api.openai.com/v1/chat/completions")
        .apiKey("your-api-key")
        .model("gpt-4o")
        .defaultTalentAdd(crawler)
        .build();

agent.prompt("请读取 https://example.com/article 的内容并总结要点").call();
  • CodeSearchTool / WebsearchTool / WebfetchTool
SimpleAgent agent = SimpleAgent.of(LlmUtil.getChatModel())
        .role("研究助理")
        .defaultTalentAdd(new CodeSearchTool())
        .defaultTalentAdd(new WebsearchTool())
        .defaultTalentAdd(new WebfetchTool())
        .build();
 
String query = "请帮我搜索关于 '2026年AI Agent的发展趋势'," +
                "并点击其中一个最有价值的搜索结果链接进行深度抓取,最后给我一个 300 字以内的总结。";

agent.prompt(query).call();