From 2124b7ea998a949b2a5e4bdc1f12bb5275d636c2 Mon Sep 17 00:00:00 2001 From: Agus Zubiaga Date: Wed, 23 Apr 2025 20:16:15 -0300 Subject: [PATCH] agent: Encourage model to include displayed fields first (#29308) Instructs the model to include the fields that we display first in the input object, so that e.g the user can see the path of a file while the model generates the content. Release Notes: - N/A --- crates/assistant_tools/src/create_file_tool.rs | 3 +++ crates/assistant_tools/src/edit_file_tool.rs | 15 +++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/crates/assistant_tools/src/create_file_tool.rs b/crates/assistant_tools/src/create_file_tool.rs index 158991bf6d..7e434f0fc5 100644 --- a/crates/assistant_tools/src/create_file_tool.rs +++ b/crates/assistant_tools/src/create_file_tool.rs @@ -24,6 +24,9 @@ pub struct CreateFileToolInput { /// /// You can create a new file by providing a path of "directory1/new_file.txt" /// + /// + /// Make sure to include this field before the `contents` field in the input object + /// so that we can display it immediately. pub path: String, /// The text contents of the file to create. diff --git a/crates/assistant_tools/src/edit_file_tool.rs b/crates/assistant_tools/src/edit_file_tool.rs index f683bd3898..a5120877c6 100644 --- a/crates/assistant_tools/src/edit_file_tool.rs +++ b/crates/assistant_tools/src/edit_file_tool.rs @@ -26,6 +26,15 @@ use workspace::Workspace; #[derive(Debug, Serialize, Deserialize, JsonSchema)] pub struct EditFileToolInput { + /// A user-friendly markdown description of what's being replaced. This will be shown in the UI. + /// + /// Fix API endpoint URLs + /// Update copyright year in `page_footer` + /// + /// Make sure to include this field before all the others in the input object + /// so that we can display it immediately. + pub display_description: String, + /// The full path of the file to modify in the project. /// /// WARNING: When specifying which file path need changing, you MUST @@ -47,12 +56,6 @@ pub struct EditFileToolInput { /// pub path: PathBuf, - /// A user-friendly markdown description of what's being replaced. This will be shown in the UI. - /// - /// Fix API endpoint URLs - /// Update copyright year in `page_footer` - pub display_description: String, - /// The text to replace. pub old_string: String,