diff --git a/README.md b/README.md index 4517764..a9eaf05 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ It has a subset of Griptape nodes, including nodes for: ## Example -In this example, we're using three `Image Description` nodes to describe the given images. Those descriptions are then `Concatenated` into a single string which is used as inspiration for creating a new image using the `Create Image from Text` node. +In this example, we're using three `Image Description` nodes to describe the given images. Those descriptions are then `Merged` into a single string which is used as inspiration for creating a new image using the `Create Image from Text` node, driven by an `OpenAI Driver`. ![Three image descriptions being used to generate a new image](docs/images/image_descriptions_to_image.png) diff --git a/__init__.py b/__init__.py index fd844fc..3823f6d 100644 --- a/__init__.py +++ b/__init__.py @@ -12,7 +12,7 @@ from dotenv import load_dotenv # Load the griptape_config.json data from .nodes.agent import CreateAgent, ExpandAgent -from .nodes.combine_nodes import ConcatenateStrings, ToolList +from .nodes.combine_nodes import MergeStrings, ToolList from .nodes.config import ( gtUIAmazonBedrockStructureConfig, gtUIAnthropicStructureConfig, @@ -94,7 +94,7 @@ NODE_CLASS_MAPPINGS = { "WebScraper": gtUIWebScraper, "gtUIFileManager": gtUIFileManager, "ToolList": ToolList, - "ConcatenateStrings": ConcatenateStrings, + "MergeStrings": MergeStrings, "PromptTask": gtUIPromptTask, "ToolTask": gtUIToolTask, "ToolkitTask": gtUIToolkitTask, @@ -114,10 +114,10 @@ NODE_DISPLAY_NAME_MAPPINGS = { "PromptImageGenerationTask": "Griptape Create: Image from Text", "PromptImageVariationTask": "Griptape Create: Image Variation", "Rule": "Griptape Create: Rules", - "gtUIOpenAiImageGenerationDriver": "Griptape Driver: OpenAI Image Generation", - "gtUIAmazonBedrockStableDiffusionImageGenerationDriver": "Griptape Driver: Amazon Bedrock Stable Diffusion Image Generation", - "gtUIAmazonBedrockTitanImageGenerationDriver": "Griptape Driver: Amazon Bedrock Titan Image Generation", - "gtUILeonardoImageGenerationDriver": "Griptape Driver: Leonardo Image Generation", + "gtUIOpenAiImageGenerationDriver": "Griptape Driver: OpenAI", + "gtUIAmazonBedrockStableDiffusionImageGenerationDriver": "Griptape Driver: Amazon Bedrock Stable Diffusion", + "gtUIAmazonBedrockTitanImageGenerationDriver": "Griptape Driver: Amazon Bedrock Titan", + "gtUILeonardoImageGenerationDriver": "Griptape Driver: Leonardo.AI", "gtUIOutputStringNode": "Griptape Display: String", "gtUIOutputImageNode": "Griptape Display: Image", "ImageQueryTask": "Griptape Run: Image Description", @@ -135,7 +135,7 @@ NODE_DISPLAY_NAME_MAPPINGS = { "WebScraper": "Griptape Tool: WebScraper", "gtUIFileManager": "Griptape Tool: FileManager", "ToolList": "Griptape Combine: Tool List", - "ConcatenateStrings": "Griptape Combine: Concatenate Strings", + "MergeStrings": "Griptape Combine: Merge Strings", } __all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"] diff --git a/docs/images/image_descriptions_to_image.png b/docs/images/image_descriptions_to_image.png index fdc6014..29193c6 100644 Binary files a/docs/images/image_descriptions_to_image.png and b/docs/images/image_descriptions_to_image.png differ diff --git a/nodes/combine_nodes.py b/nodes/combine_nodes.py index 447c6eb..fa087b5 100644 --- a/nodes/combine_nodes.py +++ b/nodes/combine_nodes.py @@ -1,6 +1,6 @@ -class ConcatenateStrings: +class MergeStrings: """ - Concatenate Strings + Merge Strings """ def __init__(self): @@ -15,7 +15,6 @@ class ConcatenateStrings: "string_2": ("STRING", {"forceInput": True}), "string_3": ("STRING", {"forceInput": True}), "string_4": ("STRING", {"forceInput": True}), - "separator": ("STRING", {"default": "\\n"}), }, } @@ -31,13 +30,9 @@ class ConcatenateStrings: string_2="", string_3="", string_4="", - separator="\n", ): - # If the user enters \n, we need to convert it to a newline - separator = separator.replace("\\n", "\n") - # Join strings by newline - concatenated_string = separator.join( + concatenated_string = "\n\n".join( [ string for string in [string_1, string_2, string_3, string_4] diff --git a/nodes/tasks.py b/nodes/tasks.py index adc8d04..bd72c8b 100644 --- a/nodes/tasks.py +++ b/nodes/tasks.py @@ -1,6 +1,7 @@ import base64 import os +import folder_paths from griptape.drivers import OpenAiImageGenerationDriver, OpenAiVisionImageQueryDriver from griptape.engines import ( ImageQueryEngine, @@ -19,8 +20,6 @@ from griptape.tasks import ( VariationImageGenerationTask, ) -import folder_paths - from ..py.griptape_config import get_config from .base_image_task import gtUIBaseImageTask from .base_task import gtUIBaseTask