zeta2: Include edits in prompt and add max_prompt_bytes param (#38737)

Release Notes:

- N/A

Co-authored-by: Michael Sloan <mgsloan@gmail.com>
This commit is contained in:
Agus Zubiaga
2025-09-23 19:50:07 +00:00
committed by GitHub
co-authored by Michael Sloan
parent bc528411df
commit 831de8e48f
8 changed files with 118 additions and 33 deletions
+7 -6
View File
@@ -63,11 +63,11 @@ struct ContextArgs {
#[derive(Debug, Args)]
struct Zeta2Args {
#[arg(long, default_value_t = 8192)]
prompt_max_bytes: usize,
max_prompt_bytes: usize,
#[arg(long, default_value_t = 2048)]
excerpt_max_bytes: usize,
max_excerpt_bytes: usize,
#[arg(long, default_value_t = 1024)]
excerpt_min_bytes: usize,
min_excerpt_bytes: usize,
#[arg(long, default_value_t = 0.66)]
target_before_cursor_over_total_bytes: f32,
#[arg(long, default_value_t = 1024)]
@@ -225,12 +225,13 @@ async fn get_context(
zeta.register_buffer(&buffer, &project, cx);
zeta.set_options(zeta2::ZetaOptions {
excerpt: EditPredictionExcerptOptions {
max_bytes: zeta2_args.excerpt_max_bytes,
min_bytes: zeta2_args.excerpt_min_bytes,
max_bytes: zeta2_args.max_excerpt_bytes,
min_bytes: zeta2_args.min_excerpt_bytes,
target_before_cursor_over_total_bytes: zeta2_args
.target_before_cursor_over_total_bytes,
},
max_diagnostic_bytes: zeta2_args.max_diagnostic_bytes,
max_prompt_bytes: zeta2_args.max_prompt_bytes,
})
});
// TODO: Actually wait for indexing.
@@ -246,7 +247,7 @@ async fn get_context(
let planned_prompt = cloud_zeta2_prompt::PlannedPrompt::populate(
&request,
&cloud_zeta2_prompt::PlanOptions {
max_bytes: zeta2_args.prompt_max_bytes,
max_bytes: zeta2_args.max_prompt_bytes,
},
)?;
anyhow::Ok(planned_prompt.to_prompt_string())