Class ToolCallAdvisor
java.lang.Object
org.springframework.ai.chat.client.advisor.ToolCallAdvisor
- All Implemented Interfaces:
Advisor,CallAdvisor,StreamAdvisor,org.springframework.core.Ordered
Recursive Advisor that disables the internal tool execution flow and instead implements
the tool calling loop as part of the advisor chain.
It uses the CallAdvisorChainUtil to implement looping advisor chain calls.
This enables intercepting the tool calling loop by the rest of the advisors next in the chain.
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for creating instances of ToolCallAdvisor. -
Field Summary
Fields inherited from interface org.springframework.ai.chat.client.advisor.api.Advisor
DEFAULT_CHAT_MEMORY_PRECEDENCE_ORDERFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Method Summary
Modifier and TypeMethodDescriptionadviseCall(ChatClientRequest chatClientRequest, CallAdvisorChain callAdvisorChain) reactor.core.publisher.Flux<ChatClientResponse>adviseStream(ChatClientRequest chatClientRequest, StreamAdvisorChain streamAdvisorChain) static ToolCallAdvisor.Builderbuilder()Creates a new Builder instance for constructing a ToolCallAdvisor.getName()Return the name of the advisor.intgetOrder()
-
Method Details
-
getName
Description copied from interface:AdvisorReturn the name of the advisor. -
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
adviseCall
public ChatClientResponse adviseCall(ChatClientRequest chatClientRequest, CallAdvisorChain callAdvisorChain) - Specified by:
adviseCallin interfaceCallAdvisor
-
adviseStream
public reactor.core.publisher.Flux<ChatClientResponse> adviseStream(ChatClientRequest chatClientRequest, StreamAdvisorChain streamAdvisorChain) - Specified by:
adviseStreamin interfaceStreamAdvisor
-
builder
Creates a new Builder instance for constructing a ToolCallAdvisor.- Returns:
- a new Builder instance
-