Skip to content

Commit ad8317b

Browse files
add stop token
1 parent 8f6ecec commit ad8317b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ fn run_pipeline(agent: &mut Agent, toolset: &tools::ToolSet) {
7474
loop {
7575
println!("\n============= LLM RESPONSE =============");
7676
if let Ok(response) = agent.post() {
77+
if response.trim().ends_with("[[[[DONE]]]]") {
78+
println!("Done.");
79+
break;
80+
}
7781
agent.add_message("assistant", &response);
7882
let invoke_result = format!(
7983
"\n============= TOOL OUTPUT =============\n{}\n",
@@ -185,6 +189,9 @@ Please output the special heading and than follow the format (must be wrapped in
185189
"arg2": value2
186190
}}
187191
}}
192+
193+
If you feel that you have finished your task, please return the output in the following token:
194+
[[[[DONE]]]]
188195
```
189196
190197
Please note that you can only call one tool at a time.

0 commit comments

Comments
 (0)