Home / Function/ test_complete_llm_run_counts_tool_calls_from_multiple_generations() — langchain Function Reference

test_complete_llm_run_counts_tool_calls_from_multiple_generations() — langchain Function Reference

Architecture documentation for the test_complete_llm_run_counts_tool_calls_from_multiple_generations() function in test_automatic_metadata.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  00ce3318_4ca8_f8e2_120d_4b72c0520241["test_complete_llm_run_counts_tool_calls_from_multiple_generations()"]
  c4a7a5fd_df82_7309_6533_bab19b148f74["test_automatic_metadata.py"]
  00ce3318_4ca8_f8e2_120d_4b72c0520241 -->|defined in| c4a7a5fd_df82_7309_6533_bab19b148f74
  style 00ce3318_4ca8_f8e2_120d_4b72c0520241 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/tracers/test_automatic_metadata.py lines 101–128

def test_complete_llm_run_counts_tool_calls_from_multiple_generations() -> None:
    """Test that tool calls are counted from multiple generations."""
    tracer = MockTracerCore()

    run = MagicMock(spec=Run)
    run.id = "test-llm-run-id-multi"
    run.run_type = "llm"
    run.extra = {}
    run.outputs = {}
    run.events = []
    run.end_time = None
    run.inputs = {}

    tracer.run_map[str(run.id)] = run

    # Create multiple generations with tool calls
    tool_calls_1 = [ToolCall(name="search", args={"query": "test"}, id="call_1")]
    tool_calls_2 = [
        ToolCall(name="calculator", args={"expression": "2+2"}, id="call_2"),
        ToolCall(name="weather", args={"location": "NYC"}, id="call_3"),
    ]
    gen1 = ChatGeneration(message=AIMessage(content="Gen1", tool_calls=tool_calls_1))
    gen2 = ChatGeneration(message=AIMessage(content="Gen2", tool_calls=tool_calls_2))
    response = LLMResult(generations=[[gen1], [gen2]])

    completed_run = tracer._complete_llm_run(response=response, run_id=run.id)

    assert completed_run.extra["tool_call_count"] == 3

Subdomains

Frequently Asked Questions

What does test_complete_llm_run_counts_tool_calls_from_multiple_generations() do?
test_complete_llm_run_counts_tool_calls_from_multiple_generations() 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_counts_tool_calls_from_multiple_generations() defined?
test_complete_llm_run_counts_tool_calls_from_multiple_generations() is defined in libs/core/tests/unit_tests/tracers/test_automatic_metadata.py at line 101.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free