Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/langchain-content-blocks

@820dfc8
Run it yourself

Works correctly with LangChain 1.0's typed content blocks on AIMessage.content — text, tool_use, image, thinking, document — across Claude, GPT-4o, and Gemini, including multi-modal composition and tool-call iteration. Use when composing multi-modal messages, iterating tool_use blocks, handling Claude's thinking content, or unifying image inputs across providers. Trigger with "langchain content blocks", "AIMessage.content", "tool_use block", "claude image input", "langchain multimodal", "thinking block replay", "claude citations".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/langchain-content-blocks

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesone-pager.md

≈688 tokens on demand. Your agent reads this file only when SKILL.md points to it.

langchain-content-blocks — One-Pager

Work correctly with LangChain 1.0's typed content blocks on AIMessage.content — text, tool_use, image, thinking, document — across Claude, GPT-4o, and Gemini.

The Problem

Multi-modal and tool-use code that works on GPT-4o breaks on Claude because the image-block shape differs (P64) and AIMessage.content is always a list[dict] on Claude (P02) so .split()/.lower() crashes with AttributeError. Extended-thinking replay fails with anthropic.BadRequestError: missing signature when prior thinking blocks are stripped between turns. Forcing tool_choice to a specific tool ignores stop_reason="end_turn" and loops forever (P63).

The Solution

This skill is the deep reference for LangChain 1.0's six typed block types: text, tool_use, tool_result, image, thinking, document. It covers streaming-delta accumulation of tool_use.input JSON, Claude thinking block signature preservation for multi-turn replay, the universal image block shape (base64 vs url, mime_type rules, per-provider size limits), Claude citations extraction from document blocks, and a provider-adapter checklist that keeps multi-modal composition portable across Claude, GPT-4o, and Gemini.

Who / What / When

Aspect Details
Who Python engineers composing multi-modal messages, iterating tool_use across stream deltas, handling Claude extended thinking, or extracting citations
What Block-type matrix (6 types x 4 attributes), safe iteration patterns, universal image composition, tool_use delta accumulation, thinking replay with signature, document/citations extraction, per-provider adapter checklist, 4 references
When After langchain-model-inference — when you need multi-modal composition, extended-thinking replay, or citation extraction; or when a tool-calling agent loop needs per-delta tool_use.input streaming

Key Features

  1. Block-type matrix — One row per block type (text, tool_use, tool_result, image, thinking, document) with columns for producers, consumer code, streaming behavior, and common gotchas; covers all six types in LangChain 1.0
  2. tool_use stream-delta accumulation — Canonical pattern for assembling fragmented input JSON deltas back into a dict before the on_chat_model_end event; covers ID matching against ToolMessage.tool_call_id (24-char toolu_* format on Anthropic)
  3. Claude thinking block replay — Signature verification, redaction (redacted_thinking) handling, and multi-turn replay semantics where prior thinking blocks must be passed back intact or Anthropic rejects the request

Quick Start

See SKILL.md for full instructions.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill is a professional developer resource providing safe and standard patterns for utilizing LangChain 1.0 content blocks across various AI providers. It correctly addresses common pitfalls like model-specific data formats and streaming complexities without introducing security risks.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 820dfc8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 months ago
What it can do
Reads files Edits files Runs commands
version
2.7.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
compatibility
Designed for Claude Code
All 4 allowed tools
ReadWriteEditBash(python:*)
Other metadata
tags
[
  "saas",
  "langchain",
  "langgraph",
  "python",
  "langchain-1.0",
  "content-blocks",
  "multimodal",
  "tool-use"
]

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/langchain-content-blocks