Skip to content

Commit d67777d

Browse files
docs: add mime_type to PDF file content examples (url/base64 only)
Add explicit mime_type: "application/pdf" to URL and base64 PDF document input examples in the messages documentation. This clarifies that mime_type is required when using type: "file" content blocks with url or base64 sources, since providers don't infer MIME type from these. Note: file ID (source_type: "id") examples do NOT need mime_type since providers already know the MIME type from when the file was uploaded. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9ddb3f2 commit d67777d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/oss/langchain/messages.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,11 @@ for your chosen model for specifics.
906906
"role": "user",
907907
"content": [
908908
{"type": "text", "text": "Describe the content of this document."},
909-
{"type": "file", "url": "https://example.com/path/to/document.pdf"},
909+
{
910+
"type": "file",
911+
"url": "https://example.com/path/to/document.pdf",
912+
"mime_type": "application/pdf",
913+
},
910914
]
911915
}
912916

@@ -1024,7 +1028,7 @@ for your chosen model for specifics.
10241028
const message = new HumanMessage({
10251029
content: [
10261030
{ type: "text", text: "Describe the content of this document." },
1027-
{ type: "file", source_type: "url", url: "https://example.com/path/to/document.pdf" },
1031+
{ type: "file", source_type: "url", url: "https://example.com/path/to/document.pdf", mime_type: "application/pdf" },
10281032
],
10291033
});
10301034

@@ -1036,6 +1040,7 @@ for your chosen model for specifics.
10361040
type: "file",
10371041
source_type: "base64",
10381042
data: "AAAAIGZ0eXBtcDQyAAAAAGlzb21tcDQyAAACAGlzb2...",
1043+
mime_type: "application/pdf",
10391044
},
10401045
],
10411046
});

0 commit comments

Comments
 (0)