Skip to content

Commit 5b5abc4

Browse files
committed
Fix for FunctionToolCallbackTests
- Add more deterministic test data for assertion
1 parent 1fdda61 commit 5b5abc4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spring-ai-integration-tests/src/test/java/org/springframework/ai/integration/tests/tool/FunctionToolCallbackTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void chatListFromBean() {
158158
var content = ChatClient.builder(this.openAiChatModel)
159159
.build()
160160
.prompt()
161-
.user("What authors wrote the books %s and %s available in the library?".formatted("The Hobbit", "Narnia"))
161+
.user("What authors wrote the books %s and %s available in the library?".formatted("The Hobbit", "The Lion, the Witch and the Wardrobe"))
162162
.tools(Tools.AUTHORS_BY_BOOKS)
163163
.call()
164164
.content();
@@ -174,7 +174,7 @@ void chatListFromCallback() {
174174
var content = ChatClient.builder(this.openAiChatModel)
175175
.build()
176176
.prompt()
177-
.user("What authors wrote the books %s and %s available in the library?".formatted("The Hobbit", "Narnia"))
177+
.user("What authors wrote the books %s and %s available in the library?".formatted("The Hobbit", "The Lion, the Witch and the Wardrobe"))
178178
.tools(FunctionToolCallback.builder("authorsByAvailableBooks", function)
179179
.description("Get the list of authors who wrote the given books available in the library")
180180
.inputType(Books.class)

spring-ai-integration-tests/src/test/java/org/springframework/ai/integration/tests/tool/domain/BookService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class BookService {
2828
private static final ConcurrentHashMap<Integer, Book> books = new ConcurrentHashMap<>(Map
2929
.of( // @formatter:off
3030
1, new Book("His Dark Materials", "Philip Pullman"),
31-
2, new Book("Narnia", "C.S. Lewis"),
31+
2, new Book("The Lion, the Witch and the Wardrobe", "C.S. Lewis"),
3232
3, new Book("The Hobbit", "J.R.R. Tolkien"),
3333
4, new Book("The Lord of The Rings", "J.R.R. Tolkien"),
3434
5, new Book("The Silmarillion", "J.R.R. Tolkien"))); // @formatter:on

0 commit comments

Comments
 (0)