mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-07 01:48:53 +00:00
perf(tokens): document tool schema cache assumption
This commit is contained in:
parent
7275a81ec7
commit
98916a31e3
@ -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)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user