원클릭으로
langchain-multimodal
Work with multimodal inputs/outputs in LangChain - includes images, audio, video, content blocks, and vision capabilities
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Work with multimodal inputs/outputs in LangChain - includes images, audio, video, content blocks, and vision capabilities
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Using the Deep Agents CLI - terminal interface, persistent memory with AGENTS.md, project conventions, skills directories, and CLI commands.
Understanding Deep Agents framework - what they are, how to create them with createDeepAgent, and the agent harness architecture with built-in middleware for planning, filesystems, and subagents.
Creating and using custom skills with progressive disclosure, SKILL.md format, and the Agent Skills protocol in Deep Agents.
Using the Deep Agents CLI - terminal interface, persistent memory with AGENTS.md, project conventions, skills directories, and CLI commands.
Using FilesystemMiddleware with virtual filesystems, backends (State, Store, Filesystem, Composite), and context management for Deep Agents.
Using FilesystemMiddleware with virtual filesystems, backends (State, Store, Filesystem, Composite), and context management for Deep Agents.
| name | langchain-multimodal |
| description | Work with multimodal inputs/outputs in LangChain - includes images, audio, video, content blocks, and vision capabilities |
| language | js |
Multimodal support lets you work with images, audio, video, and other non-text data. Models with multimodal capabilities can process and generate content across these different formats.
Key Concepts:
| Task | Recommended Model | Why |
|---|---|---|
| Image understanding | GPT-4.1, Claude Sonnet, Gemini | Strong vision capabilities |
| Image generation | DALL-E (via OpenAI) | Specialized for generation |
| Document analysis (PDF) | Claude, GPT-4.1 | Handle complex layouts |
| Audio transcription | Whisper (OpenAI) | Specialized for audio |
| Method | When to Use | Example |
|---|---|---|
| URL | Public images | { type: "image", url: "https://..." } |
| Base64 | Private/local images | { type: "image", data: "base64..." } |
| File reference | Provider file APIs | { type: "image", fileId: "..." } |
import { ChatOpenAI } from "@langchain/openai";
import { HumanMessage } from "langchain";
const model = new ChatOpenAI({ model: "gpt-4.1" });
const message = new HumanMessage({
contentBlocks: [
{ type: "text", text: "What's in this image?" },
{
type: "image",
url: "https://example.com/photo.jpg",
},
],
});
const response = await model.invoke([message]);
console.log(response.content);
import { ChatOpenAI } from "@langchain/openai";
import { HumanMessage } from "langchain";
import fs from "fs";
const model = new ChatOpenAI({ model: "gpt-4.1" });
// Read image and convert to base64
const imageBuffer = fs.readFileSync("./photo.jpg");
const base64Image = imageBuffer.toString("base64");
const message = new HumanMessage({
contentBlocks: [
{ type: "text", text: "Describe this image in detail" },
{
type: "image",
data: base64Image,
mimeType: "image/jpeg",
},
],
});
const response = await model.invoke([message]);
import { ChatOpenAI } from "@langchain/openai";
import { HumanMessage } from "langchain";
const model = new ChatOpenAI({ model: "gpt-4.1" });
const message = new HumanMessage({
contentBlocks: [
{ type: "text", text: "Compare these two images" },
{ type: "image", url: "https://example.com/image1.jpg" },
{ type: "image", url: "https://example.com/image2.jpg" },
],
});
const response = await model.invoke([message]);
import { ChatAnthropic } from "@langchain/anthropic";
import { HumanMessage } from "langchain";
import fs from "fs";
const model = new ChatAnthropic({ model: "claude-sonnet-4-5-20250929" });
const pdfBuffer = fs.readFileSync("./document.pdf");
const base64Pdf = pdfBuffer.toString("base64");
const message = new HumanMessage({
contentBlocks: [
{ type: "text", text: "Summarize this PDF document" },
{
type: "file",
data: base64Pdf,
mimeType: "application/pdf",
},
],
});
const response = await model.invoke([message]);
// Example with hypothetical audio support
const message = new HumanMessage({
contentBlocks: [
{ type: "text", text: "Transcribe this audio" },
{
type: "audio",
data: base64Audio,
mimeType: "audio/mpeg",
},
],
});
import { ChatOpenAI } from "@langchain/openai";
const model = new ChatOpenAI({ model: "gpt-4.1" });
const response = await model.invoke("Create an image of a sunset");
// Access content blocks
for (const block of response.contentBlocks) {
if (block.type === "text") {
console.log("Text:", block.text);
} else if (block.type === "image") {
console.log("Image URL:", block.url);
console.log("Image data:", block.data?.substring(0, 50) + "...");
}
}
import { ChatAnthropic } from "@langchain/anthropic";
import { HumanMessage } from "langchain";
const model = new ChatAnthropic({
model: "claude-sonnet-4-5-20250929",
});
const message = new HumanMessage({
contentBlocks: [
{
type: "image",
url: "https://example.com/chart.png",
},
{
type: "text",
text: "Extract all data points from this chart and format as a table",
},
],
});
const response = await model.invoke([message]);
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
import { HumanMessage } from "langchain";
const model = new ChatGoogleGenerativeAI({
model: "gemini-2.5-flash",
});
const message = new HumanMessage({
contentBlocks: [
{ type: "text", text: "What objects are in this image?" },
{ type: "image", url: "https://example.com/scene.jpg" },
],
});
const response = await model.invoke([message]);
✅ Image URLs: Public images via HTTPS ✅ Base64 images: Local or private images ✅ Multiple images: Compare, analyze together ✅ PDF documents: Text extraction, analysis ✅ Cross-provider format: Standard content blocks
❌ Image generation in all models: Limited to specific models ❌ Video understanding: Emerging, limited support ❌ Audio in all models: Model-specific ❌ Modify images: Models analyze, don't edit
// ❌ Problem: Using text-only model
const model = new ChatOpenAI({ model: "gpt-3.5-turbo" });
await model.invoke([imageMessage]); // Error!
// ✅ Solution: Use vision-capable model
const model = new ChatOpenAI({ model: "gpt-4.1" });
// ❌ Problem: Old format
const message = new HumanMessage({
content: [
{ type: "image_url", image_url: { url: "..." } } // OpenAI-specific
]
});
// ✅ Solution: Use standard content blocks
const message = new HumanMessage({
contentBlocks: [
{ type: "image", url: "..." } // Cross-provider
]
});
// ❌ Problem: No MIME type
{ type: "image", data: base64Data } // May fail
// ✅ Solution: Always include MIME type
{ type: "image", data: base64Data, mimeType: "image/jpeg" }
// ❌ Problem: Image exceeds size limit
const hugeImage = fs.readFileSync("./10mb_image.jpg");
// Model may reject
// ✅ Solution: Resize or compress images first
import sharp from "sharp";
const resized = await sharp("./10mb_image.jpg")
.resize(1024, 1024, { fit: "inside" })
.jpeg({ quality: 80 })
.toBuffer();