chatRaw method
Same as chat but yields raw SDK JSON chunks without extractTextFromResponse
mapping. Required by Gemma 4 path so callers can read the structured
tool_calls field via extractToolCalls.
Implementation
Stream<String> chatRaw(
String text, {
Uint8List? imageBytes,
Uint8List? audioBytes,
bool enableThinking = false,
}) {
final messageJson =
buildMessageJson(text, imageBytes: imageBytes, audioBytes: audioBytes);
final extraContext = enableThinking ? '{"enable_thinking": true}' : null;
return sendMessageStreamRaw(messageJson, extraContext: extraContext);
}