From 22342eff0e576fb84a89880ce993f3d681d7c3ab Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Thu, 29 May 2025 16:43:12 -0400 Subject: [PATCH] Pass up intent with completion requests (#31710) This PR adds a new `intent` field to completion requests to assist in categorizing them correctly. Release Notes: - N/A --------- Co-authored-by: Ben Brandt --- Cargo.lock | 7 +- Cargo.toml | 2 +- crates/agent/src/active_thread.rs | 9 ++- crates/agent/src/buffer_codegen.rs | 2 + crates/agent/src/message_editor.rs | 9 ++- crates/agent/src/terminal_inline_assistant.rs | 2 + crates/agent/src/thread.rs | 64 +++++++++++++------ crates/assistant_context_editor/Cargo.toml | 1 + .../assistant_context_editor/src/context.rs | 2 + crates/assistant_tools/src/edit_agent.rs | 11 +++- crates/eval/Cargo.toml | 1 + crates/eval/src/example.rs | 3 +- crates/eval/src/instance.rs | 1 + crates/git_ui/Cargo.toml | 1 + crates/git_ui/src/git_panel.rs | 6 +- crates/language_model/src/request.rs | 3 +- crates/language_models/src/provider/cloud.rs | 4 ++ .../language_models/src/provider/mistral.rs | 1 + .../language_models/src/provider/open_ai.rs | 1 + crates/rules_library/src/rules_library.rs | 1 + crates/semantic_index/src/summary_index.rs | 1 + 21 files changed, 101 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c600132a0b6a5a391e0caa2ecaf7f8fd70210048..75bb3b9870678effc0459f55560bec858767d4ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -531,6 +531,7 @@ dependencies = [ "workspace", "workspace-hack", "zed_actions", + "zed_llm_client", ] [[package]] @@ -5043,6 +5044,7 @@ dependencies = [ "util", "uuid", "workspace-hack", + "zed_llm_client", ] [[package]] @@ -6146,6 +6148,7 @@ dependencies = [ "workspace", "workspace-hack", "zed_actions", + "zed_llm_client", ] [[package]] @@ -19888,9 +19891,9 @@ dependencies = [ [[package]] name = "zed_llm_client" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be71e2f9b271e1eb8eb3e0d986075e770d1a0a299fb036abc3f1fc13a2fa7eb" +checksum = "de7d9523255f4e00ee3d0918e5407bd252d798a4a8e71f6d37f23317a1588203" dependencies = [ "anyhow", "serde", diff --git a/Cargo.toml b/Cargo.toml index c5137091ef70284d4721bc58fa7e6429c5b56315..69417a3ac359c93900ad1e962c009b99560d3acf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -616,7 +616,7 @@ wasmtime-wasi = "29" which = "6.0.0" wit-component = "0.221" workspace-hack = "0.1.0" -zed_llm_client = "0.8.2" +zed_llm_client = "0.8.4" zstd = "0.11" [workspace.dependencies.async-stripe] diff --git a/crates/agent/src/active_thread.rs b/crates/agent/src/active_thread.rs index 8229df354162d1e85fa8d6cf0c09aedc2778a521..e5d07bcfe1c1a9206605c0dc40ef1066c6d81021 100644 --- a/crates/agent/src/active_thread.rs +++ b/crates/agent/src/active_thread.rs @@ -54,6 +54,7 @@ use util::ResultExt as _; use util::markdown::MarkdownCodeBlock; use workspace::Workspace; use zed_actions::assistant::OpenRulesLibrary; +use zed_llm_client::CompletionIntent; pub struct ActiveThread { context_store: Entity, @@ -1412,6 +1413,7 @@ impl ActiveThread { let request = language_model::LanguageModelRequest { thread_id: None, prompt_id: None, + intent: None, mode: None, messages: vec![request_message], tools: vec![], @@ -1573,7 +1575,12 @@ impl ActiveThread { this.thread.update(cx, |thread, cx| { thread.advance_prompt_id(); - thread.send_to_model(model.model, Some(window.window_handle()), cx); + thread.send_to_model( + model.model, + CompletionIntent::UserPrompt, + Some(window.window_handle()), + cx, + ); }); this._load_edited_message_context_task = None; cx.notify(); diff --git a/crates/agent/src/buffer_codegen.rs b/crates/agent/src/buffer_codegen.rs index 7c718eac9c9f4fb90d9ffc204142835150a30594..1a423c47d5f2d262cce9fcc4cf964b7a8c7c8d66 100644 --- a/crates/agent/src/buffer_codegen.rs +++ b/crates/agent/src/buffer_codegen.rs @@ -34,6 +34,7 @@ use std::{ }; use streaming_diff::{CharOperation, LineDiff, LineOperation, StreamingDiff}; use telemetry_events::{AssistantEventData, AssistantKind, AssistantPhase}; +use zed_llm_client::CompletionIntent; pub struct BufferCodegen { alternatives: Vec>, @@ -464,6 +465,7 @@ impl CodegenAlternative { LanguageModelRequest { thread_id: None, prompt_id: None, + intent: Some(CompletionIntent::InlineAssist), mode: None, tools: Vec::new(), tool_choice: None, diff --git a/crates/agent/src/message_editor.rs b/crates/agent/src/message_editor.rs index f01fc56048da177786c784c872ff7bba9818646b..a830f279beba67854f8d9d64254c4093e20ef2cf 100644 --- a/crates/agent/src/message_editor.rs +++ b/crates/agent/src/message_editor.rs @@ -41,6 +41,7 @@ use theme::ThemeSettings; use ui::{Disclosure, KeyBinding, PopoverMenuHandle, Tooltip, prelude::*}; use util::{ResultExt as _, maybe}; use workspace::{CollaboratorId, Workspace}; +use zed_llm_client::CompletionIntent; use crate::context_picker::{ContextPicker, ContextPickerCompletionProvider, crease_for_mention}; use crate::context_store::ContextStore; @@ -358,7 +359,12 @@ impl MessageEditor { thread .update(cx, |thread, cx| { thread.advance_prompt_id(); - thread.send_to_model(model, Some(window_handle), cx); + thread.send_to_model( + model, + CompletionIntent::UserPrompt, + Some(window_handle), + cx, + ); }) .log_err(); }) @@ -1248,6 +1254,7 @@ impl MessageEditor { let request = language_model::LanguageModelRequest { thread_id: None, prompt_id: None, + intent: None, mode: None, messages: vec![request_message], tools: vec![], diff --git a/crates/agent/src/terminal_inline_assistant.rs b/crates/agent/src/terminal_inline_assistant.rs index 992f32af985ba2cdb670cdbe7c5637d16d37b096..12bc0c83764bf3702b867f428da5d55ba590f04b 100644 --- a/crates/agent/src/terminal_inline_assistant.rs +++ b/crates/agent/src/terminal_inline_assistant.rs @@ -25,6 +25,7 @@ use terminal_view::TerminalView; use ui::prelude::*; use util::ResultExt; use workspace::{Toast, Workspace, notifications::NotificationId}; +use zed_llm_client::CompletionIntent; pub fn init( fs: Arc, @@ -291,6 +292,7 @@ impl TerminalInlineAssistant { thread_id: None, prompt_id: None, mode: None, + intent: Some(CompletionIntent::TerminalInlineAssist), messages: vec![request_message], tools: Vec::new(), tool_choice: None, diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rs index 98f505f074ac91e8be0c4defb8b8bf78b6c62bb9..50e8017d7a100f83e8f89030da96e78231d83d5b 100644 --- a/crates/agent/src/thread.rs +++ b/crates/agent/src/thread.rs @@ -38,7 +38,7 @@ use thiserror::Error; use ui::Window; use util::{ResultExt as _, post_inc}; use uuid::Uuid; -use zed_llm_client::CompletionRequestStatus; +use zed_llm_client::{CompletionIntent, CompletionRequestStatus}; use crate::ThreadStore; use crate::context::{AgentContext, AgentContextHandle, ContextLoadResult, LoadedContext}; @@ -1157,6 +1157,7 @@ impl Thread { pub fn send_to_model( &mut self, model: Arc, + intent: CompletionIntent, window: Option, cx: &mut Context, ) { @@ -1166,7 +1167,7 @@ impl Thread { self.remaining_turns -= 1; - let request = self.to_completion_request(model.clone(), cx); + let request = self.to_completion_request(model.clone(), intent, cx); self.stream_completion(request, model, window, cx); } @@ -1186,11 +1187,13 @@ impl Thread { pub fn to_completion_request( &self, model: Arc, + intent: CompletionIntent, cx: &mut Context, ) -> LanguageModelRequest { let mut request = LanguageModelRequest { thread_id: Some(self.id.to_string()), prompt_id: Some(self.last_prompt_id.to_string()), + intent: Some(intent), mode: None, messages: vec![], tools: Vec::new(), @@ -1344,12 +1347,14 @@ impl Thread { fn to_summarize_request( &self, model: &Arc, + intent: CompletionIntent, added_user_message: String, cx: &App, ) -> LanguageModelRequest { let mut request = LanguageModelRequest { thread_id: None, prompt_id: None, + intent: Some(intent), mode: None, messages: vec![], tools: Vec::new(), @@ -1826,7 +1831,12 @@ impl Thread { If the conversation is about a specific subject, include it in the title. \ Be descriptive. DO NOT speak in the first person."; - let request = self.to_summarize_request(&model.model, added_user_message.into(), cx); + let request = self.to_summarize_request( + &model.model, + CompletionIntent::ThreadSummarization, + added_user_message.into(), + cx, + ); self.summary = ThreadSummary::Generating; @@ -1927,7 +1937,12 @@ impl Thread { 4. Any action items or next steps if any\n\ Format it in Markdown with headings and bullet points."; - let request = self.to_summarize_request(&model, added_user_message.into(), cx); + let request = self.to_summarize_request( + &model, + CompletionIntent::ThreadContextSummarization, + added_user_message.into(), + cx, + ); *self.detailed_summary_tx.borrow_mut() = DetailedSummaryState::Generating { message_id: last_message_id, @@ -2019,7 +2034,8 @@ impl Thread { model: Arc, ) -> Vec { self.auto_capture_telemetry(cx); - let request = Arc::new(self.to_completion_request(model.clone(), cx)); + let request = + Arc::new(self.to_completion_request(model.clone(), CompletionIntent::ToolResults, cx)); let pending_tool_uses = self .tool_use .pending_tool_uses() @@ -2215,7 +2231,7 @@ impl Thread { if self.all_tools_finished() { if let Some(ConfiguredModel { model, .. }) = self.configured_model.as_ref() { if !canceled { - self.send_to_model(model.clone(), window, cx); + self.send_to_model(model.clone(), CompletionIntent::ToolResults, window, cx); } self.auto_capture_telemetry(cx); } @@ -2902,7 +2918,7 @@ fn main() {{ // Check message in request let request = thread.update(cx, |thread, cx| { - thread.to_completion_request(model.clone(), cx) + thread.to_completion_request(model.clone(), CompletionIntent::UserPrompt, cx) }); assert_eq!(request.messages.len(), 2); @@ -2997,7 +3013,7 @@ fn main() {{ // Check entire request to make sure all contexts are properly included let request = thread.update(cx, |thread, cx| { - thread.to_completion_request(model.clone(), cx) + thread.to_completion_request(model.clone(), CompletionIntent::UserPrompt, cx) }); // The request should contain all 3 messages @@ -3104,7 +3120,7 @@ fn main() {{ // Check message in request let request = thread.update(cx, |thread, cx| { - thread.to_completion_request(model.clone(), cx) + thread.to_completion_request(model.clone(), CompletionIntent::UserPrompt, cx) }); assert_eq!(request.messages.len(), 2); @@ -3130,7 +3146,7 @@ fn main() {{ // Check that both messages appear in the request let request = thread.update(cx, |thread, cx| { - thread.to_completion_request(model.clone(), cx) + thread.to_completion_request(model.clone(), CompletionIntent::UserPrompt, cx) }); assert_eq!(request.messages.len(), 3); @@ -3174,7 +3190,7 @@ fn main() {{ // Create a request and check that it doesn't have a stale buffer warning yet let initial_request = thread.update(cx, |thread, cx| { - thread.to_completion_request(model.clone(), cx) + thread.to_completion_request(model.clone(), CompletionIntent::UserPrompt, cx) }); // Make sure we don't have a stale file warning yet @@ -3210,7 +3226,7 @@ fn main() {{ // Create a new request and check for the stale buffer warning let new_request = thread.update(cx, |thread, cx| { - thread.to_completion_request(model.clone(), cx) + thread.to_completion_request(model.clone(), CompletionIntent::UserPrompt, cx) }); // We should have a stale file warning as the last message @@ -3260,7 +3276,7 @@ fn main() {{ }); let request = thread.update(cx, |thread, cx| { - thread.to_completion_request(model.clone(), cx) + thread.to_completion_request(model.clone(), CompletionIntent::UserPrompt, cx) }); assert_eq!(request.temperature, Some(0.66)); @@ -3280,7 +3296,7 @@ fn main() {{ }); let request = thread.update(cx, |thread, cx| { - thread.to_completion_request(model.clone(), cx) + thread.to_completion_request(model.clone(), CompletionIntent::UserPrompt, cx) }); assert_eq!(request.temperature, Some(0.66)); @@ -3300,7 +3316,7 @@ fn main() {{ }); let request = thread.update(cx, |thread, cx| { - thread.to_completion_request(model.clone(), cx) + thread.to_completion_request(model.clone(), CompletionIntent::UserPrompt, cx) }); assert_eq!(request.temperature, Some(0.66)); @@ -3320,7 +3336,7 @@ fn main() {{ }); let request = thread.update(cx, |thread, cx| { - thread.to_completion_request(model.clone(), cx) + thread.to_completion_request(model.clone(), CompletionIntent::UserPrompt, cx) }); assert_eq!(request.temperature, None); } @@ -3352,7 +3368,12 @@ fn main() {{ // Send a message thread.update(cx, |thread, cx| { thread.insert_user_message("Hi!", ContextLoadResult::default(), None, vec![], cx); - thread.send_to_model(model.clone(), None, cx); + thread.send_to_model( + model.clone(), + CompletionIntent::ThreadSummarization, + None, + cx, + ); }); let fake_model = model.as_fake(); @@ -3447,7 +3468,7 @@ fn main() {{ vec![], cx, ); - thread.send_to_model(model.clone(), None, cx); + thread.send_to_model(model.clone(), CompletionIntent::UserPrompt, None, cx); }); let fake_model = model.as_fake(); @@ -3485,7 +3506,12 @@ fn main() {{ ) { thread.update(cx, |thread, cx| { thread.insert_user_message("Hi!", ContextLoadResult::default(), None, vec![], cx); - thread.send_to_model(model.clone(), None, cx); + thread.send_to_model( + model.clone(), + CompletionIntent::ThreadSummarization, + None, + cx, + ); }); let fake_model = model.as_fake(); diff --git a/crates/assistant_context_editor/Cargo.toml b/crates/assistant_context_editor/Cargo.toml index 8a1f9b1aaa5bd326926bdaccb36a44fc0e301a33..99b248bc8fc2c1c95f7452d0828548d451ca8563 100644 --- a/crates/assistant_context_editor/Cargo.toml +++ b/crates/assistant_context_editor/Cargo.toml @@ -57,6 +57,7 @@ uuid.workspace = true workspace-hack.workspace = true workspace.workspace = true zed_actions.workspace = true +zed_llm_client.workspace = true [dev-dependencies] language_model = { workspace = true, features = ["test-support"] } diff --git a/crates/assistant_context_editor/src/context.rs b/crates/assistant_context_editor/src/context.rs index 99092775d0175c59b8c53d1ff5fa2f30a0befe4c..c69bcd08d81be284708ad2b38e1edc72165fc385 100644 --- a/crates/assistant_context_editor/src/context.rs +++ b/crates/assistant_context_editor/src/context.rs @@ -44,6 +44,7 @@ use text::{BufferSnapshot, ToPoint}; use ui::IconName; use util::{ResultExt, TryFutureExt, post_inc}; use uuid::Uuid; +use zed_llm_client::CompletionIntent; #[derive(Clone, Debug, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)] pub struct ContextId(String); @@ -2262,6 +2263,7 @@ impl AssistantContext { let mut completion_request = LanguageModelRequest { thread_id: None, prompt_id: None, + intent: Some(CompletionIntent::UserPrompt), mode: None, messages: Vec::new(), tools: Vec::new(), diff --git a/crates/assistant_tools/src/edit_agent.rs b/crates/assistant_tools/src/edit_agent.rs index 4925f2c02e65f73d48d318c682f7e5242abce810..c96dde091b0ef54c4cb1bc83f9c18502585c0c1b 100644 --- a/crates/assistant_tools/src/edit_agent.rs +++ b/crates/assistant_tools/src/edit_agent.rs @@ -25,6 +25,7 @@ use serde::{Deserialize, Serialize}; use std::{cmp, iter, mem, ops::Range, path::PathBuf, sync::Arc, task::Poll}; use streaming_diff::{CharOperation, StreamingDiff}; use util::debug_panic; +use zed_llm_client::CompletionIntent; #[derive(Serialize)] struct CreateFilePromptTemplate { @@ -102,7 +103,9 @@ impl EditAgent { edit_description, } .render(&this.templates)?; - let new_chunks = this.request(conversation, prompt, cx).await?; + let new_chunks = this + .request(conversation, CompletionIntent::CreateFile, prompt, cx) + .await?; let (output, mut inner_events) = this.overwrite_with_chunks(buffer, new_chunks, cx); while let Some(event) = inner_events.next().await { @@ -226,7 +229,9 @@ impl EditAgent { edit_description, } .render(&this.templates)?; - let edit_chunks = this.request(conversation, prompt, cx).await?; + let edit_chunks = this + .request(conversation, CompletionIntent::EditFile, prompt, cx) + .await?; let (output, mut inner_events) = this.apply_edit_chunks(buffer, edit_chunks, cx); while let Some(event) = inner_events.next().await { @@ -517,6 +522,7 @@ impl EditAgent { async fn request( &self, mut conversation: LanguageModelRequest, + intent: CompletionIntent, prompt: String, cx: &mut AsyncApp, ) -> Result>> { @@ -574,6 +580,7 @@ impl EditAgent { let request = LanguageModelRequest { thread_id: conversation.thread_id, prompt_id: conversation.prompt_id, + intent: Some(intent), mode: conversation.mode, messages: conversation.messages, tool_choice, diff --git a/crates/eval/Cargo.toml b/crates/eval/Cargo.toml index 408463b1bc5a373d450e212b58b5e859be7bcb44..ae02ad79000695a67bcd15eaa3950f8f013846ca 100644 --- a/crates/eval/Cargo.toml +++ b/crates/eval/Cargo.toml @@ -67,3 +67,4 @@ unindent.workspace = true util.workspace = true uuid.workspace = true workspace-hack.workspace = true +zed_llm_client.workspace = true diff --git a/crates/eval/src/example.rs b/crates/eval/src/example.rs index ed7f139d28365d7ecbf4189d724693262c25a30f..d4cbb8f86ef66a534bad51bd69e32ce180fd1836 100644 --- a/crates/eval/src/example.rs +++ b/crates/eval/src/example.rs @@ -19,6 +19,7 @@ use collections::HashMap; use futures::{FutureExt as _, StreamExt, channel::mpsc, select_biased}; use gpui::{App, AppContext, AsyncApp, Entity}; use language_model::{LanguageModel, Role, StopReason}; +use zed_llm_client::CompletionIntent; pub const THREAD_EVENT_TIMEOUT: Duration = Duration::from_secs(60 * 2); @@ -307,7 +308,7 @@ impl ExampleContext { let message_count_before = self.app.update_entity(&self.agent_thread, |thread, cx| { thread.set_remaining_turns(iterations); - thread.send_to_model(model, None, cx); + thread.send_to_model(model, CompletionIntent::UserPrompt, None, cx); thread.messages().len() })?; diff --git a/crates/eval/src/instance.rs b/crates/eval/src/instance.rs index 6e20c66c18e284774ec6d4cf69f618b77689e55b..16bfc5c669a83ae04621b9bc7c2a2b8890346eb7 100644 --- a/crates/eval/src/instance.rs +++ b/crates/eval/src/instance.rs @@ -576,6 +576,7 @@ impl ExampleInstance { thread_id: None, prompt_id: None, mode: None, + intent: None, messages: vec![LanguageModelRequestMessage { role: Role::User, content: vec![MessageContent::Text(to_prompt(assertion.description))], diff --git a/crates/git_ui/Cargo.toml b/crates/git_ui/Cargo.toml index 33f5a4e4fd1e1b51ecb2af7ec2a4018655bdc0db..2d4e5a7f15a60d393bc517153d70b831fb56b347 100644 --- a/crates/git_ui/Cargo.toml +++ b/crates/git_ui/Cargo.toml @@ -59,6 +59,7 @@ util.workspace = true workspace.workspace = true zed_actions.workspace = true workspace-hack.workspace = true +zed_llm_client.workspace = true [target.'cfg(windows)'.dependencies] windows.workspace = true diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 4946bd0ecd02bfb6a6b6a43ff41962b36325db70..eebaf01e30e9353a3975b22059d3c0bca0778603 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -13,7 +13,6 @@ use anyhow::Context as _; use askpass::AskPassDelegate; use assistant_settings::AssistantSettings; use db::kvp::KEY_VALUE_STORE; - use editor::{ Editor, EditorElement, EditorMode, EditorSettings, MultiBuffer, ShowScrollbar, scroll::ScrollbarAutoHide, @@ -42,6 +41,7 @@ use language_model::{ }; use menu::{Confirm, SecondaryConfirm, SelectFirst, SelectLast, SelectNext, SelectPrevious}; use multi_buffer::ExcerptInfo; +use notifications::status_toast::{StatusToast, ToastIcon}; use panel::{ PanelHeader, panel_button, panel_editor_container, panel_editor_style, panel_filled_button, panel_icon_button, @@ -64,13 +64,12 @@ use ui::{ }; use util::{ResultExt, TryFutureExt, maybe}; use workspace::AppState; - -use notifications::status_toast::{StatusToast, ToastIcon}; use workspace::{ Workspace, dock::{DockPosition, Panel, PanelEvent}, notifications::DetachAndPromptErr, }; +use zed_llm_client::CompletionIntent; actions!( git_panel, @@ -1765,6 +1764,7 @@ impl GitPanel { let request = LanguageModelRequest { thread_id: None, prompt_id: None, + intent: Some(CompletionIntent::GenerateGitCommitMessage), mode: None, messages: vec![LanguageModelRequestMessage { role: Role::User, diff --git a/crates/language_model/src/request.rs b/crates/language_model/src/request.rs index 1a6c695192cbc614e63c2ee5c354f01619c98a79..b711642fb406c0bf0aeaec558474df96dc69b56d 100644 --- a/crates/language_model/src/request.rs +++ b/crates/language_model/src/request.rs @@ -12,7 +12,7 @@ use gpui::{ use image::codecs::png::PngEncoder; use serde::{Deserialize, Serialize}; use util::ResultExt; -use zed_llm_client::CompletionMode; +use zed_llm_client::{CompletionIntent, CompletionMode}; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Hash)] pub struct LanguageModelImage { @@ -281,6 +281,7 @@ pub enum LanguageModelToolChoice { pub struct LanguageModelRequest { pub thread_id: Option, pub prompt_id: Option, + pub intent: Option, pub mode: Option, pub messages: Vec, pub tools: Vec, diff --git a/crates/language_models/src/provider/cloud.rs b/crates/language_models/src/provider/cloud.rs index 8847423b34504705554529da6e2fb61f4a04448c..34b2bc368c8b31de61988fafd9805d39f6e4e835 100644 --- a/crates/language_models/src/provider/cloud.rs +++ b/crates/language_models/src/provider/cloud.rs @@ -801,6 +801,7 @@ impl LanguageModel for CloudLanguageModel { > { let thread_id = request.thread_id.clone(); let prompt_id = request.prompt_id.clone(); + let intent = request.intent; let mode = request.mode; let app_version = cx.update(|cx| AppVersion::global(cx)).ok(); match &self.model { @@ -827,6 +828,7 @@ impl LanguageModel for CloudLanguageModel { CompletionBody { thread_id, prompt_id, + intent, mode, provider: zed_llm_client::LanguageModelProvider::Anthropic, model: request.model.clone(), @@ -879,6 +881,7 @@ impl LanguageModel for CloudLanguageModel { CompletionBody { thread_id, prompt_id, + intent, mode, provider: zed_llm_client::LanguageModelProvider::OpenAi, model: request.model.clone(), @@ -916,6 +919,7 @@ impl LanguageModel for CloudLanguageModel { CompletionBody { thread_id, prompt_id, + intent, mode, provider: zed_llm_client::LanguageModelProvider::Google, model: request.model.model_id.clone(), diff --git a/crates/language_models/src/provider/mistral.rs b/crates/language_models/src/provider/mistral.rs index cf9ca366ab8eab7d949bbeea914fce243da040bf..be32bcc8bc4ca7b88c9bd55f3b9ee3a6fb90f415 100644 --- a/crates/language_models/src/provider/mistral.rs +++ b/crates/language_models/src/provider/mistral.rs @@ -820,6 +820,7 @@ mod tests { tool_choice: None, thread_id: None, prompt_id: None, + intent: None, mode: None, stop: Vec::new(), }; diff --git a/crates/language_models/src/provider/open_ai.rs b/crates/language_models/src/provider/open_ai.rs index 47e4ca319ee6f9f11f2d2d564b99ed3d9878b157..14cd516ce78537756e955502f68276d465c20bb6 100644 --- a/crates/language_models/src/provider/open_ai.rs +++ b/crates/language_models/src/provider/open_ai.rs @@ -858,6 +858,7 @@ mod tests { let request = LanguageModelRequest { thread_id: None, prompt_id: None, + intent: None, mode: None, messages: vec![LanguageModelRequestMessage { role: Role::User, diff --git a/crates/rules_library/src/rules_library.rs b/crates/rules_library/src/rules_library.rs index 1073a483eac11d547f206c8a570fa7cee17a84bd..0da3b0819ec716270e8b4ed44de34e72da7668ab 100644 --- a/crates/rules_library/src/rules_library.rs +++ b/crates/rules_library/src/rules_library.rs @@ -922,6 +922,7 @@ impl RulesLibrary { LanguageModelRequest { thread_id: None, prompt_id: None, + intent: None, mode: None, messages: vec![LanguageModelRequestMessage { role: Role::System, diff --git a/crates/semantic_index/src/summary_index.rs b/crates/semantic_index/src/summary_index.rs index ebf480989fd10df6032245952afe63db4ac6501b..108130ebc9883414284b736199fe0114def413dc 100644 --- a/crates/semantic_index/src/summary_index.rs +++ b/crates/semantic_index/src/summary_index.rs @@ -560,6 +560,7 @@ impl SummaryIndex { thread_id: None, prompt_id: None, mode: None, + intent: None, messages: vec![LanguageModelRequestMessage { role: Role::User, content: vec![prompt.into()],