Add Prompt type to CustomComponent

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-12-15 20:08:24 -03:00
commit 7999b3364b

View file

@ -34,6 +34,7 @@ The CustomComponent class serves as the foundation for creating custom component
| --------------------------------------------------------- | | --------------------------------------------------------- |
| _`str`_, _`int`_, _`float`_, _`bool`_, _`list`_, _`dict`_ | | _`str`_, _`int`_, _`float`_, _`bool`_, _`list`_, _`dict`_ |
| _`langflow.field_typing.NestedDict`_ | | _`langflow.field_typing.NestedDict`_ |
| _`langflow.field_typing.Prompt`_ |
| _`langchain.chains.base.Chain`_ | | _`langchain.chains.base.Chain`_ |
| _`langchain.PromptTemplate`_ | | _`langchain.PromptTemplate`_ |
| _`langchain.llms.base.BaseLLM`_ | | _`langchain.llms.base.BaseLLM`_ |
@ -47,6 +48,13 @@ 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. 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.
<Admonition type="info">
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.
</Admonition>
<Admonition type="info"> <Admonition type="info">
Unlike Langchain types, base Python types do not add a Unlike Langchain types, base Python types do not add a
[handle](../guidelines/components) to the field by default. To add handles, [handle](../guidelines/components) to the field by default. To add handles,