Function calling only considers functions in the first tool? #194
Labels
component:dart sdk
Issue/PR related to Dart SDK
status:triaged
Issue/PR triaged to the corresponding sub-team
type:bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Description of the bug:
Using
gemini-1.5-flash
.Prompt: "What is the weather today?"
Tool configuration 1:
Response 1:
I need to know your location to get the weather forecast. Can you tell me your latitude and longitude?
Tool configuration 2 (switching the order of the two tools):
Response 2:
I am sorry, I cannot fulfill this request. I do not have access to weather information.
Artificially unifying the two tools into a virtual one, merging all functions under that:
The model properly asks first for the location tool for the lat / lon coordinates, and then with a second round of call (where I pass the location function call result down) it properly asks to call the weather function with the proper GPS coordinates.
Respnose:
The weather today is clear and the temperature is 25 degrees Celsius. The wind is blowing from the southwest at 2 meters per second.
Actual vs expected behavior:
I'd expect to be able to keep the two tools apart for extensible software architecture. So far I'm aiming for 8 tools, many of those have multiple functions.
Any other information you'd like to share?
I peeked at the code and it looks to me that ultimately a REST API call is made. The
_generateContentRequest
seems to serialize the tools OK (by looking at it)if (tools != null) 'tools': tools.map((t) => t.toJson()).toList(),
generative-ai-dart/pkgs/google_generative_ai/lib/src/model.dart
Line 333 in 8a58d77
The text was updated successfully, but these errors were encountered: