langchain/libs/partners/anthropic/tests/unit_tests
ccurme 1538ee17f9
anthropic[major]: support python 3.13 (#27916)
Last week Anthropic released version 0.39.0 of its python sdk, which
enabled support for Python 3.13. This release deleted a legacy
`client.count_tokens` method, which we currently access during init of
the `Anthropic` LLM. Anthropic has replaced this functionality with the
[client.beta.messages.count_tokens()
API](https://github.com/anthropics/anthropic-sdk-python/pull/726).

To enable support for `anthropic >= 0.39.0` and Python 3.13, here we
drop support for the legacy token counting method, and add support for
the new method via `ChatAnthropic.get_num_tokens_from_messages`.

To fully support the token counting API, we update the signature of
`get_num_tokens_from_message` to accept tools everywhere.

---------

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
2024-11-12 14:31:07 -05:00
..
__snapshots__ multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
__init__.py
_utils.py multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
test_chat_models.py anthropic[major]: support python 3.13 (#27916) 2024-11-12 14:31:07 -05:00
test_imports.py anthropic[minor]: package move (#17974) 2024-02-25 21:57:26 -08:00
test_llms.py core, partners: implement standard tracing params for LLMs (#25410) 2024-08-16 13:18:09 -04:00
test_output_parsers.py multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
test_standard.py standard-tests[patch]: Update chat model standard tests (#22378) 2024-06-17 13:37:41 -07:00