MCPcopy
hub / github.com/langchain-ai/langchain / accepts_context

Function accepts_context

libs/core/langchain_core/runnables/utils.py:91–96  ·  view source on GitHub ↗

Check if a callable accepts a context argument.

(callable: Callable[..., Any])

Source from the content-addressed store, hash-verified

89
90
91def accepts_context(callable: Callable[..., Any]) -> bool:
92 """Check if a callable accepts a context argument."""
93 try:
94 return signature(callable).parameters.get("context") is not None
95 except ValueError:
96 return False
97
98
99class IsLocalDict(ast.NodeVisitor):

Callers 3

arunMethod · 0.90
_acall_with_configMethod · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected