Contribute components
New components are added as objects of the CustomComponent class.
Any dependencies are added to the pyproject.toml file.
Contribute an example component to Langflow
Anyone can contribute an example component. For example, if you created a new document loader called MyCustomDocumentLoader, you can follow these steps to contribute it to Langflow.
- Write your loader as an object of the CustomComponent class. You'll create a new class,
MyCustomDocumentLoader
, that will inherit fromCustomComponent
and override the base class's methods. - Define optional attributes like
display_name
,description
, anddocumentation
to provide information about your custom component. - Implement the
build_config
method to define the configuration options for your custom component. - Implement the
build
method to define the logic for taking input parameters specified in thebuild_config
method and returning the desired output. - Add the code to the /components/documentloaders folder.
- Add the dependency to /documentloaders/init.py as
from .MyCustomDocumentLoader import MyCustomDocumentLoader
. - Add any new dependencies to the pyproject.toml file.
- Submit documentation for your component. For this example, you'd submit documentation to the loaders page.
- Submit your changes as a pull request. The Langflow team will have a look, suggest changes, and add your component to Langflow.