mirror of
https://github.com/google/adk-docs.git
synced 2026-09-14 16:16:59 +08:00
27e1303857
* Migrating from Map to typed data classes in FuncTool and LongRunningTool kotlin examples * lint cleanup of kotlin snippets * adding gradle wrapper for kotlin snippets * cleaning up build file for kotlin * fixing ktlint_code_style, added focus on included Gradle Wrapper --------- Co-authored-by: Kristopher Overholt <koverholt@google.com>
21 lines
609 B
Kotlin
21 lines
609 B
Kotlin
package com.google.adk.kt.examples.tools
|
|
|
|
import com.google.adk.kt.annotations.Param
|
|
import com.google.adk.kt.annotations.Tool
|
|
|
|
// --8<-- [start:required_params]
|
|
class WeatherService {
|
|
/**
|
|
* Retrieves the weather for a city in the specified unit.
|
|
*/
|
|
@Tool
|
|
fun getWeather(
|
|
@Param("The city and state, e.g., San Francisco, CA") location: String,
|
|
@Param("The temperature unit, either 'Celsius' or 'Fahrenheit'") unit: String,
|
|
): String {
|
|
// ... function logic ...
|
|
return "Weather for $location is sunny in $unit."
|
|
}
|
|
}
|
|
// --8<-- [end:required_params]
|