diff --git a/nodes/tools/gtUIKnowledgeBaseTool.py b/nodes/tools/gtUIKnowledgeBaseTool.py index 0ba4a44..640b71d 100644 --- a/nodes/tools/gtUIKnowledgeBaseTool.py +++ b/nodes/tools/gtUIKnowledgeBaseTool.py @@ -5,6 +5,7 @@ from griptape.tools import ( GriptapeCloudKnowledgeBaseClient, ) +from ..utilities import to_pascal_case from .gtUIBaseTool import gtUIBaseTool @@ -62,8 +63,8 @@ class gtUIKnowledgeBaseTool(gtUIBaseTool): name = data.get("name", "Griptape Knowledge Base") description = data.get("description", "Contains helpful information") - print(name) - print(description) + name = to_pascal_case(name) + tool = GriptapeCloudKnowledgeBaseClient( name=name, description=description, diff --git a/nodes/utilities.py b/nodes/utilities.py index 9be3dd9..6d85a3f 100644 --- a/nodes/utilities.py +++ b/nodes/utilities.py @@ -1,4 +1,5 @@ import base64 +import re from io import BytesIO from urllib.parse import urlparse, urlunparse @@ -10,6 +11,17 @@ from jinja2 import Template from PIL import Image, ImageOps, ImageSequence +def to_pascal_case(string): + # First, replace any non-word character with a space + string = re.sub(r"[^\w\s]", " ", string) + + # Split the string into words + words = string.split() + + # Capitalize the first letter of each word after the first word + return "".join(word.capitalize() for word in words) + + def construct_base_url(base_url: str, port: int) -> str: # Parse the base_url parsed_url = urlparse(base_url)