diff --git a/crates/cloud_llm_client/src/cloud_llm_client.rs b/crates/cloud_llm_client/src/cloud_llm_client.rs index 786da3ae511bcb72b9684a8b6919a141450861ca..23f749ec439f8d26944435c4ceaaa34455ada075 100644 --- a/crates/cloud_llm_client/src/cloud_llm_client.rs +++ b/crates/cloud_llm_client/src/cloud_llm_client.rs @@ -134,6 +134,7 @@ pub struct PredictEditsBody { #[derive(Default, Debug, Clone, Copy, Serialize, Deserialize)] pub enum PredictEditsRequestTrigger { + Testing, Diagnostics, Cli, #[default] diff --git a/crates/edit_prediction/src/capture_example.rs b/crates/edit_prediction/src/capture_example.rs index 1c199be39b7b004bf47ad3e152e264c53efda73b..766dc0fa4fac93581d518b9f8ea18bf9fc0c7c47 100644 --- a/crates/edit_prediction/src/capture_example.rs +++ b/crates/edit_prediction/src/capture_example.rs @@ -14,6 +14,7 @@ use text::{BufferSnapshot as TextBufferSnapshot, Point}; pub(crate) const DEFAULT_EXAMPLE_CAPTURE_RATE_PER_10K_PREDICTIONS: u16 = 10; pub(crate) const DEFAULT_STAFF_EXAMPLE_CAPTURE_RATE_PER_10K_PREDICTIONS: u16 = 100; +pub(crate) const ZETA2_TESTING_RATE_PER_10K_PREDICTION: u16 = 500; pub fn capture_example( project: Entity, @@ -250,6 +251,10 @@ pub(crate) fn should_sample_edit_prediction_example_capture(cx: &App) -> bool { && rand::random::() % 10_000 < capture_rate } +pub(crate) fn should_send_testing_zeta2_request() -> bool { + rand::random::() % 10_000 < ZETA2_TESTING_RATE_PER_10K_PREDICTION +} + #[cfg(test)] mod tests { use super::*; diff --git a/crates/edit_prediction/src/edit_prediction.rs b/crates/edit_prediction/src/edit_prediction.rs index 098136b42f2c92ddb80a43a46bb29ed7518aff34..fb2de3d6e190954acd61815b15e0534e2950f5e6 100644 --- a/crates/edit_prediction/src/edit_prediction.rs +++ b/crates/edit_prediction/src/edit_prediction.rs @@ -71,7 +71,9 @@ pub mod zeta2; #[cfg(test)] mod edit_prediction_tests; -use crate::capture_example::should_sample_edit_prediction_example_capture; +use crate::capture_example::{ + should_sample_edit_prediction_example_capture, should_send_testing_zeta2_request, +}; use crate::license_detection::LicenseDetectionWatcher; use crate::mercury::Mercury; use crate::onboarding_modal::ZedPredictModal; @@ -170,6 +172,7 @@ pub enum EditPredictionModel { Mercury, } +#[derive(Clone)] pub struct EditPredictionModelInput { project: Entity, buffer: Entity, @@ -1760,7 +1763,20 @@ impl EditPredictionStore { } } let task = match self.edit_prediction_model { - EditPredictionModel::Zeta1 => zeta1::request_prediction_with_zeta1(self, inputs, cx), + EditPredictionModel::Zeta1 => { + if should_send_testing_zeta2_request() { + let mut zeta2_inputs = inputs.clone(); + zeta2_inputs.trigger = PredictEditsRequestTrigger::Testing; + zeta2::request_prediction_with_zeta2( + self, + zeta2_inputs, + Default::default(), + cx, + ) + .detach(); + } + zeta1::request_prediction_with_zeta1(self, inputs, cx) + } EditPredictionModel::Zeta2 { version } => { zeta2::request_prediction_with_zeta2(self, inputs, version, cx) }