Modified a few nodes, and updated tools (#7)

* Update README.md
** Updated Install instructions
** Added new example
* Fix no input connected error for display Text node
* Created Merge Text node
* Combined tools into a single input for Create Agent. You can now use one or more tools.
This commit is contained in:
Jason Schleifer
2024-05-20 07:14:27 +12:00
committed by GitHub
parent cf66f4dc08
commit ce8cbcea94
6 changed files with 41 additions and 36 deletions
+1 -2
View File
@@ -1,5 +1,5 @@
* Create a gtUIRulesetsList node which is a list of rulesets
* Combine the tool & tools in Create Agent
* Get everything to output Artifacts
* Create an Artifact Viewer
* Show logs
@@ -9,5 +9,4 @@
* give it webscraping tools
* knowledgebase access
* Could it have access to current workspace?
* Change display: String to Display: Text
* Create a Griptape Menu that hovers on the page somewhere
+4 -4
View File
@@ -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 MergeStrings, ToolList
from .nodes.combine_nodes import MergeTexts, ToolList
from .nodes.config import (
gtUIAmazonBedrockStructureConfig,
gtUIAnthropicStructureConfig,
@@ -94,7 +94,7 @@ NODE_CLASS_MAPPINGS = {
"WebScraper": gtUIWebScraper,
"gtUIFileManager": gtUIFileManager,
"ToolList": ToolList,
"MergeStrings": MergeStrings,
"MergeTexts": MergeTexts,
"PromptTask": gtUIPromptTask,
"ToolTask": gtUIToolTask,
"ToolkitTask": gtUIToolkitTask,
@@ -118,7 +118,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"gtUIAmazonBedrockStableDiffusionImageGenerationDriver": "Griptape Driver: Amazon Bedrock Stable Diffusion",
"gtUIAmazonBedrockTitanImageGenerationDriver": "Griptape Driver: Amazon Bedrock Titan",
"gtUILeonardoImageGenerationDriver": "Griptape Driver: Leonardo.AI",
"gtUIOutputStringNode": "Griptape Display: String",
"gtUIOutputStringNode": "Griptape Display: Text",
"gtUIOutputImageNode": "Griptape Display: Image",
"ImageQueryTask": "Griptape Run: Image Description",
"PromptTask": "Griptape Run: Prompt Task",
@@ -135,7 +135,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"WebScraper": "Griptape Tool: WebScraper",
"gtUIFileManager": "Griptape Tool: FileManager",
"ToolList": "Griptape Combine: Tool List",
"MergeStrings": "Griptape Combine: Merge Strings",
"MergeTexts": "Griptape Combine: Merge Text",
}
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]
-5
View File
@@ -29,7 +29,6 @@ class CreateAgent(BaseAgent):
"forceInput": True,
},
),
"tool": ("TOOL", {"forceInput": True}),
"tools": ("TOOL_LIST", {"forceInput": True, "INPUT_IS_LIST": True}),
"rulesets": ("RULESET", {"forceInput": True}),
},
@@ -46,7 +45,6 @@ class CreateAgent(BaseAgent):
self,
STRING,
config=None,
tool=None,
input_string=None,
tools=[],
rulesets=[],
@@ -55,10 +53,7 @@ class CreateAgent(BaseAgent):
config = OpenAiStructureConfig()
task_memory_client = [TaskMemoryClient(off_prompt=False)]
# Collect the tools to be used
agent_tools = []
if tool:
agent_tools = [tool]
if len(tools) > 0:
agent_tools += tools
+2 -2
View File
@@ -13,11 +13,11 @@ class gtUIBaseTool:
def INPUT_TYPES(s):
return {"required": {"off_prompt": ("BOOLEAN", {"default": False})}}
RETURN_TYPES = ("TOOL",)
RETURN_TYPES = ("TOOL_LIST",)
RETURN_NAMES = ("TOOL",)
FUNCTION = "create"
CATEGORY = "Griptape/Tools"
def create(self, off_prompt):
return (BaseTool(off_prompt=off_prompt),)
return ([BaseTool(off_prompt=off_prompt)],)
+30 -19
View File
@@ -1,6 +1,6 @@
class MergeStrings:
class MergeTexts:
"""
Merge Strings
Merge Texts
"""
def __init__(self):
@@ -11,10 +11,12 @@ class MergeStrings:
return {
"required": {},
"optional": {
"string_1": ("STRING", {"forceInput": True}),
"string_2": ("STRING", {"forceInput": True}),
"string_3": ("STRING", {"forceInput": True}),
"string_4": ("STRING", {"forceInput": True}),
"input_1": ("STRING", {"forceInput": True}),
"input_2": ("STRING", {"forceInput": True}),
"input_3": ("STRING", {"forceInput": True}),
"input_4": ("STRING", {"forceInput": True}),
"input_5": ("STRING", {"forceInput": True}),
"input_6": ("STRING", {"forceInput": True}),
},
}
@@ -26,16 +28,18 @@ class MergeStrings:
def create(
self,
string_1="",
string_2="",
string_3="",
string_4="",
input_1="",
input_2="",
input_3="",
input_4="",
input_5="",
input_6="",
):
# Join strings by newline
concatenated_string = "\n\n".join(
[
string
for string in [string_1, string_2, string_3, string_4]
for string in [input_1, input_2, input_3, input_4, input_5, input_6]
if not string == ""
],
)
@@ -55,12 +59,12 @@ class ToolList:
def INPUT_TYPES(s):
return {
"optional": {
"tool_2": ("TOOL",),
"tool_3": ("TOOL",),
"tool_4": ("TOOL",),
"tool_5": ("TOOL",),
"tool_6": ("TOOL",),
"tool_1": ("TOOL",),
"tool_1": ("TOOL_LIST",),
"tool_2": ("TOOL_LIST",),
"tool_3": ("TOOL_LIST",),
"tool_4": ("TOOL_LIST",),
"tool_5": ("TOOL_LIST",),
"tool_6": ("TOOL_LIST",),
}
}
@@ -80,8 +84,15 @@ class ToolList:
tool_6=None,
):
tool_list = [
tool
for tool in [tool_1, tool_2, tool_3, tool_4, tool_5, tool_6]
tool[0]
for tool in [
tool_1,
tool_2,
tool_3,
tool_4,
tool_5,
tool_6,
]
if tool is not None
]
return (tool_list,)
+4 -4
View File
@@ -22,7 +22,7 @@ class gtUIFileManager(gtUIBaseTool):
def create(self, off_prompt, workdir=""):
tool = FileManager(off_prompt=off_prompt, workdir=workdir)
return (tool,)
return ([tool],)
class gtUICalculator(gtUIBaseTool):
@@ -32,7 +32,7 @@ class gtUICalculator(gtUIBaseTool):
def create(self, off_prompt):
tool = Calculator(off_prompt=off_prompt)
return (tool,)
return ([tool],)
class gtUIWebScraper(gtUIBaseTool):
@@ -47,7 +47,7 @@ class gtUIWebScraper(gtUIBaseTool):
web_scraper_driver=MarkdownifyWebScraperDriver(timeout=1000)
),
)
return (tool,)
return ([tool],)
class gtUIDateTime(gtUIBaseTool):
@@ -57,4 +57,4 @@ class gtUIDateTime(gtUIBaseTool):
def create(self, off_prompt):
tool = DateTime(off_prompt=off_prompt)
return (tool,)
return ([tool],)