From 7999b3364b77e1795647eb162f0de6e4582dc8ff Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 15 Dec 2023 20:08:24 -0300 Subject: [PATCH] Add Prompt type to CustomComponent --- docs/docs/components/custom.mdx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/docs/components/custom.mdx b/docs/docs/components/custom.mdx index 382c40cc4..84823e341 100644 --- a/docs/docs/components/custom.mdx +++ b/docs/docs/components/custom.mdx @@ -34,6 +34,7 @@ The CustomComponent class serves as the foundation for creating custom component | --------------------------------------------------------- | | _`str`_, _`int`_, _`float`_, _`bool`_, _`list`_, _`dict`_ | | _`langflow.field_typing.NestedDict`_ | + | _`langflow.field_typing.Prompt`_ | | _`langchain.chains.base.Chain`_ | | _`langchain.PromptTemplate`_ | | _`langchain.llms.base.BaseLLM`_ | @@ -48,10 +49,17 @@ The CustomComponent class serves as the foundation for creating custom component The difference between _`dict`_ and _`langflow.field_typing.NestedDict`_ is that one adds a simple key-value pair field, while the other opens a more robust dictionary editor. - Unlike Langchain types, base Python types do not add a + To use the _`Prompt`_ type, you must also add _`**kwargs`_ to the _`build`_ method. This is because the _`Prompt`_ type passes new arbitrary keyword arguments to it. + + If you want to add the values of the variables to the template you defined, you must format the PromptTemplate inside the CustomComponent class. + + + + + Unlike Langchain types, base Python types do not add a [handle](../guidelines/components) to the field by default. To add handles, use the _`input_types`_ key in the _`build_config`_ method. - + - **build_config**: Used to define the configuration fields of the component (if applicable). It should always return a dictionary with specific keys representing the field names and corresponding configurations. This method is called when the code is processed (i.e., when you click _Check and Save_ in the code editor). It must follow the format described below: