test_arun_on_dataset() — langchain Function Reference
Architecture documentation for the test_arun_on_dataset() function in test_runner_utils.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a8706c8f_d4c8_7d16_1e26_8393c85d766e["test_arun_on_dataset()"] c6cd417d_d0bc_a309_dd34_61e338d2ac18["test_runner_utils.py"] a8706c8f_d4c8_7d16_1e26_8393c85d766e -->|defined in| c6cd417d_d0bc_a309_dd34_61e338d2ac18 style a8706c8f_d4c8_7d16_1e26_8393c85d766e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py lines 244–354
async def test_arun_on_dataset() -> None:
dataset = Dataset(
id=uuid.uuid4(),
name="test",
description="Test dataset",
owner_id="owner",
created_at=_CREATED_AT,
tenant_id=_TENANT_ID,
_host_url="http://localhost:1984",
)
uuids = [
"0c193153-2309-4704-9a47-17aee4fb25c8",
"0d11b5fd-8e66-4485-b696-4b55155c0c05",
"90d696f0-f10d-4fd0-b88b-bfee6df08b84",
"4ce2c6d8-5124-4c0c-8292-db7bdebcf167",
"7b5a524c-80fa-4960-888e-7d380f9a11ee",
]
examples = [
Example(
id=uuids[0],
created_at=_CREATED_AT,
inputs={"input": "1"},
outputs={"output": "2"},
dataset_id=str(uuid.uuid4()),
),
Example(
id=uuids[1],
created_at=_CREATED_AT,
inputs={"input": "3"},
outputs={"output": "4"},
dataset_id=str(uuid.uuid4()),
),
Example(
id=uuids[2],
created_at=_CREATED_AT,
inputs={"input": "5"},
outputs={"output": "6"},
dataset_id=str(uuid.uuid4()),
),
Example(
id=uuids[3],
created_at=_CREATED_AT,
inputs={"input": "7"},
outputs={"output": "8"},
dataset_id=str(uuid.uuid4()),
),
Example(
id=uuids[4],
created_at=_CREATED_AT,
inputs={"input": "9"},
outputs={"output": "10"},
dataset_id=str(uuid.uuid4()),
),
]
def mock_read_dataset(*_: Any, **__: Any) -> Dataset:
return dataset
def mock_list_examples(*_: Any, **__: Any) -> Iterator[Example]:
return iter(examples)
async def mock_arun_chain(
example: Example,
*_: Any,
**__: Any,
) -> dict[str, Any]:
return {"result": f"Result for example {example.id}"}
def mock_create_project(*_: Any, **__: Any) -> Any:
proj = mock.MagicMock()
proj.id = "123"
return proj
with (
mock.patch.object(Client, "read_dataset", new=mock_read_dataset),
mock.patch.object(Client, "list_examples", new=mock_list_examples),
mock.patch(
"langchain_classic.smith.evaluation.runner_utils._arun_llm_or_chain",
new=mock_arun_chain,
),
mock.patch.object(Client, "create_project", new=mock_create_project),
Domain
Subdomains
Source
Frequently Asked Questions
What does test_arun_on_dataset() do?
test_arun_on_dataset() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py.
Where is test_arun_on_dataset() defined?
test_arun_on_dataset() is defined in libs/langchain/tests/unit_tests/smith/evaluation/test_runner_utils.py at line 244.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free