spring-ai
spring-ai copied to clipboard
External controlled tool calling with `ToolCallingManager` cannot really work.
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