perf(tokens): document tool schema cache assumption
This commit is contained in:
@@ -44,6 +44,7 @@ def _estimate_tools_tokens(
|
|||||||
leading_separator: bool,
|
leading_separator: bool,
|
||||||
) -> int:
|
) -> int:
|
||||||
"""Estimate stable tool definition tokens without re-encoding every loop."""
|
"""Estimate stable tool definition tokens without re-encoding every loop."""
|
||||||
|
# ToolRegistry keeps the returned definitions list alive until the registry changes.
|
||||||
tools_id = id(tools)
|
tools_id = id(tools)
|
||||||
fingerprint = tuple(id(tool) for tool in tools)
|
fingerprint = tuple(id(tool) for tool in tools)
|
||||||
cached = _TOOLS_TOKEN_CACHE.get(tools_id)
|
cached = _TOOLS_TOKEN_CACHE.get(tools_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user