Home / Function/ test_tool_injected_arg_without_schema() — langchain Function Reference

test_tool_injected_arg_without_schema() — langchain Function Reference

Architecture documentation for the test_tool_injected_arg_without_schema() function in test_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  0dcb0d64_be7c_ebef_39ba_f2cc2368550d["test_tool_injected_arg_without_schema()"]
  8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"]
  0dcb0d64_be7c_ebef_39ba_f2cc2368550d -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555
  style 0dcb0d64_be7c_ebef_39ba_f2cc2368550d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 1690–1731

def test_tool_injected_arg_without_schema(tool_: BaseTool) -> None:
    assert _schema(tool_.get_input_schema()) == {
        "title": "foo",
        "description": "Foo.\n\nArgs:\n    x: abc\n    y: 123",
        "type": "object",
        "properties": {
            "x": {"title": "X", "type": "integer"},
            "y": {"title": "Y", "type": "string"},
        },
        "required": ["x", "y"],
    }
    assert _schema(tool_.tool_call_schema) == {
        "title": "foo",
        "description": "foo.",
        "type": "object",
        "properties": {"x": {"title": "X", "type": "integer"}},
        "required": ["x"],
    }
    assert tool_.invoke({"x": 5, "y": "bar"}) == "bar"
    assert tool_.invoke(
        {
            "name": "foo",
            "args": {"x": 5, "y": "bar"},
            "id": "123",
            "type": "tool_call",
        }
    ) == ToolMessage("bar", tool_call_id="123", name="foo")
    expected_error = (
        ValidationError if not isinstance(tool_, InjectedTool) else TypeError
    )
    with pytest.raises(expected_error):
        tool_.invoke({"x": 5})

    assert convert_to_openai_function(tool_) == {
        "name": "foo",
        "description": "foo.",
        "parameters": {
            "type": "object",
            "properties": {"x": {"type": "integer"}},
            "required": ["x"],
        },
    }

Domain

Subdomains

Frequently Asked Questions

What does test_tool_injected_arg_without_schema() do?
test_tool_injected_arg_without_schema() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_tool_injected_arg_without_schema() defined?
test_tool_injected_arg_without_schema() is defined in libs/core/tests/unit_tests/test_tools.py at line 1690.

Analyze Your Own Codebase

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

Try Supermodel Free