Skip to content

Commit fd932c5

Browse files
committed
[fel] remove logs and more
1 parent 86293b0 commit fd932c5

File tree

83 files changed

+266
-599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+266
-599
lines changed

examples/fel-example/05-retrieval/src/main/java/modelengine/example/ai/chat/retrieval/RetrievalExampleController.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,12 @@ public class RetrievalExampleController {
6767

6868
public RetrievalExampleController(ChatModel chatModel, EmbedModel embedModel, ObjectSerializer serializer,
6969
@Value("${example.model.chat}") String chatModelName,
70-
@Value("${example.model.embed}") String embedModelName,
71-
@Value("${fel.openai.apiKey}") String apiKey) {
70+
@Value("${example.model.embed}") String embedModelName) {
7271
DocumentEmbedModel documentEmbedModel =
7372
new DefaultDocumentEmbedModel(embedModel, EmbedOption.custom().model(embedModelName).build());
7473
VectorStore vectorStore = new MemoryVectorStore(documentEmbedModel);
7574
ChatFlowModel chatFlowModel =
76-
new ChatFlowModel(chatModel, ChatOption.custom().model(chatModelName).apiKey(apiKey).stream(false).build());
75+
new ChatFlowModel(chatModel, ChatOption.custom().model(chatModelName).stream(false).build());
7776

7877
AiProcessFlow<Tip, Content> retrieveFlow = AiFlows.<Tip>create()
7978
.runnableParallel(history(), passThrough())
@@ -96,10 +95,7 @@ public RetrievalExampleController(ChatModel chatModel, EmbedModel embedModel, Ob
9695
indexFlow.converse().offer(file);
9796

9897
this.ragFlow = AiFlows.<String>create()
99-
.map(query -> {
100-
System.out.println("query");
101-
return Tip.from("query", query);
102-
})
98+
.map(query -> Tip.from("query", query))
10399
.runnableParallel(value("context", retrieveFlow), passThrough())
104100
.prompt(Prompts.history(), Prompts.human(CHAT_PROMPT))
105101
.generate(chatFlowModel)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
fel:
22
openai:
3-
api-base: 'https://api.siliconflow.cn/v1'
4-
api-key: 'sk-jujmjfaevrwyxtsyyrvpwlkwrbwwoxrjsdfpjcokwobflxqy'
3+
api-base: '${api-base}'
4+
api-key: '${your-api-key}'
55
example:
66
model:
7-
chat: 'Qwen/Qwen2.5-72B-Instruct'
8-
embed: 'BAAI/bge-large-zh-v1.5'
7+
chat: '${model-name}'
8+
embed: '${model-name}'

framework/fel/java/fel-community/model-openai/src/main/java/modelengine/fel/community/model/openai/OpenAiModel.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ private HttpClassicClient getHttpClient() {
198198
return value;
199199
}));
200200

201-
log.info("Create custom HTTPS config: {}", this.serializer.serialize(custom));
202201
return this.httpClientFactory.create(HttpClassicClientFactory.Config.builder()
203202
.socketTimeout(this.clientConfig.socketTimeout())
204203
.connectTimeout(this.clientConfig.connectTimeout())
@@ -212,7 +211,6 @@ private HttpClassicClient getHttpClient(SecureConfig secureConfig) {
212211
}
213212

214213
Map<String, Object> custom = buildHttpsConfig(secureConfig);
215-
log.info("Create custom HTTPS config: {}", this.serializer.serialize(custom));
216214
return this.httpClientFactory.create(HttpClassicClientFactory.Config.builder()
217215
.socketTimeout(this.clientConfig.socketTimeout())
218216
.connectTimeout(this.clientConfig.connectTimeout())

framework/fel/java/fel-core/src/main/java/modelengine/fel/core/chat/ChatOption.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import modelengine.fel.core.tool.ToolInfo;
1010
import modelengine.fel.core.model.http.SecureConfig;
11-
import modelengine.fitframework.inspection.Nonnull;
1211
import modelengine.fitframework.pattern.builder.BuilderFactory;
1312

1413
import java.util.List;
@@ -26,7 +25,6 @@ public interface ChatOption {
2625
*
2726
* @return 表示模型名字的 {@link String}。
2827
*/
29-
@Nonnull
3028
String model();
3129

3230
/**
@@ -37,7 +35,6 @@ public interface ChatOption {
3735
*
3836
* @return 表示是否使用流式接口的 {@code boolean}。
3937
*/
40-
@Nonnull
4138
Boolean stream();
4239

4340
/**

framework/fel/java/fel-core/src/main/java/modelengine/fel/core/tool/ToolCall.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public interface ToolCall {
2121
*
2222
* @return 表示工具调用唯一编号的 {@link String}。
2323
*/
24-
@Nonnull
2524
String id();
2625

2726
/**
@@ -36,15 +35,13 @@ public interface ToolCall {
3635
*
3736
* @return 表示工具名称的 {@link String}。
3837
*/
39-
@Nonnull
4038
String name();
4139

4240
/**
4341
* 获取工具调用参数。
4442
*
4543
* @return 表示工具调用参数的 {@link String}。
4644
*/
47-
@Nonnull
4845
String arguments();
4946

5047
/**

framework/fel/java/fel-core/src/main/java/modelengine/fel/core/tool/ToolInfo.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*---------------------------------------------------------------------------------------------
2-
* Copyright (c) 2024 Huawei Technologies Co., Ltd. All rights reserved.
3-
* This file is a part of the ModelEngine Project.
4-
* Licensed under the MIT License. See License.txt in the project root for license information.
5-
*--------------------------------------------------------------------------------------------*/
1+
/*
2+
* Copyright (c) 2024-2025 Huawei Technologies Co., Ltd. All rights reserved.
3+
* This file is a part of the ModelEngine Project.
4+
* Licensed under the MIT License. See License.txt in the project root for license information.
5+
*/
66

77
package modelengine.fel.core.tool;
88

framework/fel/java/fel-flow/src/main/java/modelengine/fel/engine/activities/AiStart.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,6 @@ public <M extends ChatMessage> AiState<M, D, O, RF, F> generate(BlockModel<O, M>
561561
public <M extends ChatMessage> AiState<ChatMessage, D, O, RF, F> generate(FlowModel<O, M> model) {
562562
Validation.notNull(model, "Streaming Model operator cannot be null.");
563563
Processor<O, ChatMessage> processor = this.publisher().flatMap(input -> {
564-
System.out.println("generate");
565564
return Flows.source(AiFlowSession.applyPattern(model, input.getData(), input.getSession()));
566565
}, null).displayAs("generate");
567566
return new AiState<>(new State<>(processor, this.flow().origin()), this.flow());
@@ -593,7 +592,6 @@ public final AiState<Tip, D, Tip, RF, F> runnableParallel(Pattern<O, Tip>... pat
593592
}
594593

595594
AiState<Tip, D, Tip, RF, F> state = aiFork.join(Tip::new, (acc, data) -> {
596-
System.out.println(String.format("[%s][runnableParallel] acc=%s, input=%s", Thread.currentThread().getId(), acc, data));
597595
acc.merge(data);
598596
return acc;
599597
});
@@ -603,10 +601,6 @@ public final AiState<Tip, D, Tip, RF, F> runnableParallel(Pattern<O, Tip>... pat
603601

604602
private Processor<O, Tip> getPatternProcessor(Pattern<O, Tip> pattern, AiState<O, D, O, RF, F> node) {
605603
return node.publisher()
606-
.map(input -> {
607-
Tip tip = AiFlowSession.applyPattern(pattern, input.getData(), input.getSession());
608-
System.out.println(String.format("[%s][getPatternProcessor.tip] tip=%s", Thread.currentThread().getId(), tip));
609-
return tip;
610-
}, null);
604+
.map(input -> AiFlowSession.applyPattern(pattern, input.getData(), input.getSession()), null);
611605
}
612606
}

framework/fel/java/fel-flow/src/main/java/modelengine/fel/engine/activities/AiState.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,11 @@ public Publisher<O> publisher() {
103103

104104
@Override
105105
public void register(EmitterListener<O, FlowSession> handler) {
106-
if (handler != null) {
107-
this.state.register(handler);
108-
}
106+
this.state.register(handler);
109107
}
110108

111109
public void unregister(EmitterListener<O, FlowSession> listener) {
112-
if (listener != null) {
113-
this.state.unregister(listener);
114-
}
110+
this.state.unregister(listener);
115111
}
116112

117113
@Override

framework/fel/java/fel-flow/src/main/java/modelengine/fel/engine/flows/AiProcessFlow.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ public void handle(D data, FlowSession session) {
4444
@Override
4545
public void register(EmitterListener<R, FlowSession> listener) {
4646
if (listener != null) {
47-
// this.origin().register((data, token) -> listener.handle(ObjectUtils.cast(data), new FlowSession(token)));
4847
EmitterListener<Object, FlowSession> wrapperHandler =
49-
(data, token) -> listener.handle(ObjectUtils.cast(data), token);
48+
(data, session) -> listener.handle(ObjectUtils.cast(data), session);
5049
this.listeners.put(listener, wrapperHandler);
5150
this.origin().register(wrapperHandler);
5251
}

framework/fel/java/fel-flow/src/main/java/modelengine/fel/engine/flows/Conversation.java

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,8 @@ public Conversation(AiProcessFlow<D, R> flow, FlowSession session) {
6363
@SafeVarargs
6464
public final ConverseLatch<R> offer(D... data) {
6565
ConverseLatch<R> latch = setListener(this.flow);
66-
FlowSession newSession = new FlowSession(this.session);
66+
FlowSession newSession = FlowSession.newRootSession(this.session, this.session.preserved());
6767
newSession.getWindow().setFrom(null);
68-
System.out.println(String.format("[%s][Conversation.offer] session=%s, windowId=%s, newWindowId=%s",
69-
Thread.currentThread().getId(), this.session.getId(), this.session.getWindow().id(),
70-
newSession.getWindow().id()
71-
));
7268
this.flow.start().offer(data, newSession);
7369
newSession.getWindow().complete();
7470
return latch;
@@ -87,35 +83,12 @@ public ConverseLatch<R> offer(String nodeId, List<?> data) {
8783
Validation.notBlank(nodeId, "invalid nodeId.");
8884
ConverseLatch<R> latch = setListener(this.flow);
8985
FlowSession newSession = new FlowSession(this.session);
86+
newSession.getWindow().setFrom(null);
9087
this.flow.origin().offer(nodeId, data.toArray(new Object[0]), newSession);
9188
newSession.getWindow().complete();
9289
return latch;
9390
}
9491

95-
/**
96-
* 当前会话订阅一个发射源,由发射源驱动会话执行,会话结束后会注销本次订阅。
97-
* <p>注意发射源的 {@link Source#emit(Object, FlowSession)} 传入的 {@link FlowSession} 的状态数据,会被当前会话的各类
98-
* {@code bind} 方法覆盖, 如 {@link Conversation#bind(String, Object)}、 {@link Conversation#bind(Memory)} 等。</p>
99-
*
100-
* @param source 表示发射源的 {@link Source}{@code <}{@link D}{@code >}。
101-
* @return 表示线程同步器的 {@link ConverseLatch}{@code <}{@link R}{@code >}。
102-
* @throws IllegalArgumentException 当 {@code source} 为 {@code null} 时。
103-
*/
104-
// public ConverseLatch<R> offer(Source<D> source) {
105-
// Validation.notNull(source, "Source can not be null.");
106-
//
107-
// FlowSession sessionClone = new FlowSession(this.session);
108-
// AiProcessFlow<D, R> processFlow = AiFlows.<D>create().just((data, ctx) -> {
109-
// FlowContext<D> flowContext = ObjectUtils.cast(ctx);
110-
// flowContext.getSession().copySessionState(sessionClone);
111-
// }).delegate(this.flow).close();
112-
// processFlow.offer(source);
113-
//
114-
// Action finallyCb = this.callBackBuilder.getFinallyCb();
115-
// this.callBackBuilder.doOnFinally(finallyCb.andThen(() -> source.unregister(processFlow)));
116-
// return setListener(processFlow);
117-
// }
118-
11992
/**
12093
* 绑定大模型超参数到对话上下文,用于流程后续的大模型节点。
12194
*
@@ -228,7 +201,6 @@ public Conversation<D, R> doOnFinally(Action finallyAction) {
228201

229202
private ConverseLatch<R> setListener(AiProcessFlow<D, R> currFlow) {
230203
ConverseLatch<R> latch = new ConverseLatch<>();
231-
System.out.println(String.format("[Conversation][setListener] latchId=%s", latch.getId()));
232204
Predictable<R> predictable = new Predictable<>(currFlow, this.callBackBuilder.build(), latch);
233205
ConverseListener<R> listener = this.converseListener.getAndSet(predictable);
234206
if (listener != null && !listener.isCompleted()) {

0 commit comments

Comments
 (0)