doc: update docs

This commit is contained in:
Michael Yang 2024-05-14 18:11:57 +08:00
parent d561e47365
commit 231fa0908b
12 changed files with 162 additions and 156 deletions

View File

@ -2,10 +2,9 @@ import {defineConfig} from 'vitepress'
// https://vitepress.dev/reference/site-config
export default defineConfig({
lang: 'zh-CN',
title: "Agents-Flex",
titleTemplate: ':title - Agents-Flex 官方网站',
description: "一个优雅的 LLM大语言模型应用开发框架",
titleTemplate: ':title - Agents-Flex Official website',
description: "A Java framework for LLM applications",
lastUpdated: true,
appearance:"dark",
@ -17,12 +16,12 @@ export default defineConfig({
lang: 'en'
},
zh:{
titleTemplate: ':title - Agents-Flex 官方网站',
description: "一个优雅的 LLM大语言模型应用开发框架",
label: '简体中文',
lang: 'zh', // 可选,将作为 `lang` 属性添加到 `html` 标签中
// link: '/zh/guide' // 默认 /fr/ -- 显示在导航栏翻译菜单上,可以是外部的
themeConfig: {
// logo: '/assets/images/logo.png',
outline: {
label: "章节"
},
@ -30,6 +29,47 @@ export default defineConfig({
pattern: 'https://github.com/agents-flex/agents-flex/edit/main/docs/:path',
text: '编辑当前页面'
},
nav: [
{text: '首页', link: '/'},
{text: '帮助文档', link: '/zh/intro/what-is-agentsflex'},
{text: 'ChangeLog', link: 'https://github.com/agents-flex/agents-flex/releases'},
],
sidebar: [
{
text: '快速开始',
items: [
{text: 'Agents-Flex 是什么', link: '/zh/intro/what-is-agentsflex'},
{text: '快速开始', link: '/zh/intro/getting-started'},
{text: 'Maven 依赖', link: '/zh/intro/maven'},
{text: '微信交流群', link: '/zh/intro/communication'},
]
},
{
text: '核心模块',
items: [
{text: 'LLMs 大语言模型', link: '/zh/core/llms'},
// {text: 'Prompt 提示词', link: '/zh/core/prompt'},
// {text: 'Chat 对话', link: '/zh/core/chat'},
// {text: 'Function Calling 方法调用', link: '/zh/core/function-calling'},
{text: 'Memory 记忆', link: '/zh/core/memory'},
{text: 'Embedding 嵌入', link: '/zh/core/embedding'},
{text: 'Store 存储', link: '/zh/core/store'},
{text: 'Document 文档', link: '/zh/core/document'},
{text: 'Agent 智能体', link: '/zh/core/agent'},
{text: 'Chain 执行链', link: '/zh/core/chain'},
]
},
{
text: '基础示例',
items: [
{text: '简单对话', link: '/zh/samples/chat'},
{text: '历史对话', link: '/zh/samples/chat-with-memory'},
{text: 'RAG 应用', link: '/zh/samples/rag'},
]
}
],
}
},
@ -37,64 +77,53 @@ export default defineConfig({
themeConfig: {
// logo: '/assets/images/logo.png',
// outline:{
// label:"章节"
// },
search: {
provider: 'local'
},
editLink: {
// pattern: 'https://github.com/agents-flex/agents-flex/edit/main/docs/:path'
pattern: 'https://gitee.com/agents-flex/agents-flex/edit/main/docs/:path',
// text: '编辑当前页面'
pattern: 'https://github.com/agents-flex/agents-flex/edit/main/docs/:path'
},
// https://vitepress.dev/reference/default-theme-config
// logo: '/assets/images/logo01.png',
nav: [
{text: '首页', link: '/'},
socialLinks: [
{ icon: 'github', link: 'https://github.com/agents-flex/agents-flex' },
],
{text: '帮助文档', link: '/zh/intro/what-is-agentsflex'},
{text: 'ChangeLog', link: '/zh/changes'},
{
text: '获取源码', items: [
{text: 'Gitee', link: 'https://gitee.com/agents-flex/agents-flex'},
{text: 'Github', link: 'https://github.com/agents-flex/agents-flex'},
{text: '示例代码', link: 'https://gitee.com/agents-flex/agents-flex-samples'},
]
},
nav: [
{text: 'Home', link: '/'},
{text: 'Document', link: '/intro/what-is-agentsflex'},
{text: 'ChangeLog', link: 'https://github.com/agents-flex/agents-flex/releases'},
],
sidebar: [
{
text: '快速开始',
text: 'Quick Start',
items: [
{text: 'Agents-Flex 是什么', link: '/zh/intro/what-is-agentsflex'},
{text: '快速开始', link: '/zh/intro/getting-started'},
{text: 'Maven 依赖', link: '/zh/intro/maven'},
{text: '微信交流群', link: '/zh/intro/communication'},
{text: 'What is Agents-Flex', link: '/intro/what-is-agentsflex'},
{text: 'Quick Start', link: '/intro/getting-started'},
{text: 'Maven Dependencies', link: '/intro/maven'},
{text: 'Communication', link: '/intro/communication'},
]
},
{
text: '核心模块',
text: 'Core Modules',
items: [
{text: 'LLMs 大语言模型', link: '/zh/core/llms'},
{text: 'LLMs', link: '/core/llms'},
// {text: 'Prompt 提示词', link: '/zh/core/prompt'},
// {text: 'Chat 对话', link: '/zh/core/chat'},
// {text: 'Function Calling 方法调用', link: '/zh/core/function-calling'},
{text: 'Memory 记忆', link: '/zh/core/memory'},
{text: 'Embedding 嵌入', link: '/zh/core/embedding'},
{text: 'Store 存储', link: '/zh/core/store'},
{text: 'Document 文档', link: '/zh/core/document'},
{text: 'Agent 智能体', link: '/zh/core/agent'},
{text: 'Chain 执行链', link: '/zh/core/chain'},
{text: 'Memory', link: '/core/memory'},
{text: 'Embedding', link: '/core/embedding'},
{text: 'Store', link: '/core/store'},
{text: 'Document', link: '/core/document'},
{text: 'Agent', link: '/core/agent'},
{text: 'Chain', link: '/core/chain'},
]
},
{
text: '基础示例',
text: 'Samples',
items: [
{text: '简单对话', link: '/zh/samples/chat'},
{text: '历史对话', link: '/zh/samples/chat-with-memory'},
{text: 'RAG 应用', link: '/zh/samples/rag'},
{text: 'Simple Chat', link: '/samples/chat'},
{text: 'Chat With Histories', link: '/samples/chat-with-memory'},
{text: 'RAG Application', link: '/samples/rag'},
]
}
],

View File

@ -2,7 +2,7 @@
`AI Agent` is an abstract concept with various definitions and interpretations within the industry.
The author understands an agent as a "person" with an identity, a name, memory, and the ability to execute tasks. During execution, an agent can engage in planning, use tools, or perform critical thinking.
According to the author: an agent as a "person" with an identity, a name, memory, and the ability to execute tasks. During execution, an agent can engage in planning, use tools, or perform critical thinking.
It is entirely up to the developer to decide how an agent engages in planning, uses tools, or performs critical thinking, rather than being determined by the Agents-Flex framework.
@ -20,7 +20,7 @@ public abstract class Agent {
- id: Defines the agent's id, which should be unique for each agent.
- name: The agent's name (or alias)
- memory: Memory storage
- memory: Memory store
- `execute(Map<String, Object> variables, Chain chain)`: Execution method to be implemented by subclasses.
## Example Code
@ -32,8 +32,8 @@ public class SampleLlmAgent extends LLMAgent {
public SampleLlmAgent(Llm llm) {
this.llm = llm;
this.prompt = "You are now a MySQL database architect. Please, based on the following table structure information," +
"Help me generate executable DDL statements so that I can use them to create the table structure in MySQL.\n" +
this.prompt = "You are now a MySQL database architect. Please help me generate executable DDL statements so that I can use them to create the table structure in MySQL " +
"based on the following table structure information.\n" +
"Note: \n" +
"Please return the DDL content directly, without explanation or any additional content other than the DDL statements.\n" +
"\nThe following is the content of the table information:\n\n{ddlInfo}";
@ -56,7 +56,7 @@ public static void main(String[] args) {
SampleLlmAgent agent = new SampleLlmAgent(llm);
String ddlInfo = "Table Name studentFields id,name";
String ddlInfo = "Table Name: studentFields: id,name";
Map<String, Object> variables = new HashMap<>();
variables.put("ddlInfo", ddlInfo);
@ -66,7 +66,7 @@ public static void main(String[] args) {
}
```
` System.out.println` The output result is as follows:
The output result is as follows:
```sql
CREATE TABLE `student` (

View File

@ -1,15 +1,16 @@
# Chain
The execution chain is a chain formed by arranging and combining multiple agents. A powerful AI functionality often requires the collaboration of multiple agents.
The `Chain` is a chain formed by arranging and combining multiple agents. A powerful AI functionality often requires the collaboration of multiple agents.
In the chain execution, it is generally executed by the first agent, and the result of the execution is handed over to the second agent for further cooperation, and then to the third agent, and so on, until we get the desired result.
During the execution of the execution chain, it may be necessary to pause for user interaction or data input, before the execution chain can resume execution. Therefore, each Chain execution chain has many different states, with the following state constants:
During the execution of the execution chain, it may be necessary to pause for user interaction or data input, before the execution chain can resume execution.
Therefore, each Chain has many different states, with the following state constants:
```java
public enum ChainStatus {
READY(0), // Not started execution
READY(0), // Not execution
START(1), // Execution started, in progress...
PAUSE_FOR_WAKE_UP(5), //Paused waiting for wake-up
PAUSE_FOR_INPUT(6), //Paused waiting for data input
@ -25,24 +26,24 @@ public enum ChainStatus {
}
}
```
## Types of Execution Chains
## Types of Chains
To meet different scenarios, Agents-Flex provides the following types of execution chains:
To meet different scenarios, Agents-Flex provides the following types of chains:
- SequentialChain: Sequential execution chain
- ParallelChain: Concurrent (parallel) execution chain
- LoopChain: Looping execution chain, which can be used for games between two (or more) models (such as two large models playing chess) or similar functionalities like the `Stanford AI Town`.
- SequentialChain: Sequential chain
- ParallelChain: Concurrent (parallel) chain
- LoopChain: Looping chain, which can be used for games between two (or more) models (such as two LLMs playing chess) or similar functionalities like the `Stanford AI Town`.
## Perception
During the execution of a chain, notifications of execution events are issued at different stages. Additionally, each agent may also publish its own custom events during execution.
Each agent can perceive changes in the execution of the chain by implementing `ChainEventListener`, thereby endowing the agent with the ability to perceive the world.
Each agent can perceive changes in the execution of the chain by implementing `ChainEventListener`, thereby endowing the agent with the ability to perceive the world (Chain).
## Example Code
## Samples
**Example Code1**Execute through `SequentialChain` and obtain a result:
**Samples 1**Execute through `SequentialChain` and obtain a result:
```java
public static void main(String[] args) {
@ -75,7 +76,7 @@ The above code implements the Agents arrangement shown in the diagram below:
---
**Example Code2** The execution chain pauses during execution, waiting for user input before resuming execution.
**Samples 2** The chain pauses during execution, waiting for user input before resuming execution.
```java
public static void main(String[] args) {
@ -94,11 +95,11 @@ public static void main(String[] args) {
Map<String, Object> variables = new HashMap<>();
variables.put(parameter.getName(), userInput);
//Resume the execution of the chain.
//Resume the chain execution.
chain.resume(variables);
});
//Start execution.
//start execution.
chain.execute(new HashMap<>());
//Output results (multiple results).

View File

@ -1,6 +1,6 @@
# Document
In Agents-Flex, a Document is a document object with vector data. It is defined as follows:
In Agents-Flex, `Document` is a document object with vector data. It is defined as follows:
```java
public class Document extends VectorData {
@ -23,9 +23,9 @@ public class Document extends VectorData {
Since it contains vector data, it can be stored in a VectorStore.
In the document module, besides the `Document ` itself, the following components are also provided:
In the `Document` module, besides the `Document` itself, the following components are also provided:
- **DocumentLoade**: A document loader used to load (read) document content from different sources (such as local disk, database, website, etc.).
- **DocumentLoader**: A document loader used to load (read) document content from different sources (such as local disk, database, website, etc.).
- **DocumentParser**: A document parser used to parse different types of documents to ultimately obtain `Document` objects, such as parsing Word, PDF, HTML, etc.
- **DocumentSplitter**: A document splitter used to split large documents into multiple smaller documents, facilitating Embedding computation and storage in vector databases.

View File

@ -1,34 +1,35 @@
# Large Language Models (LLMs)
Agents-Flex provides an abstract implementation interface for Large Language Models (LLMs) called `Llm.java`, supporting two different dialogue modes: `chat` and `chatStream`.
Agents-Flex provides an abstract implementation interface for Large Language Models (LLMs) called `Llm.java`,
supporting two different chat types: `chat` and `chatStream`.
For various vendors, Agents-Flex offers different implementation classes and communication protocols, including `HTTP`, `SSE`, and `WebSocket` clients.
## Chat dialogue
## Chat
In AI large language model chat conversations, we need to consider several different scenarios:
In chat conversations of AI LLMs, we need to consider several different scenarios:
- Simple conversation
- Historical conversation
- Simple chat
- Chat with Histories
- Function Calling
These capabilities are determined by prompts, so Agents-Flex provides three implementations of prompts:
- SimplePrompt: Used for simple conversation scenarios
- HistoriesPrompt: Used for historical conversation scenarios
- FunctionPrompt: Used for Function Calling scenarios
- SimplePrompt: Used for simple chat
- HistoriesPrompt: Used for chat with Histories
- FunctionPrompt: Used for Function Calling
During the interaction between prompts and large models, messages are exchanged. Therefore, Agents-Flex also provides different message implementations:
During the interaction between prompts and LLMs, messages are exchanged. Therefore, Agents-Flex also provides different message implementations:
- AiMessage: The message returned by the large model, which includes not only the message content but also data such as token consumption.
- FunctionMessage: A subclass of AiMessage, returned when using FunctionPrompt in the chat method.
- HumanMessage: Represents messages input by users during conversations.
- SystemMessage: Represents system messages, often used to inform the large language model's role, for fine-tuning prompts.
- **AiMessage**: The message returned by the LLMs, which includes not only the message content but also data such as token consumption.
- **FunctionMessage**: A subclass of AiMessage, returned when using FunctionPrompt in the `chat` method.
- **HumanMessage**: Represents messages input by Human during conversations.
- **SystemMessage**: Represents system messages, often used to inform the LLM's role, for fine-tuning prompts.
### Example Code
**Simple Dialogue**
**Simple Chat**
```java
public static void main(String[] args) {
@ -41,7 +42,7 @@ public static void main(String[] args) {
}
```
**Historical Dialogue**
**Chat with Histories**
```java
public static void main(String[] args) {
@ -67,13 +68,13 @@ public class WeatherUtil {
@FunctionDef(name = "get_the_weather_info", description = "get the weather info")
public static String getWeatherInfo(
@FunctionParam(name = "city", description = "the city name") String name) {
//Here, we should retrieve API information through third-party interfaces.
//Here, we should call API through third-party interfaces.
return name + "The weather is cloudy turning to overcast. ";
}
}
```
Create FunctionPrompt and pass it to the large model through the chat method:
Create FunctionPrompt and pass it to the LLMs through the `chat` method:
```java
public static void main(String[] args) {
@ -82,7 +83,7 @@ public static void main(String[] args) {
OpenAiLlm llm = new OpenAiLlm(config);
FunctionPrompt prompt = new FunctionPrompt("Today, how's the weather in New York?", WeatherUtil.class);
FunctionPrompt prompt = new FunctionPrompt("how's the weather in New York?", WeatherUtil.class);
FunctionResultResponse response = llm.chat(prompt);
//Execute utility class method to obtain result.

View File

@ -2,13 +2,13 @@
In Agents-Flex, memory is divided into two types:
- ChatMemory: Used to store conversation content during dialogue with large language models.
- ContextMemory: Used in the execution chain of agents, similar to a Key-Value data structure.
- **ChatMemory**: Used to store conversation content during chat with LLMs.
- **ContextMemory**: Used in the chain of agents, similar to a Key-Value data structure.
Additionally, Agents-Flex provides default implementation classes for ChatMemory and ContextMemory:
- DefaultChatMemory: Default implementation for storing conversation content.
- DefaultContextMemory: Default implementation for the Key-Value data structure.
- **DefaultChatMemory**: Default implementation for storing conversation content.
- **DefaultContextMemory**: Default implementation for the Key-Value data structure.
These implementations store data in memory by default. Users can implement custom ChatMemory and ContextMemory for scenarios requiring message persistence.
By default, These implementations are store data in memory. Users can implement custom ChatMemory and ContextMemory for scenarios requiring message persistence.

View File

@ -5,13 +5,14 @@ Agents-Flex's Store refers to the ` VectorStore `, which defines the following m
- `store(List<T> documents, StoreOptions options)`: Used to store vector data.
- `delete(Collection<String> ids, StoreOptions options)`: Used to delete vector data.
- `update(List<T> documents, StoreOptions options)`: Used to update vector data.
- `search(SearchWrapper wrapper, StoreOptions options)`: Used to query (retrieve) vector data.
- `search(SearchWrapper wrapper, StoreOptions options)`: Used to search (retrieve) vector data.
Currently, the following vector databases have been adapted in Agents-Flex:
- Milvus Vector Database: https://milvus.io
- Alibaba Cloud Vector Retrieval Service: https://help.aliyun.com/document_detail/2510317.html
- Tencent Cloud Vector Database: https://cloud.tencent.com/document/product/1709/98666
- Milvus Vector Database: https://milvus.io
Additionally, adaptation for more vector databases is currently in progress:
@ -41,7 +42,7 @@ store.setEmbeddingModel(llm);
With the above setup completed, we can happily use the store to perform `CRUD ` operations on vector data.
**Add new data:**
**Add new Document:**
```java
Document document = new Document();
@ -51,7 +52,7 @@ document.setContent("Text data of the document...");
store.store(document);
```
**Update data**
**Update Document**
```java
Document document = new Document();
@ -61,7 +62,7 @@ document.setContent("New document data...");
store.update(document);
```
**Delete data:**
**Delete Document:**
```java
store.delete(100);
@ -81,9 +82,9 @@ List<Document> result = store.search(wrapper);
Currently, there is no SQL-like language in the field of vector databases to unify database queries. Each vector database provider offers different APIs or unique query languages.
To eliminate the differences in querying among various vector databases, Agents-Flex has developed the SearchWrapper for unified adaptation.
To eliminate the differences in querying among various vector databases, Agents-Flex has developed the `SearchWrapper` for unified adaptation.
The SearchWrapper supports generating Filter Expressions (similar to the "where" clause in SQL) for further filtering of vector databases.
The `SearchWrapper` supports generating Filter Expressions (similar to the "where" clause in SQL) for further filtering of vector databases.
```java
@Test
@ -103,9 +104,9 @@ public void testSearchWrapper() {
```
Filter expressions can be referred to as follows:
- Milvus Vector Databasehttps://milvus.io/docs/boolean.md
- Tencent Cloud Vector Databasehttps://cloud.tencent.com/document/product/1709/95099
- Alibaba Cloud Vector Retrieval Servicehttps://help.aliyun.com/document_detail/2513006.html
- Milvus Vector Databasehttps://milvus.io/docs/boolean.md

View File

@ -2,31 +2,31 @@
layout: home
hero:
name: "Agents-Flex"
text: "An Elegant Framework for Developing LLM (Large Language Model) Applications"
tagline: A lightweight and simple Java framework for LLM applications, inspired by LangChain。
name: Agents-Flex
text: A Java framework for LLM applications
tagline: lightweight, simple, and more elegant.
image:
src: /assets/images/logo.png
alt: Agents-Flex
actions:
- theme: brand
text: Start
link: /zh/intro/getting-started
text: Quick Start
link: /intro/getting-started
- theme: alt
text: Documentation
link: /zh/intro/what-is-agentsflex
link: /intro/what-is-agentsflex
features:
- title: LLMs Connector
details: Agents-Flex includes a variety of network protocols for connecting large models, such as HTTP, SSE, and WS. Its simple and flexible design allows developers to easily connect to various large models, including OpenAI, Baidu Wenxin, Spark Model, and Tongyi Qianwen.
details: Agents-Flex includes a variety of network protocols for connecting LLMs, such as HTTP, SSE and WS. Its simple and flexible design allows developers to easily connect to various LLMs, including OpenAI, LLama, and Others AI.
- title: Prompt
details: Agents-Flex provides a rich set of development templates and supports a Prompt Framework, including FEW-SHOT, CRISPE, BROKE, and ICIO. Developers can also customize their own unique prompt templates.
details: Agents-Flex provides a rich set of development templates and Prompt Frameworks, including FEW-SHOT, CRISPE, BROKE, and ICIO. Developers can also customize their own unique prompt templates.
- title: Function Calling
details: Agents-Flex has a very flexible Function Calling component. It supports local method definitions, parsing, callbacks through LLMs, and executing local methods to obtain results. Developers can implement Function Calling with just a few lines of code.
details: Agents-Flex has a very flexible Function Calling component. It supports local method definitions, parsing, callbacks through LLMs, and executing local methods to obtain results.
- title: Document
details: Agents-Flex offers comprehensive text processing methods with built-in Loader, Parser, and Splitter components. Each component has multiple implementations, making it easy to load data from the web, local files, databases, and various data types.
details: Agents-Flex offers Loader, Parser, and Splitter components for the Document. Each component has multiple implementations, making it easy to load data from the web, local files, databases, and various data types.
- title: Memory
details: The Memory module of Agents-Flex is divided into MessageMemory and ContextMemory, used for recording historical dialogues and Chain execution contexts, respectively. Developers can extend the Memory module by inheritance to achieve richer functionalities.
details: The Memory module of Agents-Flex is divided into MessageMemory and ContextMemory, used for recording chat messages and Chain execution contexts. Developers can extend the Memory module by inheritance to achieve richer functionalities.
- title: Embedding
details: Agents-Flex includes extensive embedding capabilities and extensions. Developers can implement the Embedding interface to expand their private embedding algorithms and support.
- title: Vector Store
@ -34,7 +34,7 @@ features:
- title: Agent
details: Agents-Flex defines an abstract implementation of Agents. Developers can use the Agents Chain to create more interactive applications.
- title: Chain
details: Agents-Flexs Chain includes synchronous sequential execution Chains, asynchronous execution Chains, and loop execution Chains, helping developers handle various scenarios.
details: Agents-Flexs Chain includes sequential Chains, asynchronous Chains, and loop Chains, helping developers handle various scenarios.
---

View File

@ -27,7 +27,7 @@ Or use Gradle:
implementation 'com.agentsflex:agents-flex-bom:1.0.0-beta.3'
```
**Step 2: Create a Java class with a Main method:**
**Step 2: Create a Java class with a `main` method:**
```java
public class Main {
@ -57,25 +57,10 @@ public class Main {
}
```
For Spark model:
```java
public class Main {
public static void main(String[] args) {
SparkLlmConfig config = new SparkLlmConfig();
config.setAppId("****");
config.setApiKey("****");
config.setApiSecret("****");
Llm llm = new SparkLlm(config);
String response = llm.chat("请问你叫什么名字");
}
}
```
## Streaming Conversation
Streaming dialogue requires calling the `chatStream` method, and passing the prompt along with `StreamResponseListener`, as shown in the code below:
Streaming Conversation requires calling the `chatStream` method, and passing the prompt with `StreamResponseListener` object, as shown in the code below:
```java
public class Main {

View File

@ -2,19 +2,11 @@
## Foreword
The XML Maven dependency example below may not represent the latest version of Agents-Flex. Please refer to the latest version and modify the version number accordingly. You can check the latest version at:https://search.maven.org/artifact/com.agentsflex/parent
The Maven dependency example below may not represent the latest version of Agents-Flex. Please refer to the latest version and modify the version number accordingly.
You can check the latest version at: https://search.maven.org/artifact/com.agentsflex/parent
## Scenarios without SpringBoot
```xml
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-bom</artifactId>
<version>1.0.0-beta.3</version>
</dependency>
```
## Scenarios with SpringBoot
## use with SpringBoot
```xml
<dependency>
@ -23,3 +15,14 @@ The XML Maven dependency example below may not represent the latest version of A
<version>1.0.0-beta.3</version>
</dependency>
```
## without SpringBoot
```xml
<dependency>
<groupId>com.agentsflex</groupId>
<artifactId>agents-flex-bom</artifactId>
<version>1.0.0-beta.3</version>
</dependency>
```

View File

@ -4,11 +4,6 @@ Agents-Flex is an AI application development framework developed in Java, design
Agents-Flex is suitable for various scenarios, including chat, image generation, embedding models, function calling, and RAG applications, and supports both synchronous and streaming API options.
Other open-source frameworks by the author include:
- MyBatis-Flex: https://mybatis-flex.com
- AiEditor: https://aieditor.dev
- AiAdmin: Official website under construction...
## Comparison between Agents-Flex and other frameworks
@ -18,7 +13,6 @@ Compared to `Spring-AI` and `LangChain4j`, Agents-Flex is more universally appli
> 1) For example, `Spring-AI` requires JDK version `JDK 21+` whereas Agents-Flex only needs `JDK8+`.
> 2) `Spring-AI` requires usage within the Spring framework, whereas Agents-Flex supports integration with any framework and provides `spring-boot-starter`.
> 3) `Spring-AI` and `LangChain4j` generally do not support large models, embedding models, and vector databases commonly used in China, whereas Agents-Flex is friendly towards domestically developed services.
**2、Simpler API design**
@ -78,14 +72,6 @@ public static void main(String[] args) {
ioChain2.addNode(new Agent2("agent4"));
ioChain2.addNode(ioChain1);
ioChain2.registerEventListener(new ChainEventListener() {
@Override
public void onEvent(ChainEvent event, Chain chain) {
System.out.println(event);
}
});
Object result = ioChain2.executeForResult("your params");
System.out.println(result);
}
@ -95,14 +81,14 @@ The above code implements Agents orchestration as shown in the diagram below:
![](../../assets/images/chians-01.png)
The data flow is as follows: agent3 --> agent4 --> chain1, and within chain1, there is the process of agent1 --> agent2.
The data flow is as follows: `agent3` --> `agent4` --> `chain1`, and within `chain1`, there is the process of `agent1` --> `agent2`.
In Agents-Flex, we have built-in three different types of Agents execution chains:
- SequentialChain: Executes agents sequentially.
- ParallelChain: Executes agents concurrently (in parallel).
- LoopChain: Executes agents in a loop.
- **SequentialChain**: Executes agents sequentially.
- **ParallelChain**: Executes agents concurrently (in parallel).
- **LoopChain**: Executes agents in a loop.
Moreover, each of these three execution chains can serve as a sub-chain for other execution chains, thus forming powerful and complex Agents execution chains.
Moreover, each of these three chains can serve as a sub-chain for other chains, thus forming powerful and complex Agents chains.

View File

@ -24,7 +24,7 @@ features:
- title: Function Calling
details: Agents-Flex 内置了非常灵活的 Function Calling 组件,包括本地方法的定义、解析、通过 LLMs 回调、并执行本地方法到结果,开发者几行代码就可以完成 Function Calling。
- title: Document
details: Agents-Flex 在文本出来方法、内置了 Loader、Parser、Splitter 三大组件,而每种组件又有多重不同的实现类,因此,我们可以轻易的加载网络数据、本地数据、数据库数据,以及多种数据类型。
details: Agents-Flex 在文本处理方面、内置了 Loader、Parser、Splitter 三大组件,而每种组件又有多重不同的实现类,因此,我们可以轻易的加载网络数据、本地数据、数据库数据,以及多种数据类型。
- title: Memory
details: Agents-Flex 的 Memory 模块分为 MessageMemory 和 ContextMemory他们分别用于历史对话和 Chain 执行上下文记录,我们可以通过继承 Memory 去实现更加丰富的扩展。
- title: Embedding