Home / Function/ test__parse_arguments_from_tool_call() — langchain Function Reference

test__parse_arguments_from_tool_call() — langchain Function Reference

Architecture documentation for the test__parse_arguments_from_tool_call() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8e0c7958_bc7e_ac67_e6b4_962f2764fede["test__parse_arguments_from_tool_call()"]
  9c4a2438_9884_cbb0_3cf5_de8827531653["test_chat_models.py"]
  8e0c7958_bc7e_ac67_e6b4_962f2764fede -->|defined in| 9c4a2438_9884_cbb0_3cf5_de8827531653
  style 8e0c7958_bc7e_ac67_e6b4_962f2764fede fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/tests/unit_tests/test_chat_models.py lines 51–71

def test__parse_arguments_from_tool_call() -> None:
    """Test that string arguments are preserved as strings in tool call parsing.

    PR #30154
    String-typed tool arguments (like IDs or long strings) were being incorrectly
    processed. The parser should preserve string values as strings rather than
    attempting to parse them as JSON when they're already valid string arguments.

    Use a long string ID to ensure string arguments maintain their original type after
    parsing, which is critical for tools expecting string inputs.
    """
    raw_response = (
        '{"model":"sample-model","message":{"role":"assistant","content":"",'
        '"tool_calls":[{"function":{"name":"get_profile_details",'
        '"arguments":{"arg_1":"12345678901234567890123456"}}}]},"done":false}'
    )
    raw_tool_calls = json.loads(raw_response)["message"]["tool_calls"]
    response = _parse_arguments_from_tool_call(raw_tool_calls[0])
    assert response is not None
    assert isinstance(response["arg_1"], str)
    assert response["arg_1"] == "12345678901234567890123456"

Domain

Subdomains

Frequently Asked Questions

What does test__parse_arguments_from_tool_call() do?
test__parse_arguments_from_tool_call() is a function in the langchain codebase, defined in libs/partners/ollama/tests/unit_tests/test_chat_models.py.
Where is test__parse_arguments_from_tool_call() defined?
test__parse_arguments_from_tool_call() is defined in libs/partners/ollama/tests/unit_tests/test_chat_models.py at line 51.

Analyze Your Own Codebase

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

Try Supermodel Free