test_tracer_nested_run() — langchain Function Reference
Architecture documentation for the test_tracer_nested_run() function in test_async_base_tracer.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e1e6d912_e6e7_c364_6d78_56003a6ca9c8["test_tracer_nested_run()"] a49e8dc2_b2f8_294c_51a9_1a3ea21182fb["test_async_base_tracer.py"] e1e6d912_e6e7_c364_6d78_56003a6ca9c8 -->|defined in| a49e8dc2_b2f8_294c_51a9_1a3ea21182fb style e1e6d912_e6e7_c364_6d78_56003a6ca9c8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/tracers/test_async_base_tracer.py lines 218–333
async def test_tracer_nested_run() -> None:
"""Test tracer on a nested run."""
tracer = FakeAsyncTracer()
chain_uuid = uuid4()
tool_uuid = uuid4()
llm_uuid1 = uuid4()
llm_uuid2 = uuid4()
for _ in range(10):
await tracer.on_chain_start(
serialized={"name": "chain"}, inputs={}, run_id=chain_uuid
)
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_uuid1,
parent_run_id=tool_uuid,
)
await tracer.on_llm_end(response=LLMResult(generations=[[]]), run_id=llm_uuid1)
await tracer.on_tool_end("test", run_id=tool_uuid)
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_chain_end(outputs={}, run_id=chain_uuid)
compare_run = Run(
id=str(chain_uuid),
name="chain",
error=None,
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={"name": "chain"},
inputs={},
outputs={},
run_type="chain",
trace_id=chain_uuid,
dotted_order=f"20230101T000000000000Z{chain_uuid}",
child_runs=[
Run(
id=tool_uuid,
name="tool",
parent_run_id=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={"name": "tool"},
inputs={"input": "test"},
outputs={"output": "test"},
error=None,
run_type="tool",
trace_id=chain_uuid,
dotted_order=f"20230101T000000000000Z{chain_uuid}.20230101T000000000000Z{tool_uuid}",
child_runs=[
Run(
id=str(llm_uuid1),
name="llm",
parent_run_id=str(tool_uuid),
error=None,
start_time=datetime.now(timezone.utc),
end_time=datetime.now(timezone.utc),
events=[
{"name": "start", "time": datetime.now(timezone.utc)},
Domain
Subdomains
Source
Frequently Asked Questions
What does test_tracer_nested_run() do?
test_tracer_nested_run() 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_run() defined?
test_tracer_nested_run() is defined in libs/core/tests/unit_tests/tracers/test_async_base_tracer.py at line 218.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free