def _collect_valid_content_to_encode(self, preprocessed_content: list[RandomModelPreprocessedContent]) -> list[str]:
        """
        Collect the valid content to encode from the preprocessed content. Each individual content can be
        an InferenceError, or a list of tuples with the original text and the preprocessed content. The
        valid content to encode in this model is string.

        Args:
            preprocessed_content: A list of preprocessed content.

        Returns:
            list[str]: A list of valid content to encode.

        Raises:
            ValueError: If the content is not a tensor, nor an InferenceError. This means there is an
            unexpected content type.
        """
        valid_content_to_encode = []
        valid_content_to_encode_type = (str, )

        for chunk in preprocessed_content:
            if isinstance(chunk, list):
                for _, content_to_encode in chunk:
                    if isinstance(content_to_encode, valid_content_to_encode_type):
                        valid_content_to_encode.append(content_to_encode)
                    else:
                        raise ValueError(f"Expected {valid_content_to_encode_type} "
                                         f"but got {type(content_to_encode)}")
            elif isinstance(chunk, InferenceErrorModel):
                continue
            else:
                raise ValueError(f"Unexpected content type: {type(chunk)}. "
                                 f"Should be a list of tuples or an InferenceError")
        return valid_content_to_encode

        Collect the valid content to encode from the preprocessed content. Each individual content can be
        an InferenceError, or a list of tuples with the original text and the preprocessed content. The
        valid content to encode in this model is string.

        Args:
            preprocessed_content: A list of preprocessed content.

        Returns:
            list[str]: A list of valid content to encode.

        Raises:
            ValueError: If the content is not a tensor, nor an InferenceError. This means there is an
            unexpected content type.
        
src/marqo/inference/native_inference/inference_pipeline/random_model_inference_pipeline.py