Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

Fix DocumentContent.content_type defaulting to application/pdf for all documents

Louis Choquel4e6b10fa6a82
diff --git a/pipelex/core/stuffs/document_content.py b/pipelex/core/stuffs/document_content.py
index 427b485dc..0c786a861 100644
--- a/pipelex/core/stuffs/document_content.py
+++ b/pipelex/core/stuffs/document_content.py
@@ -34,7 +34,7 @@ class DocumentContent(StuffContent):
@property
@override
def content_type(self) -> str | None:
- return self.mime_type or "application/pdf"
+ return self.mime_type
@property
@override
diff --git a/tests/unit/pipelex/core/stuffs/data.py b/tests/unit/pipelex/core/stuffs/data.py
index 2a6cd07fa..f71fd3492 100644
--- a/tests/unit/pipelex/core/stuffs/data.py
+++ b/tests/unit/pipelex/core/stuffs/data.py
@@ -753,7 +753,7 @@ class StuffViewerTestData:
css_class="test-class",
)
IMAGE_CONTENT: ClassVar[ImageContent] = ImageContent(url=URLs.png_example_1, mime_type="image/png")
- PDF_CONTENT: ClassVar[DocumentContent] = DocumentContent(url=URLs.pdf_example_1)
+ PDF_CONTENT: ClassVar[DocumentContent] = DocumentContent(url=URLs.pdf_example_1, mime_type="application/pdf")
MERMAID_CONTENT: ClassVar[MermaidContent] = MermaidContent(
mermaid_code="graph TD; A-->B",
mermaid_url="https://mermaid.live/view#abc",