88 lines
2.5 KiB
Markdown
88 lines
2.5 KiB
Markdown
# Easy-Agents
|
||
|
||
Easy-Agents 是一个轻量、可扩展的 Java AI 应用开发框架,覆盖从模型调用到工具执行、MCP 集成、检索与工作流编排的完整链路。
|
||
|
||
## 主要能力
|
||
|
||
- 多模型统一接入(Chat / Embedding / Rerank / Image)
|
||
- Prompt 与消息上下文管理
|
||
- Tool 定义、执行与拦截器机制
|
||
- MCP 客户端能力(调用、拦截、缓存与管理)
|
||
- 文档读取与切分、向量存储与检索
|
||
- 工作流执行引擎(Flow)与 Easy-Agents 适配支持
|
||
|
||
## 模块说明
|
||
|
||
- `easy-agents-bom`:依赖版本管理(BOM)。
|
||
- `easy-agents-core`:核心抽象与基础能力。
|
||
- `easy-agents-chat`:对话模型接入实现集合。
|
||
- `easy-agents-embedding`:向量化模型实现集合。
|
||
- `easy-agents-rerank`:重排模型实现集合。
|
||
- `easy-agents-image`:图像模型能力。
|
||
- `easy-agents-store`:向量存储实现。
|
||
- `easy-agents-search-engine`:检索引擎实现。
|
||
- `easy-agents-tool`:工具调用能力。
|
||
- `easy-agents-mcp`:MCP 集成。
|
||
- `easy-agents-flow`:流程编排核心引擎。
|
||
- `easy-agents-support`:Flow 与 Easy-Agents 适配模块。
|
||
- `easy-agents-spring-boot-starter`:Spring Boot 自动配置支持。
|
||
- `easy-agents-samples`:示例工程。
|
||
|
||
## 环境要求
|
||
|
||
- JDK 8+
|
||
- Maven 3.8+
|
||
|
||
## 构建与安装
|
||
|
||
在项目根目录执行:
|
||
|
||
```bash
|
||
mvn -DskipTests -Dmaven.javadoc.skip=true -Dgpg.skip=true clean install
|
||
```
|
||
|
||
构建完成后,相关构件会安装到本地 Maven 仓库,可供 `easyflow` 等项目直接依赖。
|
||
|
||
## 快速示例
|
||
|
||
```java
|
||
public static void main(String[] args) {
|
||
OpenAIChatModel chatModel = OpenAIChatConfig.builder()
|
||
.provider("GiteeAI")
|
||
.endpoint("https://ai.gitee.com")
|
||
.requestPath("/v1/chat/completions")
|
||
.apiKey("your-api-key")
|
||
.model("Qwen3-32B")
|
||
.buildModel();
|
||
|
||
String output = chatModel.chat("如何才能更幽默?");
|
||
System.out.println(output);
|
||
}
|
||
```
|
||
|
||
## 在业务项目中引入(示例)
|
||
|
||
```xml
|
||
<dependencyManagement>
|
||
<dependencies>
|
||
<dependency>
|
||
<groupId>com.easyagents</groupId>
|
||
<artifactId>easy-agents-bom</artifactId>
|
||
<version>0.0.1</version>
|
||
</dependency>
|
||
</dependencies>
|
||
</dependencyManagement>
|
||
|
||
<dependencies>
|
||
<dependency>
|
||
<groupId>com.easyagents</groupId>
|
||
<artifactId>easy-agents-flow</artifactId>
|
||
</dependency>
|
||
<dependency>
|
||
<groupId>com.easyagents</groupId>
|
||
<artifactId>easy-agents-support</artifactId>
|
||
</dependency>
|
||
</dependencies>
|
||
```
|
||
|