Skip to content

The agent engineering platform.

cohere[patch]: Fix positional argument (#19678)

billytrend-cohere36abb5dd4112
diff --git a/libs/partners/cohere/langchain_cohere/chat_models.py b/libs/partners/cohere/langchain_cohere/chat_models.py
index ea830e81f9..8babfc3e16 100644
--- a/libs/partners/cohere/langchain_cohere/chat_models.py
+++ b/libs/partners/cohere/langchain_cohere/chat_models.py
@@ -303,7 +303,7 @@ class ChatCohere(BaseChatModel, BaseCohere):
def get_num_tokens(self, text: str) -> int:
"""Calculate number of tokens."""
- return len(self.client.tokenize(text).tokens)
+ return len(self.client.tokenize(text=text).tokens)
def _format_cohere_tool_calls(