summaryrefslogtreecommitdiffstats
path: root/src/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/config')
-rw-r--r--src/config/bot.rs2
-rw-r--r--src/config/mod.rs30
-rw-r--r--src/config/session.rs2
3 files changed, 22 insertions, 12 deletions
diff --git a/src/config/bot.rs b/src/config/bot.rs
index e02cce7..098c8d7 100644
--- a/src/config/bot.rs
+++ b/src/config/bot.rs
@@ -49,7 +49,7 @@ impl Bot {
let model = {
let config = config.read();
match bot_config.model_id.as_ref() {
- Some(model_id) => Model::retrieve(&config, model_id)?,
+ Some(model_id) => Model::retrieve_chat(&config, model_id)?,
None => config.current_model().clone(),
}
};
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 571bf2c..a905ae8 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -61,13 +61,19 @@ 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 RAG_TEMPLATE: &str = r#"Answer the question based only on the provided context:
-<context>
-__CONTEXT__
-</context>
+const RAG_TEMPLATE: &str = r#"Use the following context as your learned knowledge, inside <context></context> XML tags.
+ <context>
+ __CONTEXT__
+ </context>
-Question: __INPUT__
-"#;
+ When answer to user:
+ - If you don't know, just say that you don't know.
+ - If you don't know when you are not sure, ask for clarification.
+ Avoid mentioning that you obtained the information from the context.
+ And answer according to the language of the user's question.
+
+ Given the context information, answer the query.
+ Query: __INPUT__"#;
const LEFT_PROMPT: &str = "{color.green}{?session {?bot {bot}#}{session}{?role /}}{!session {?bot {bot}}}{role}{?rag @{rag}}{color.cyan}{?session )}{!session >}{color.reset} ";
const RIGHT_PROMPT: &str = "{color.purple}{?session {?consume_tokens {consume_tokens}({consume_percent}%)}{!consume_tokens {consume_tokens}}}{color.reset}";
@@ -96,7 +102,9 @@ pub struct Config {
pub dangerously_functions_filter: Option<FunctionsFilter>,
pub bot_prelude: Option<String>,
pub bots: Vec<BotConfig>,
- pub embedding_model: Option<String>,
+ pub rag_embedding_model: Option<String>,
+ pub rag_chunk_size: Option<usize>,
+ pub rag_chunk_overlap: Option<usize>,
pub rag_top_k: usize,
pub rag_template: Option<String>,
pub compress_threshold: usize,
@@ -147,7 +155,9 @@ impl Default for Config {
dangerously_functions_filter: None,
bot_prelude: None,
bots: vec![],
- embedding_model: None,
+ rag_embedding_model: None,
+ rag_chunk_size: None,
+ rag_chunk_overlap: None,
rag_top_k: 4,
rag_template: None,
compress_threshold: 4000,
@@ -616,7 +626,7 @@ impl Config {
}
pub fn set_model(&mut self, model_id: &str) -> Result<()> {
- let model = Model::retrieve(self, model_id)?;
+ let model = Model::retrieve_chat(self, model_id)?;
match self.role_like_mut() {
Some(role_like) => role_like.set_model(&model),
None => {
@@ -682,7 +692,7 @@ impl Config {
match role.model_id() {
Some(model_id) => {
if self.model.id() != model_id {
- let model = Model::retrieve(self, model_id)?;
+ let model = Model::retrieve_chat(self, model_id)?;
role.set_model(&model);
}
}
diff --git a/src/config/session.rs b/src/config/session.rs
index 38855cc..7400f30 100644
--- a/src/config/session.rs
+++ b/src/config/session.rs
@@ -73,7 +73,7 @@ impl Session {
let mut session: Self =
serde_yaml::from_str(&content).with_context(|| format!("Invalid session {}", name))?;
- session.model = Model::retrieve(config, &session.model_id)?;
+ session.model = Model::retrieve_chat(config, &session.model_id)?;
session.name = name.to_string();
session.path = Some(path.display().to_string());