core[patch]: add to RunnableLambda docstring (#24575)

Explain behavior when function returns a runnable.
This commit is contained in:
ccurme 2024-07-23 16:46:44 -04:00 committed by GitHub
parent ee3955c68c
commit 2d6b0bf3e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3999,11 +3999,14 @@ class RunnableLambda(Runnable[Input, Output]):
RunnableLambda can be composed as any other Runnable and provides
seamless integration with LangChain tracing.
`RunnableLambda` is best suited for code that does not need to support
``RunnableLambda`` is best suited for code that does not need to support
streaming. If you need to support streaming (i.e., be able to operate
on chunks of inputs and yield chunks of outputs), use `RunnableGenerator`
on chunks of inputs and yield chunks of outputs), use ``RunnableGenerator``
instead.
Note that if a ``RunnableLambda`` returns an instance of ``Runnable``, that
instance is invoked (or streamed) during execution.
Examples:
.. code-block:: python