원클릭으로
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 | python |
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:
from langchain_openai import ChatOpenAI
from langchain.schema.messages import HumanMessage
model = ChatOpenAI(model="gpt-4.1")
message = HumanMessage(content_blocks=[
{"type": "text", "text": "What's in this image?"},
{"type": "image", "url": "https://example.com/photo.jpg"},
])
response = model.invoke([message])
print(response.content)
from langchain_openai import ChatOpenAI
from langchain.schema.messages import HumanMessage
import base64
model = ChatOpenAI(model="gpt-4.1")
# Read image and convert to base64
with open("./photo.jpg", "rb") as image_file:
base64_image = base64.b64encode(image_file.read()).decode("utf-8")
message = HumanMessage(content_blocks=[
{"type": "text", "text": "Describe this image in detail"},
{
"type": "image",
"base64": base64_image,
"mime_type": "image/jpeg",
},
])
response = model.invoke([message])
message = HumanMessage(content_blocks=[
{"type": "text", "text": "Compare these two images"},
{"type": "image", "url": "https://example.com/image1.jpg"},
{"type": "image", "url": "https://example.com/image2.jpg"},
])
from langchain_anthropic import ChatAnthropic
from langchain.schema.messages import HumanMessage
import base64
model = ChatAnthropic(model="claude-sonnet-4-5-20250929")
with open("./document.pdf", "rb") as pdf_file:
base64_pdf = base64.b64encode(pdf_file.read()).decode("utf-8")
message = HumanMessage(content_blocks=[
{"type": "text", "text": "Summarize this PDF document"},
{
"type": "file",
"base64": base64_pdf,
"mime_type": "application/pdf",
},
])
response = model.invoke([message])
from langchain_openai import ChatOpenAI
model = ChatOpenAI(model="gpt-4.1")
response = model.invoke("Create an image of a sunset")
# Access content blocks
for block in response.content_blocks:
if block["type"] == "text":
print(f"Text: {block['text']}")
elif block["type"] == "image":
print(f"Image URL: {block.get('url')}")
if "base64" in block:
print(f"Image data: {block['base64'][:50]}...")
from langchain_anthropic import ChatAnthropic
from langchain.schema.messages import HumanMessage
model = ChatAnthropic(model="claude-sonnet-4-5-20250929")
message = HumanMessage(content_blocks=[
{"type": "image", "url": "https://example.com/chart.png"},
{"type": "text", "text": "Extract all data points from this chart"},
])
response = model.invoke([message])
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain.schema.messages import HumanMessage
model = ChatGoogleGenerativeAI(model="gemini-2.5-flash")
message = HumanMessage(content_blocks=[
{"type": "text", "text": "What objects are in this image?"},
{"type": "image", "url": "https://example.com/scene.jpg"},
])
response = model.invoke([message])
# ❌ Problem: Using text-only model
model = ChatOpenAI(model="gpt-3.5-turbo")
model.invoke([image_message]) # Error!
# ✅ Solution: Use vision-capable model
model = ChatOpenAI(model="gpt-4.1")
# ❌ Problem: No MIME type
{"type": "image", "base64": base64_data} # May fail
# ✅ Solution: Always include MIME type
{"type": "image", "base64": base64_data, "mime_type": "image/jpeg"}
# ❌ Problem: Image exceeds size limit
with open("./10mb_image.jpg", "rb") as f:
huge_image = f.read() # Too large
# ✅ Solution: Resize images first
from PIL import Image
import io
img = Image.open("./10mb_image.jpg")
img.thumbnail((1024, 1024))
buffer = io.BytesIO()
img.save(buffer, format="JPEG", quality=80)
resized_data = base64.b64encode(buffer.getvalue()).decode()