Skip to content

Commit

Permalink
update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
ccurme committed Nov 5, 2024
1 parent a3350f4 commit c54b676
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libs/partners/anthropic/langchain_anthropic/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c54b676

Please sign in to comment.