toGeminiRole function
Maps a Genkit Role to the role string expected by the Gemini API.
Gemini's Content API only understands user and model roles. Tool
(function response) messages must be sent with the user role for
compatibility.
Implementation
@visibleForTesting
String toGeminiRole(Role role) {
if (role == Role.model) return 'model';
// user, tool and anything else map to 'user'.
return 'user';
}