test_tracer_nested_runs_on_error() — langchain Function Reference
Architecture documentation for the test_tracer_nested_runs_on_error() function in test_async_base_tracer.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 41a4bd7d_deff_2989_1743_667f750eba0f["test_tracer_nested_runs_on_error()"] a49e8dc2_b2f8_294c_51a9_1a3ea21182fb["test_async_base_tracer.py"] 41a4bd7d_deff_2989_1743_667f750eba0f -->|defined in| a49e8dc2_b2f8_294c_51a9_1a3ea21182fb 0964cd32_f826_4bb4_e380_fe8ef2770b89["_compare_run_with_error()"] 41a4bd7d_deff_2989_1743_667f750eba0f -->|calls| 0964cd32_f826_4bb4_e380_fe8ef2770b89 style 41a4bd7d_deff_2989_1743_667f750eba0f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/tracers/test_async_base_tracer.py lines 470–615
async def test_tracer_nested_runs_on_error() -> None:
"""Test tracer on a nested run with an error."""
exception = Exception("test")
tracer = FakeAsyncTracer()
chain_uuid = uuid4()
tool_uuid = uuid4()
llm_uuid1 = uuid4()
llm_uuid2 = uuid4()
llm_uuid3 = uuid4()
for _ in range(3):
await tracer.on_chain_start(
serialized={"name": "chain"}, inputs={}, run_id=chain_uuid
)
await tracer.on_llm_start(
serialized=SERIALIZED,
prompts=[],
run_id=llm_uuid1,
parent_run_id=chain_uuid,
)
await tracer.on_llm_end(response=LLMResult(generations=[[]]), run_id=llm_uuid1)
await tracer.on_llm_start(
serialized=SERIALIZED,
prompts=[],
run_id=llm_uuid2,
parent_run_id=chain_uuid,
)
await tracer.on_llm_end(response=LLMResult(generations=[[]]), run_id=llm_uuid2)
await tracer.on_tool_start(
serialized={"name": "tool"},
input_str="test",
run_id=tool_uuid,
parent_run_id=chain_uuid,
)
await tracer.on_llm_start(
serialized=SERIALIZED,
prompts=[],
run_id=llm_uuid3,
parent_run_id=tool_uuid,
)
await tracer.on_llm_error(exception, run_id=llm_uuid3)
await tracer.on_tool_error(exception, run_id=tool_uuid)
await tracer.on_chain_error(exception, run_id=chain_uuid)
compare_run = Run(
id=str(chain_uuid),
name="chain",
start_time=datetime.now(timezone.utc),
end_time=datetime.now(timezone.utc),
events=[
{"name": "start", "time": datetime.now(timezone.utc)},
{"name": "error", "time": datetime.now(timezone.utc)},
],
extra={},
serialized={"name": "chain"},
error=repr(exception),
inputs={},
outputs=None,
run_type="chain",
trace_id=chain_uuid,
dotted_order=f"20230101T000000000000Z{chain_uuid}",
child_runs=[
Run(
id=str(llm_uuid1),
name="llm",
parent_run_id=str(chain_uuid),
start_time=datetime.now(timezone.utc),
end_time=datetime.now(timezone.utc),
events=[
{"name": "start", "time": datetime.now(timezone.utc)},
{"name": "end", "time": datetime.now(timezone.utc)},
],
extra={},
serialized=SERIALIZED,
error=None,
inputs={"prompts": []},
outputs=LLMResult(generations=[[]], llm_output=None).model_dump(),
run_type="llm",
trace_id=chain_uuid,
dotted_order=f"20230101T000000000000Z{chain_uuid}.20230101T000000000000Z{llm_uuid1}",
Domain
Subdomains
Source
Frequently Asked Questions
What does test_tracer_nested_runs_on_error() do?
test_tracer_nested_runs_on_error() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/tracers/test_async_base_tracer.py.
Where is test_tracer_nested_runs_on_error() defined?
test_tracer_nested_runs_on_error() is defined in libs/core/tests/unit_tests/tracers/test_async_base_tracer.py at line 470.
What does test_tracer_nested_runs_on_error() call?
test_tracer_nested_runs_on_error() calls 1 function(s): _compare_run_with_error.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free