pub struct SelectiveToolResult {
pub keep_last: usize,
}Expand description
Replace the payload of Content::FunctionResult (tool-result) content in
all but the last keep_last messages that carry tool results — they are the
bulkiest and least useful once stale. Text and other content is left intact.
The result content itself is kept, with its payload swapped for
OMITTED_TOOL_RESULT — on result and, for a failed call, on
exception too, since provider converters render exception instead of
result and leaving it would send the original error verbatim — rather
than deleted. Deleting it would leave the
matching assistant tool_calls entry unanswered, which providers reject
outright — so the size win would come at the cost of a 400 on the next
request. Mirrors the intent of upstream’s ToolResultCompactionStrategy,
which likewise replaces stale tool groups with a compact stand-in instead
of removing them; upstream summarizes the group with an LLM, while this
port (which has no summarizing strategy) substitutes a fixed marker.
Fields§
§keep_last: usizeImplementations§
Source§impl SelectiveToolResult
impl SelectiveToolResult
pub fn new(keep_last: usize) -> SelectiveToolResult
Trait Implementations§
Source§impl Clone for SelectiveToolResult
impl Clone for SelectiveToolResult
Source§fn clone(&self) -> SelectiveToolResult
fn clone(&self) -> SelectiveToolResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more