community[patch]: Replace positional argument with text=text for cohere>=5 compatibility (#19407)

- **Description:** Replace positional argument with text=text for
cohere>=5 compatibility
This commit is contained in:
billytrend-cohere 2024-03-21 12:42:51 -05:00 committed by GitHub
parent b20c2640da
commit f6bcd42421
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -244,4 +244,4 @@ class ChatCohere(BaseChatModel, BaseCohere):
def get_num_tokens(self, text: str) -> int: def get_num_tokens(self, text: str) -> int:
"""Calculate number of tokens.""" """Calculate number of tokens."""
return len(self.client.tokenize(text).tokens) return len(self.client.tokenize(text=text).tokens)