Home / Function/ _get_model() — langchain Function Reference

_get_model() — langchain Function Reference

Architecture documentation for the _get_model() function in test_shell_tool_integration.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  354734fe_d7c4_f60e_5bb6_2113b3e8d6ed["_get_model()"]
  16cf511f_16f7_4874_8879_68a3622bd4eb["test_shell_tool_integration.py"]
  354734fe_d7c4_f60e_5bb6_2113b3e8d6ed -->|defined in| 16cf511f_16f7_4874_8879_68a3622bd4eb
  b1bf8b44_ecaf_51c6_9436_cf7e95327b0f["test_shell_tool_basic_execution()"]
  b1bf8b44_ecaf_51c6_9436_cf7e95327b0f -->|calls| 354734fe_d7c4_f60e_5bb6_2113b3e8d6ed
  3bb8f1dd_39ac_a1d8_6ae3_7b30f8ddd3de["test_shell_session_persistence()"]
  3bb8f1dd_39ac_a1d8_6ae3_7b30f8ddd3de -->|calls| 354734fe_d7c4_f60e_5bb6_2113b3e8d6ed
  ed54f626_5872_6778_c934_444495cb286b["test_shell_tool_error_handling()"]
  ed54f626_5872_6778_c934_444495cb286b -->|calls| 354734fe_d7c4_f60e_5bb6_2113b3e8d6ed
  42f51aa1_eee3_f5fb_f845_045038cef68f["test_shell_tool_with_custom_tools()"]
  42f51aa1_eee3_f5fb_f845_045038cef68f -->|calls| 354734fe_d7c4_f60e_5bb6_2113b3e8d6ed
  style 354734fe_d7c4_f60e_5bb6_2113b3e8d6ed fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/integration_tests/agents/middleware/test_shell_tool_integration.py lines 22–31

def _get_model(provider: str) -> Any:
    """Get chat model for the specified provider."""
    if provider == "anthropic":
        return pytest.importorskip("langchain_anthropic").ChatAnthropic(
            model="claude-sonnet-4-5-20250929"
        )
    if provider == "openai":
        return pytest.importorskip("langchain_openai").ChatOpenAI(model="gpt-4o-mini")
    msg = f"Unknown provider: {provider}"
    raise ValueError(msg)

Domain

Subdomains

Frequently Asked Questions

What does _get_model() do?
_get_model() is a function in the langchain codebase, defined in libs/langchain_v1/tests/integration_tests/agents/middleware/test_shell_tool_integration.py.
Where is _get_model() defined?
_get_model() is defined in libs/langchain_v1/tests/integration_tests/agents/middleware/test_shell_tool_integration.py at line 22.
What calls _get_model()?
_get_model() is called by 4 function(s): test_shell_session_persistence, test_shell_tool_basic_execution, test_shell_tool_error_handling, test_shell_tool_with_custom_tools.

Analyze Your Own Codebase

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

Try Supermodel Free