fix(langchain): bump min core version and improve approximate token counting (#35026)

This commit is contained in:
ccurme
2026-02-05 09:37:25 -05:00
committed by GitHub
parent 3e3dbd9b88
commit a434f3aa08
3 changed files with 7 additions and 5 deletions

View File

@@ -144,8 +144,10 @@ def _get_approximate_token_counter(model: BaseChatModel) -> TokenCounter:
if model._llm_type == "anthropic-chat": # noqa: SLF001 if model._llm_type == "anthropic-chat": # noqa: SLF001
# 3.3 was estimated in an offline experiment, comparing with Claude's token-counting # 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 # API: https://platform.claude.com/docs/en/build-with-claude/token-counting
return partial(count_tokens_approximately, chars_per_token=3.3) return partial(
return count_tokens_approximately count_tokens_approximately, use_usage_metadata_scaling=True, chars_per_token=3.3
)
return partial(count_tokens_approximately, use_usage_metadata_scaling=True)
class SummarizationMiddleware(AgentMiddleware[AgentState[ResponseT], ContextT, ResponseT]): class SummarizationMiddleware(AgentMiddleware[AgentState[ResponseT], ContextT, ResponseT]):

View File

@@ -24,7 +24,7 @@ classifiers = [
version = "1.2.9" version = "1.2.9"
requires-python = ">=3.10.0,<4.0.0" requires-python = ">=3.10.0,<4.0.0"
dependencies = [ dependencies = [
"langchain-core>=1.2.8,<2.0.0", "langchain-core>=1.2.9,<2.0.0",
"langgraph>=1.0.7,<1.1.0", "langgraph>=1.0.7,<1.1.0",
"pydantic>=2.7.4,<3.0.0", "pydantic>=2.7.4,<3.0.0",
] ]

View File

@@ -1,5 +1,5 @@
version = 1 version = 1
revision = 3 revision = 2
requires-python = ">=3.10.0, <4.0.0" requires-python = ">=3.10.0, <4.0.0"
resolution-markers = [ resolution-markers = [
"python_full_version >= '3.14' and platform_python_implementation == 'PyPy'", "python_full_version >= '3.14' and platform_python_implementation == 'PyPy'",
@@ -2125,7 +2125,7 @@ wheels = [
[[package]] [[package]]
name = "langchain-core" name = "langchain-core"
version = "1.2.8" version = "1.2.9"
source = { editable = "../core" } source = { editable = "../core" }
dependencies = [ dependencies = [
{ name = "jsonpatch" }, { name = "jsonpatch" },