From ee364c6ac1634c3b5fd89c9947d8f446b665df68 Mon Sep 17 00:00:00 2001 From: yorkhellen Date: Fri, 1 May 2026 23:57:15 +0800 Subject: [PATCH] fix(helpers): restore tiktoken fallback in estimate_prompt_tokens_chain --- nanobot/utils/helpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nanobot/utils/helpers.py b/nanobot/utils/helpers.py index ae008bec..0afe193c 100644 --- a/nanobot/utils/helpers.py +++ b/nanobot/utils/helpers.py @@ -431,6 +431,7 @@ def estimate_prompt_tokens_chain( tokens, source = provider_counter(messages, tools, model) if isinstance(tokens, (int, float)) and tokens > 0: return int(tokens), str(source or "provider_counter") + estimated = estimate_prompt_tokens(messages, tools) if estimated > 0: return int(estimated), "tiktoken" return 0, "none"