From abb306615098723ab24744549ac5a34b5208478f Mon Sep 17 00:00:00 2001 From: ccurme Date: Thu, 20 Jun 2024 14:49:00 -0400 Subject: [PATCH] docs: clarify streaming with RunnableLambda (#23228) --- docs/docs/how_to/functions.ipynb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/docs/how_to/functions.ipynb b/docs/docs/how_to/functions.ipynb index e095d70c27..aa67935c50 100644 --- a/docs/docs/how_to/functions.ipynb +++ b/docs/docs/how_to/functions.ipynb @@ -300,7 +300,11 @@ "id": "922b48bd", "metadata": {}, "source": [ - "# Streaming\n", + "## Streaming\n", + "\n", + ":::{.callout-note}\n", + "[RunnableLambda](https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableLambda.html) 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](https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.RunnableGenerator.html) instead as in the example below.\n", + ":::\n", "\n", "You can use generator functions (ie. functions that use the `yield` keyword, and behave like iterators) in a chain.\n", "\n",