Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
<role>Maintainer</role>
</roles>
</developer>
<developer>
<name>Song Yongtan</name>
<email>271667068@qq.com</email>
<roles>
<role>Committer</role>
</roles>
</developer>
</developers>

<scm>
Expand All @@ -44,6 +51,16 @@
<!-- FIT version -->
<fit.version>3.5.0-SNAPSHOT</fit.version>

<!-- Third-party versions -->
<byte-buddy.version>1.17.5</byte-buddy.version>
<druid.version>1.2.20</druid.version>
<fastjson.version>1.2.83</fastjson.version>
<guava.version>32.0.1-jre</guava.version>
<hanlp.version>portable-1.8.4</hanlp.version>
<lombok.version>1.18.36</lombok.version>
<jackson.version>2.18.2</jackson.version>
<mybatis.version>3.5.13</mybatis.version>

<!-- Test framework versions -->
<assertj.version>3.27.3</assertj.version>
<junit5.version>5.12.2</junit5.version>
Expand Down Expand Up @@ -380,6 +397,110 @@
<artifactId>fit-mybatis-common</artifactId>
<version>${fit.version}</version>
</dependency>

<!-- WaterFlow -->
<dependency>
<groupId>org.fitframework.waterflow</groupId>
<artifactId>waterflow-bridge-fit-reactor</artifactId>
<version>${fit.version}</version>
</dependency>
<dependency>
<groupId>org.fitframework.waterflow</groupId>
<artifactId>waterflow-core</artifactId>
<version>${fit.version}</version>
</dependency>
<dependency>
<groupId>org.fitframework.waterflow</groupId>
<artifactId>waterflow-common</artifactId>
<version>${fit.version}</version>
</dependency>

<!-- FEL -->
<dependency>
<groupId>org.fitframework.fel</groupId>
<artifactId>fel-core</artifactId>
<version>${fit.version}</version>
</dependency>
<dependency>
<groupId>org.fitframework.fel</groupId>
<artifactId>tool-service</artifactId>
<version>${fit.version}</version>
</dependency>
<dependency>
<groupId>org.fitframework.fel</groupId>
<artifactId>tool-info</artifactId>
<version>${fit.version}</version>
</dependency>
<dependency>
<groupId>org.fitframework.fel</groupId>
<artifactId>tool-mcp-common</artifactId>
<version>${fit.version}</version>
</dependency>
<dependency>
<groupId>org.fitframework.fel</groupId>
<artifactId>tool-mcp-client-service</artifactId>
<version>${fit.version}</version>
</dependency>

<!-- Ohscript -->
<dependency>
<groupId>org.fitframework.ohscript</groupId>
<artifactId>ohscript</artifactId>
<version>${fit.version}</version>
</dependency>

