Class AbstractToolCallSupport
java.lang.Object
org.springframework.ai.chat.model.AbstractToolCallSupport
- Direct Known Subclasses:
AnthropicChatModel
,AzureOpenAiChatModel
,BedrockProxyChatModel
,FunctionCallingHelper
,MiniMaxChatModel
,MistralAiChatModel
,MoonshotChatModel
,OllamaChatModel
,OpenAiChatModel
,VertexAiGeminiChatModel
,ZhiPuAiChatModel
Deprecated.
Abstract base class for tool call support. Provides functionality for handling function
callbacks and executing functions.
- Since:
- 1.0.0
- Author:
- Christian Tzolov, Grogdunn, Thomas Vitale, Jihoon Kim
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map<String,
FunctionCallback> Deprecated.The function callback register is used to resolve the function callbacks by name.protected final FunctionCallbackResolver
Deprecated.The function callback resolver is used to resolve the function callbacks by name from the Spring context.protected static final boolean
Deprecated. -
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractToolCallSupport
(FunctionCallbackResolver functionCallbackResolver) Deprecated.protected
AbstractToolCallSupport
(FunctionCallbackResolver functionCallbackResolver, FunctionCallingOptions functionCallingOptions, List<FunctionCallback> toolFunctionCallbacks) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionbuildToolCallConversation
(List<Message> previousMessages, AssistantMessage assistantMessage, ToolResponseMessage toolResponseMessage) Deprecated.protected ToolResponseMessage
executeFunctions
(AssistantMessage assistantMessage, ToolContext toolContext) Deprecated.Deprecated.handleToolCalls
(Prompt prompt, ChatResponse response) Deprecated.protected boolean
isProxyToolCalls
(Prompt prompt, FunctionCallingOptions defaultOptions) Deprecated.protected boolean
isToolCall
(ChatResponse chatResponse, Set<String> toolCallFinishReasons) Deprecated.protected boolean
isToolCall
(Generation generation, Set<String> toolCallFinishReasons) Deprecated.protected List<FunctionCallback>
resolveFunctionCallbacks
(Set<String> functionNames) Deprecated.runtimeFunctionCallbackConfigurations
(FunctionCallingOptions runtimeFunctionOptions) Deprecated.
-
Field Details
-
IS_RUNTIME_CALL
protected static final boolean IS_RUNTIME_CALLDeprecated.- See Also:
-
functionCallbackRegister
Deprecated.The function callback register is used to resolve the function callbacks by name. -
functionCallbackResolver
Deprecated.The function callback resolver is used to resolve the function callbacks by name from the Spring context. It is optional and usually used with Spring auto-configuration.
-
-
Constructor Details
-
AbstractToolCallSupport
Deprecated. -
AbstractToolCallSupport
@Deprecated protected AbstractToolCallSupport(FunctionCallbackResolver functionCallbackResolver, FunctionCallingOptions functionCallingOptions, List<FunctionCallback> toolFunctionCallbacks) Deprecated.
-
-
Method Details
-
getFunctionCallbackRegister
Deprecated. -
runtimeFunctionCallbackConfigurations
@Deprecated protected Set<String> runtimeFunctionCallbackConfigurations(FunctionCallingOptions runtimeFunctionOptions) Deprecated.Handle the runtime function callback configurations. Register the function callbacks- Parameters:
runtimeFunctionOptions
- FunctionCallingOptions to handle.- Returns:
- Set of function names to call.
-
handleToolCalls
Deprecated. -
buildToolCallConversation
@Deprecated protected List<Message> buildToolCallConversation(List<Message> previousMessages, AssistantMessage assistantMessage, ToolResponseMessage toolResponseMessage) Deprecated. -
resolveFunctionCallbacks
Deprecated.Resolve the function callbacks by name. Retrieve them from the registry or try to resolve them from the Application Context.- Parameters:
functionNames
- Name of function callbacks to retrieve.- Returns:
- list of resolved FunctionCallbacks.
-
executeFunctions
@Deprecated protected ToolResponseMessage executeFunctions(AssistantMessage assistantMessage, ToolContext toolContext) Deprecated. -
isToolCall
@Deprecated protected boolean isToolCall(ChatResponse chatResponse, Set<String> toolCallFinishReasons) Deprecated. -
isToolCall
Deprecated.Check if the generation is a tool call. The tool call finish reasons are used to determine if the generation is a tool call.- Parameters:
generation
- the generation to check.toolCallFinishReasons
- the tool call finish reasons to check.- Returns:
- true if the generation is a tool call, false otherwise.
-
isProxyToolCalls
@Deprecated protected boolean isProxyToolCalls(Prompt prompt, FunctionCallingOptions defaultOptions) Deprecated.Check if the proxyToolCalls is enabled for the given prompt or the default tool call options. The prompt options take precedence over the default options. When the proxyToolCalls is enabled the ChatModel implementation will not handle the function calling internally. The tool call and tool response messages are exposed outside the ChatModel implementation.- Parameters:
prompt
- the prompt to check.defaultOptions
- the default tool call options to check.- Returns:
- true if the proxyToolCalls is enabled, false otherwise.
-
ToolCallingManager
instead.