fix(langchain): recognize ChatAnthropicVertex in _get_approximate_token_counter (#36320)

This commit is contained in:
Jordan Hury
2026-03-28 01:19:03 +03:00
committed by GitHub
parent 1545dbfa17
commit 475408fa62

View File

@@ -141,7 +141,7 @@ Example:
def _get_approximate_token_counter(model: BaseChatModel) -> TokenCounter:
"""Tune parameters of approximate token counter based on model type."""
if model._llm_type == "anthropic-chat": # noqa: SLF001
if model._llm_type.startswith("anthropic-chat"): # noqa: SLF001
# 3.3 was estimated in an offline experiment, comparing with Claude's token-counting
# API: https://platform.claude.com/docs/en/build-with-claude/token-counting
return partial(