create_reasoning_block() — langchain Function Reference
Architecture documentation for the create_reasoning_block() function in content.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 9fa2d563_4c17_62b4_036d_4eea2d1e468a["create_reasoning_block()"] c7f11daf_e104_efbe_7225_f1d6da8e8630["content.py"] 9fa2d563_4c17_62b4_036d_4eea2d1e468a -->|defined in| c7f11daf_e104_efbe_7225_f1d6da8e8630 style 9fa2d563_4c17_62b4_036d_4eea2d1e468a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/messages/content.py lines 1363–1401
def create_reasoning_block(
reasoning: str | None = None,
id: str | None = None,
index: int | str | None = None,
**kwargs: Any,
) -> ReasoningContentBlock:
"""Create a `ReasoningContentBlock`.
Args:
reasoning: The reasoning text or thought summary.
id: Content block identifier.
Generated automatically if not provided.
index: Index of block in aggregate response.
Used during streaming.
Returns:
A properly formatted `ReasoningContentBlock`.
!!! note
The `id` is generated automatically if not provided, using a UUID4 format
prefixed with `'lc_'` to indicate it is a LangChain-generated ID.
"""
block = ReasoningContentBlock(
type="reasoning",
reasoning=reasoning or "",
id=ensure_id(id),
)
if index is not None:
block["index"] = index
extras = {k: v for k, v in kwargs.items() if v is not None}
if extras:
block["extras"] = extras
return block
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does create_reasoning_block() do?
create_reasoning_block() is a function in the langchain codebase, defined in libs/core/langchain_core/messages/content.py.
Where is create_reasoning_block() defined?
create_reasoning_block() is defined in libs/core/langchain_core/messages/content.py at line 1363.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free