From 19c2df4822db4731760547f9fea6fe4e810c1115 Mon Sep 17 00:00:00 2001 From: KCaverly Date: Thu, 19 Oct 2023 14:33:52 -0400 Subject: [PATCH] outlined when truncation is taking place in the prompt --- crates/ai/src/templates/file_context.rs | 4 ++++ crates/ai/src/templates/generate.rs | 3 ++- crates/assistant/src/prompts.rs | 2 -- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/ai/src/templates/file_context.rs b/crates/ai/src/templates/file_context.rs index 253d24e4691d52371d2af13e07e160ec3ac6e0f6..1afd61192edc02b153abe8cd00836d67caa42f02 100644 --- a/crates/ai/src/templates/file_context.rs +++ b/crates/ai/src/templates/file_context.rs @@ -131,6 +131,10 @@ impl PromptTemplate for FileContext { )?; writeln!(prompt, "```{language_name}\n{context}\n```").unwrap(); + if truncated { + writeln!(prompt, "Note the content has been truncated and only represents a portion of the file.").unwrap(); + } + if let Some(selected_range) = &args.selected_range { let start = selected_range.start.to_offset(buffer); let end = selected_range.end.to_offset(buffer); diff --git a/crates/ai/src/templates/generate.rs b/crates/ai/src/templates/generate.rs index 34d874cc4128ccae034a0ecf3beace159bbec1ac..19334340c8e5d302ef7e07f24eedf820670ea9e3 100644 --- a/crates/ai/src/templates/generate.rs +++ b/crates/ai/src/templates/generate.rs @@ -50,7 +50,8 @@ impl PromptTemplate for GenerateInlineContent { .unwrap(); } else { writeln!(prompt, "Modify the user's selected {content_type} based upon the users prompt: '{user_prompt}'").unwrap(); - writeln!(prompt, "You MUST reply with only the adjusted {content_type} (within the '<|START|' and '|END|>' spans), not the entire file.").unwrap(); + writeln!(prompt, "You must reply with only the adjusted {content_type} (within the '<|START|' and '|END|>' spans) not the entire file.").unwrap(); + writeln!(prompt, "Double check that you only return code and not the '<|START|' and '|END|'> spans").unwrap(); } } else { writeln!( diff --git a/crates/assistant/src/prompts.rs b/crates/assistant/src/prompts.rs index c7b52a35405deadc3a9319ea77aea34e1989f273..dffcbc29234d3f24174d1d9a6610045105eae890 100644 --- a/crates/assistant/src/prompts.rs +++ b/crates/assistant/src/prompts.rs @@ -166,8 +166,6 @@ pub fn generate_content_prompt( let chain = PromptChain::new(args, templates); let (prompt, _) = chain.generate(true)?; - println!("PROMPT: {:?}", &prompt); - anyhow::Ok(prompt) }