def predict(self, text: Union[List[str], str], as_argilla_records: bool = True, **kwargs):
        """
        The function takes in a list of strings and returns a list of predictions

        Args:
          text (Union[List[str], str]): The text to be classified.
          as_argilla_records (bool): If True, the prediction will be returned as an Argilla record. If
        False, the prediction will be returned as a string. Defaults to True

        Returns:
          A list of predictions
        """
        from datasets import Dataset

        if self.trainer_model is None:
            self._logger.warning("Using model without fine-tuning.")
            self.init_model()

        str_input = False
        if isinstance(text, str):
            text = [text]
            str_input = True

        entities_list = self.trainer_model.predict(text, **kwargs)

        if as_argilla_records:
            formatted_prediction = []

            for sentence, entities in zip(text, entities_list):
                predictions = [
                    (entity["label"], entity["char_start_index"], entity["char_end_index"], entity["score"])
                    for entity in entities
                ]
                dataset = Dataset.from_dict({"tokens": text})
                encoding = self.trainer_model.tokenizer({"tokens": dataset["tokens"]}, return_batch_encoding=True)[
                    "batch_encoding"
                ]
                word_ids = sorted(set(encoding.word_ids()) - {None})
                tokens = []
                for word_id in word_ids:
                    char_span = encoding.word_to_chars(word_id)
                    tokens.append(sentence[char_span.start : char_span.end].lstrip().rstrip())
                formatted_prediction.append(self._record_class(text=sentence, tokens=tokens, prediction=predictions))
        else:
            formatted_prediction = entities_list

        if str_input:
            return formatted_prediction[0]
        return formatted_prediction

        The function takes in a list of strings and returns a list of predictions

        Args:
          text (Union[List[str], str]): The text to be classified.
          as_argilla_records (bool): If True, the prediction will be returned as an Argilla record. If
        False, the prediction will be returned as a string. Defaults to True

        Returns:
          A list of predictions
        
argilla-v1/src/argilla_v1/training/span_marker.py