diff --git a/crates/language_models/src/provider/copilot_chat.rs b/crates/language_models/src/provider/copilot_chat.rs index ce1b168e30..b00ec7570c 100644 --- a/crates/language_models/src/provider/copilot_chat.rs +++ b/crates/language_models/src/provider/copilot_chat.rs @@ -267,23 +267,6 @@ impl LanguageModel for CopilotChatLanguageModel { LanguageModelCompletionError, >, > { - if let Some(message) = request.messages.last() { - if message.contents_empty() { - const EMPTY_PROMPT_MSG: &str = - "Empty prompts aren't allowed. Please provide a non-empty prompt."; - return futures::future::ready(Err(anyhow::anyhow!(EMPTY_PROMPT_MSG).into())) - .boxed(); - } - - // Copilot Chat has a restriction that the final message must be from the user. - // While their API does return an error message for this, we can catch it earlier - // and provide a more helpful error message. - if !matches!(message.role, Role::User) { - const USER_ROLE_MSG: &str = "The final message must be from the user. To provide a system prompt, you must provide the system prompt followed by a user prompt."; - return futures::future::ready(Err(anyhow::anyhow!(USER_ROLE_MSG).into())).boxed(); - } - } - let copilot_request = match into_copilot_chat(&self.model, request) { Ok(request) => request, Err(err) => return futures::future::ready(Err(err.into())).boxed(),