Home / Function/ test_parse_tool_call_with_none_arguments() — langchain Function Reference

test_parse_tool_call_with_none_arguments() — langchain Function Reference

Architecture documentation for the test_parse_tool_call_with_none_arguments() function in test_openai_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  9892ff7f_2a19_8e4f_3338_5ba07c4fa971["test_parse_tool_call_with_none_arguments()"]
  0f94a062_f577_31c7_fb9c_0f526b273e64["test_openai_tools.py"]
  9892ff7f_2a19_8e4f_3338_5ba07c4fa971 -->|defined in| 0f94a062_f577_31c7_fb9c_0f526b273e64
  style 9892ff7f_2a19_8e4f_3338_5ba07c4fa971 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_openai_tools.py lines 1356–1378

def test_parse_tool_call_with_none_arguments() -> None:
    """Test parse_tool_call handles None arguments for parameter-less tools.

    When an LLM calls a tool that has no parameters, some providers return
    None for the arguments field instead of an empty string or "{}".
    This should not raise an error.

    See: https://github.com/langchain-ai/langchain/issues/34123
    """
    # Test case from issue #34123: arguments is None
    raw_tool_call = {
        "function": {"arguments": None, "name": "orderStatus"},
        "id": "chatcmpl-tool-8b1f759d874b412e931e64cf6f57bdcc",
        "type": "function",
    }

    # This should not raise an error - should return parsed tool call with empty args
    result = parse_tool_call(raw_tool_call, return_id=True)

    assert result is not None
    assert result["name"] == "orderStatus"
    assert result["args"] == {}
    assert result["id"] == "chatcmpl-tool-8b1f759d874b412e931e64cf6f57bdcc"

Domain

Subdomains

Frequently Asked Questions

What does test_parse_tool_call_with_none_arguments() do?
test_parse_tool_call_with_none_arguments() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/output_parsers/test_openai_tools.py.
Where is test_parse_tool_call_with_none_arguments() defined?
test_parse_tool_call_with_none_arguments() is defined in libs/core/tests/unit_tests/output_parsers/test_openai_tools.py at line 1356.

Analyze Your Own Codebase

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

Try Supermodel Free