You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/firebase_vertexai/firebase_vertexai/example/lib/main.dart
+23-17Lines changed: 23 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -103,14 +103,16 @@ class _ChatWidgetState extends State<ChatWidget> {
103
103
});
104
104
}
105
105
106
-
// This is a hypothetical API to return a fake weather data collection for certain location
106
+
// This is a hypothetical API to return a fake weather data collection for
107
+
// certain location
107
108
Future<Map<String, Object?>> fetchWeather(
108
109
double latitude,
109
110
double longitude,
110
111
String date,
111
112
) async {
112
113
// TODO(developer): Call a real weather API.
113
-
// Mock response from the API. In developer live code this would call the external API and return what that API returns.
114
+
// Mock response from the API. In developer live code this would call the
115
+
// external API and return what that API returns.
114
116
final apiResponse = {
115
117
'location':'$latitude, $longitude',
116
118
'date': date,
@@ -127,24 +129,26 @@ class _ChatWidgetState extends State<ChatWidget> {
127
129
'Get the weather conditions for a specific city on a specific date.',
128
130
parameters: {
129
131
'location':Schema.object(
130
-
description:
131
-
'The longitude and latitude of the city for which to get the weather. Must always be a nested object of `longitude` and `latitude`. The values must be floats.',
132
+
description:'The longitude and latitude of the city for which to get '
133
+
'the weather. Must always be a nested object of '
134
+
'`longitude` and `latitude`. The values must be floats.',
132
135
properties: {
133
136
'latitude':Schema.number(
134
137
format:'float',
135
-
description:
136
-
'A numeric value indicating the latitude of the desired location between -90 and 90',
138
+
description:'A numeric value indicating the latitude of the '
139
+
'desired location between -90 and 90',
137
140
),
138
141
'longitude':Schema.number(
139
142
format:'float',
140
143
description:
141
-
'A numeric value indicating the longitude of the desired location between -180 and 180',
144
+
'A numeric value indicating the longitude of the desired '
145
+
'location between -180 and 180',
142
146
),
143
147
},
144
148
),
145
149
'date':Schema.string(
146
-
description:
147
-
'The date for which to get the weather. Date must be in the format: YYYY-MM-DD.',
150
+
description:'The date for which to get the weather. '
151
+
'Date must be in the format: YYYY-MM-DD.',
148
152
),
149
153
},
150
154
);
@@ -532,8 +536,8 @@ class _ChatWidgetState extends State<ChatWidget> {
532
536
var latitude = location['latitude']!asdouble;
533
537
var longitude = location['longitude']!asdouble;
534
538
final functionResult =awaitfetchWeather(latitude, longitude, date);
535
-
// Send the response to the model so that it can use the result to generate
536
-
// text for the user.
539
+
// Send the response to the model so that it can use the result to
0 commit comments