Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
183a651
add chat and function back to server prompt template
cynthiajoan Jan 26, 2026
20e2769
auto function calling for server prompt template
cynthiajoan Jan 26, 2026
224570a
Merge branch 'main' into firebaseai/server_prompt_session_function
cynthiajoan Feb 12, 2026
be55d7c
update with api decision
cynthiajoan Feb 13, 2026
a716459
add tool structure
cynthiajoan Mar 20, 2026
cad10e3
kts support
cynthiajoan Mar 20, 2026
cd28cb7
Merge branch 'main' into firebaseai/server_prompt_session_function
cynthiajoan Mar 20, 2026
9eb7597
fix compile error for server template page
cynthiajoan Mar 20, 2026
8b4d873
Add auto function calling to chat stream, and add test cases
cynthiajoan Mar 23, 2026
79e61c9
add tools and toolConfig into template request
cynthiajoan Mar 23, 2026
99de68b
fix the template function name and update the schema override sample
cynthiajoan Mar 24, 2026
2a9d021
Merge branch 'main' into firebaseai/server_prompt_session_function
cynthiajoan Mar 25, 2026
aa02f22
add too config
cynthiajoan Mar 25, 2026
41b12ef
some fix for e2e test
cynthiajoan Mar 25, 2026
8bfd117
fix analyzer
cynthiajoan Mar 25, 2026
27de3d3
Merge branch 'main' into firebaseai/server_prompt_session_function
cynthiajoan Mar 30, 2026
5da0e7e
Merge https://github.com/firebase/flutterfire into firebaseai/server_…
cynthiajoan Mar 31, 2026
5f65d17
tiny year change
cynthiajoan Mar 31, 2026
4c826a2
bot review comment
cynthiajoan Apr 1, 2026
83e2282
fix analyzer and formatter
cynthiajoan Apr 1, 2026
a0a6f03
Merge https://github.com/firebase/flutterfire into firebaseai/server_…
cynthiajoan Apr 2, 2026
e3f5f12
Merge branch 'firebaseai/server_prompt_session_function' of https://g…
cynthiajoan Apr 2, 2026
e62eaaa
remove unrelated files from PR
cynthiajoan Apr 2, 2026
5620afc
fix formatter
cynthiajoan Apr 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import 'package:flutter/material.dart';
import 'package:firebase_ai/firebase_ai.dart';
import 'package:firebase_auth/firebase_auth.dart';
import '../utils/function_call_utils.dart';
import '../widgets/message_widget.dart';

class FunctionCallingPage extends StatefulWidget {
Expand All @@ -31,13 +32,6 @@ class FunctionCallingPage extends StatefulWidget {
State<FunctionCallingPage> createState() => _FunctionCallingPageState();
}

class Location {
final String city;
final String state;

Location(this.city, this.state);
}

class _FunctionCallingPageState extends State<FunctionCallingPage> {
late GenerativeModel _functionCallModel;
late GenerativeModel _autoFunctionCallModel;
Expand Down Expand Up @@ -80,7 +74,7 @@ class _FunctionCallingPageState extends State<FunctionCallingPage> {
'The date for which to get the weather. Date must be in the format: YYYY-MM-DD.',
),
},
callable: _fetchWeatherCallable,
callable: fetchWeatherCallable,
);
_autoFindRestaurantsTool = AutoFunctionDeclaration(
name: 'findRestaurants',
Expand Down Expand Up @@ -231,16 +225,6 @@ class _FunctionCallingPageState extends State<FunctionCallingPage> {
};
}

Future<Map<String, Object?>> _fetchWeatherCallable(
Map<String, Object?> args,
) async {
final locationData = args['location']! as Map<String, Object?>;
final city = locationData['city']! as String;
final state = locationData['state']! as String;
final date = args['date']! as String;
return fetchWeather(Location(city, state), date);
}

void _initializeModel() {
final generationConfig = GenerationConfig(
thinkingConfig: _enableThinking
Expand Down Expand Up @@ -301,23 +285,6 @@ class _FunctionCallingPageState extends State<FunctionCallingPage> {
);
}

// This is a hypothetical API to return a fake weather data collection for
// certain location
Future<Map<String, Object?>> fetchWeather(
Location location,
String date,
) async {
// TODO(developer): Call a real weather API.
// Mock response from the API. In developer live code this would call the
// external API and return what that API returns.
final apiResponse = {
'temperature': 38,
'chancePrecipitation': '56%',
'cloudConditions': 'partly-cloudy',
};
return apiResponse;
}

/// Actual function to demonstrate the function calling feature.
final fetchWeatherTool = FunctionDeclaration(
'fetchWeather',
Expand Down
Loading
Loading