Home / Function/ _runnable_support() — langchain Function Reference

_runnable_support() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f7ae6963_2f68_4d86_2810_0e3c26f6d7fb["_runnable_support()"]
  0b528c80_0ce7_1c74_8932_bc433bcb03c6["utils.py"]
  f7ae6963_2f68_4d86_2810_0e3c26f6d7fb -->|defined in| 0b528c80_0ce7_1c74_8932_bc433bcb03c6
  style f7ae6963_2f68_4d86_2810_0e3c26f6d7fb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/messages/utils.py lines 784–802

def _runnable_support(
    func: Callable[
        Concatenate[Sequence[MessageLikeRepresentation] | PromptValue, _P], _R_co
    ],
) -> _RunnableSupportCallable[_P, _R_co]:
    @wraps(func)
    def wrapped(
        messages: Sequence[MessageLikeRepresentation] | PromptValue | None = None,
        *args: _P.args,
        **kwargs: _P.kwargs,
    ) -> _R_co | Runnable[Sequence[MessageLikeRepresentation], _R_co]:
        # Import locally to prevent circular import.
        from langchain_core.runnables.base import RunnableLambda  # noqa: PLC0415

        if messages is not None:
            return func(messages, *args, **kwargs)
        return RunnableLambda(partial(func, **kwargs), name=func.__name__)

    return cast("_RunnableSupportCallable[_P, _R_co]", wrapped)

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free