test_tracer_nested_runs_on_error() — langchain Function Reference
Architecture documentation for the test_tracer_nested_runs_on_error() function in test_base_tracer.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a7dbb1f1_2e2c_c851_27e9_890c6e77f883["test_tracer_nested_runs_on_error()"] 013f89c1_4436_b008_1552_7a3ea97dace9["test_base_tracer.py"] a7dbb1f1_2e2c_c851_27e9_890c6e77f883 -->|defined in| 013f89c1_4436_b008_1552_7a3ea97dace9 6e040bd9_776b_69d1_2348_538d6cc259ae["_compare_run_with_error()"] a7dbb1f1_2e2c_c851_27e9_890c6e77f883 -->|calls| 6e040bd9_776b_69d1_2348_538d6cc259ae style a7dbb1f1_2e2c_c851_27e9_890c6e77f883 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/tracers/test_base_tracer.py lines 471–616
def test_tracer_nested_runs_on_error() -> None:
"""Test tracer on a nested run with an error."""
exception = Exception("test")
tracer = FakeTracer()
chain_uuid = uuid4()
tool_uuid = uuid4()
llm_uuid1 = uuid4()
llm_uuid2 = uuid4()
llm_uuid3 = uuid4()
for _ in range(3):
tracer.on_chain_start(
serialized={"name": "chain"}, inputs={}, run_id=chain_uuid
)
tracer.on_llm_start(
serialized=SERIALIZED,
prompts=[],
run_id=llm_uuid1,
parent_run_id=chain_uuid,
)
tracer.on_llm_end(response=LLMResult(generations=[[]]), run_id=llm_uuid1)
tracer.on_llm_start(
serialized=SERIALIZED,
prompts=[],
run_id=llm_uuid2,
parent_run_id=chain_uuid,
)
tracer.on_llm_end(response=LLMResult(generations=[[]]), run_id=llm_uuid2)
tracer.on_tool_start(
serialized={"name": "tool"},
input_str="test",
run_id=tool_uuid,
parent_run_id=chain_uuid,
)
tracer.on_llm_start(
serialized=SERIALIZED,
prompts=[],
run_id=llm_uuid3,
parent_run_id=tool_uuid,
)
tracer.on_llm_error(exception, run_id=llm_uuid3)
tracer.on_tool_error(exception, run_id=tool_uuid)
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_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_base_tracer.py at line 471.
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