From 9cc0ae0242543671c0fb2e5f9107e7cea9dd4938 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 31 Jul 2023 14:37:18 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20docs(flow-runner.mdx):=20add=20e?= =?UTF-8?q?xplanation=20about=20using=20Document=20as=20input=20in=20FlowR?= =?UTF-8?q?unner=20class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The commit adds an explanation about using a `Document` as input in the `FlowRunner` class. It clarifies that using a `Document` is a straightforward way to pass text data in Langflow. Typically, a flow expects a string or a dictionary as input, and if a dictionary is used, it should be built according to the needs of the specific flow. The commit also mentions that the content of a document can be extracted using the `page_content` property and passed as an argument to the selected flow. --- docs/docs/examples/flow-runner.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/docs/examples/flow-runner.mdx b/docs/docs/examples/flow-runner.mdx index f762c38c3..c4a8f8220 100644 --- a/docs/docs/examples/flow-runner.mdx +++ b/docs/docs/examples/flow-runner.mdx @@ -280,6 +280,10 @@ class FlowRunner(CustomComponent): return Document(page_content=str(result)) ``` +We are using a _`Document`_ as input because it is a straightforward way to pass text data in Langflow. +Generally, a flow will take a string or a dictionary as input because that's what LangChain components expect. +In case you are passing a dictionary, you need to build it according to the needs of the flow you are using. + The content of a document can be extracted using the _`page_content`_ property and passed as an argument to the selected flow. In this example, we are using a Document because it can be parsed by a [Loader](../components/loaders), but we'd need to process _`page_content`_ depending on the input of the flow we are running.