renderVisionChat function

String renderVisionChat(
  1. List<Map<String, Object?>> messages, {
  2. List<Map<String, Object?>>? tools,
  3. bool addGenerationPrompt = true,
  4. bool enableThinking = true,
  5. bool preserveThinking = false,
})

Renders the still-image subset of the VL template. Images are represented by a single placeholder here; prepareVisionPrompt expands it to the number of projected image rows. Image parts use {'type': 'image'} and can be interleaved with text parts. Video is explicitly unsupported.

Implementation

String renderVisionChat(
  List<Map<String, Object?>> messages, {
  List<Map<String, Object?>>? tools,
  bool addGenerationPrompt = true,
  bool enableThinking = true,
  bool preserveThinking = false,
}) => renderChat(
  [
    for (final message in messages)
      {
        ...message,
        if (message.containsKey('content'))
          'content': _content(
            message['content'],
            toolItems: message['role'] == 'tool',
          ),
      },
  ],
  tools: tools,
  addGenerationPrompt: addGenerationPrompt,
  enableThinking: enableThinking,
  preserveThinking: preserveThinking,
);