Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gemini: Add support for passing images as part of the prompt (#29203)

Bennet Bo Fennerb0b620af5683
diff --git a/crates/language_models/src/provider/google.rs b/crates/language_models/src/provider/google.rs
index 3db0157396d..152eef13042 100644
--- a/crates/language_models/src/provider/google.rs
+++ b/crates/language_models/src/provider/google.rs
@@ -384,7 +384,14 @@ pub fn into_google(
}
}
language_model::MessageContent::RedactedThinking(_) => None,
- language_model::MessageContent::Image(_) => None,
+ language_model::MessageContent::Image(image) => {
+ Some(Part::InlineDataPart(google_ai::InlineDataPart {
+ inline_data: google_ai::GenerativeContentBlob {
+ mime_type: "image/png".to_string(),
+ data: image.source.to_string(),
+ },
+ }))
+ }
language_model::MessageContent::ToolUse(tool_use) => {
Some(Part::FunctionCallPart(google_ai::FunctionCallPart {
function_call: google_ai::FunctionCall {