langchain/libs/core/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
..
_api multiple: rely on asyncio_mode auto in tests (#27200) 2024-10-15 16:26:38 +00:00
caches core: Put Python version as a project requirement so it is considered by ruff (#26608) 2024-09-18 14:37:57 +00:00
callbacks core[patch]: Update AsyncCallbackManager to honor run_inline attribute and prevent context loss (#26885) 2024-10-07 14:59:29 -04:00
chat_history core: Add various ruff rules (#26836) 2024-10-07 22:30:27 +00:00
data Separate out langchain_core package (#13577) 2023-11-20 13:09:30 -08:00
dependencies community[minor]: Add glue catalog loader (#20220) 2024-04-16 11:39:23 -04:00
document_loaders core: Add ruff rules for comprehensions (C4) (#26829) 2024-09-25 09:34:17 -04:00
documents multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
embeddings core[minor]: moved fake llms and embeddings to core (#19226) 2024-03-18 10:01:26 -07:00
example_selectors core: Put Python version as a project requirement so it is considered by ruff (#26608) 2024-09-18 14:37:57 +00:00
examples core:adds tests for partial_variables (#15427) 2024-01-02 15:00:06 -08:00
fake core: fix batch race condition in FakeListChatModel (#26924) 2024-10-03 23:14:31 +00:00
indexing core[minor]: add **kwargs to index and aindex functions for custom vector_field support (#26998) 2024-10-07 14:52:50 -04:00
language_models core: Add various ruff rules (#26836) 2024-10-07 22:30:27 +00:00
load core[patch]: fix repr and str for Serializable (#26786) 2024-10-24 08:36:35 -07:00
messages anthropic[major]: support python 3.13 (#27916) 2024-11-12 14:31:07 -05:00
output_parsers core: fix CommaSeparatedListOutputParser to handle columns that may contain commas in it (#26365) 2024-11-01 22:42:24 +00:00
outputs core[patch]: fix ChatGeneration.text with content blocks (#20294) 2024-04-10 15:54:06 -07:00
prompts core[patch]: rm image loading (#27797) 2024-10-31 10:34:51 -07:00
rate_limiters core[minor]: Add BaseModel.rate_limiter, RateLimiter abstraction and in-memory implementation (#24669) 2024-07-26 03:03:34 +00:00
runnables core: use friendlier names for duplicated nodes in mermaid output (#27747) 2024-10-31 16:52:00 -04:00
stores core: Put Python version as a project requirement so it is considered by ruff (#26608) 2024-09-18 14:37:57 +00:00
tracers core[patch]: Add ruff rules for flake8-simplify (SIM) (#26848) 2024-09-27 20:13:23 +00:00
utils core[patch]: make oai tool description optional (#27756) 2024-11-06 18:06:47 +00:00
vectorstores core: Add various ruff rules (#26836) 2024-10-07 22:30:27 +00:00
__init__.py Separate out langchain_core package (#13577) 2023-11-20 13:09:30 -08:00
conftest.py core: Add ruff rules for error messages (EM) (#26965) 2024-10-07 22:12:28 +00:00
prompt_file.txt Separate out langchain_core package (#13577) 2023-11-20 13:09:30 -08:00
pydantic_utils.py core: Add ruff rules for error messages (EM) (#26965) 2024-10-07 22:12:28 +00:00
stubs.py core: Add various ruff rules (#26836) 2024-10-07 22:30:27 +00:00
test_globals.py Separate out langchain_core package (#13577) 2023-11-20 13:09:30 -08:00
test_imports.py core: Add ruff rules for error messages (EM) (#26965) 2024-10-07 22:12:28 +00:00
test_messages.py core: Add various ruff rules (#26836) 2024-10-07 22:30:27 +00:00
test_outputs.py REFACTOR: Refactor langchain_core (#13627) 2023-11-21 08:35:29 -08:00
test_prompt_values.py multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
test_pydantic_serde.py core: Add N(naming) ruff rules (#25362) 2024-09-19 05:09:39 +00:00
test_sys_info.py core(minor): Add a way to print out system information for debugging purposes. (#15718) 2024-01-08 12:20:18 -08:00
test_tools.py core[patch]: make get_all_basemodel_annotations public (#27761) 2024-10-30 14:43:29 -07:00