summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.agent.example.yaml6
-rw-r--r--config.example.yaml4
-rw-r--r--src/config/agent.rs12
3 files changed, 14 insertions, 8 deletions
diff --git a/config.agent.example.yaml b/config.agent.example.yaml
index b0c3b08..32ca55d 100644
--- a/config.agent.example.yaml
+++ b/config.agent.example.yaml
@@ -2,10 +2,10 @@
# Location `<aichat-config-dir>/agents/<agent-name>/config.yaml`
model: openai:gpt-4o # Specify the LLM to use
-temperature: null # Set default temperature parameter
-top_p: null # Set default top-p parameter, range (0, 1)
+temperature: null # Set default temperature parameter, range (0, 1)
+top_p: null # Set default top-p parameter, with a range of (0, 1) or (0, 2) depending on the model
use_tools: null # Which additional tools to use by agent. (e.g. 'fs,web_search')
agent_prelude: null # Set a session to use when starting the agent. (e.g. temp, default)
-
+instructions: null # Override the instructions for the agent, have no effect for dynamic instructions
variables: # Custom default values for the agent variables
<key>: <value>
diff --git a/config.example.yaml b/config.example.yaml
index 470f93d..aa26de7 100644
--- a/config.example.yaml
+++ b/config.example.yaml
@@ -1,7 +1,7 @@
# ---- llm ----
model: openai:gpt-4o # Specify the LLM to use
-temperature: null # Set default temperature parameter
-top_p: null # Set default top-p parameter, range (0, 1)
+temperature: null # Set default temperature parameter (0, 1)
+top_p: null # Set default top-p parameter, with a range of (0, 1) or (0, 2) depending on the model
# ---- behavior ----
stream: true # Controls whether to use the stream-style API.
diff --git a/src/config/agent.rs b/src/config/agent.rs
index d3f248e..a666bdf 100644
--- a/src/config/agent.rs
+++ b/src/config/agent.rs
@@ -173,8 +173,6 @@ impl Agent {
}
pub fn export(&self) -> Result<String> {
- let mut agent = self.clone();
- agent.definition.instructions = self.interpolated_instructions();
let mut value = json!({});
value["name"] = json!(self.name());
let variables = self.variables();
@@ -182,7 +180,9 @@ impl Agent {
value["variables"] = serde_json::to_value(variables)?;
}
value["config"] = json!(self.config);
- value["definition"] = json!(self.definition);
+ let mut definition = self.definition.clone();
+ definition.instructions = self.interpolated_instructions();
+ value["definition"] = json!(definition);
value["functions_dir"] = Config::agent_functions_dir(&self.name)
.display()
.to_string()
@@ -224,6 +224,7 @@ impl Agent {
.session_dynamic_instructions
.clone()
.or_else(|| self.shared_dynamic_instructions.clone())
+ .or_else(|| self.config.instructions.clone())
.unwrap_or_else(|| self.definition.instructions.clone());
for (k, v) in self.variables() {
output = output.replace(&format!("{{{{{k}}}}}"), v)
@@ -398,6 +399,8 @@ pub struct AgentConfig {
pub use_tools: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub agent_prelude: Option<String>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub instructions: Option<String>,
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
pub variables: AgentVariables,
}
@@ -437,6 +440,9 @@ impl AgentConfig {
if let Some(v) = read_env_value::<String>(&with_prefix("agent_prelude")) {
self.agent_prelude = v;
}
+ if let Some(v) = read_env_value::<String>(&with_prefix("instructions")) {
+ self.instructions = v;
+ }
if let Ok(v) = env::var(with_prefix("variables")) {
if let Ok(v) = serde_json::from_str(&v) {
self.variables = v;