spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

External controlled tool calling with `ToolCallingManager` cannot really work.

Open chickenlj opened this issue 8 months ago • 3 comments
trafficstars

Bug description

As defined below, executeToolCalls(Prompt prompt, ChatResponse chatResponse) in Spring AI requires prompt to get Options configuration as the context to get tool definition, prepare ToolContext, etc.

But if I use ToolCall outside the scope of ChatClient, there's no way for me to get the prompt that was used in ChatClient that inited the tool calling request.

public interface ToolCallingManager {

	/**
	 * Resolve the tool definitions from the model's tool calling options.
	 */
	List<ToolDefinition> resolveToolDefinitions(ToolCallingChatOptions chatOptions);

	/**
	 * Execute the tool calls requested by the model.
	 */
	ToolExecutionResult executeToolCalls(Prompt prompt, ChatResponse chatResponse);

}

Simply put, where I can get the prompt instance to call toolCallingManager.executeToolCalls(prompt, chatResponse);

Environment 1.0.0-M6

chickenlj avatar Mar 18 '25 16:03 chickenlj