Skip to content

Commit 556391b

Browse files
authored
Add doFinalizeLoop() hook to ToolCallAdvisor (#5064)
Introduce doFinalizeLoop() method as a symmetric counterpart to doInitializeLoop(). This protected hook allows subclasses to perform cleanup or finalization logic after the tool calling loop completes. Signed-off-by: Christian Tzolov <[email protected]>
1 parent 8ca583d commit 556391b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spring-ai-client-chat/src/main/java/org/springframework/ai/chat/client/advisor/ToolCallAdvisor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ public ChatClientResponse adviseCall(ChatClientRequest chatClientRequest, CallAd
150150
}
151151
while (isToolCall); // loop until no tool calls are present
152152

153+
return this.doFinalizeLoop(chatClientResponse, callAdvisorChain);
154+
}
155+
156+
protected ChatClientResponse doFinalizeLoop(ChatClientResponse chatClientResponse,
157+
CallAdvisorChain callAdvisorChain) {
153158
return chatClientResponse;
154159
}
155160

0 commit comments

Comments
 (0)