spring-projects / spring-projects/spring-ai
If the parameter of the tool is empty, after the framework calls the tool, the Flux stream returns empty content
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
tools code:
public class FunctionCallTools {
@Tool(name = "getCurrentDateTime", description = "获取当前时间")
public static String getCurrentDateTime() {
return String.valueOf(LocalDateTime.now().atZone(LocaleContextHolder.getTimeZone().toZoneId()));
}
}
Controller interface code:
@RequestMapping("/tools")
public Flux<String> functionCall(@RequestParam(value = "message", defaultValue = "hello, tell me a joke") String message,
HttpServletResponse response) {
response.setCharacterEncoding("UTF-8");
return chatClient.prompt(message)
.tools(new FunctionCallTools())
.stream()
.content();
}
After open browser,I input "http://localhost:9090/chat/tools?message=what the date is today? ",after running,the browser returned empty,why? but if I called a tool with at least one argument,the browser can return and display the result correctly.
the version of spring-ai I used is 1.0.3,only spring-ai-starter-model-openai and spring-ai-autoconfigure-mode-openai have been introduced
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the /chat/tools endpoint with the zero-argument getCurrentDateTime tool, then compare it with a tool that has an argument. Inspect the chatClient.prompt(...).tools(...).stream().content() path and the Flux handling for tool results. Done means the endpoint emits the tool result for empty-parameter tools as well as parameterized tools.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100