Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent: Model name context (#41490)
versecafec1dea842fff6
diff --git a/crates/agent/src/edit_agent/evals.rs b/crates/agent/src/edit_agent/evals.rsindex 84cdd101f57..2cc6a6b4242 100644--- a/crates/agent/src/edit_agent/evals.rs+++ b/crates/agent/src/edit_agent/evals.rs@@ -1581,6 +1581,7 @@ impl EditAgentTest {let template = crate::SystemPromptTemplate {project: &project_context,available_tools: tool_names,+ model_name: None,};let templates = Templates::new();template.render(&templates).unwrap()diff --git a/crates/agent/src/templates.rs b/crates/agent/src/templates.rsindex 72a8f6633cb..db787d834e6 100644--- a/crates/agent/src/templates.rs+++ b/crates/agent/src/templates.rs@@ -38,6 +38,7 @@ pub struct SystemPromptTemplate<'a> {#[serde(flatten)]pub project: &'a prompt_store::ProjectContext,pub available_tools: Vec<SharedString>,+ pub model_name: Option<String>,}impl Template for SystemPromptTemplate<'_> {@@ -79,9 +80,11 @@ mod tests {let template = SystemPromptTemplate {project: &project,available_tools: vec!["echo".into()],+ model_name: Some("test-model".to_string()),};let templates = Templates::new();let rendered = template.render(&templates).unwrap();assert!(rendered.contains("## Fixing Diagnostics"));+ assert!(rendered.contains("test-model"));}}diff --git a/crates/agent/src/templates/system_prompt.hbs b/crates/agent/src/templates/system_prompt.hbsindex ca324fad7ac..46206471356 100644--- a/crates/agent/src/templates/system_prompt.hbs+++ b/crates/agent/src/templates/system_prompt.hbs@@ -150,6 +150,12 @@ Otherwise, follow debugging best practices:Operating System: {{os}}Default Shell: {{shell}}+{{#if model_name}}+## Model Information++You are powered by the model named {{model_name}}.++{{/if}}{{#if (or has_rules has_user_rules)}}## User's Custom Instructionsdiff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rsindex 64e512690be..4c0fb001637 100644--- a/crates/agent/src/thread.rs+++ b/crates/agent/src/thread.rs@@ -1928,6 +1928,7 @@ impl Thread {let system_prompt = SystemPromptTemplate {project: self.project_context.read(cx),available_tools,+ model_name: self.model.as_ref().map(|m| m.name().0.to_string()),}.render(&self.templates).context("failed to build system prompt")