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.

google_ai: Parse thought parts in Gemini responses (#31925)

Fernando Freire3077abf9cfdf
diff --git a/crates/google_ai/src/google_ai.rs b/crates/google_ai/src/google_ai.rs
index 68a36ac8ff1..c6472dfd680 100644
--- a/crates/google_ai/src/google_ai.rs
+++ b/crates/google_ai/src/google_ai.rs
@@ -202,6 +202,7 @@ pub enum Part {
InlineDataPart(InlineDataPart),
FunctionCallPart(FunctionCallPart),
FunctionResponsePart(FunctionResponsePart),
+ ThoughtPart(ThoughtPart),
}
#[derive(Debug, Serialize, Deserialize)]
@@ -235,6 +236,13 @@ pub struct FunctionResponsePart {
pub function_response: FunctionResponse,
}
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ThoughtPart {
+ pub thought: bool,
+ pub thought_signature: String,
+}
+
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CitationSource {
diff --git a/crates/language_models/src/provider/google.rs b/crates/language_models/src/provider/google.rs
index b95d94506c5..718a7ba7ea0 100644
--- a/crates/language_models/src/provider/google.rs
+++ b/crates/language_models/src/provider/google.rs
@@ -620,6 +620,7 @@ impl GoogleEventMapper {
)));
}
Part::FunctionResponsePart(_) => {}
+ Part::ThoughtPart(_) => {}
});
}
}