run type for lambdas

pull/20683/head
Eugene Yurtsev 1 month ago
parent e5f5d9ff56
commit d2d17e86b9

@ -3634,6 +3634,8 @@ class RunnableLambda(Runnable[Input, Output]):
]
] = None,
name: Optional[str] = None,
*,
run_type: Optional[str] = None,
) -> None:
"""Create a RunnableLambda from a callable, and async callable or both.
@ -3643,6 +3645,8 @@ class RunnableLambda(Runnable[Input, Output]):
Args:
func: Either sync or async callable
afunc: An async callable that takes an input and returns an output.
name: An optional name for the runnable.
run_type: An optional type for the runnable.
"""
if afunc is not None:
self.afunc = afunc
@ -3674,6 +3678,8 @@ class RunnableLambda(Runnable[Input, Output]):
except AttributeError:
pass
self.run_type = run_type
@property
def InputType(self) -> Any:
"""The type of the input to this runnable."""
@ -3968,6 +3974,7 @@ class RunnableLambda(Runnable[Input, Output]):
self._invoke,
input,
self._config(config, self.func),
run_type=self.run_type,
**kwargs,
)
else:
@ -3988,6 +3995,7 @@ class RunnableLambda(Runnable[Input, Output]):
self._ainvoke,
input,
self._config(config, the_func),
run_type=self.run_type,
**kwargs,
)

Loading…
Cancel
Save