test_complete_llm_run_automatically_stores_tool_call_count() — langchain Function Reference
Architecture documentation for the test_complete_llm_run_automatically_stores_tool_call_count() function in test_automatic_metadata.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD cf0ca3a0_01cd_643a_79d4_65a819becc97["test_complete_llm_run_automatically_stores_tool_call_count()"] c4a7a5fd_df82_7309_6533_bab19b148f74["test_automatic_metadata.py"] cf0ca3a0_01cd_643a_79d4_65a819becc97 -->|defined in| c4a7a5fd_df82_7309_6533_bab19b148f74 style cf0ca3a0_01cd_643a_79d4_65a819becc97 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/tracers/test_automatic_metadata.py lines 24–51
def test_complete_llm_run_automatically_stores_tool_call_count() -> None:
"""Test that `_complete_llm_run` automatically stores tool call count."""
tracer = MockTracerCore()
run = MagicMock(spec=Run)
run.id = "test-llm-run-id"
run.run_type = "llm"
run.extra = {}
run.outputs = {}
run.events = []
run.end_time = None
run.inputs = {}
tracer.run_map[str(run.id)] = run
tool_calls = [
ToolCall(name="search", args={"query": "test"}, id="call_1"),
ToolCall(name="calculator", args={"expression": "2+2"}, id="call_2"),
]
message = AIMessage(content="Test", tool_calls=tool_calls)
generation = ChatGeneration(message=message)
response = LLMResult(generations=[[generation]])
# Complete the LLM run (this should trigger automatic metadata storage)
completed_run = tracer._complete_llm_run(response=response, run_id=run.id)
assert "tool_call_count" in completed_run.extra
assert completed_run.extra["tool_call_count"] == 2
Domain
Subdomains
Source
Frequently Asked Questions
What does test_complete_llm_run_automatically_stores_tool_call_count() do?
test_complete_llm_run_automatically_stores_tool_call_count() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/tracers/test_automatic_metadata.py.
Where is test_complete_llm_run_automatically_stores_tool_call_count() defined?
test_complete_llm_run_automatically_stores_tool_call_count() is defined in libs/core/tests/unit_tests/tracers/test_automatic_metadata.py at line 24.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free