-
Notifications
You must be signed in to change notification settings - Fork 7.4k
feat(firebase-ai): add function calling example #2678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
"fetchWeather", | ||
"Get the weather conditions for a specific US city on a specific date.", | ||
mapOf( | ||
"city" to Schema.string("The US city of the location."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid confusion on what string should be sent as "city", "state" and "date", I'd send an empty string on this code sample and add a code comment on the line above, with something along the lines of // Replace this empty string with the US city of choice
. (Same for state and date).
import kotlinx.serialization.json.JsonPrimitive | ||
|
||
/** | ||
* Hypothetical repository that calls an external weather API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more accessible option (language-wise) is "Example repository".
suspend fun fetchWeather( | ||
city: String, state: String, date: String | ||
): JsonObject = withContext(Dispatchers.IO) { | ||
// For demo purposes, this hypothetical response is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, I'd rephrase it to something along the lines of // This response is a hardcoded example of the expected format, and should be used for demo purposes only
This is a follow up to #2667