mirror of
https://github.com/hwchase17/langchain.git
synced 2026-02-22 07:05:36 +00:00
### Description: earlier we have to use like below: ```python from langchain_core.messages import trim_messages from langchain_core.messages.utils import count_tokens_approximately trim_messages(..., token_counter=count_tokens_approximately) ``` Now can be used as like this also ```python from langchain_core.messages import trim_messages trim_messages(..., token_counter="approximate") ``` - [x] **Added tests** - [x] **Lint and test**: Run this as I made change in langchain/core, uv run --group test pytest tests/unit_tests/messages/test_utils.py -v <img width="1006" height="66" alt="image" src="https://github.com/user-attachments/assets/c6938c29-a781-4e7f-871b-8e888ee764b7" /> --------- Co-authored-by: Mason Daugherty <mason@langchain.dev> Co-authored-by: Mason Daugherty <github@mdrxy.com>