added pascal case for tool names

This commit is contained in:
Jason Schleifer
2024-08-05 07:36:45 -07:00
parent 2952593e42
commit 0dcefa07a9
2 changed files with 15 additions and 2 deletions
+3 -2
View File
@@ -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,
+12
View File
@@ -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)