Solon Ai Flow 编排开发框架发布预告(效果预览)

Solon Ai 在推出 Solon Ai Mcp 后,又将推出 Solon Ai Flow。

1、Solon Ai Flow 是个啥?

Solon Ai Flow 是一个智能体编排开发框架(基于 solon-flow 构建)。它是框架!不是工具,不是产品(这与市面上流行的工具和产品,有较大差别)。

使用 yaml 格式编排,很像 docker-compose 的观感。

2、发布预告

预计下周(2025年农历小满)发布首个版本。

3、效果预览

  • 简单的聊天智能体
id: chat_case1 layout:   - type: "start"   - task: "@TextInput"     meta:       text: "你好"   - task: "@ChatModel"     meta:       systemPrompt: "你是个聊天助手"       stream: false       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: "@TextOutput" 
  • RAG 知识库智能体
id: rag_case1 layout:   - type: "start"   - task: "@TextInput"     meta:       text: "Solon 是谁开发的?"   - task: "@EmbeddingModel"     meta:       embeddingConfig: # "@type": "org.noear.solon.ai.embedding.EmbeddingConfig"         provider: "ollama"         model: "bge-m3"         apiUrl: "http://127.0.0.1:11434/api/embed"   - task: "@InMemoryRepository"     meta:       documentSources:         - "https://solon.noear.org/article/about?format=md"       splitPipeline:         - "org.noear.solon.ai.rag.splitter.RegexTextSplitter"         - "org.noear.solon.ai.rag.splitter.TokenSizeTextSplitter"   - task: "@ChatModel"     meta:       systemPrompt: "你是个知识库"       stream: false       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: "@TextOutput" 
  • 两个智能体表演相声式吵架(llm 与 llm 讲相声)
id: pk_case1 layout:   - type: "start"   - task: "@TextInput"     meta:       text: "你好"   - task: "@ChatModel"     id: model_a     meta:       systemPrompt: "你是一个智能体名字叫“阿飞”。将跟另一个叫“阿紫”的智能体,表演相声式吵架。"       stream: false       chatSession: "A"       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: "@TextOutput"     meta:       prefix: "阿飞: "   - task: "@ChatModel"     id: model_b     meta:       systemPrompt: "你是一个智能体名字叫“阿紫”。将跟另一个叫“阿飞”的智能体,表演相声式吵架。"       stream: false       chatSession: "B"       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: "@TextOutput"     meta:       prefix: "阿紫: "   - type: "exclusive"     link:       - nextId: model_a         condition: 'context.counter().incr("demo") < 10'       - nextId: end   - type: "end"     id: "end" 

4、如何运行?

case2, csae3, case4 是用 TextInput,TextOutput 作输出输入。通过流引擎和引上下文,即可运行。

@SolonTest public class ChatTest {     @Inject     FlowEngine flowEngine;          @Test     public void case2() {         flowEngine.eval("case2");     }          @Test     public void case3() {         flowEngine.eval("case3");     }          @Test     public void case4() {         flowEngine.eval("case4");     } } 

csae1 则是用 ChatInput 和 ChatOutput 作输入输出(基于 Context.current() 输入和输出),需要正常的 web 聊天场景

@Controller public class DemoController {     @Inject     FlowEngine flowEngine;      ChatSession chatSession = new ChatSessionDefault();      @Mapping("case1")     public void case1() throws Exception {         FlowContext flowContext = new FlowContext();         flowContext.put(Attrs.CTX_CHAT_SESSION, chatSession); //传递聊天会话          flowEngine.eval("case1", flowContext);      } } 

发表评论

评论已关闭。

相关文章