-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Bug description
When I use the ChatOptions.builder()...
method to create a set of chat options and set these options on my Prompt
instance, no tool calls are available to the LLM.
Environment
OpenJDK 21.0.7 with Spring AI 1.1.0-SNAPSHOT
Steps to reproduce
ChatOptions chatOptions = new ChatOptions.builder.model("qwen3:14b").build();
Prompt prompt = ChatClient.prompt()
.tools(new DateTimeTools())
.user("What is the current date and time?")
.options(chatOptions)
.call().chatResponse();
Expected behavior
My expectation was that the tools defined in the DateTimeTools
class would be available to the model but they were not. 😲
If you visit the DefaultChatClientUtils
file and place a breakpoint on line 96, you will see what actually happens. We check to see if the provided ChatOptions
instance is of the type ToolingChatOptions
, when we see that it's not we skip the rest of the tool processing. In this case we miss the opportunity to add the tooling callbacks from the prompt itself on line 103.
Is this the expected behavior? If so, I think this is worthy of a callout in the documentation. It took me a while to figure this out, much time would have been saved if I had been creating a TooCallingChatOptions
instance in the first place.
I would be happy to either open a PR to ensure we add prompt tools every time or to update the documentation, whichever makes the most sense.
Minimal Complete Reproducible example
The code above provides most of the code needed for a working example, please let me know if more information is needed.
Thank you! This project is already a big time save for me, I really appreciate it! 💜