Creates a dependency for injection based on the provided context or type.
| PARAMETER | DESCRIPTION |
x | The context or dependency to be injected. TYPE: Any |
| RETURNS | DESCRIPTION |
Any | A FastDepends object that will resolve the dependency for injection. |
Source code in autogen/tools/dependency_injection.py
| @export_module("autogen.tools")
def Depends(x: Any) -> Any: # noqa: N802
"""Creates a dependency for injection based on the provided context or type.
Args:
x: The context or dependency to be injected.
Returns:
A FastDepends object that will resolve the dependency for injection.
"""
if isinstance(x, BaseContext):
return FastDepends(lambda: x)
return FastDepends(x)
|