Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,17 @@ def get_shape_content(shape, **kwargs):
model=llm_model,
prompt=kwargs.get("llm_prompt"),
)
if llm_description is None:
llm_description = ""
except Exception:
# Unable to generate a description
pass

# Also grab any description embedded in the deck
try:
alt_text = shape._element._nvXxPr.cNvPr.attrib.get("descr", "")
alt_text = (
shape._element._nvXxPr.cNvPr.attrib.get("descr", "") or ""
)
except Exception:
# Unable to get alt text
pass
Expand Down
15 changes: 15 additions & 0 deletions packages/markitdown/tests/test_module_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,21 @@ def test_markitdown_llm_parameters() -> None:
assert messages[0]["content"][0]["text"] == test_prompt


def test_markitdown_pptx_none_llm_description(monkeypatch: pytest.MonkeyPatch) -> None:
"""PPTX conversion should handle null LLM captions without raising TypeError."""

monkeypatch.setattr(
"markitdown.converters._pptx_converter.llm_caption",
lambda *args, **kwargs: None,
)

markitdown = MarkItDown(llm_client=MagicMock(), llm_model="gpt-4o")
result = markitdown.convert(os.path.join(TEST_FILES_DIR, "test.pptx"))

# Conversion should succeed and still include regular PPTX-derived content.
validate_strings(result, PPTX_TEST_STRINGS)


@pytest.mark.skipif(
skip_llm,
reason="do not run llm tests without a key",
Expand Down