Skip to content

Commit 835f381

Browse files
authored
feat(graph): reactagent with inputkey (#2242)
Signed-off-by: zhouyou <zhouyou9505@gmail.com>
1 parent 9211296 commit 835f381

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/agent/ReactAgent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ public Builder postToolHook(NodeAction postToolHook) {
444444
return this;
445445
}
446446

447-
public Builder llmInputMessagesKey(String llmInputMessagesKey) {
448-
this.inputKey = llmInputMessagesKey;
447+
public Builder inputKey(String inputKey) {
448+
this.inputKey = inputKey;
449449
return this;
450450
}
451451

spring-ai-alibaba-graph-core/src/test/java/com/alibaba/cloud/ai/graph/agent/ReactAgentHookTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public void testReactAgentWithPreLlmHook() throws Exception {
130130
.name("weather_agent")
131131
.model(chatModel)
132132
.tools(List.of(toolCallback))
133-
.llmInputMessagesKey("llm_input_messages")
133+
.inputKey("llm_input_messages")
134134
.preLlmHook(state -> {
135135
if (!state.value("messages").isPresent()) {
136136
return Map.of();
@@ -178,7 +178,7 @@ public void testReactAgentWithPostLlmHook() throws Exception {
178178
ReactAgent agent = ReactAgent.builder()
179179
.name("dataAgent")
180180
.model(chatModel)
181-
.llmInputMessagesKey("llm_input_messages")
181+
.inputKey("llm_input_messages")
182182
.tools(List.of(toolCallback))
183183
.postLlmHook(state -> {
184184

@@ -212,7 +212,7 @@ public void testReactAgentWithPreToolHook() throws Exception {
212212
.name("dataAgent")
213213
.model(chatModel)
214214
.tools(List.of(toolCallback))
215-
.llmInputMessagesKey("llm_input_messages")
215+
.inputKey("llm_input_messages")
216216
.preToolHook(state -> {
217217
// 在preToolHook中获取最新的时间戳 传给toolCall保证时效性
218218
long currentTimestamp = System.currentTimeMillis();

0 commit comments

Comments
 (0)