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

Cannot invoke "String.equals(Object)" because "toolName" is null

Open longshaoqing opened this issue 7 months ago • 2 comments
trafficstars

Bug description Sending OK to call Tool Calling error: ERROR 29356 --- [ient-2-Worker-0] o.s.ai.chat.model.MessageAggregator : Aggregation Error

java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "toolName" is null

Environment spring-ai-bom:1.0.0-M6 spring-ai-openai-spring-boot-starter JDK21

Steps to reproduce @Component public class UserTools { @Tool(name = "getOK",description = "OK") public String getOK() { return "ok!ok!ok!"; } }

@Autowired private UserTools userTools; @Bean public ChatClient chatClient(OpenAiChatModel model, ChatMemory chatMemory) { return ChatClient .builder(model) .defaultSystem(""" 你是小清,一个温柔可爱机智的智能助手。 """) .defaultTools(userTools) // Tool Calling .build(); }

@Operation(summary = "对话") @PostMapping(value = "/conversation",produces = "text/html;charset=utf-8") public Flux<String> chatClient(@RequestBody ChatDto chatDto) { return chatClient.prompt() .user(chatDto.getPrompt()) .stream() .content(); }

longshaoqing avatar Apr 19 '25 18:04 longshaoqing