Home / Function/ _parse_python_function_docstring() — langchain Function Reference

_parse_python_function_docstring() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c02b2a05_36d0_546c_95cc_4172e6a6d71b["_parse_python_function_docstring()"]
  6508e071_ac7c_8516_5d11_f42f8a45558c["base.py"]
  c02b2a05_36d0_546c_95cc_4172e6a6d71b -->|defined in| 6508e071_ac7c_8516_5d11_f42f8a45558c
  daa5e145_cf07_31db_8626_86e163af6615["_infer_arg_descriptions()"]
  daa5e145_cf07_31db_8626_86e163af6615 -->|calls| c02b2a05_36d0_546c_95cc_4172e6a6d71b
  style c02b2a05_36d0_546c_95cc_4172e6a6d71b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tools/base.py lines 155–175

def _parse_python_function_docstring(
    function: Callable, annotations: dict, *, error_on_invalid_docstring: bool = False
) -> tuple[str, dict]:
    """Parse function and argument descriptions from a docstring.

    Assumes the function docstring follows Google Python style guide.

    Args:
        function: The function to parse the docstring from.
        annotations: Type annotations for the function parameters.
        error_on_invalid_docstring: Whether to raise an error on invalid docstring.

    Returns:
        A tuple containing the function description and argument descriptions.
    """
    docstring = inspect.getdoc(function)
    return _parse_google_docstring(
        docstring,
        list(annotations),
        error_on_invalid_docstring=error_on_invalid_docstring,
    )

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free