def test_image_vision_llm_reader_load_data_with_parser_config(
    torch_installed: bool, test_16x16_png_image_file: str
):
    """
    We use doubles (mocks and fakes) for the model and the tokenizer objects
    in order to avoid having to download checkpoints as part of tests, while
    still covering all essential `ImageVisionLLMReader` class functionality.
    """
    with (
        mock.patch(
            "transformers.Blip2ForConditionalGeneration.from_pretrained",
            return_value=ModelFake(),
        ) as model,
        mock.patch(
            "transformers.Blip2Processor.from_pretrained",
            return_value=TokenizerFake(),
        ) as processor,
    ):
        parser_config = {
            "processor": processor(),
            "model": model(),
            "device": "auto",  # not used (placeholder)
            "dtype": float,  # not used (placeholder)
        }

        if torch_installed:
            image_vision_llm_reader = ImageVisionLLMReader(
                parser_config=parser_config, keep_image=True
            )
            assert image_vision_llm_reader._torch_imported
        else:
            with _get_custom_import(torch_installed=False):
                image_vision_llm_reader = ImageVisionLLMReader(
                    parser_config=parser_config, keep_image=True
                )
                assert not image_vision_llm_reader._torch_imported

        result = image_vision_llm_reader.load_data(file=test_16x16_png_image_file)[0]
        assert (
            result.text
            == "Question: describe what you see in this image. Answer: a black and white checkered pattern"
        )

    We use doubles (mocks and fakes) for the model and the tokenizer objects
    in order to avoid having to download checkpoints as part of tests, while
    still covering all essential `ImageVisionLLMReader` class functionality.
    
llama-index-integrations/readers/llama-index-readers-file/tests/test_image_vision_llm.py