From c54b676a043143fb3207b5aa3d89f9a15b453483 Mon Sep 17 00:00:00 2001 From: Chester Curme Date: Tue, 5 Nov 2024 11:36:57 -0500 Subject: [PATCH] update docstring --- .../partners/anthropic/langchain_anthropic/chat_models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/partners/anthropic/langchain_anthropic/chat_models.py b/libs/partners/anthropic/langchain_anthropic/chat_models.py index 5795e5eaf0810..0784ff2bdeb49 100644 --- a/libs/partners/anthropic/langchain_anthropic/chat_models.py +++ b/libs/partners/anthropic/langchain_anthropic/chat_models.py @@ -1115,7 +1115,13 @@ class AnswerWithJustification(BaseModel): @beta() def get_num_tokens_from_messages(self, messages: List[BaseMessage]) -> int: - """Count tokens in a sequence of input messages.""" + """Count tokens in a sequence of input messages. + + .. versionchanged:: 0.2.5 + + Uses Anthropic's token counting API to count tokens in messages. See: + https://docs.anthropic.com/en/api/messages-count-tokens + """ if any( isinstance(tool, ToolMessage) or (isinstance(tool, AIMessage) and tool.tool_calls)