<!-- Third-party -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.hankcs</groupId>
<artifactId>hanlp</artifactId>
<version>${hanlp.version}</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>${byte-buddy.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
2 changes: 2 additions & 0 deletions framework/fel/java/fel-community/model-openai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

<artifactId>fel-model-openai-plugin</artifactId>

<name>FEL Model OpenAI</name>

<dependencies>
<!-- FIT -->
<dependency>
Expand Down
2 changes: 2 additions & 0 deletions framework/fel/java/fel-community/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<artifactId>fel-community-parent</artifactId>
<packaging>pom</packaging>

<name>FEL Community Parent</name>

<modules>
<module>model-openai</module>
<module>tokenizer-hanlp</module>
Expand Down
2 changes: 2 additions & 0 deletions framework/fel/java/fel-community/tokenizer-hanlp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

<artifactId>fel-tokenizer-hanlp-plugin</artifactId>

<name>FEL Tokenizer HanLP</name>

<dependencies>
<!-- FIT -->
<dependency>
Expand Down
2 changes: 2 additions & 0 deletions framework/fel/java/fel-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

<artifactId>fel-core</artifactId>

<name>FEL Core</name>

<dependencies>
<!-- FIT -->
<dependency>
Expand Down
8 changes: 8 additions & 0 deletions framework/fel/java/fel-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

<artifactId>fel-flow</artifactId>

<name>FEL Flow</name>

<dependencies>
<!-- FIT -->
<dependency>
Expand Down Expand Up @@ -47,6 +49,12 @@
<artifactId>waterflow-bridge-fit-reactor</artifactId>
</dependency>

<!-- Third-party -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

<!-- Test Plugins -->
<dependency>
<groupId>org.fitframework.plugin</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ protected AiActivity(F flow) {
this.flow = Validation.notNull(flow, "Flow cannot be null.");
}

/**
* 获取 AI 节点所对应的流程对象。
*
* @return AI 节点所对应的流程对象。
*/
public F flow() {
return this.flow;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ public class AiMatchHappen<O, D, I, RF extends Flow<D>, F extends AiFlow<D, RF>>

private final F flow;

/**
* 创建一个 AI 流程匹配发生器。
*
* @param matchHappen 匹配发生器。
* @param flow AI 流程。
*/
public AiMatchHappen(MatchHappen<O, D, I, RF> matchHappen, F flow) {
this.matchHappen = Validation.notNull(matchHappen, "MatchHappen cannot be null.");
this.flow = Validation.notNull(flow, "Flow cannot be null.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public class AiMatchToHappen<D, I, RF extends Flow<D>, F extends AiFlow<D, RF>>

private final F flow;

/**
* 创建一个 {@link AiMatchToHappen} 对象。
*
* @param matchToHappen 匹配条件。
* @param flow AI 流程。
*/
public AiMatchToHappen(MatchToHappen<D, I, RF> matchToHappen, F flow) {
this.matchToHappen = Validation.notNull(matchToHappen, "matchToHappen cannot be null.");
this.flow = Validation.notNull(flow, "Flow cannot be null.");
Expand Down Expand Up @@ -75,8 +81,8 @@ public <O> AiMatchHappen<O, D, I, RF, F> match(Operators.Whether<I> whether,
/**
* 提供一个默认的处理逻辑,并结束条件节点。
*
* @param processor 表示分支处理器的 {@link AiBranchProcessor}{@code <}{@link O}{@code , }{@link D}{@code ,
* }{@link ?}{@code , }{@link RF}{@code , }{@link F}{@code >}。
* @param processor 表示分支处理器的 {@link AiBranchProcessor}{@code <}{@link O}{@code , }{@link D}{@code ,?,
* }{@link RF}{@code , }{@link F}{@code >}。
* @param <O> 表示第一个条件分支指定的返回类型。
* @return 表示条件节点的 {@link AiState}{@code <}{@link O}{@code , }{@link D}{@code , }{@link O}{@code ,
* }{@link RF}{@code , }{@link F}{@code >}。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public AiParallel(Parallel<D, I, RF> parallel, F flow) {
/**
* 生成平行节点的子分支。
*
* @param <O> 表示分支处理器的输入参数的类型。
* @param processor 表示分支处理器的 {@link AiBranchProcessor}{@code <}{@link O}{@code , }{@link D}{@code ,
* }{@link I}{@code , }{@link RF}{@code , }{@link F}{@code >}。
* @return 表示平行节点子分支的 {@link AiFork}{@code <}{@link O}{@code , }{@link D}{@code , }{@link I}{@code ,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ public AiState<Content, D, O, RF, F> synthesize(Synthesizer<O> synthesizer) {
/**
* 将模型处理返回值的格式化解析。
*
* @param <R> 表示解析器的返回值类型。
* @param parser 表示格式化解析器的 {@link Parser}{@code <}{@link R}{@code >}。
* @return 表示格式化解析节点的 {@link AiState}{@code <}{@link O}{@code , }{@link D}{@code , }{@link O}{@code ,
* }{@link RF}{@code , }{@link F}{@code >}。
Expand Down Expand Up @@ -505,8 +506,8 @@ public <R> AiState<R, D, O, RF, F> delegate(AiProcessFlow<O, R> aiFlow) {
* @return 表示委托节点的 {@link AiState}{@code <}{@link R}{@code , }{@link D}{@code , }{@link O}{@code ,
* }{@link RF}{@code , }{@link F}{@code >}。
* @throws IllegalArgumentException <ul>
* <li>当 {@code aiFlow} 为 {@code null}时。</il>
* <li>当 {@code nodeId} 为 {@code null} 、空字符串或只有空白字符的字符串时。</il>
* <li>当 {@code aiFlow} 为 {@code null}时。</li>
* <li>当 {@code nodeId} 为 {@code null} 、空字符串或只有空白字符的字符串时。</li>
* </ul>
*/
public <R> AiState<R, D, O, RF, F> delegate(AiProcessFlow<O, R> aiFlow, String nodeId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
public class AiFlow<D, F extends Flow<D>> extends IdGenerator {
private final F flow;

/**
* 创建一个 AI 流程。
*
* @param flow 流程。
*/
public AiFlow(F flow) {
this.flow = Validation.notNull(flow, "Flow cannot be null.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public class AiProcessFlow<D, R> extends AiFlow<D, ProcessFlow<D>>
private final Map<EmitterListener<R, FlowSession>, EmitterListener<Object, FlowSession>> listeners =
new ConcurrentHashMap<>();

/**
* 创建一个流程。
*
* @param flow 表示流程。
*/
public AiProcessFlow(ProcessFlow<D> flow) {
super(flow);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,47 @@ public T await() {
return this.data;
}

/**
* Returns the data.
*
* @return The data.
*/
public T data() {
return this.data;
}

/**
* Sets the data.
*
* @param data The data.
*/
public void data(T data) {
this.data = data;
}

/**
* Returns the throwable.
*
* @return The throwable.
*/
public Throwable throwable() {
return this.throwable;
}

/**
* Sets the throwable.
*
* @param throwable The throwable.
*/
public void throwable(Throwable throwable) {
this.throwable = throwable;
}

/**
* Returns the count-down latch.
*
* @return The count-down latch.
*/
public CountDownLatch countDownLatch() {
return this.countDownLatch;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
package modelengine.fel.engine.operators.models;

import modelengine.fel.core.chat.ChatMessage;
import modelengine.fel.core.chat.ChatModel;
import modelengine.fel.core.chat.ChatOption;
import modelengine.fel.core.chat.MessageType;
import modelengine.fel.core.chat.Prompt;
import modelengine.fel.core.chat.support.AiMessage;
import modelengine.fel.core.chat.ChatModel;
import modelengine.fel.core.memory.Memory;
import modelengine.fel.core.model.BlockModel;
import modelengine.fel.engine.util.AiFlowSession;
Expand All @@ -32,10 +32,21 @@ public class ChatBlockModel implements BlockModel<Prompt, ChatMessage> {
private final ChatModel provider;
private final ChatOption option;

/**
* 创建一个阻塞对话模型。
*
* @param provider 聊天模型提供者。
*/
public ChatBlockModel(ChatModel provider) {
this(provider, ChatOption.custom().build());
}

/**
* 创建一个阻塞对话模型。
*
* @param provider 聊天模型提供者。
* @param option 聊天模型选项。
*/
public ChatBlockModel(ChatModel provider, ChatOption option) {
this.provider = Validation.notNull(provider, "The model provider cannot be null.");
this.option = Validation.notNull(option, "The chat options cannot be null.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ public class ChatChunk implements ChatMessage {
private final StringBuilder text = new StringBuilder();
private final List<ToolCall> toolCalls = new ArrayList<>();

public ChatChunk() {
}
/**
* 创建一个空的 {@link ChatChunk}。
*/
public ChatChunk() {}

/**
* 使用文本数据、媒体数据和工具请求初始化 {@link ChatChunk}。
*
Expand Down
Loading