firebase / firebase/flutterfire
[firebase_ai]: Grounding with Google not working in Flutter
- Dominant language
- Dart
- Stars
- 9.3k
- Forks
- 4.1k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 53
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues.
### Which plugins are affected?
Other
### Which platforms are affected?
Android
### Description
I adding multiple tools with grounding using Firebase Ai Logic with Gemini API.
All tools are working but googleSearch fails,
`Error: ServerException Tool use with function calling is unsupported`
if i remove ` Tool.googleSearch(),` everything works then.
```
firebase_ai: ^3.2.0
firebase_core: ^4.1.0
```
```
final GenerativeModel _model = FirebaseAI.googleAI().generativeModel(
model: modalName,
generationConfig: GenerationConfig(),
tools: [
Tool.functionDeclarations([changeAppThemeTool, writeToTextFileTool]),
Tool.googleSearch(),
],
);
```
user Input
```
String text="Who won the recent cricket world cup?";
String finalPrompt="""
Follow the instructions give by user.
${text.trim()}
Use the following tools or sequence of tools if needed:
1. changeAppTheme: change the app theme colors based on user's request, notify
2. Google Search if needed to get the latest information.
3.
If no tool required treat normal text response.
If tools is triggered the combine result of user query along with result return from tools
"""
```
### Reproducing the issue
```
modalName = 'gemini-2.5-flash';
prompt="Who won the recent cricket world cup?";
final GenerativeModel _model = FirebaseAI.googleAI().generativeModel(
model: modalName,
generationConfig: GenerationConfig(),
tools: [
Tool.googleSearch(),
],
);
final content = [Content.text(prompt)];
final response = await _model.generateContent(content);
```
### Firebase Core version
3.2.0
### Flutter Version
3.32.0
### Relevant Log Output
```shell
```
### Flutter dependencies
Expand Flutter dependencies snippet
```yaml
Replace this line with the contents of your `flutter pub deps -- --style=compact`.
```
### Additional context and comments
I/flutter (31342): Error generating content: Tool use with function calling is unsupported
I/flutter (31342): #0 DeveloperSerialization.parseGenerateContentResponse (package:firebase_ai/src/developer/api.dart:108:56)
I/flutter (31342):
I/flutter (31342): #1 GeminiAiServices.generateContent (package:flutter_app_vertex_ai_agent/services/gemini_ai_services.dart:29:24)
I/flutter (31342):
I/flutter (31342): #2 _GenerateContentPageState.generateContent (package:flutter_app_vertex_ai_agent/screens/generate_content_page.dart:437:29)
I/flutter (31342):
I/flutter (31342): Error generateContent: ServerException Tool use with function calling is unsupported
Contributor guide
Assessment
This issue has not been assessed yet.