-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CombineTextsUnsortedComponent to langflow components
- Loading branch information
1 parent
6a06af1
commit 082c02f
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/backend/base/langflow/components/helpers/CombineTextsUnsorted.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from langflow.interface.custom.custom_component import CustomComponent | ||
from langflow.field_typing import Text | ||
|
||
|
||
class CombineTextsUnsortedComponent(CustomComponent): | ||
display_name = "Combine Texts (Unsorted)" | ||
description = "Concatenate text sources into a single text chunk using a specified delimiter." | ||
icon = "merge" | ||
|
||
def build_config(self): | ||
return { | ||
"texts": { | ||
"display_name": "Texts", | ||
"info": "The first text input to concatenate.", | ||
}, | ||
"delimiter": { | ||
"display_name": "Delimiter", | ||
"info": "A string used to separate the two text inputs. Defaults to a whitespace.", | ||
}, | ||
} | ||
|
||
def build(self, texts: list[str], delimiter: str = " ") -> Text: | ||
combined = delimiter.join(texts) | ||
self.status = combined | ||
return combined |