fix(helpers): restore tiktoken fallback in estimate_prompt_tokens_chain
This commit is contained in:
@@ -431,6 +431,7 @@ def estimate_prompt_tokens_chain(
|
|||||||
tokens, source = provider_counter(messages, tools, model)
|
tokens, source = provider_counter(messages, tools, model)
|
||||||
if isinstance(tokens, (int, float)) and tokens > 0:
|
if isinstance(tokens, (int, float)) and tokens > 0:
|
||||||
return int(tokens), str(source or "provider_counter")
|
return int(tokens), str(source or "provider_counter")
|
||||||
|
estimated = estimate_prompt_tokens(messages, tools)
|
||||||
if estimated > 0:
|
if estimated > 0:
|
||||||
return int(estimated), "tiktoken"
|
return int(estimated), "tiktoken"
|
||||||
return 0, "none"
|
return 0, "none"
|
||||||
|
|||||||
Reference in New Issue
Block a user