Home / Function/ get_function_first_arg_dict_keys() — langchain Function Reference

get_function_first_arg_dict_keys() — langchain Function Reference

Architecture documentation for the get_function_first_arg_dict_keys() function in utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  e6523587_4154_e7aa_21f3_ffc925c5d0d5["get_function_first_arg_dict_keys()"]
  ca66092c_447c_d201_0d3c_cfa6ca2cc9d3["utils.py"]
  e6523587_4154_e7aa_21f3_ffc925c5d0d5 -->|defined in| ca66092c_447c_d201_0d3c_cfa6ca2cc9d3
  style e6523587_4154_e7aa_21f3_ffc925c5d0d5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/utils.py lines 365–381

def get_function_first_arg_dict_keys(func: Callable) -> list[str] | None:
    """Get the keys of the first argument of a function if it is a dict.

    Args:
        func: The function to check.

    Returns:
        The keys of the first argument if it is a dict, None otherwise.
    """
    try:
        code = inspect.getsource(func)
        tree = ast.parse(textwrap.dedent(code))
        visitor = IsFunctionArgDict()
        visitor.visit(tree)
        return sorted(visitor.keys) if visitor.keys else None
    except (SyntaxError, TypeError, OSError, SystemError):
        return None

Subdomains

Frequently Asked Questions

What does get_function_first_arg_dict_keys() do?
get_function_first_arg_dict_keys() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/utils.py.
Where is get_function_first_arg_dict_keys() defined?
get_function_first_arg_dict_keys() is defined in libs/core/langchain_core/runnables/utils.py at line 365.

Analyze Your Own Codebase

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

Try Supermodel Free