diff --git a/README.md b/README.md index a74ba79..7a989e1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ + +> [!NOTE] +> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。 +> [English](./README.en.md) · [原始项目](https://github.com/cloudwego/eino) · [上游 README](https://github.com/cloudwego/eino/blob/HEAD/README.md) +> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。 + # Eino ![coverage](https://raw.githubusercontent.com/cloudwego/eino/badges/.badges/main/coverage.svg) @@ -10,25 +16,25 @@ ![Stars](https://img.shields.io/github/stars/cloudwego/eino) ![Forks](https://img.shields.io/github/forks/cloudwego/eino) -English | [中文](README.zh_CN.md) +[English](README.md) | 中文 -# Overview +# 简介 -**Eino['aino]** is an LLM application development framework in Golang. It draws from LangChain, Google ADK, and other open-source frameworks, and is designed to follow Golang conventions. +**Eino['aino]** 是一个 Go 语言的 LLM 应用开发框架,借鉴了 LangChain、Google ADK 等开源项目,按照 Go 的惯例设计。 -Eino provides: -- **[Components](https://github.com/cloudwego/eino-ext)**: reusable building blocks like `ChatModel`, `Tool`, `Retriever`, and `ChatTemplate`, with official implementations for OpenAI, Ollama, and more. -- **Agent Development Kit (ADK)**: build AI agents with tool use, multi-agent coordination, context management, interrupt/resume for human-in-the-loop, and ready-to-use agent patterns. -- **Composition**: connect components into graphs and workflows that can run standalone or be exposed as tools for agents. -- **[Examples](https://github.com/cloudwego/eino-examples)**: working code for common patterns and real-world use cases. +Eino 提供: +- **[组件](https://github.com/cloudwego/eino-ext)**:`ChatModel`、`Tool`、`Retriever`、`ChatTemplate` 等可复用模块,官方实现覆盖 OpenAI、Ollama 等 +- **智能体开发套件(ADK)**:支持工具调用、多智能体协同、上下文管理、中断/恢复等人机交互,以及开箱即用的智能体模式 +- **编排**:把组件组装成图或工作流,既能独立运行,也能作为工具给智能体调用 +- **[示例](https://github.com/cloudwego/eino-examples)**:常见模式和实际场景的可运行代码 ![](.github/static/img/eino/eino_concept.jpeg) -# Quick Start +# 快速上手 ## ChatModelAgent -Configure a ChatModel, optionally add tools, and you have a working agent: +配置好 ChatModel,加上工具(可选),就能跑起来: ```Go chatModel, _ := openai.NewChatModel(ctx, &openai.ChatModelConfig{ @@ -51,7 +57,7 @@ for { } ``` -Add tools to give the agent capabilities: +加工具让智能体有更多能力: ```Go agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{ @@ -64,13 +70,13 @@ agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{ }) ``` -The agent handles the ReAct loop internally — it decides when to call tools and when to respond. +智能体内部自动处理 ReAct 循环,自己判断什么时候调工具、什么时候回复。 -→ [ChatModelAgent examples](https://github.com/cloudwego/eino-examples/tree/main/adk/intro) · [docs](https://www.cloudwego.io/docs/eino/core_modules/eino_adk/agent_implementation/chat_model/) +→ [ChatModelAgent 示例](https://github.com/cloudwego/eino-examples/tree/main/adk/intro) · [文档](https://www.cloudwego.io/zh/docs/eino/core_modules/eino_adk/agent_implementation/chat_model/) ## DeepAgent -For complex tasks, use DeepAgent. It breaks down problems into steps, delegates to sub-agents, and tracks progress: +复杂任务用 DeepAgent,它会把问题拆成步骤,分派给子智能体,并追踪进度: ```Go deepAgent, _ := deep.New(ctx, &deep.Config{ @@ -87,13 +93,13 @@ runner := adk.NewRunner(ctx, adk.RunnerConfig{Agent: deepAgent}) iter := runner.Query(ctx, "Analyze the sales data in report.csv and generate a summary chart") ``` -DeepAgent can be configured to coordinate multiple specialized agents, run shell commands, execute Python code, and search the web. +DeepAgent 可以配置成:协调多个专业智能体、跑 shell 命令、执行 Python、搜索网络。 -→ [DeepAgent example](https://github.com/cloudwego/eino-examples/tree/main/adk/multiagent/deep) · [docs](https://www.cloudwego.io/docs/eino/core_modules/eino_adk/agent_implementation/deepagents/) +→ [DeepAgent 示例](https://github.com/cloudwego/eino-examples/tree/main/adk/multiagent/deep) · [文档](https://www.cloudwego.io/zh/docs/eino/core_modules/eino_adk/agent_implementation/deepagents/) -## Composition +## 编排 -When you need precise control over execution flow, use `compose` to build graphs and workflows: +需要精确控制执行流程时,用 `compose` 搭图或工作流: ```Go graph := compose.NewGraph[*Input, *Output]() @@ -110,7 +116,7 @@ runnable, _ := graph.Compile(ctx) result, _ := runnable.Invoke(ctx, input) ``` -Compositions can be exposed as tools for agents, bridging deterministic workflows with autonomous behavior: +编排出来的流程可以包装成工具给智能体用,把确定性流程和自主决策结合起来: ```Go tool, _ := graphtool.NewInvokableGraphTool(graph, "data_pipeline", "Process and validate data") @@ -125,85 +131,86 @@ agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{ }) ``` -This lets you build domain-specific pipelines with exact control, then let agents decide when to use them. +这样你可以写出精确可控的业务流程,再让智能体决定什么时候调用。 -→ [GraphTool examples](https://github.com/cloudwego/eino-examples/tree/main/adk/common/tool/graphtool) · [compose docs](https://www.cloudwego.io/docs/eino/core_modules/chain_and_graph_orchestration/) +→ [GraphTool 示例](https://github.com/cloudwego/eino-examples/tree/main/adk/common/tool/graphtool) · [编排文档](https://www.cloudwego.io/zh/docs/eino/core_modules/chain_and_graph_orchestration/) -# Key Features +# 主要特性 -## Component Ecosystem +## 组件生态 -Eino defines component abstractions (ChatModel, Tool, Retriever, Embedding, etc.) with official implementations for OpenAI, Claude, Gemini, Ark, Ollama, Elasticsearch, and more. +Eino 定义了组件抽象(ChatModel、Tool、Retriever、Embedding 等),官方实现覆盖 OpenAI、Claude、Gemini、Ark、Ollama、Elasticsearch 等。 → [eino-ext](https://github.com/cloudwego/eino-ext) -## Stream Processing +## 流式处理 -Eino automatically handles streaming throughout orchestration: concatenating, boxing, merging, and copying streams as data flows between nodes. Components only implement the streaming paradigms that make sense for them; the framework handles the rest. +Eino 在编排中自动处理流式:拼接、装箱、合并、复制。组件只需实现有业务意义的流式范式,框架处理剩下的。 -→ [docs](https://www.cloudwego.io/docs/eino/core_modules/chain_and_graph_orchestration/stream_programming_essentials/) +→ [文档](https://www.cloudwego.io/zh/docs/eino/core_modules/chain_and_graph_orchestration/stream_programming_essentials/) -## Callback Aspects +## 回调切面 -Inject logging, tracing, and metrics at fixed points (OnStart, OnEnd, OnError, OnStartWithStreamInput, OnEndWithStreamOutput) across components, graphs, and agents. +在固定切点(OnStart、OnEnd、OnError、OnStartWithStreamInput、OnEndWithStreamOutput)注入日志、追踪、指标,适用于组件、图、智能体。 -→ [docs](https://www.cloudwego.io/docs/eino/core_modules/chain_and_graph_orchestration/callback_manual/) +→ [文档](https://www.cloudwego.io/zh/docs/eino/core_modules/chain_and_graph_orchestration/callback_manual/) -## Interrupt/Resume +## 中断/恢复 -Any agent or tool can pause execution for human input and resume from checkpoint. The framework handles state persistence and routing. +任何智能体或工具都能暂停等待人工输入,从检查点恢复。框架处理状态持久化和路由。 -→ [docs](https://www.cloudwego.io/docs/eino/core_modules/eino_adk/agent_hitl/) · [examples](https://github.com/cloudwego/eino-examples/tree/main/adk/human-in-the-loop) +→ [文档](https://www.cloudwego.io/zh/docs/eino/core_modules/eino_adk/agent_hitl/) · [示例](https://github.com/cloudwego/eino-examples/tree/main/adk/human-in-the-loop) -# Framework Structure +# 框架结构 ![](.github/static/img/eino/eino_framework.jpeg) -The Eino framework consists of: +Eino 框架包含: -- Eino (this repo): Type definitions, streaming mechanism, component abstractions, orchestration, agent implementations, aspect mechanisms +- Eino(本仓库):类型定义、流处理机制、组件抽象、编排、智能体实现、切面机制 -- [EinoExt](https://github.com/cloudwego/eino-ext): Component implementations, callback handlers, usage examples, evaluators, prompt optimizers +- [EinoExt](https://github.com/cloudwego/eino-ext):组件实现、回调处理器、使用示例、评估器、提示优化器 -- [Eino Devops](https://github.com/cloudwego/eino-ext/tree/main/devops): Visualized development and debugging +- [Eino Devops](https://github.com/cloudwego/eino-ext/tree/main/devops):可视化开发和调试 -- [EinoExamples](https://github.com/cloudwego/eino-examples): Example applications and best practices +- [EinoExamples](https://github.com/cloudwego/eino-examples):示例应用和最佳实践 -## Documentation +## 文档 -- [Eino User Manual](https://www.cloudwego.io/zh/docs/eino/) -- [Eino: Quick Start](https://www.cloudwego.io/zh/docs/eino/quick_start/) +- [Eino 用户手册](https://www.cloudwego.io/zh/docs/eino/) +- [Eino: 快速开始](https://www.cloudwego.io/zh/docs/eino/quick_start/) -## Dependencies -- Go 1.18 and above. +## 依赖 +- Go 1.18 及以上 -## Code Style +## 代码规范 -This repo uses `golangci-lint`. Check locally with: +本仓库使用 `golangci-lint`,本地检查: ```bash golangci-lint run ./... ``` -Rules enforced: -- Exported functions, interfaces, packages, etc. should have GoDoc comments -- Code should be formatted with `gofmt -s` -- Import order should follow `goimports` (std -> third party -> local) +规则: +- 导出的函数、接口、package 等需要 GoDoc 注释 +- 代码格式符合 `gofmt -s` +- import 顺序符合 `goimports`(std -> third party -> local) -## Security +## 安全 -If you discover a potential security issue in this project, or think you may -have discovered a security issue, we ask that you notify Bytedance Security via our [security center](https://security.bytedance.com/src) or [vulnerability reporting email](mailto:sec@bytedance.com?subject=Feedback%20On%20Eino). +如果你在该项目中发现潜在的安全问题,或你认为可能发现了安全问题,请通过我们的[安全中心](https://security.bytedance.com/src) +或[漏洞报告邮箱](mailto:sec@bytedance.com?subject=关于Eino的反馈)通知字节跳动安全团队。 -Do **not** create a public GitHub issue. -## Contact -- Membership: [COMMUNITY MEMBERSHIP](https://github.com/cloudwego/community/blob/main/COMMUNITY_MEMBERSHIP.md) -- Issues: [Issues](https://github.com/cloudwego/eino/issues) -- Lark: Scan the QR code below with [Feishu](https://www.feishu.cn/en/) to join the CloudWeGo/eino user group. +请**不要**创建公开的 GitHub Issue。 + +## 联系我们 +- 成为 member:[COMMUNITY MEMBERSHIP](https://github.com/cloudwego/community/blob/main/COMMUNITY_MEMBERSHIP.md) +- Issues:[Issues](https://github.com/cloudwego/eino/issues) +- 飞书:扫码加入 CloudWeGo/eino 用户群     LarkGroup -## License +## 开源许可证 -This project is licensed under the [Apache-2.0 License](LICENSE-APACHE). +本项目基于 [Apache-2.0 许可证](LICENSE-APACHE) 开源。