Skip to content

Conversation

@chunghyunleeme
Copy link

@chunghyunleeme chunghyunleeme commented Dec 23, 2025

Summary

  • Add explicit mime_type: "application/pdf" to JavaScript PDF document input examples in the messages documentation

Issue

When using type: "file" content blocks with source_type: "url" for PDF files, providers like Google Vertex AI require an explicit mime_type field. However, the current documentation examples don't include this field, which can lead to errors when users follow the examples.

For example, without mime_type, Vertex AI receives application/octet-stream as the default MIME type, which it doesn't recognize as a valid PDF document.

Changes

Updated JavaScript examples in src/oss/langchain/messages.mdx:

  • Added mime_type: "application/pdf" to URL source example
  • Added mime_type: "application/pdf" to base64 source example

Test plan

  • Visual inspection of documentation rendering

🤖 Generated with Claude Code

@github-actions github-actions bot added langchain For docs changes to LangChain oss external User is not a member of langchain-ai labels Dec 23, 2025
@chunghyunleeme chunghyunleeme force-pushed the fix/add-mime-type-to-file-content-examples branch from 06e8107 to d67777d Compare December 23, 2025 07:46
Add explicit mime_type: "application/pdf" to JavaScript PDF document
input examples (URL and base64) 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 sources.

Note: file ID examples don't 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>
@chunghyunleeme chunghyunleeme force-pushed the fix/add-mime-type-to-file-content-examples branch from d67777d to 8d23727 Compare December 23, 2025 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external User is not a member of langchain-ai langchain For docs changes to LangChain oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant