**kwargs: Any,
    ) -> BaseMessage:
        """Asynchronously pass messages to the model and return a message prediction.
        Use this method when calling chat models and only the top
            candidate generation is needed.
        Args:
            messages: A sequence of chat messages corresponding to a single model input.
            stop: Stop words to use when generating. Model output is cut off at the
                first occurrence of any of these substrings.
            **kwargs: Arbitrary additional keyword arguments. These are usually passed
                to the model provider API call.
        Returns:
            Top model prediction as a message.
        """
[docs]    def get_token_ids(self, text: str) -> List[int]:
        """Return the ordered ids of the tokens in a text.
        Args:
            text: The string input to tokenize.
        Returns:
            A list of ids corresponding to the tokens in the text, in order they occur
                in the text.
        """
        return _get_token_ids_default_method(text)
[docs]    def get_num_tokens(self, text: str) -> int:
        """Get the number of tokens present in the text.
        Useful for checking if an input will fit in a model's context window.
        Args:
            text: The string input to tokenize.
        Returns:
            The integer number of tokens in the text.
        """
        return len(self.get_token_ids(text))
[docs]    def get_num_tokens_from_messages(self, messages: List[BaseMessage]) -> int:
        """Get the number of tokens in the messages.
        Useful for checking if an input will fit in a model's context window.
        Args:
            messages: The message inputs to tokenize.
        Returns:
            The sum of the number of tokens across the messages.