Home / Function/ _get_filtered_args() — langchain Function Reference

_get_filtered_args() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/langchain_core/tools/base.py lines 126–152

def _get_filtered_args(
    inferred_model: type[BaseModel],
    func: Callable,
    *,
    filter_args: Sequence[str],
    include_injected: bool = True,
) -> dict:
    """Get filtered arguments from a function's signature.

    Args:
        inferred_model: The Pydantic model inferred from the function.
        func: The function to extract arguments from.
        filter_args: Arguments to exclude from the result.
        include_injected: Whether to include injected arguments.

    Returns:
        Dictionary of filtered arguments with their schema definitions.
    """
    schema = inferred_model.model_json_schema()["properties"]
    valid_keys = signature(func).parameters
    return {
        k: schema[k]
        for i, (k, param) in enumerate(valid_keys.items())
        if k not in filter_args
        and (i > 0 or param.name not in {"self", "cls"})
        and (include_injected or not _is_injected_arg_type(param.annotation))
    }

Subdomains

Frequently Asked Questions

What does _get_filtered_args() do?
_get_filtered_args() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/base.py.
Where is _get_filtered_args() defined?
_get_filtered_args() is defined in libs/core/langchain_core/tools/base.py at line 126.
What does _get_filtered_args() call?
_get_filtered_args() calls 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