core[patch]: Fix doc-strings for code blocks (#23232)

Code blocks need extra space around them to be rendered properly by
sphinx
This commit is contained in:
Eugene Yurtsev 2024-06-20 15:34:52 -04:00 committed by GitHub
parent d5be160af0
commit 7545b1d29b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1357,6 +1357,7 @@ class Runnable(Generic[Input, Output], ABC):
Example: Example:
.. code-block:: python .. code-block:: python
from langchain_core.runnables import RunnableLambda from langchain_core.runnables import RunnableLambda
import time import time
@ -3388,6 +3389,7 @@ class RunnableGenerator(Runnable[Input, Output]):
RunnableGenerator makes it easy to implement custom behavior within a streaming RunnableGenerator makes it easy to implement custom behavior within a streaming
context. Below we show an example: context. Below we show an example:
.. code-block:: python .. code-block:: python
from langchain_core.prompts import ChatPromptTemplate from langchain_core.prompts import ChatPromptTemplate
@ -4384,13 +4386,16 @@ class RunnableEach(RunnableEachBase[Input, Output]):
Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]] Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]
] = None, ] = None,
) -> RunnableEach[Input, Output]: ) -> RunnableEach[Input, Output]:
""" """Bind lifecycle listeners to a Runnable, returning a new Runnable.
Bind lifecycle listeners to a Runnable, returning a new Runnable.
Args:
on_start: Called before the runnable starts running, with the Run object. on_start: Called before the runnable starts running, with the Run object.
on_end: Called after the runnable finishes running, with the Run object. on_end: Called after the runnable finishes running, with the Run object.
on_error: Called if the runnable throws an error, with the Run object. on_error: Called if the runnable throws an error, with the Run object.
Returns:
A new Runnable with the listeners bound.
The Run object contains information about the run, including its id, The Run object contains information about the run, including its id,
type, input, output, error, start_time, end_time, and any tags or metadata type, input, output, error, start_time, end_time, and any tags or metadata
added to the run. added to the run.
@ -4408,9 +4413,9 @@ class RunnableEach(RunnableEachBase[Input, Output]):
on_end: Optional[AsyncListener] = None, on_end: Optional[AsyncListener] = None,
on_error: Optional[AsyncListener] = None, on_error: Optional[AsyncListener] = None,
) -> RunnableEach[Input, Output]: ) -> RunnableEach[Input, Output]:
""" """Bind async lifecycle listeners to a Runnable, returning a new Runnable.
Bind async lifecycle listeners to a Runnable, returning a new Runnable.
Args:
on_start: Called asynchronously before the runnable starts running, on_start: Called asynchronously before the runnable starts running,
with the Run object. with the Run object.
on_end: Called asynchronously after the runnable finishes running, on_end: Called asynchronously after the runnable finishes running,
@ -4418,6 +4423,9 @@ class RunnableEach(RunnableEachBase[Input, Output]):
on_error: Called asynchronously if the runnable throws an error, on_error: Called asynchronously if the runnable throws an error,
with the Run object. with the Run object.
Returns:
A new Runnable with the listeners bound.
The Run object contains information about the run, including its id, The Run object contains information about the run, including its id,
type, input, output, error, start_time, end_time, and any tags or metadata type, input, output, error, start_time, end_time, and any tags or metadata
added to the run. added to the run.