Skip to content

Commit c0cc26b

Browse files
committed
Replace FunctionCallback to ToolCallback
1 parent 40e1b43 commit c0cc26b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

kotlin/kotlin-function-callback/src/main/kotlin/com/example/kotlin_function_callback/KotlinFunctionCallbackApplication.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package com.example.kotlin_function_callback
22

33
import org.springframework.ai.chat.client.ChatClient
4-
import org.springframework.ai.model.function.FunctionCallback
4+
import org.springframework.ai.tool.ToolCallback
5+
import org.springframework.ai.tool.function.FunctionToolCallback
56
import org.springframework.boot.CommandLineRunner
67
import org.springframework.boot.autoconfigure.SpringBootApplication
78
import org.springframework.boot.runApplication
@@ -18,7 +19,7 @@ class KotlinFunctionCallbackApplication {
1819
val chatClient = chatClientBuilder.build();
1920
val response = chatClient
2021
.prompt("What are the weather conditions in San Francisco, Tokyo, and Paris? Find the temperature in Celsius for each of the three locations.")
21-
.functions("WeatherInfo")
22+
.tools("WeatherInfo")
2223
.call().chatResponse();
2324

2425
println("Response: $response")
@@ -33,9 +34,8 @@ class KotlinFunctionCallbackApplication {
3334
class Config {
3435

3536
@Bean
36-
fun weatherFunctionInfo(currentWeather: (WeatherRequest) -> WeatherResponse): FunctionCallback {
37-
return FunctionCallback.builder()
38-
.function("WeatherInfo", currentWeather)
37+
fun weatherFunctionInfo(currentWeather: (WeatherRequest) -> WeatherResponse): ToolCallback {
38+
return FunctionToolCallback.builder("WeatherInfo", currentWeather)
3939
.description(
4040
"Find the weather conditions, forecasts, and temperatures for a location, like a city or state."
4141
)

0 commit comments

Comments
 (0)