Class ToolOutputDeduplicator
Tool outputs are never truncated: a tool result is the data the model reasons over, and
cutting it mid-value silently corrupts it (a partial JSON schema read back and re-saved wipes the
unread sections). Overall context-window pressure is handled coherently one layer up by ContextWindowPlugin, which summarizes/trims whole messages rather than
mutilating any single one. This class therefore only collapses an exact repeat of a prior
call — same tool, same input, same output — into a short reference note; the original, identical
content is still present in history. Two different calls that happen to answer the same (two
queries that both find nothing) are kept apart: a note pointing at the other call would read as
"you already ran this" and hide the answer to the one just made.
One instance per stream request — not thread-safe.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ToolOutputDeduplicator
public ToolOutputDeduplicator()
-
-
Method Details
-
process
Processes a tool output before it is added to message history and streamed. Returns the original output unchanged, or — when this request already saw the same call with the same output — a short reference note pointing at the earlier call.
-