Home / Function/ _get_tool_calls_from_response() — langchain Function Reference

_get_tool_calls_from_response() — langchain Function Reference

Architecture documentation for the _get_tool_calls_from_response() function in chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  22b4b72b_4c0e_fde2_2401_52040de102e0["_get_tool_calls_from_response()"]
  5b41b5a0_b415_2ecd_9522_191ca69202ca["chat_models.py"]
  22b4b72b_4c0e_fde2_2401_52040de102e0 -->|defined in| 5b41b5a0_b415_2ecd_9522_191ca69202ca
  3b4a8d88_e271_d530_a2cc_d47df386a668["_iterate_over_stream()"]
  3b4a8d88_e271_d530_a2cc_d47df386a668 -->|calls| 22b4b72b_4c0e_fde2_2401_52040de102e0
  99d71779_02a3_5ac1_9f57_f8b40ddef80e["_aiterate_over_stream()"]
  99d71779_02a3_5ac1_9f57_f8b40ddef80e -->|calls| 22b4b72b_4c0e_fde2_2401_52040de102e0
  ef2fbbf4_d176_ecab_7ad5_9a91394db4ee["_parse_arguments_from_tool_call()"]
  22b4b72b_4c0e_fde2_2401_52040de102e0 -->|calls| ef2fbbf4_d176_ecab_7ad5_9a91394db4ee
  style 22b4b72b_4c0e_fde2_2401_52040de102e0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/langchain_ollama/chat_models.py lines 207–225

def _get_tool_calls_from_response(
    response: Mapping[str, Any],
) -> list[ToolCall]:
    """Get tool calls from Ollama response."""
    tool_calls = []
    if "message" in response and (
        raw_tool_calls := response["message"].get("tool_calls")
    ):
        tool_calls.extend(
            [
                tool_call(
                    id=str(uuid4()),
                    name=tc["function"]["name"],
                    args=_parse_arguments_from_tool_call(tc) or {},
                )
                for tc in raw_tool_calls
            ]
        )
    return tool_calls

Domain

Subdomains

Frequently Asked Questions

What does _get_tool_calls_from_response() do?
_get_tool_calls_from_response() is a function in the langchain codebase, defined in libs/partners/ollama/langchain_ollama/chat_models.py.
Where is _get_tool_calls_from_response() defined?
_get_tool_calls_from_response() is defined in libs/partners/ollama/langchain_ollama/chat_models.py at line 207.
What does _get_tool_calls_from_response() call?
_get_tool_calls_from_response() calls 1 function(s): _parse_arguments_from_tool_call.
What calls _get_tool_calls_from_response()?
_get_tool_calls_from_response() is called by 2 function(s): _aiterate_over_stream, _iterate_over_stream.

Analyze Your Own Codebase

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

Try Supermodel Free