Home / Function/ test_content_blocks_reasoning_extraction() — langchain Function Reference

test_content_blocks_reasoning_extraction() — langchain Function Reference

Architecture documentation for the test_content_blocks_reasoning_extraction() function in test_ai.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  85c74347_524c_d44f_b29e_28455be12485["test_content_blocks_reasoning_extraction()"]
  f148f3ce_73bd_627d_a979_33d23ebac843["test_ai.py"]
  85c74347_524c_d44f_b29e_28455be12485 -->|defined in| f148f3ce_73bd_627d_a979_33d23ebac843
  style 85c74347_524c_d44f_b29e_28455be12485 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/test_ai.py lines 485–504

def test_content_blocks_reasoning_extraction() -> None:
    """Test best-effort reasoning extraction from `additional_kwargs`."""
    message = AIMessage(
        content="The answer is 42.",
        additional_kwargs={"reasoning_content": "Let me think about this problem..."},
    )
    content_blocks = message.content_blocks
    assert len(content_blocks) == 2
    assert content_blocks[0]["type"] == "reasoning"
    assert content_blocks[0].get("reasoning") == "Let me think about this problem..."
    assert content_blocks[1]["type"] == "text"
    assert content_blocks[1]["text"] == "The answer is 42."

    # Test no reasoning extraction when no reasoning content
    message = AIMessage(
        content="The answer is 42.", additional_kwargs={"other_field": "some value"}
    )
    content_blocks = message.content_blocks
    assert len(content_blocks) == 1
    assert content_blocks[0]["type"] == "text"

Domain

Subdomains

Frequently Asked Questions

What does test_content_blocks_reasoning_extraction() do?
test_content_blocks_reasoning_extraction() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/messages/test_ai.py.
Where is test_content_blocks_reasoning_extraction() defined?
test_content_blocks_reasoning_extraction() is defined in libs/core/tests/unit_tests/messages/test_ai.py at line 485.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free