-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
GraphProcess graphProcess = new GraphProcess(this.compiledGraph);
Sinks.Many<ServerSentEvent<String>> sink = Sinks.many().unicast().onBackpressureBuffer();
AsyncGenerator<NodeOutput> resultFuture = compiledGraph.stream(objectMap, runnableConfig);
graphProcess.processStream(resultFuture, sink);
public Map<String, Object> apply(OverAllState state) throws Exception {
String query = state.value("query", "");
Integer expanderNumber = state.value("expander_number", this.NUMBER);
Flux<ChatResponse> chatResponseFlux = this.chatClient.prompt().user((user) -> user.text(DEFAULT_PROMPT_TEMPLATE.getTemplate()).param("number", expanderNumber).param("query", query)).stream().chatResponse();
AsyncGenerator<? extends NodeOutput> generator = StreamingChatGenerator.builder()
.startingNode("expander_llm_stream")
.startingState(state)
.mapResult(response -> {
String text = response.getResult().getOutput().getText();
List<String> queryVariants = Arrays.asList(text.split("\n"));
return Map.of("expander_content", queryVariants);
}).build(chatResponseFlux);
throw new RuntimeException("流程执行出错");
// return Map.of("expander_content", generator);
}
当NodeAction.apply 方法中抛出异常 ,会导致该节点不停的被调用,大概20次左右停止, 且不会触发GraphProcess 中的exceptionally 回调
Expected Behavior
希望节点抛出异常后 流程能终止 且能够触发exceptionally 或者
Steps To Reproduce
No response
Environment
Spring AI Alibaba version(s):1.0.0.3
Debug logs
No response
Anything else?
No response