Home / Function/ _is_injected_arg_type() — langchain Function Reference

_is_injected_arg_type() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  5c55c769_8605_2bfb_879c_38c645ebb4f8["_is_injected_arg_type()"]
  80cebff4_efbd_4311_85e9_de0dc81a7eee["base.py"]
  5c55c769_8605_2bfb_879c_38c645ebb4f8 -->|defined in| 80cebff4_efbd_4311_85e9_de0dc81a7eee
  68a5b08c_d816_ea55_afcc_7739e4c97f93["_get_filtered_args()"]
  68a5b08c_d816_ea55_afcc_7739e4c97f93 -->|calls| 5c55c769_8605_2bfb_879c_38c645ebb4f8
  ce65f72d_5a31_1cf5_28d0_0114514b29b5["create_schema_from_function()"]
  ce65f72d_5a31_1cf5_28d0_0114514b29b5 -->|calls| 5c55c769_8605_2bfb_879c_38c645ebb4f8
  b7b0f260_6a90_b70a_e9d8_029e942e59a1["tool_call_schema()"]
  b7b0f260_6a90_b70a_e9d8_029e942e59a1 -->|calls| 5c55c769_8605_2bfb_879c_38c645ebb4f8
  0f980582_36e3_bd64_ec07_fc1d2414d385["_parse_input()"]
  0f980582_36e3_bd64_ec07_fc1d2414d385 -->|calls| 5c55c769_8605_2bfb_879c_38c645ebb4f8
  fa82d3e5_c342_0a6d_3c6f_5aa889ad3f2a["_filter_injected_args()"]
  fa82d3e5_c342_0a6d_3c6f_5aa889ad3f2a -->|calls| 5c55c769_8605_2bfb_879c_38c645ebb4f8
  8745af63_18ba_8e71_017a_49fe2e3217b3["_is_directly_injected_arg_type()"]
  5c55c769_8605_2bfb_879c_38c645ebb4f8 -->|calls| 8745af63_18ba_8e71_017a_49fe2e3217b3
  style 5c55c769_8605_2bfb_879c_38c645ebb4f8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tools/base.py lines 1442–1467

def _is_injected_arg_type(
    type_: type | TypeVar, injected_type: type[InjectedToolArg] | None = None
) -> bool:
    """Check if a type annotation indicates an injected argument.

    Args:
        type_: The type annotation to check.
        injected_type: The specific injected type to check for.

    Returns:
        `True` if the type is an injected argument, `False` otherwise.
    """
    if injected_type is None:
        # if no injected type is specified,
        # check if the type is a directly injected argument
        if _is_directly_injected_arg_type(type_):
            return True
        injected_type = InjectedToolArg

    # if the type is an Annotated type, check if annotated metadata
    # is an intance or subclass of the injected type
    return any(
        isinstance(arg, injected_type)
        or (isinstance(arg, type) and issubclass(arg, injected_type))
        for arg in get_args(type_)[1:]
    )

Subdomains

Frequently Asked Questions

What does _is_injected_arg_type() do?
_is_injected_arg_type() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/base.py.
Where is _is_injected_arg_type() defined?
_is_injected_arg_type() is defined in libs/core/langchain_core/tools/base.py at line 1442.
What does _is_injected_arg_type() call?
_is_injected_arg_type() calls 1 function(s): _is_directly_injected_arg_type.
What calls _is_injected_arg_type()?
_is_injected_arg_type() is called by 5 function(s): _filter_injected_args, _get_filtered_args, _parse_input, create_schema_from_function, tool_call_schema.

Analyze Your Own Codebase

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

Try Supermodel Free