Home / Function/ _is_directly_injected_arg_type() — langchain Function Reference

_is_directly_injected_arg_type() — langchain Function Reference

Architecture documentation for the _is_directly_injected_arg_type() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8745af63_18ba_8e71_017a_49fe2e3217b3["_is_directly_injected_arg_type()"]
  80cebff4_efbd_4311_85e9_de0dc81a7eee["base.py"]
  8745af63_18ba_8e71_017a_49fe2e3217b3 -->|defined in| 80cebff4_efbd_4311_85e9_de0dc81a7eee
  5c55c769_8605_2bfb_879c_38c645ebb4f8["_is_injected_arg_type()"]
  5c55c769_8605_2bfb_879c_38c645ebb4f8 -->|calls| 8745af63_18ba_8e71_017a_49fe2e3217b3
  style 8745af63_18ba_8e71_017a_49fe2e3217b3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tools/base.py lines 1422–1439

def _is_directly_injected_arg_type(type_: Any) -> bool:
    """Check if a type annotation indicates a directly injected argument.

    This is currently only used for `ToolRuntime`.

    Checks if either the annotation itself is a subclass of `_DirectlyInjectedToolArg`
    or the origin of the annotation is a subclass of `_DirectlyInjectedToolArg`.

    For example, `ToolRuntime` or `ToolRuntime[ContextT, StateT]` would both return
    `True`.
    """
    return (
        isinstance(type_, type) and issubclass(type_, _DirectlyInjectedToolArg)
    ) or (
        (origin := get_origin(type_)) is not None
        and isinstance(origin, type)
        and issubclass(origin, _DirectlyInjectedToolArg)
    )

Subdomains

Frequently Asked Questions

What does _is_directly_injected_arg_type() do?
_is_directly_injected_arg_type() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/base.py.
Where is _is_directly_injected_arg_type() defined?
_is_directly_injected_arg_type() is defined in libs/core/langchain_core/tools/base.py at line 1422.
What calls _is_directly_injected_arg_type()?
_is_directly_injected_arg_type() is called by 1 function(s): _is_injected_arg_type.

Analyze Your Own Codebase

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

Try Supermodel Free