Solon AI 正式发布了(版号,随 Solon v3.3.1)。历时小半年。
1、简介
Solon AI 是一个 Java AI(智能体) 全场景应用开发框架,提供有丰富的接口能力。主要支持的的智能体开发场景有:Chat;RAG;MCP;AiFlow。
其中 ChatModel 是 Solon AI 的核心模型接口(其它暂略),通过方言的方式(ChatDialect)可适配各种环境(或平台)提供的大语言模型。
开源地址:
https://gitee.com/opensolon/solon-ai
2、历时回顾
时间
回顾
2025-01 中
Solon Flow 项目启动
将为 Solon AI 编排提供支持
2025-01 底
Solon AI 项目启动
2025-02 中
设计 Solon AI 开放接口,和适配机制
2025-03 中
Solon Expression 项目启动
为 Solon AI RAG 知识库,提供统一的过滤表达式支持
2025-04 初
Solon AI MCP 项目启动
2025-05 初
Solon Flow Designer 项目启动
(由 广东越洋科技有限公司 供献代码)
2025-05 中
Solon AI Flow 项目启动
使用 Solon Flow 编排 Solon AI 定制的任务组件
3、体验展示
ChatModel
publicvoidcall(ChatModel chatModel)throws IOException { chatModel.prompt("hello").call(); } publicvoidstream(ChatModel chatModel)throws IOException { chatModel.prompt("hello").stream(); } publicvoidtoolCall(ChatModel chatModel)throws IOException { chatModel.prompt("今天杭州的天气情况?") .options(o -> o.toolsAdd(newWeatherTools()) .call(); } publicvoidsession(ChatModel chatModel)throws IOException { ChatSessionchatSession=newChatSessionDefault("session-1"); chatSession.addMessage(ChatMessage.ofUser("今天杭州的天气情况?")); chatModel.prompt(chatSession) .options(o -> o.toolsAdd(newWeatherTools()) .stream(); }RAG
publicvoidinit(ChatModel chatModel, RepositoryStorable repository)throws IOException { PdfLoaderloader=newPdfLoader(newFile("lzsite.pdf")).additionalMetadata("file", "lzsite.pdf"); List documents = newSplitterPipeline() .next(newRegexTextSplitter("\n\n")) .next(newTokenSizeTextSplitter(500)) .split(loader.load()); repository.insert(documents); } publicvoidsearch(ChatModel chatModel, RepositoryStorable repository)throws IOException { Stringquery="良渚遗址公司有哪些景点?" //知识库检索 List context = repository.search(message); //消息增强 ChatMessagemessage= ChatMessage.augment(query, context) chatModel.prompt(message).call(); }MCP-server
@McpServerEndpoint(sseEndpoint = "/mcp/sse") publicclassMcpServerTool{ @ToolMapping(description = "查询天气预报") public String getWeather(@Param(description = "城市位置") String location) { return"晴,14度"; } @ResourceMapping(uri = "config://app-version", description = "获取应用版本号", mimeType = "text/config") public String getAppVersion() { return"v3.2.0"; } @ResourceMapping(uri = "db://users/{user_id}/email", description = "根据用户ID查询邮箱") public String getEmail(@Param(description = "用户Id") String user_id) { return user_id + "@example.com"; } @PromptMapping(description = "生成关于某个主题的提问") public Collection askQuestion(@Param(description = "主题") String topic) { return Arrays.asList(ChatMessage.ofUser("请解释一下'" + topic + "'的概念?")); } }MCP-client
publicvoidclient(ChatModel chatModel){ McpClientProviderclientProvider= McpClientProvider.builder() .apiUrl("http://localhost:8080/mcp/sse") .build(); Stringrst= clientProvider.callToolAsText("getWeather", Map.of("location", "杭州")) .getContent(); chatModel.prompt("杭州今天的天气怎么样?") .options(options -> { options.toolsAdd(clientProvider)) .call(); }AiFlow
id:helloworld layout: -task:"@VarInput" meta: message:"你好" -task:"@ChatModel" meta: chatConfig:# "@type": "org.noear.solon.ai.chat.ChatConfig" provider:"ollama" model:"qwen2.5:1.5b" apiUrl:"http://127.0.0.1:11434/api/chat" -task:"@ConsoleOutput" # flowEngine.eval("helloworld");4、最近更新日志新增 solon-ai-flow 插件
新增 solon-ai-load-ddl 插件
添加 solon-ai-core ChatMessage:ofUser (media) 方法
添加 solon-ai-core ChatSession:addMessage (ChatPrompt) 方法
添加 solon-ai-core ChatSession:addMessage (Collection) 方法
添加 solon-ai-core RerankingConfig,RerankingModel toString 方法
添加 solon-ai-core 模型的网络代理支持(支持简单配置,和复杂构建)
添加 solon-ai-mcp 客户端的网络代理简单配置支持
添加 solon-ai-mcp messageEndpoint 端点配置支持(应对特殊需求,一般自动更好)
添加 solon-ai-mcp ToolMapping,ResourceMapping 注解方法对 Produces 注解的支持(用它可指定结果转换处理)
添加 solon-ai-mcp ToolCallResultConverter:matched 方法
添加 solon-ai-mcp 资源模板的响应适配
添加 solon-ai-mcp McpClientProvider:getResourceTemplates 方法
添加 solon-ai-mcp 检查原语是否存在的方法(hasTool, hasPrompt, hasResource)
添加 solon-ai-mcp 提示语支持 UserMessage 拆解成多条 mcp 内容(如果,同时有媒体和文本的话)
优化 solon-ai-core tool 空参数时的不同大模型兼容性
优化 solon-ai-core ChatSession 的作用,为限数提供支持
优化 solon-ai-core MethodFunctionTool 移除对 Mapping 注解的支持(语意更清楚,之前 MethodToolProvider 已经移除,这个落了)
优化 solon-ai-core EmbeddingRequest,ImageRequest,RerankingRequest 当 resp.getError () 非 null 时,直接出抛异常
优化 solon-ai-mcp 取消 MethodFunctionResource 对反回类型的限制(增加了 resultConverter 转换处理)
优化 solon-ai-mcp McpServerEndpointProvider 支持零添加原语,postStart 后,可添加原语
修复 solon-ai ChatRequestDefault:stream 请求 r1 时,可能会产生两次 tink 消息发射
特别声明:以上内容(如有图片或视频亦包括在内)为自媒体平台“网易号”用户上传并发布,本平台仅提供信息存储服务。
Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.