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:
@@ -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());
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user