Fix examples for deprecated usages

- Fix Java FunctionCallback chatClient to use toolNames instead of tools to specify the function name
 - Fix MCP FileSystem Application ChatClientBuilder to use defaultToolCallbacks instead of defaultTools
This commit is contained in:
Ilayaperumal Gopinathan
2025-05-01 18:12:30 +01:00
parent c0cc26b6c3
commit 22f3f55cbc
2 changed files with 4 additions and 2 deletions

View File

@@ -26,10 +26,12 @@ public class SpringAiJavaFunctionCallbackApplication {
ChatClient chatClient = chatClientBuilder.build();
ChatResponse response = chatClient
.prompt("What are the weather conditions in San Francisco, Tokyo, and Paris? Find the temperature in Celsius for each of the three locations.")
.tools("WeatherInfo")
.toolNames("WeatherInfo")
.call().chatResponse();
System.out.println("Response: " + response);
System.out.println("Exiting successfully");
System.exit(0);
}
catch (Exception e) {
System.out.println("Error during weather check: " + e.getMessage());

View File

@@ -29,7 +29,7 @@ public class Application {
return args -> {
var chatClient = chatClientBuilder
.defaultTools(new SyncMcpToolCallbackProvider(mcpClient))
.defaultToolCallbacks(new SyncMcpToolCallbackProvider(mcpClient))
.build();
System.out.println("Running predefined questions with AI model responses:\n");