From 4383fee3c19c66197d92db2ae92b21a48672d5f0 Mon Sep 17 00:00:00 2001 From: Umesh Yadav <23421535+imumesh18@users.noreply.github.com> Date: Tue, 17 Jun 2025 00:31:55 +0530 Subject: [PATCH] assistant_tools: Enable diff-fenced edit parser for all Gemini models (#32812) I saw recently we added diff-fenced edit parser which improves the overall edit performance of gemini models in this PR: #32737. The idea is to enable it to all the models which has gemini as their id as this will help copilot and openrouter provider as they seem to aggregate all these models under one umbrella. I thought about adding a new method in LanguageModel as vendor_name() which returns the underlying actual model provider name but felt like a too early abstraction for a method to be used at one place. Release Notes: - N/A --- crates/assistant_tools/src/edit_agent/edit_parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/assistant_tools/src/edit_agent/edit_parser.rs b/crates/assistant_tools/src/edit_agent/edit_parser.rs index 5ba3931c56b5144a3affaca67b4f2daa24db683b..db58c2bf3685030abfa6cfdd506c068c6643dce8 100644 --- a/crates/assistant_tools/src/edit_agent/edit_parser.rs +++ b/crates/assistant_tools/src/edit_agent/edit_parser.rs @@ -75,7 +75,7 @@ impl FromStr for EditFormat { impl EditFormat { /// Return an optimal edit format for the language model pub fn from_model(model: Arc) -> anyhow::Result { - if model.provider_id().0 == "google" { + if model.provider_id().0 == "google" || model.id().0.to_lowercase().contains("gemini") { Ok(EditFormat::DiffFenced) } else { Ok(EditFormat::XmlTags)