diff --git a/src/backend/langflow/graph/base.py b/src/backend/langflow/graph/base.py index 6896de28b..ff586c6da 100644 --- a/src/backend/langflow/graph/base.py +++ b/src/backend/langflow/graph/base.py @@ -3,6 +3,7 @@ # - Defer prompts building to the last moment or when they have all the tools # - Build each inner agent first, then build the outer agent +import contextlib import types import warnings from copy import deepcopy @@ -94,8 +95,6 @@ class Node: params[key] = file_path - # We should check if the type is in something not - # the opposite elif value.get("type") not in DIRECT_TYPES: # Get the edge that connects to this node edges = [ @@ -129,6 +128,9 @@ class Node: new_value = value.get("value") if new_value is None: warnings.warn(f"Value for {key} in {self.node_type} is None. ") + if value.get("type") == "int": + with contextlib.suppress(TypeError, ValueError): + new_value = int(new_value) # type: ignore params[key] = new_value # Add _type to params diff --git a/src/backend/langflow/interface/text_splitters/base.py b/src/backend/langflow/interface/text_splitters/base.py index 68f340055..1f007a6b0 100644 --- a/src/backend/langflow/interface/text_splitters/base.py +++ b/src/backend/langflow/interface/text_splitters/base.py @@ -35,6 +35,24 @@ class TextSplitterCreator(LangChainTypeCreator): "display_name": "Separator", } + signature["template"]["chunk_size"] = { + "type": "int", + "required": True, + "show": True, + "value": 4000, + "name": "chunk_size", + "display_name": "Chunk Size", + } + + signature["template"]["chunk_overlap"] = { + "type": "int", + "required": True, + "show": True, + "value": 200, + "name": "chunk_overlap", + "display_name": "Chunk Overlap", + } + return signature except ValueError as exc: raise ValueError(f"Text Splitter {name} not found") from exc