Interface ToolCallingManager
- All Known Implementing Classes:
DefaultToolCallingManager,GoogleGenAiToolCallingManager
public interface ToolCallingManager
Service responsible for managing the tool calling process for a chat model.
- Since:
- 1.0.0
- Author:
- Thomas Vitale
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a defaultToolCallingManagerbuilder.executeToolCalls(Prompt prompt, ChatResponse chatResponse) Execute the tool calls requested by the model.default ToolExecutionResultexecuteToolCalls(Prompt prompt, ChatResponse chatResponse, ToolCallDecisions decisions) Execute the tool calls requested by the model as a person decided: an allowed call runs, a denied call does not and the model receives the decision's message as its result.resolveToolDefinitions(ToolCallingChatOptions chatOptions) Resolve the tool definitions from the model's tool calling options.
-
Method Details
-
resolveToolDefinitions
Resolve the tool definitions from the model's tool calling options. -
executeToolCalls
Execute the tool calls requested by the model.- Throws:
ToolCallConfirmationRequiredException- if a tool call needs a person's confirmation before it runs; none of the calls ran. Resume withexecuteToolCalls(Prompt, ChatResponse, ToolCallDecisions).
-
executeToolCalls
default ToolExecutionResult executeToolCalls(Prompt prompt, ChatResponse chatResponse, ToolCallDecisions decisions) Execute the tool calls requested by the model as a person decided: an allowed call runs, a denied call does not and the model receives the decision's message as its result. Every tool call of the response needs a decision, and an allowed call runs only with a tool the prompt carries. This is how a batch paused with aToolCallConfirmationRequiredExceptionresumes; the response is the reply the model gave, read from storage the end user cannot change.The default throws
UnsupportedOperationException.- Parameters:
prompt- the conversation the model answered with the tool calls, carrying the tools; it may end with the reply itselfchatResponse- the reply with the tool callsdecisions- one decision per tool call of the reply- Returns:
- the result, with the conversation history ending in the tool results
- Throws:
IllegalArgumentException- if a decision names no tool call of the reply, a tool call has no decision, or an allowed call names a tool the prompt does not carryToolCallLimitExceededException- if an allowed call breaks a limit; the caller handles it, there is no loop to turn it into a reply- Since:
- 2.1.0
-
builder
Create a defaultToolCallingManagerbuilder.
-