"""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.
        """
        return sum([self.get_num_tokens(get_buffer_string([m])) for m in messages])
    @classmethod
    def _all_required_field_names(cls) -> Set:
        """DEPRECATED: Kept for backwards compatibility.
        Use get_pydantic_field_names.
        """
        return get_pydantic_field_names(cls)