zeta2: Add labeled sections prompt format (#38828)

Release Notes:

- N/A

Co-authored-by: Agus <agus@zed.dev>
This commit is contained in:
Michael Sloan
2025-09-25 00:07:43 +00:00
committed by GitHub
co-authored by Agus
parent 7167be5889
commit 8fc7bd9ae8
8 changed files with 199 additions and 120 deletions
@@ -1,6 +1,10 @@
use chrono::Duration;
use serde::{Deserialize, Serialize};
use std::{ops::Range, path::PathBuf};
use std::{
ops::Range,
path::{Path, PathBuf},
sync::Arc,
};
use uuid::Uuid;
use crate::PredictEditsGitInfo;
@@ -10,7 +14,7 @@ use crate::PredictEditsGitInfo;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PredictEditsRequest {
pub excerpt: String,
pub excerpt_path: PathBuf,
pub excerpt_path: Arc<Path>,
/// Within file
pub excerpt_range: Range<usize>,
/// Within `excerpt`
@@ -32,7 +36,17 @@ pub struct PredictEditsRequest {
// Only available to staff
#[serde(default)]
pub debug_info: bool,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub prompt_max_bytes: Option<usize>,
#[serde(default)]
pub prompt_format: PromptFormat,
}
#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
pub enum PromptFormat {
#[default]
MarkedExcerpt,
LabeledSections,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -59,7 +73,7 @@ pub struct Signature {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ReferencedDeclaration {
pub path: PathBuf,
pub path: Arc<Path>,
pub text: String,
pub text_is_truncated: bool,
/// Range of `text` within file, possibly truncated according to `text_is_truncated`
@@ -117,7 +131,7 @@ pub struct DebugInfo {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Edit {
pub path: PathBuf,
pub path: Arc<Path>,
pub range: Range<usize>,
pub content: String,
}