summaryrefslogtreecommitdiffstats
path: root/src/config/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config/mod.rs')
-rw-r--r--src/config/mod.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 693c9f5..ff7a22b 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -73,6 +73,8 @@ const SYNC_MODELS_URL: &str =
const SUMMARIZE_PROMPT: &str =
"Summarize the discussion briefly in 200 words or less to use as a prompt for future context.";
const SUMMARY_PROMPT: &str = "This is a summary of the chat history as a recap: ";
+const SUBQUERY_COMPRESSION_PROMPT: &str =
+ "Summarize the subquery thought process by keeping all key facts, numbers, names, identifiers needed to answer follow-up questions. Leave the final result of the subquery unchanged. Reply with the full text directly.";
const RAG_TEMPLATE: &str = r#"Answer the query based on the context while respecting the rules. (user query, some textual context and rules, all inside xml tags)
@@ -122,6 +124,10 @@ pub struct Config {
pub subquery: bool,
pub subquery_max_depth: usize,
+ pub subquery_compression: bool,
+ pub subquery_compression_prompt: Option<String>,
+ pub subquery_compression_threshold: usize,
+
pub repl_prelude: Option<String>,
pub cmd_prelude: Option<String>,
pub agent_prelude: Option<String>,
@@ -201,6 +207,10 @@ impl Default for Config {
subquery: false,
subquery_max_depth: 3,
+ subquery_compression: false,
+ subquery_compression_prompt: None,
+ subquery_compression_threshold: 1000,
+
repl_prelude: None,
cmd_prelude: None,
agent_prelude: None,
@@ -609,6 +619,14 @@ impl Config {
("function_calling", self.function_calling.to_string()),
("subquery", self.subquery.to_string()),
("subquery_max_depth", self.subquery_max_depth.to_string()),
+ (
+ "subquery_compression",
+ self.subquery_compression.to_string(),
+ ),
+ (
+ "subquery_compression_threshold",
+ self.subquery_compression_threshold.to_string(),
+ ),
("stream", self.stream.to_string()),
("save", self.save.to_string()),
("keybindings", self.keybindings.clone()),
@@ -695,6 +713,18 @@ impl Config {
let value = value.parse().with_context(|| "Invalid value")?;
config.write().subquery_max_depth = value;
}
+ "subquery_compression" => {
+ let value = value.parse().with_context(|| "Invalid value")?;
+ config.write().subquery_compression = value;
+ }
+ "subquery_compression_prompt" => {
+ let value: Option<String> = parse_value(value)?;
+ config.write().subquery_compression_prompt = value;
+ }
+ "subquery_compression_threshold" => {
+ let value = value.parse().with_context(|| "Invalid value")?;
+ config.write().subquery_compression_threshold = value;
+ }
"stream" => {
let value = value.parse().with_context(|| "Invalid value")?;
config.write().stream = value;
@@ -2336,6 +2366,17 @@ impl Config {
if let Some(v) = read_env_value::<String>(&get_env_name("summary_prompt")) {
self.summary_prompt = v;
}
+ if let Some(Some(v)) = read_env_bool(&get_env_name("subquery_compression")) {
+ self.subquery_compression = v;
+ }
+ if let Some(v) = read_env_value::<String>(&get_env_name("subquery_compression_prompt")) {
+ self.subquery_compression_prompt = v;
+ }
+ if let Some(Some(v)) =
+ read_env_value::<usize>(&get_env_name("subquery_compression_threshold"))
+ {
+ self.subquery_compression_threshold = v;
+ }
if let Some(v) = read_env_value::<String>(&get_env_name("rag_embedding_model")) {
self.rag_embedding_model = v;