test__validate_example_inputs_for_chain_input_mapper() — langchain Function Reference
Architecture documentation for the test__validate_example_inputs_for_chain_input_mapper() function in test_runner_utils.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 793260e3_f5ca_9d83_9cc3_79d1f3235bdb["test__validate_example_inputs_for_chain_input_mapper()"] c6cd417d_d0bc_a309_dd34_61e338d2ac18["test_runner_utils.py"] 793260e3_f5ca_9d83_9cc3_79d1f3235bdb -->|defined in| c6cd417d_d0bc_a309_dd34_61e338d2ac18 style 793260e3_f5ca_9d83_9cc3_79d1f3235bdb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py lines 108–135
def test__validate_example_inputs_for_chain_input_mapper() -> None:
mock_ = mock.MagicMock()
mock_.inputs = {"foo": "bar", "baz": "qux"}
chain = mock.MagicMock()
chain.input_keys = ["not foo", "not baz", "not qux"]
def wrong_output_format(inputs: dict) -> str:
assert "foo" in inputs
assert "baz" in inputs
return "hehe"
with pytest.raises(InputFormatError, match="must be a dictionary"):
_validate_example_inputs_for_chain(mock_, chain, wrong_output_format)
def wrong_output_keys(inputs: dict) -> dict:
assert "foo" in inputs
assert "baz" in inputs
return {"not foo": "foo", "not baz": "baz"}
with pytest.raises(InputFormatError, match="Missing keys after loading example"):
_validate_example_inputs_for_chain(mock_, chain, wrong_output_keys)
def input_mapper(inputs: dict) -> dict:
assert "foo" in inputs
assert "baz" in inputs
return {"not foo": inputs["foo"], "not baz": inputs["baz"], "not qux": "qux"}
_validate_example_inputs_for_chain(mock_, chain, input_mapper)
Domain
Subdomains
Source
Frequently Asked Questions
What does test__validate_example_inputs_for_chain_input_mapper() do?
test__validate_example_inputs_for_chain_input_mapper() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py.
Where is test__validate_example_inputs_for_chain_input_mapper() defined?
test__validate_example_inputs_for_chain_input_mapper() is defined in libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py at line 108.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free