Home / Function/ test_convert_from_runnable_other() — langchain Function Reference

test_convert_from_runnable_other() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/test_tools.py lines 1610–1636

def test_convert_from_runnable_other() -> None:
    # String input
    def f(x: str) -> str:
        return x + "a"

    def g(x: str) -> str:
        return x + "z"

    runnable = RunnableLambda(f) | g
    as_tool = runnable.as_tool()
    args_schema = as_tool.args_schema
    assert args_schema is None
    assert as_tool.description

    result = as_tool.invoke("b")
    assert result == "baz"

    # Test with config
    def h(x: str) -> str:
        config = ensure_config()
        assert config["configurable"]["foo"] == "not-bar"
        return x + "a"

    runnable2 = RunnableLambda(h)
    as_tool2 = runnable2.as_tool()
    result2 = as_tool2.invoke("b", config={"configurable": {"foo": "not-bar"}})
    assert result2 == "ba"

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free