[PR #2363] [MERGED] JS: add mime_type to JavaScript image content examples #2369

Closed
opened 2026-02-17 17:23:20 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/2363
Author: @uddhavNbhat
Created: 1/26/2026
Status: Merged
Merged: 5/29/2026
Merged by: @npentrel

Base: mainHead: patch-2


📝 Commits (2)

  • d2e4b02 JS: add mime_type to JavaScript image content examples
  • 15b5624 Apply suggestion from @npentrel

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 src/oss/langchain/messages.mdx (+1 -0)

📄 Description

Summary

  • Add explicit mime_type fields to JavaScript image content examples for both URL-based and base64-based multimodal inputs.

Issue

When using type: "image" content blocks with source_type: "url" or source_type: "base64", providers such as OpenAI Vision and Google Gemini require an explicit mime_type to correctly interpret the image data.

The current documentation examples omit this field, which can lead to 400 Invalid MIME type errors when users follow the examples verbatim. In practice, providers may default to application/octet-stream when mime_type is not specified, causing image inputs to be rejected.

Changes

Updated JavaScript examples in the messages documentation:

  • Added mime_type: "image/jpeg" to URL-based image example
  • Added mime_type: "image/jpeg" to base64 image example
  • Clarified the expected structure for image content blocks

These changes align the documentation with actual provider requirements and prevent runtime errors for multimodal image inputs.

Overview

Type of change

Type: [Replace with: New documentation page / Update existing documentation / Fix typo/bug/link/formatting / Remove outdated content / Other]

Related issues/PRs

  • GitHub issue:
  • Feature PR:
  • Linear issue:
  • Slack thread:

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally using docs dev
  • All code examples have been tested and work correctly
  • I have used root relative paths for internal links
  • I have updated navigation in src/docs.json if needed

(Internal team members only / optional): Create a preview deployment as necessary using the Create Preview Branch workflow

Additional notes


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/2363 **Author:** [@uddhavNbhat](https://github.com/uddhavNbhat) **Created:** 1/26/2026 **Status:** ✅ Merged **Merged:** 5/29/2026 **Merged by:** [@npentrel](https://github.com/npentrel) **Base:** `main` ← **Head:** `patch-2` --- ### 📝 Commits (2) - [`d2e4b02`](https://github.com/langchain-ai/docs/commit/d2e4b0231e652133d9f43b0e177e1778fc944f63) JS: add mime_type to JavaScript image content examples - [`15b5624`](https://github.com/langchain-ai/docs/commit/15b5624ad158efc9079b699cf92c40363e368939) Apply suggestion from @npentrel ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/oss/langchain/messages.mdx` (+1 -0) </details> ### 📄 Description ## Summary - Add explicit `mime_type` fields to JavaScript image content examples for both URL-based and base64-based multimodal inputs. ## Issue When using `type: "image"` content blocks with `source_type: "url"` or `source_type: "base64"`, providers such as OpenAI Vision and Google Gemini require an explicit `mime_type` to correctly interpret the image data. The current documentation examples omit this field, which can lead to `400 Invalid MIME type` errors when users follow the examples verbatim. In practice, providers may default to `application/octet-stream` when `mime_type` is not specified, causing image inputs to be rejected. ## Changes Updated JavaScript examples in the messages documentation: - Added `mime_type: "image/jpeg"` to URL-based image example - Added `mime_type: "image/jpeg"` to base64 image example - Clarified the expected structure for image content blocks These changes align the documentation with actual provider requirements and prevent runtime errors for multimodal image inputs. ## Overview <!-- Brief description of what documentation is being added/updated --> ## Type of change **Type:** [Replace with: New documentation page / Update existing documentation / Fix typo/bug/link/formatting / Remove outdated content / Other] ## Related issues/PRs <!-- Link to related issues, feature PRs, or discussions (if applicable) To automatically close an issue when this PR is merged, use closing keywords: - "closes #123" or "fixes #123" or "resolves #123" For regular references without auto-closing, just use: - "#123" or "See issue #123" Examples: - closes #456 (will auto-close issue #456 when PR is merged) - See #789 for context (will reference but not auto-close issue #789) --> - GitHub issue: - Feature PR: <!-- For LangChain employees, if applicable: --> - Linear issue: - Slack thread: ## Checklist <!-- Put an 'x' in all boxes that apply --> - [x] I have read the [contributing guidelines](README.md) - [x] I have tested my changes locally using `docs dev` - [x] All code examples have been tested and work correctly - [x] I have used **root relative** paths for internal links - [x] I have updated navigation in `src/docs.json` if needed (Internal team members only / optional): Create a preview deployment as necessary using the [Create Preview Branch workflow](https://github.com/langchain-ai/docs/actions/workflows/create-preview-branch.yml) ## Additional notes <!-- Any other information that would be helpful for reviewers --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-17 17:23:20 -05:00
yindo changed title from [PR #2363] JS: add mime_type to JavaScript image content examples to [PR #2363] [MERGED] JS: add mime_type to JavaScript image content examples 2026-06-05 18:18:12 -04:00
yindo closed this issue 2026-06-05 18:18:13 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#2369