Merge dev to main (#4)
* updated Readme instructions (#1) * Update README.md * Fix no input connected error * added string concatenate node * added example * Merge branch 'main' into dev * Concatenate Nodes is now Merge Nodes * Merge branch 'main' into dev * updated the description
This commit is contained in:
@@ -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`.
|
||||
|
||||

|
||||
|
||||
|
||||
+7
-7
@@ -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"]
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 880 KiB After Width: | Height: | Size: 3.0 MiB |
@@ -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]
|
||||
|
||||
+1
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user