diff --git a/crates/assistant2/src/system_prompt.md b/crates/assistant2/src/system_prompt.md new file mode 100644 index 0000000000000000000000000000000000000000..7b7871922b25eebe6b6239e8959585d2b3f6714e --- /dev/null +++ b/crates/assistant2/src/system_prompt.md @@ -0,0 +1,12 @@ +You are an AI assistant integrated into a text editor. Your goal is to do one of the following two things: + +1. Help users answer questions and perform tasks related to their codebase. +2. Answer general-purpose questions unrelated to their particular codebase. + +It will be up to you to decide which of these you are doing based on what the user has told you. When unclear, ask clarifying questions to understand the user's intent before proceeding. + +You should only perform actions that modify the user’s system if explicitly requested by the user: +- If the user asks a question about how to accomplish a task, provide guidance or information, and use read-only tools (e.g., search) to assist. You may suggest potential actions, but do not directly modify the user’s system without explicit instruction. +- If the user clearly requests that you perform an action, carry out the action directly without explaining why you are doing so. + +Be concise and direct in your responses. diff --git a/crates/assistant2/src/thread.rs b/crates/assistant2/src/thread.rs index 6bfbda90dc08e2c0b20cef4e63d7e425292131de..3c8b833ab3e5f39eb382d69a7d6e551b38411b0f 100644 --- a/crates/assistant2/src/thread.rs +++ b/crates/assistant2/src/thread.rs @@ -376,7 +376,13 @@ impl Thread { _cx: &App, ) -> LanguageModelRequest { let mut request = LanguageModelRequest { - messages: vec![], + messages: vec![LanguageModelRequestMessage { + role: Role::System, + content: vec![MessageContent::Text( + include_str!("./system_prompt.md").to_string(), + )], + cache: true, + }], tools: Vec::new(), stop: Vec::new(), temperature: None, diff --git a/crates/assistant_tool/src/tool_working_set.rs b/crates/assistant_tool/src/tool_working_set.rs index a9b034e08d484d90a475dd0a85e2ac7bba2e5d06..e1d73ed7b7279befa8accda3e1128d59dce70bc2 100644 --- a/crates/assistant_tool/src/tool_working_set.rs +++ b/crates/assistant_tool/src/tool_working_set.rs @@ -15,7 +15,6 @@ pub struct ToolWorkingSet { state: Mutex, } -#[derive(Default)] struct WorkingSetState { context_server_tools_by_id: HashMap>, context_server_tools_by_name: HashMap>, @@ -24,6 +23,18 @@ struct WorkingSetState { next_tool_id: ToolId, } +impl Default for WorkingSetState { + fn default() -> Self { + Self { + context_server_tools_by_id: Default::default(), + context_server_tools_by_name: Default::default(), + disabled_tools_by_source: Default::default(), + is_scripting_tool_disabled: true, + next_tool_id: Default::default(), + } + } +} + impl ToolWorkingSet { pub fn tool(&self, name: &str, cx: &App) -> Option> { self.state