Home / Function/ extract_tool_calls() — langchain Function Reference

extract_tool_calls() — langchain Function Reference

Architecture documentation for the extract_tool_calls() function in output_parsers.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8979d571_9d49_809d_ec8f_862c616b5d6f["extract_tool_calls()"]
  3702dbed_edb1_9f35_9019_2f747b6a4112["output_parsers.py"]
  8979d571_9d49_809d_ec8f_862c616b5d6f -->|defined in| 3702dbed_edb1_9f35_9019_2f747b6a4112
  470cac50_e74a_5b1d_dcca_af4864b0170e["_extract_tool_calls_from_message()"]
  470cac50_e74a_5b1d_dcca_af4864b0170e -->|calls| 8979d571_9d49_809d_ec8f_862c616b5d6f
  style 8979d571_9d49_809d_ec8f_862c616b5d6f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/langchain_anthropic/output_parsers.py lines 80–93

def extract_tool_calls(content: str | list[str | dict]) -> list[ToolCall]:
    """Extract tool calls from a list of content blocks."""
    if isinstance(content, list):
        tool_calls = []
        for block in content:
            if isinstance(block, str):
                continue
            if block["type"] != "tool_use":
                continue
            tool_calls.append(
                tool_call(name=block["name"], args=block["input"], id=block["id"]),
            )
        return tool_calls
    return []

Domain

Subdomains

Frequently Asked Questions

What does extract_tool_calls() do?
extract_tool_calls() is a function in the langchain codebase, defined in libs/partners/anthropic/langchain_anthropic/output_parsers.py.
Where is extract_tool_calls() defined?
extract_tool_calls() is defined in libs/partners/anthropic/langchain_anthropic/output_parsers.py at line 80.
What calls extract_tool_calls()?
extract_tool_calls() is called by 1 function(s): _extract_tool_calls_from_message.

Analyze Your Own Codebase

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

Try Supermodel Free