mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 15:19:33 +00:00
update docstring
This commit is contained in:
parent
a3350f4174
commit
c54b676a04
@ -1115,7 +1115,13 @@ class ChatAnthropic(BaseChatModel):
|
|||||||
|
|
||||||
@beta()
|
@beta()
|
||||||
def get_num_tokens_from_messages(self, messages: List[BaseMessage]) -> int:
|
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(
|
if any(
|
||||||
isinstance(tool, ToolMessage)
|
isinstance(tool, ToolMessage)
|
||||||
or (isinstance(tool, AIMessage) and tool.tool_calls)
|
or (isinstance(tool, AIMessage) and tool.tool_calls)
|
||||||
|
Loading…
Reference in New Issue
Block a user