Skip to content

Commit

Permalink
new: implemented --cot-tags argument to pass a custom set of CoT tags
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Feb 6, 2025
1 parent 9c1cc1d commit ea60d2a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ pub struct Config {
pub force_strategy: bool,
pub user_only: bool,
pub max_iterations: usize,
pub cot_tags: Vec<String>,
}

pub struct TaskSpecs {
Expand Down Expand Up @@ -340,7 +341,7 @@ impl Agent {
}

async fn on_invalid_action(&self, invocation: Invocation, error: Option<String>) {
if invocation.action == "thinking" || invocation.action == "think" {
if self.config.cot_tags.contains(&invocation.action) {
self.on_event(Event::new(EventType::Thinking(invocation.payload.unwrap())))
.unwrap();
return;
Expand Down
3 changes: 3 additions & 0 deletions src/cli/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ pub struct Args {
/// Force specified serialization format even if the model supports native tools calling.
#[arg(long)]
pub force_format: bool,
/// Chain-of-Thought xml tags.
#[arg(long, value_parser, num_args = 1.., value_delimiter = ' ', default_values_t = ["think".to_string(), "thinking".to_string(), "reasoning".to_string()])]
pub cot_tags: Vec<String>,
/// Tasklet file.
#[arg(short = 'T', long)]
pub tasklet: Option<String>,
Expand Down
1 change: 1 addition & 0 deletions src/cli/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pub async fn setup_agent_for_task(
force_strategy: args.force_format,
user_only: args.user_only,
max_iterations: args.max_iterations,
cot_tags: args.cot_tags.clone(),
};

// create the agent
Expand Down

0 comments on commit ea60d2a

Please sign in to comment.