Class DefaultToolCallingManager
java.lang.Object
org.springframework.ai.model.tool.DefaultToolCallingManager
- All Implemented Interfaces:
ToolCallingManager
Default implementation of
ToolCallingManager.- Since:
- 1.0.0
- Author:
- Thomas Vitale, chabinhwang, Christian Tzolov, Dimitar Proynov
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault cap applied to every tool name unless overridden viaDefaultToolCallingManager.Builder.maxCallsPerTool(String, int), exempted viaDefaultToolCallingManager.Builder.excludeToolFromLimit(String), or disabled entirely viaDefaultToolCallingManager.Builder.unlimitedCallsPerTool().static final intDefault cap on the total number of tool calls, across all tools combined, allowed within a turn, unless disabled entirely viaDefaultToolCallingManager.Builder.unlimitedTotalToolCalls(). -
Constructor Summary
ConstructorsConstructorDescriptionDefaultToolCallingManager(io.micrometer.observation.ObservationRegistry observationRegistry, ToolCallbackResolver toolCallbackResolver, ToolExecutionExceptionProcessor toolExecutionExceptionProcessor) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a defaultToolCallingManagerbuilder.executeToolCalls(Prompt prompt, ChatResponse chatResponse) Execute the tool calls requested by the model.resolveToolDefinitions(ToolCallingChatOptions chatOptions) Resolve the tool definitions from the model's tool calling options.voidsetObservationConvention(ToolCallingObservationConvention observationConvention)
-
Field Details
-
DEFAULT_MAX_CALLS_PER_TOOL
public static final int DEFAULT_MAX_CALLS_PER_TOOLDefault cap applied to every tool name unless overridden viaDefaultToolCallingManager.Builder.maxCallsPerTool(String, int), exempted viaDefaultToolCallingManager.Builder.excludeToolFromLimit(String), or disabled entirely viaDefaultToolCallingManager.Builder.unlimitedCallsPerTool(). Generous enough for legitimate iterative tool use (pagination, retries) while still catching a runaway loop long before it becomes expensive.- See Also:
-
DEFAULT_MAX_TOTAL_TOOL_CALLS
public static final int DEFAULT_MAX_TOTAL_TOOL_CALLSDefault cap on the total number of tool calls, across all tools combined, allowed within a turn, unless disabled entirely viaDefaultToolCallingManager.Builder.unlimitedTotalToolCalls().- See Also:
-
-
Constructor Details
-
DefaultToolCallingManager
public DefaultToolCallingManager(io.micrometer.observation.ObservationRegistry observationRegistry, ToolCallbackResolver toolCallbackResolver, ToolExecutionExceptionProcessor toolExecutionExceptionProcessor)
-
-
Method Details
-
resolveToolDefinitions
Description copied from interface:ToolCallingManagerResolve the tool definitions from the model's tool calling options.- Specified by:
resolveToolDefinitionsin interfaceToolCallingManager
-
executeToolCalls
Description copied from interface:ToolCallingManagerExecute the tool calls requested by the model.- Specified by:
executeToolCallsin interfaceToolCallingManager
-
setObservationConvention
-
builder
Description copied from interface:ToolCallingManagerCreate a defaultToolCallingManagerbuilder.
-