test_complete_llm_run_handles_null_tool_calls() — langchain Function Reference
Architecture documentation for the test_complete_llm_run_handles_null_tool_calls() function in test_automatic_metadata.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD f14818fc_bbbe_bca3_06ef_d803aaa8dd08["test_complete_llm_run_handles_null_tool_calls()"] c4a7a5fd_df82_7309_6533_bab19b148f74["test_automatic_metadata.py"] f14818fc_bbbe_bca3_06ef_d803aaa8dd08 -->|defined in| c4a7a5fd_df82_7309_6533_bab19b148f74 style f14818fc_bbbe_bca3_06ef_d803aaa8dd08 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/tracers/test_automatic_metadata.py lines 131–155
def test_complete_llm_run_handles_null_tool_calls() -> None:
"""Test that `_complete_llm_run` handles null `tool_calls` gracefully."""
tracer = MockTracerCore()
run = MagicMock(spec=Run)
run.id = "test-llm-run-id-null-tools"
run.run_type = "llm"
run.extra = {}
run.outputs = {}
run.events = []
run.end_time = None
run.inputs = {}
tracer.run_map[str(run.id)] = run
message = AIMessage(content="Test with null tool_calls")
generation = ChatGeneration(message=message)
# Bypass Pydantic validation by directly setting attribute
object.__setattr__(message, "tool_calls", None)
response = LLMResult(generations=[[generation]])
# Should not raise TypeError from len(None)
completed_run = tracer._complete_llm_run(response=response, run_id=run.id)
assert "tool_call_count" not in completed_run.extra
Domain
Subdomains
Source
Frequently Asked Questions
What does test_complete_llm_run_handles_null_tool_calls() do?
test_complete_llm_run_handles_null_tool_calls() 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_handles_null_tool_calls() defined?
test_complete_llm_run_handles_null_tool_calls() is defined in libs/core/tests/unit_tests/tracers/test_automatic_metadata.py at line 131.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free