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
// Mock response from the API. In developer live code this would call the external API and return what that API returns.
114
114
final apiResponse = {
115
-
'location': arguments['location'],
115
+
'location':'$latitude, $longitude',
116
+
'date': date,
116
117
'temperature':38,
117
118
'chancePrecipitation':'56%',
118
119
'cloudConditions':'partly-cloudy',
@@ -121,45 +122,29 @@ class _ChatWidgetState extends State<ChatWidget> {
121
122
}
122
123
123
124
/// Actual function to demonstrate the function calling feature.
124
-
finalgetWeatherTool=FunctionDeclaration(
125
-
'fetchCurrentWeather',
125
+
finalfetchWeatherTool=FunctionDeclaration(
126
+
'fetchWeather',
126
127
'Get the weather conditions for a specific city on a specific date.',
127
128
parameters: {
128
-
'location':Schema.string(
129
+
'location':Schema.object(
129
130
description:
130
-
'The city name of the location for which to get the weather.',
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
+
properties: {
133
+
'latitude':Schema.number(
134
+
format:'float',
135
+
description:
136
+
'A numeric value indicating the latitude of the desired location between -90 and 90',
137
+
),
138
+
'longitude':Schema.number(
139
+
format:'float',
140
+
description:
141
+
'A numeric value indicating the longitude of the desired location between -180 and 180',
142
+
),
143
+
},
131
144
),
132
-
},
133
-
);
134
-
135
-
/// Sample function to show the usage of Schema, and demo the usage of ToolConfig.
136
-
final extractSaleRecordsTool =FunctionDeclaration(
137
-
'extractSaleRecords',
138
-
'Extract sale records from a document.',
139
-
parameters: {
140
-
'records':Schema.array(
141
-
description:'A list of sale records',
142
-
items:Schema.object(
143
-
description:'Data for a sale record',
144
-
properties: {
145
-
'id':Schema.integer(description:'The unique id of the sale.'),
146
-
'date':Schema.string(
147
-
description:
148
-
'Date of the sale, in the format of MMDDYY, e.g., 031023',
149
-
),
150
-
'totalAmount':
151
-
Schema.number(description:'The total amount of the sale.'),
152
-
'customerName':Schema.string(
153
-
description:
154
-
'The name of the customer, including first name and last name.',
155
-
),
156
-
'customerContact':Schema.string(
157
-
description:
158
-
'The phone number of the customer, e.g., 650-123-4567.',
0 commit comments