File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
spring-ai-client-chat/src/test/java/org/springframework/ai/chat/client Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1683,6 +1683,28 @@ void whenFunctionNameIsEmptyThenThrow() {
16831683 .build ())).isInstanceOf (IllegalArgumentException .class ).hasMessage ("name cannot be null or empty" );
16841684 }
16851685
1686+ @ Test
1687+ @ Disabled ("This fails now as the FunctionToolCallback description is allowed to be empty" )
1688+ void whenFunctionDescriptionIsNullThenThrow () {
1689+ ChatClient chatClient = new DefaultChatClientBuilder (mock (ChatModel .class )).build ();
1690+ ChatClient .ChatClientRequestSpec spec = chatClient .prompt ();
1691+ assertThatThrownBy (() -> spec .toolCallbacks (FunctionToolCallback .builder ("name" , input -> "hello" )
1692+ .description (null )
1693+ .inputType (String .class )
1694+ .build ())).isInstanceOf (IllegalArgumentException .class ).hasMessage ("Description must not be empty" );
1695+ }
1696+
1697+ @ Test
1698+ @ Disabled ("This fails now as the FunctionToolCallback description is allowed to be empty" )
1699+ void whenFunctionDescriptionIsEmptyThenThrow () {
1700+ ChatClient chatClient = new DefaultChatClientBuilder (mock (ChatModel .class )).build ();
1701+ ChatClient .ChatClientRequestSpec spec = chatClient .prompt ();
1702+ assertThatThrownBy (() -> spec .toolCallbacks (
1703+ FunctionToolCallback .builder ("name" , input -> "hello" ).description ("" ).inputType (String .class ).build ()))
1704+ .isInstanceOf (IllegalArgumentException .class )
1705+ .hasMessage ("Description must not be empty" );
1706+ }
1707+
16861708 @ Test
16871709 void whenFunctionThenReturn () {
16881710 ChatClient chatClient = new DefaultChatClientBuilder (mock (ChatModel .class )).build ();
You can’t perform that action at this time.
0 commit comments