Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion examples/c/src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,19 @@ nlohmann::ordered_json GetUserContent(const std::string& model_type, int num_ima
content_json = nlohmann::ordered_json(content);

} else {
// Gemma-3 style: structured content
// Gemma-style structured content (Gemma-3 / Gemma-4)
content_json = nlohmann::ordered_json::array();

// Add N image blocks
for (int i = 0; i < num_images; i++) {
content_json.push_back(nlohmann::ordered_json::object({{"type", "image"}}));
}

// Add N audio blocks (e.g. Gemma-4 audio support)
for (int i = 0; i < num_audios; i++) {
content_json.push_back(nlohmann::ordered_json::object({{"type", "audio"}}));
}

// Always add a text block (with the user prompt)
content_json.push_back(nlohmann::ordered_json::object({{"type", "text"}, {"text", prompt}}));
}
Expand Down
Loading