From 8de4812302fd2b982775b77633c862c84578cfea Mon Sep 17 00:00:00 2001 From: Mendon Kissling <59585235+mendonk@users.noreply.github.com> Date: Thu, 2 May 2024 16:49:30 -0400 Subject: [PATCH] initial-content --- .../docs/contributing/contribute-component.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/docs/contributing/contribute-component.md diff --git a/docs/docs/contributing/contribute-component.md b/docs/docs/contributing/contribute-component.md new file mode 100644 index 000000000..1b45747f3 --- /dev/null +++ b/docs/docs/contributing/contribute-component.md @@ -0,0 +1,20 @@ +# How to contribute components? + +As of Langflow 1.0 alpha, new components are added as objects of the `CustomComponent` class and any dependencies are added to the pyproject.toml file. + +## Add an example component + +You have a new document loader called **MyCustomEmbedding** and it would look awesome in Langflow. + +1. Write your loader as an object of the [CustomComponent](https://github.com/langflow-ai/langflow/blob/dev/src/backend/base/langflow/interface/custom/custom_component/custom_component.py) class. You'll create a new class, `MyCustomEmbeddingComponent`, that will inherit from `CustomComponent` and override the base class's methods. +2. Define optional attributes like `display_name`, `description`, and `documentation` to provide information about your custom component. +3. Implement the `build_config` method to define the configuration options for your custom component. +4. Implement the `build` method to define the logic for taking input parameters specified in the `build_config` method and returning the desired output. +5. Add the code to the [/components/document_loaders](https://github.com/langflow-ai/langflow/tree/dev/src/backend/base/langflow/components) folder. +6. Add the dependency to [/document_loaders/\_\_init\_\_.py](https://github.com/langflow-ai/langflow/blob/dev/src/backend/base/langflow/components/documentloaders/__init__.py) as `from .MyCustomEmbedding import MyCustomEmbeddingComponent`. +7. Add any new dependencies to the outer [pyproject.toml](https://github.com/langflow-ai/langflow/blob/dev/pyproject.toml#L27) file. +8. Submit your changes as a pull request. The Langflow team will have a look, suggest changes, and add your component to Langflow. + + + +