fix: fixes to agent behaviour and llm steering
This commit is contained in:
@@ -187,7 +187,9 @@ fn correction_already_sent(conversation: &[ChatMessage], correction: &str) -> bo
|
||||
.iter()
|
||||
.rev()
|
||||
.skip(1)
|
||||
.take_while(|message| !message.user)
|
||||
.take_while(|message| {
|
||||
!message.user && !(message.tool && message.content.starts_with("Tool result "))
|
||||
})
|
||||
.any(|message| message.tool && message.content == correction)
|
||||
}
|
||||
|
||||
@@ -2089,6 +2091,22 @@ mod tests {
|
||||
&conversation,
|
||||
TOOL_PROTOCOL_CORRECTION
|
||||
));
|
||||
|
||||
let mut result = assistant(None, "Tool result 1 (bash):\nok\n");
|
||||
result.tool = true;
|
||||
let mut prior_correction = assistant(None, TOOL_PROTOCOL_CORRECTION);
|
||||
prior_correction.tool = true;
|
||||
let conversation = vec![
|
||||
assistant(Some(call), ""),
|
||||
prior_correction,
|
||||
assistant(None, call),
|
||||
result,
|
||||
assistant(Some(call), ""),
|
||||
];
|
||||
assert!(!correction_already_sent(
|
||||
&conversation,
|
||||
TOOL_PROTOCOL_CORRECTION
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user