Add persistent local agent tools

This commit is contained in:
Georg Bauer
2026-07-25 14:57:17 +02:00
parent 668d8b787e
commit 4a45735072
20 changed files with 3139 additions and 37 deletions

View File

@@ -904,6 +904,7 @@ mod tests {
&[
ChatTurn {
user: true,
tool: false,
skip_previous_eos: false,
reasoning: None,
reasoning_complete: true,
@@ -911,6 +912,7 @@ mod tests {
},
ChatTurn {
user: false,
tool: false,
skip_previous_eos: false,
reasoning: None,
reasoning_complete: true,
@@ -918,6 +920,7 @@ mod tests {
},
ChatTurn {
user: true,
tool: false,
skip_previous_eos: false,
reasoning: None,
reasoning_complete: true,
@@ -938,12 +941,33 @@ mod tests {
model.render_continuation("Hello", ReasoningMode::Direct, true),
[128_803, 19_923, 128_804, 128_822]
);
let tool_turn = ChatTurn {
user: false,
tool: true,
skip_previous_eos: false,
reasoning: None,
reasoning_complete: true,
content: "Hello".into(),
};
let wrapped_user = ChatTurn {
user: true,
tool: false,
skip_previous_eos: false,
reasoning: None,
reasoning_complete: true,
content: "<tool_result>Hello</tool_result>".into(),
};
assert_eq!(
model.render_conversation("", &[tool_turn], ReasoningMode::Direct),
model.render_conversation("", &[wrapped_user], ReasoningMode::Direct)
);
assert_eq!(
model.render_conversation(
"",
&[
ChatTurn {
user: true,
tool: false,
skip_previous_eos: false,
reasoning: None,
reasoning_complete: true,
@@ -951,6 +975,7 @@ mod tests {
},
ChatTurn {
user: false,
tool: false,
skip_previous_eos: false,
reasoning: Some("Hello".into()),
reasoning_complete: true,
@@ -958,6 +983,7 @@ mod tests {
},
ChatTurn {
user: true,
tool: false,
skip_previous_eos: false,
reasoning: None,
reasoning_complete: true,