diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b7b08f36d..ef91010aea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **BREAKING**: `RagContext.output` was changed to `RagContext.outputs` to support multiple outputs. All relevant RAG modules were adjusted accordingly. - **BREAKING**: Removed before and after response modules from `ResponseRagStage`. - **BREAKING**: Moved ruleset and metadata ingestion from standalone modules to `PromptResponseRagModule`. +- **BREAKING**: Dropped `Client` from all Tool names for better naming consistency. +- **BREAKING**: Dropped `_client` suffix from all Tool packages. +- **BREAKING**: Added `Tool` suffix to all Tool names for better naming consistency. - Engines that previously required Drivers now pull from `griptape.config.config.drivers` by default. - `BaseTask.add_parent/child` will now call `self.structure.add_task` if possible. diff --git a/README.md b/README.md index 42df8fbd64..1f6d6d8831 100644 --- a/README.md +++ b/README.md @@ -89,14 +89,14 @@ With Griptape, you can create Structures, such as Agents, Pipelines, and Workflo ```python from griptape.structures import Agent -from griptape.tools import WebScraper, FileManager, TaskMemoryClient +from griptape.tools import WebScraperTool, FileManagerTool, TaskMemoryTool agent = Agent( input="Load {{ args[0] }}, summarize it, and store it in a file called {{ args[1] }}.", tools=[ - WebScraper(off_prompt=True), - TaskMemoryClient(off_prompt=True), - FileManager() + WebScraperTool(off_prompt=True), + TaskMemoryTool(off_prompt=True), + FileManagerTool() ] ) agent.run("https://griptape.ai", "griptape.txt") diff --git a/docs/examples/src/load_query_and_chat_marqo_1.py b/docs/examples/src/load_query_and_chat_marqo_1.py index ac3ffca0d1..013a0264f7 100644 --- a/docs/examples/src/load_query_and_chat_marqo_1.py +++ b/docs/examples/src/load_query_and_chat_marqo_1.py @@ -5,7 +5,7 @@ from griptape.drivers import MarqoVectorStoreDriver, OpenAiEmbeddingDriver from griptape.loaders import WebLoader from griptape.structures import Agent -from griptape.tools import VectorStoreClient +from griptape.tools import VectorStoreTool # Define the namespace namespace = "griptape-ai" @@ -19,7 +19,7 @@ ) # Initialize the knowledge base tool -vector_store_tool = VectorStoreClient( +vector_store_tool = VectorStoreTool( description="Contains information about the Griptape Framework from www.griptape.ai", vector_store_driver=vector_store, ) diff --git a/docs/examples/src/multi_agent_workflow_1.py b/docs/examples/src/multi_agent_workflow_1.py index 311fa22a23..137a5075f1 100644 --- a/docs/examples/src/multi_agent_workflow_1.py +++ b/docs/examples/src/multi_agent_workflow_1.py @@ -5,9 +5,9 @@ from griptape.structures import Agent, Workflow from griptape.tasks import PromptTask, StructureRunTask from griptape.tools import ( - TaskMemoryClient, - WebScraper, - WebSearch, + TaskMemoryTool, + WebScraperTool, + WebSearchTool, ) WRITERS = [ @@ -29,16 +29,16 @@ def build_researcher() -> Agent: researcher = Agent( id="researcher", tools=[ - WebSearch( + WebSearchTool( web_search_driver=GoogleWebSearchDriver( api_key=os.environ["GOOGLE_API_KEY"], search_id=os.environ["GOOGLE_API_SEARCH_ID"], ), ), - WebScraper( + WebScraperTool( off_prompt=True, ), - TaskMemoryClient(off_prompt=False), + TaskMemoryTool(off_prompt=False), ], rulesets=[ Ruleset( diff --git a/docs/examples/src/multiple_agent_shared_memory_1.py b/docs/examples/src/multiple_agent_shared_memory_1.py index 118684d37d..e156e531ad 100644 --- a/docs/examples/src/multiple_agent_shared_memory_1.py +++ b/docs/examples/src/multiple_agent_shared_memory_1.py @@ -3,7 +3,7 @@ from griptape.config import AzureOpenAiDriverConfig, config from griptape.drivers import AzureMongoDbVectorStoreDriver, AzureOpenAiEmbeddingDriver from griptape.structures import Agent -from griptape.tools import TaskMemoryClient, WebScraper +from griptape.tools import TaskMemoryTool, WebScraperTool AZURE_OPENAI_ENDPOINT_1 = os.environ["AZURE_OPENAI_ENDPOINT_1"] AZURE_OPENAI_API_KEY_1 = os.environ["AZURE_OPENAI_API_KEY_1"] @@ -41,12 +41,12 @@ loader = Agent( tools=[ - WebScraper(off_prompt=True), + WebScraperTool(off_prompt=True), ], ) asker = Agent( tools=[ - TaskMemoryClient(off_prompt=False), + TaskMemoryTool(off_prompt=False), ], meta_memory=loader.meta_memory, task_memory=loader.task_memory, diff --git a/docs/examples/src/query_webpage_astra_db_1.py b/docs/examples/src/query_webpage_astra_db_1.py index b5d2b0a010..3d1c618429 100644 --- a/docs/examples/src/query_webpage_astra_db_1.py +++ b/docs/examples/src/query_webpage_astra_db_1.py @@ -14,7 +14,7 @@ from griptape.engines.rag.stages import ResponseRagStage, RetrievalRagStage from griptape.loaders import WebLoader from griptape.structures import Agent -from griptape.tools import RagClient, TaskMemoryClient +from griptape.tools import RagTool, TaskMemoryTool namespace = "datastax_blog" input_blogpost = "www.datastax.com/blog/indexing-all-of-wikipedia-on-a-laptop" @@ -49,9 +49,9 @@ raise Exception(artifacts.value) vector_store_driver.upsert_text_artifacts({namespace: artifacts}) -vector_store_tool = RagClient( +vector_store_tool = RagTool( description="A DataStax blog post", rag_engine=engine, ) -agent = Agent(tools=[vector_store_tool, TaskMemoryClient(off_prompt=False)]) +agent = Agent(tools=[vector_store_tool, TaskMemoryTool(off_prompt=False)]) agent.run("What engine made possible to index such an amount of data, " "and what kind of tuning was required?") diff --git a/docs/examples/src/talk_to_a_pdf_1.py b/docs/examples/src/talk_to_a_pdf_1.py index 2ac184a226..459ac05194 100644 --- a/docs/examples/src/talk_to_a_pdf_1.py +++ b/docs/examples/src/talk_to_a_pdf_1.py @@ -7,7 +7,7 @@ from griptape.engines.rag.stages import ResponseRagStage, RetrievalRagStage from griptape.loaders import PdfLoader from griptape.structures import Agent -from griptape.tools import RagClient +from griptape.tools import RagTool from griptape.utils import Chat namespace = "attention" @@ -25,7 +25,7 @@ response_modules=[PromptResponseRagModule(prompt_driver=OpenAiChatPromptDriver(model="gpt-4o"))] ), ) -vector_store_tool = RagClient( +vector_store_tool = RagTool( description="Contains information about the Attention Is All You Need paper. " "Use it to answer any related questions.", rag_engine=engine, diff --git a/docs/examples/src/talk_to_a_webpage_1.py b/docs/examples/src/talk_to_a_webpage_1.py index d24eb9427a..4b57833370 100644 --- a/docs/examples/src/talk_to_a_webpage_1.py +++ b/docs/examples/src/talk_to_a_webpage_1.py @@ -6,7 +6,7 @@ from griptape.loaders import WebLoader from griptape.rules import Rule, Ruleset from griptape.structures import Agent -from griptape.tools import RagClient +from griptape.tools import RagTool from griptape.utils import Chat namespace = "physics-wiki" @@ -33,7 +33,7 @@ vector_store_driver.upsert_text_artifacts({namespace: artifacts}) -vector_store_tool = RagClient( +vector_store_tool = RagTool( description="Contains information about physics. " "Use it to answer any physics-related questions.", rag_engine=engine, ) diff --git a/docs/examples/src/talk_to_redshift_1.py b/docs/examples/src/talk_to_redshift_1.py index 7354a77ccc..bd4b57f4f0 100644 --- a/docs/examples/src/talk_to_redshift_1.py +++ b/docs/examples/src/talk_to_redshift_1.py @@ -6,7 +6,7 @@ from griptape.loaders import SqlLoader from griptape.rules import Rule, Ruleset from griptape.structures import Agent -from griptape.tools import FileManager, SqlClient +from griptape.tools import FileManagerTool, SqlTool from griptape.utils import Chat session = boto3.Session() @@ -19,7 +19,7 @@ ) ) -sql_tool = SqlClient( +sql_tool = SqlTool( sql_loader=sql_loader, table_name="people", table_description="contains information about tech industry professionals", @@ -27,7 +27,7 @@ ) agent = Agent( - tools=[sql_tool, FileManager()], + tools=[sql_tool, FileManagerTool()], rulesets=[ Ruleset( name="HumansOrg Agent", diff --git a/docs/examples/talk-to-a-pdf.md b/docs/examples/talk-to-a-pdf.md index 2e0743ae44..519a64a9dc 100644 --- a/docs/examples/talk-to-a-pdf.md +++ b/docs/examples/talk-to-a-pdf.md @@ -1,4 +1,4 @@ -This example demonstrates how to vectorize a PDF of the [Attention Is All You Need](https://arxiv.org/pdf/1706.03762.pdf) paper and setup a Griptape agent with rules and the [VectorStoreClient](../reference/griptape/tools/vector_store_client/tool.md) tool to use it during conversations. +This example demonstrates how to vectorize a PDF of the [Attention Is All You Need](https://arxiv.org/pdf/1706.03762.pdf) paper and setup a Griptape agent with rules and the [VectorStoreTool](../reference/griptape/tools/vector_store_client/tool.md) tool to use it during conversations. ```python --8<-- "docs/examples/src/talk_to_a_pdf_1.py" diff --git a/docs/griptape-framework/drivers/src/audio_transcription_drivers_1.py b/docs/griptape-framework/drivers/src/audio_transcription_drivers_1.py index e4415e1d4e..16013638e6 100644 --- a/docs/griptape-framework/drivers/src/audio_transcription_drivers_1.py +++ b/docs/griptape-framework/drivers/src/audio_transcription_drivers_1.py @@ -1,11 +1,11 @@ from griptape.drivers import OpenAiAudioTranscriptionDriver from griptape.engines import AudioTranscriptionEngine from griptape.structures import Agent -from griptape.tools.audio_transcription_client.tool import AudioTranscriptionClient +from griptape.tools.audio_transcription.tool import AudioTranscriptionTool driver = OpenAiAudioTranscriptionDriver(model="whisper-1") -tool = AudioTranscriptionClient( +tool = AudioTranscriptionTool( off_prompt=False, engine=AudioTranscriptionEngine( audio_transcription_driver=driver, diff --git a/docs/griptape-framework/drivers/src/embedding_drivers_10.py b/docs/griptape-framework/drivers/src/embedding_drivers_10.py index 3ef816b29f..4f7560c991 100644 --- a/docs/griptape-framework/drivers/src/embedding_drivers_10.py +++ b/docs/griptape-framework/drivers/src/embedding_drivers_10.py @@ -4,7 +4,7 @@ VoyageAiEmbeddingDriver, ) from griptape.structures import Agent -from griptape.tools import TaskMemoryClient, WebScraper +from griptape.tools import TaskMemoryTool, WebScraperTool config.drivers = DriverConfig( prompt=OpenAiChatPromptDriver(model="gpt-4o"), @@ -12,7 +12,7 @@ ) agent = Agent( - tools=[WebScraper(off_prompt=True), TaskMemoryClient(off_prompt=False)], + tools=[WebScraperTool(off_prompt=True), TaskMemoryTool(off_prompt=False)], ) agent.run("based on https://www.griptape.ai/, tell me what Griptape is") diff --git a/docs/griptape-framework/drivers/src/image_generation_drivers_1.py b/docs/griptape-framework/drivers/src/image_generation_drivers_1.py index 637b6ec7a3..b20a42265f 100644 --- a/docs/griptape-framework/drivers/src/image_generation_drivers_1.py +++ b/docs/griptape-framework/drivers/src/image_generation_drivers_1.py @@ -1,7 +1,7 @@ from griptape.drivers import OpenAiImageGenerationDriver from griptape.engines import PromptImageGenerationEngine from griptape.structures import Agent -from griptape.tools import PromptImageGenerationClient +from griptape.tools import PromptImageGenerationTool driver = OpenAiImageGenerationDriver( model="dall-e-2", @@ -11,7 +11,7 @@ agent = Agent( tools=[ - PromptImageGenerationClient(engine=engine), + PromptImageGenerationTool(engine=engine), ] ) diff --git a/docs/griptape-framework/drivers/src/image_generation_drivers_2.py b/docs/griptape-framework/drivers/src/image_generation_drivers_2.py index 63663ae79d..ab07fcb279 100644 --- a/docs/griptape-framework/drivers/src/image_generation_drivers_2.py +++ b/docs/griptape-framework/drivers/src/image_generation_drivers_2.py @@ -1,7 +1,7 @@ from griptape.drivers import AmazonBedrockImageGenerationDriver, BedrockStableDiffusionImageGenerationModelDriver from griptape.engines import PromptImageGenerationEngine from griptape.structures import Agent -from griptape.tools import PromptImageGenerationClient +from griptape.tools import PromptImageGenerationTool model_driver = BedrockStableDiffusionImageGenerationModelDriver( style_preset="pixel-art", @@ -16,7 +16,7 @@ agent = Agent( tools=[ - PromptImageGenerationClient(engine=engine), + PromptImageGenerationTool(engine=engine), ] ) diff --git a/docs/griptape-framework/drivers/src/image_generation_drivers_3.py b/docs/griptape-framework/drivers/src/image_generation_drivers_3.py index 630d80f20d..b8c63589de 100644 --- a/docs/griptape-framework/drivers/src/image_generation_drivers_3.py +++ b/docs/griptape-framework/drivers/src/image_generation_drivers_3.py @@ -1,7 +1,7 @@ from griptape.drivers import AmazonBedrockImageGenerationDriver, BedrockTitanImageGenerationModelDriver from griptape.engines import PromptImageGenerationEngine from griptape.structures import Agent -from griptape.tools import PromptImageGenerationClient +from griptape.tools import PromptImageGenerationTool model_driver = BedrockTitanImageGenerationModelDriver() @@ -14,7 +14,7 @@ agent = Agent( tools=[ - PromptImageGenerationClient(engine=engine), + PromptImageGenerationTool(engine=engine), ] ) diff --git a/docs/griptape-framework/drivers/src/image_generation_drivers_4.py b/docs/griptape-framework/drivers/src/image_generation_drivers_4.py index 428f470cf8..f1bc062004 100644 --- a/docs/griptape-framework/drivers/src/image_generation_drivers_4.py +++ b/docs/griptape-framework/drivers/src/image_generation_drivers_4.py @@ -3,7 +3,7 @@ from griptape.drivers import AzureOpenAiImageGenerationDriver from griptape.engines import PromptImageGenerationEngine from griptape.structures import Agent -from griptape.tools import PromptImageGenerationClient +from griptape.tools import PromptImageGenerationTool driver = AzureOpenAiImageGenerationDriver( model="dall-e-3", @@ -16,7 +16,7 @@ agent = Agent( tools=[ - PromptImageGenerationClient(engine=engine), + PromptImageGenerationTool(engine=engine), ] ) diff --git a/docs/griptape-framework/drivers/src/image_generation_drivers_5.py b/docs/griptape-framework/drivers/src/image_generation_drivers_5.py index 06157107f3..46173a2324 100644 --- a/docs/griptape-framework/drivers/src/image_generation_drivers_5.py +++ b/docs/griptape-framework/drivers/src/image_generation_drivers_5.py @@ -3,7 +3,7 @@ from griptape.drivers import LeonardoImageGenerationDriver from griptape.engines import PromptImageGenerationEngine from griptape.structures import Agent -from griptape.tools import PromptImageGenerationClient +from griptape.tools import PromptImageGenerationTool driver = LeonardoImageGenerationDriver( model=os.environ["LEONARDO_MODEL_ID"], @@ -16,7 +16,7 @@ agent = Agent( tools=[ - PromptImageGenerationClient(engine=engine), + PromptImageGenerationTool(engine=engine), ] ) diff --git a/docs/griptape-framework/drivers/src/image_generation_drivers_6.py b/docs/griptape-framework/drivers/src/image_generation_drivers_6.py index feb8a54d7d..d295da4ffb 100644 --- a/docs/griptape-framework/drivers/src/image_generation_drivers_6.py +++ b/docs/griptape-framework/drivers/src/image_generation_drivers_6.py @@ -1,7 +1,7 @@ from griptape.drivers import OpenAiImageGenerationDriver from griptape.engines import PromptImageGenerationEngine from griptape.structures import Agent -from griptape.tools import PromptImageGenerationClient +from griptape.tools import PromptImageGenerationTool driver = OpenAiImageGenerationDriver( model="dall-e-2", @@ -12,7 +12,7 @@ agent = Agent( tools=[ - PromptImageGenerationClient(engine=engine), + PromptImageGenerationTool(engine=engine), ] ) diff --git a/docs/griptape-framework/drivers/src/prompt_drivers_10.py b/docs/griptape-framework/drivers/src/prompt_drivers_10.py index 04e2acb353..1d757668cc 100644 --- a/docs/griptape-framework/drivers/src/prompt_drivers_10.py +++ b/docs/griptape-framework/drivers/src/prompt_drivers_10.py @@ -1,11 +1,11 @@ from griptape.drivers import OllamaPromptDriver from griptape.structures import Agent -from griptape.tools import Calculator +from griptape.tools import CalculatorTool agent = Agent( prompt_driver=OllamaPromptDriver( model="llama3.1", ), - tools=[Calculator()], + tools=[CalculatorTool()], ) agent.run("What is (192 + 12) ^ 4") diff --git a/docs/griptape-framework/drivers/src/text_to_speech_drivers_1.py b/docs/griptape-framework/drivers/src/text_to_speech_drivers_1.py index c6a03b80d7..376113d633 100644 --- a/docs/griptape-framework/drivers/src/text_to_speech_drivers_1.py +++ b/docs/griptape-framework/drivers/src/text_to_speech_drivers_1.py @@ -3,7 +3,7 @@ from griptape.drivers import ElevenLabsTextToSpeechDriver from griptape.engines import TextToSpeechEngine from griptape.structures import Agent -from griptape.tools.text_to_speech_client.tool import TextToSpeechClient +from griptape.tools.text_to_speech.tool import TextToSpeechTool driver = ElevenLabsTextToSpeechDriver( api_key=os.environ["ELEVEN_LABS_API_KEY"], @@ -11,7 +11,7 @@ voice="Matilda", ) -tool = TextToSpeechClient( +tool = TextToSpeechTool( engine=TextToSpeechEngine( text_to_speech_driver=driver, ), diff --git a/docs/griptape-framework/drivers/src/text_to_speech_drivers_2.py b/docs/griptape-framework/drivers/src/text_to_speech_drivers_2.py index 99927a3907..4a6323b1be 100644 --- a/docs/griptape-framework/drivers/src/text_to_speech_drivers_2.py +++ b/docs/griptape-framework/drivers/src/text_to_speech_drivers_2.py @@ -1,11 +1,11 @@ from griptape.drivers import OpenAiTextToSpeechDriver from griptape.engines import TextToSpeechEngine from griptape.structures import Agent -from griptape.tools.text_to_speech_client.tool import TextToSpeechClient +from griptape.tools.text_to_speech.tool import TextToSpeechTool driver = OpenAiTextToSpeechDriver() -tool = TextToSpeechClient( +tool = TextToSpeechTool( engine=TextToSpeechEngine( text_to_speech_driver=driver, ), diff --git a/docs/griptape-framework/drivers/src/web_scraper_drivers_3.py b/docs/griptape-framework/drivers/src/web_scraper_drivers_3.py index d9fe11e85b..d4c77c2aed 100644 --- a/docs/griptape-framework/drivers/src/web_scraper_drivers_3.py +++ b/docs/griptape-framework/drivers/src/web_scraper_drivers_3.py @@ -1,15 +1,15 @@ from griptape.drivers import MarkdownifyWebScraperDriver from griptape.loaders import WebLoader from griptape.structures import Agent -from griptape.tools import TaskMemoryClient, WebScraper +from griptape.tools import TaskMemoryTool, WebScraperTool agent = Agent( tools=[ - WebScraper( + WebScraperTool( web_loader=WebLoader(web_scraper_driver=MarkdownifyWebScraperDriver(timeout=1000)), off_prompt=True, ), - TaskMemoryClient(off_prompt=False), + TaskMemoryTool(off_prompt=False), ], ) agent.run("List all email addresses on griptape.ai in a flat numbered markdown list.") diff --git a/docs/griptape-framework/drivers/src/web_search_drivers_2.py b/docs/griptape-framework/drivers/src/web_search_drivers_2.py index 5cde1a9a81..a33b8c00cf 100644 --- a/docs/griptape-framework/drivers/src/web_search_drivers_2.py +++ b/docs/griptape-framework/drivers/src/web_search_drivers_2.py @@ -2,17 +2,17 @@ from griptape.drivers import GoogleWebSearchDriver from griptape.structures import Agent -from griptape.tools import TaskMemoryClient, WebSearch +from griptape.tools import TaskMemoryTool, WebSearchTool agent = Agent( tools=[ - WebSearch( + WebSearchTool( web_search_driver=GoogleWebSearchDriver( api_key=os.environ["GOOGLE_API_KEY"], search_id=os.environ["GOOGLE_API_SEARCH_ID"], ), ), - TaskMemoryClient(off_prompt=False), + TaskMemoryTool(off_prompt=False), ], ) agent.run("Give me some websites with information about AI frameworks.") diff --git a/docs/griptape-framework/misc/src/events_3.py b/docs/griptape-framework/misc/src/events_3.py index bae8b82243..2a567debe5 100644 --- a/docs/griptape-framework/misc/src/events_3.py +++ b/docs/griptape-framework/misc/src/events_3.py @@ -4,7 +4,7 @@ from griptape.events import CompletionChunkEvent, EventListener, event_bus from griptape.structures import Pipeline from griptape.tasks import ToolkitTask -from griptape.tools import TaskMemoryClient, WebScraper +from griptape.tools import TaskMemoryTool, WebScraperTool event_bus.add_event_listeners( [ @@ -20,7 +20,7 @@ ToolkitTask( "Based on https://griptape.ai, tell me what griptape is.", prompt_driver=OpenAiChatPromptDriver(model="gpt-4o", stream=True), - tools=[WebScraper(off_prompt=True), TaskMemoryClient(off_prompt=False)], + tools=[WebScraperTool(off_prompt=True), TaskMemoryTool(off_prompt=False)], ) ) diff --git a/docs/griptape-framework/misc/src/events_4.py b/docs/griptape-framework/misc/src/events_4.py index f5523cb113..a66e77b1d3 100644 --- a/docs/griptape-framework/misc/src/events_4.py +++ b/docs/griptape-framework/misc/src/events_4.py @@ -1,13 +1,13 @@ from griptape.structures import Pipeline from griptape.tasks import ToolkitTask -from griptape.tools import TaskMemoryClient, WebScraper +from griptape.tools import TaskMemoryTool, WebScraperTool from griptape.utils import Stream pipeline = Pipeline() pipeline.add_tasks( ToolkitTask( "Based on https://griptape.ai, tell me what griptape is.", - tools=[WebScraper(off_prompt=True), TaskMemoryClient(off_prompt=False)], + tools=[WebScraperTool(off_prompt=True), TaskMemoryTool(off_prompt=False)], ) ) diff --git a/docs/griptape-framework/src/index_3.py b/docs/griptape-framework/src/index_3.py index 043fc75f77..ac153b15fa 100644 --- a/docs/griptape-framework/src/index_3.py +++ b/docs/griptape-framework/src/index_3.py @@ -1,7 +1,7 @@ from griptape.structures import Agent -from griptape.tools import Calculator +from griptape.tools import CalculatorTool -calculator = Calculator() +calculator = CalculatorTool() agent = Agent(tools=[calculator]) diff --git a/docs/griptape-framework/src/index_4.py b/docs/griptape-framework/src/index_4.py index 0bb345438a..dd07280ce4 100644 --- a/docs/griptape-framework/src/index_4.py +++ b/docs/griptape-framework/src/index_4.py @@ -1,7 +1,7 @@ from griptape.memory.structure import ConversationMemory from griptape.structures import Pipeline from griptape.tasks import PromptTask, ToolkitTask -from griptape.tools import FileManager, TaskMemoryClient, WebScraper +from griptape.tools import FileManagerTool, TaskMemoryTool, WebScraperTool # Pipelines represent sequences of tasks. pipeline = Pipeline(conversation_memory=ConversationMemory()) @@ -11,7 +11,7 @@ ToolkitTask( "{{ args[0] }}", # Add tools for web scraping, and file management - tools=[WebScraper(off_prompt=True), FileManager(off_prompt=True), TaskMemoryClient(off_prompt=False)], + tools=[WebScraperTool(off_prompt=True), FileManagerTool(off_prompt=True), TaskMemoryTool(off_prompt=False)], ), # Augment `input` from the previous task. PromptTask("Say the following in spanish: {{ parent_output }}"), diff --git a/docs/griptape-framework/structures/src/agents_1.py b/docs/griptape-framework/structures/src/agents_1.py index 20d04004db..9ce4aec22c 100644 --- a/docs/griptape-framework/structures/src/agents_1.py +++ b/docs/griptape-framework/structures/src/agents_1.py @@ -1,7 +1,7 @@ from griptape.structures import Agent -from griptape.tools import Calculator +from griptape.tools import CalculatorTool -agent = Agent(input="Calculate the following: {{ args[0] }}", tools=[Calculator()]) +agent = Agent(input="Calculate the following: {{ args[0] }}", tools=[CalculatorTool()]) agent.run("what's 13^7?") print("Answer:", agent.output) diff --git a/docs/griptape-framework/structures/src/task_memory_1.py b/docs/griptape-framework/structures/src/task_memory_1.py index 90940a6118..e8cfbd8aca 100644 --- a/docs/griptape-framework/structures/src/task_memory_1.py +++ b/docs/griptape-framework/structures/src/task_memory_1.py @@ -1,7 +1,7 @@ from griptape.structures import Agent -from griptape.tools import Calculator +from griptape.tools import CalculatorTool -# Create an agent with the Calculator tool -agent = Agent(tools=[Calculator(off_prompt=False)]) +# Create an agent with the CalculatorTool tool +agent = Agent(tools=[CalculatorTool(off_prompt=False)]) agent.run("What is 10 raised to the power of 5?") diff --git a/docs/griptape-framework/structures/src/task_memory_2.py b/docs/griptape-framework/structures/src/task_memory_2.py index dcc5b4d5ce..9ff24e1ff0 100644 --- a/docs/griptape-framework/structures/src/task_memory_2.py +++ b/docs/griptape-framework/structures/src/task_memory_2.py @@ -1,7 +1,7 @@ from griptape.structures import Agent -from griptape.tools import Calculator +from griptape.tools import CalculatorTool -# Create an agent with the Calculator tool -agent = Agent(tools=[Calculator(off_prompt=True)]) +# Create an agent with the CalculatorTool tool +agent = Agent(tools=[CalculatorTool(off_prompt=True)]) agent.run("What is 10 raised to the power of 5?") diff --git a/docs/griptape-framework/structures/src/task_memory_3.py b/docs/griptape-framework/structures/src/task_memory_3.py index cab4f4e3ee..926a21cd35 100644 --- a/docs/griptape-framework/structures/src/task_memory_3.py +++ b/docs/griptape-framework/structures/src/task_memory_3.py @@ -1,7 +1,7 @@ from griptape.structures import Agent -from griptape.tools import Calculator, TaskMemoryClient +from griptape.tools import CalculatorTool, TaskMemoryTool -# Create an agent with the Calculator tool -agent = Agent(tools=[Calculator(off_prompt=True), TaskMemoryClient(off_prompt=False)]) +# Create an agent with the CalculatorTool tool +agent = Agent(tools=[CalculatorTool(off_prompt=True), TaskMemoryTool(off_prompt=False)]) agent.run("What is the square root of 12345?") diff --git a/docs/griptape-framework/structures/src/task_memory_4.py b/docs/griptape-framework/structures/src/task_memory_4.py index d192bebb7e..cfd6d57113 100644 --- a/docs/griptape-framework/structures/src/task_memory_4.py +++ b/docs/griptape-framework/structures/src/task_memory_4.py @@ -1,8 +1,8 @@ from griptape.structures import Agent -from griptape.tools import WebScraper +from griptape.tools import WebScraperTool -# Create an agent with the WebScraper tool -agent = Agent(tools=[WebScraper()]) +# Create an agent with the WebScraperTool tool +agent = Agent(tools=[WebScraperTool()]) agent.run( "According to this page https://en.wikipedia.org/wiki/Elden_Ring, how many copies of Elden Ring have been sold?" diff --git a/docs/griptape-framework/structures/src/task_memory_5.py b/docs/griptape-framework/structures/src/task_memory_5.py index a5d3995a9e..a53d106b4b 100644 --- a/docs/griptape-framework/structures/src/task_memory_5.py +++ b/docs/griptape-framework/structures/src/task_memory_5.py @@ -1,10 +1,10 @@ from griptape.structures import Agent -from griptape.tools import TaskMemoryClient, WebScraper +from griptape.tools import TaskMemoryTool, WebScraperTool agent = Agent( tools=[ - WebScraper(off_prompt=True), - TaskMemoryClient(off_prompt=False), + WebScraperTool(off_prompt=True), + TaskMemoryTool(off_prompt=False), ] ) diff --git a/docs/griptape-framework/structures/src/task_memory_6.py b/docs/griptape-framework/structures/src/task_memory_6.py index fb5c3eabb1..3f4d14b0a1 100644 --- a/docs/griptape-framework/structures/src/task_memory_6.py +++ b/docs/griptape-framework/structures/src/task_memory_6.py @@ -14,7 +14,7 @@ from griptape.memory import TaskMemory from griptape.memory.task.storage import TextArtifactStorage from griptape.structures import Agent -from griptape.tools import FileManager, TaskMemoryClient, WebScraper +from griptape.tools import FileManagerTool, TaskMemoryTool, WebScraperTool config.drivers = OpenAiDriverConfig( prompt=OpenAiChatPromptDriver(model="gpt-4"), @@ -45,9 +45,9 @@ } ), tools=[ - WebScraper(off_prompt=True), - TaskMemoryClient(off_prompt=True, allowlist=["query"]), - FileManager(off_prompt=True), + WebScraperTool(off_prompt=True), + TaskMemoryTool(off_prompt=True, allowlist=["query"]), + FileManagerTool(off_prompt=True), ], ) diff --git a/docs/griptape-framework/structures/src/task_memory_7.py b/docs/griptape-framework/structures/src/task_memory_7.py index 1ffec43e89..d2f07466f0 100644 --- a/docs/griptape-framework/structures/src/task_memory_7.py +++ b/docs/griptape-framework/structures/src/task_memory_7.py @@ -1,9 +1,9 @@ from griptape.structures import Agent -from griptape.tools import WebScraper +from griptape.tools import WebScraperTool agent = Agent( tools=[ - WebScraper(off_prompt=True) # `off_prompt=True` will store the data in Task Memory + WebScraperTool(off_prompt=True) # `off_prompt=True` will store the data in Task Memory # Missing a Tool that can read from Task Memory ] ) diff --git a/docs/griptape-framework/structures/src/task_memory_8.py b/docs/griptape-framework/structures/src/task_memory_8.py index 9aba9516f9..8461192282 100644 --- a/docs/griptape-framework/structures/src/task_memory_8.py +++ b/docs/griptape-framework/structures/src/task_memory_8.py @@ -1,12 +1,10 @@ from griptape.structures import Agent -from griptape.tools import TaskMemoryClient, WebScraper +from griptape.tools import TaskMemoryTool, WebScraperTool agent = Agent( tools=[ - WebScraper(off_prompt=True), # This tool will store the data in Task Memory - TaskMemoryClient( - off_prompt=True - ), # This tool will store the data back in Task Memory with no way to get it out + WebScraperTool(off_prompt=True), # This tool will store the data in Task Memory + TaskMemoryTool(off_prompt=True), # This tool will store the data back in Task Memory with no way to get it out ] ) agent.run( diff --git a/docs/griptape-framework/structures/src/task_memory_9.py b/docs/griptape-framework/structures/src/task_memory_9.py index c6d93ba5e7..66bb562f03 100644 --- a/docs/griptape-framework/structures/src/task_memory_9.py +++ b/docs/griptape-framework/structures/src/task_memory_9.py @@ -1,9 +1,9 @@ from griptape.structures import Agent -from griptape.tools import Calculator +from griptape.tools import CalculatorTool agent = Agent( tools=[ - Calculator() # Default value of `off_prompt=False` will return the data directly to the LLM + CalculatorTool() # Default value of `off_prompt=False` will return the data directly to the LLM ] ) agent.run("What is 10 ^ 3, 55 / 23, and 12345 * 0.5?") diff --git a/docs/griptape-framework/structures/src/tasks_16.py b/docs/griptape-framework/structures/src/tasks_16.py index 796b836da8..5f2e6b718a 100644 --- a/docs/griptape-framework/structures/src/tasks_16.py +++ b/docs/griptape-framework/structures/src/tasks_16.py @@ -5,25 +5,25 @@ from griptape.structures import Agent, Pipeline from griptape.tasks import StructureRunTask from griptape.tools import ( - TaskMemoryClient, - WebScraper, - WebSearch, + TaskMemoryTool, + WebScraperTool, + WebSearchTool, ) def build_researcher() -> Agent: researcher = Agent( tools=[ - WebSearch( + WebSearchTool( web_search_driver=GoogleWebSearchDriver( api_key=os.environ["GOOGLE_API_KEY"], search_id=os.environ["GOOGLE_API_SEARCH_ID"], ), ), - WebScraper( + WebScraperTool( off_prompt=True, ), - TaskMemoryClient(off_prompt=False), + TaskMemoryTool(off_prompt=False), ], rulesets=[ Ruleset( diff --git a/docs/griptape-framework/structures/src/tasks_4.py b/docs/griptape-framework/structures/src/tasks_4.py index 43737980b5..936b59f99b 100644 --- a/docs/griptape-framework/structures/src/tasks_4.py +++ b/docs/griptape-framework/structures/src/tasks_4.py @@ -1,12 +1,12 @@ from griptape.structures import Agent from griptape.tasks import ToolkitTask -from griptape.tools import FileManager, TaskMemoryClient, WebScraper +from griptape.tools import FileManagerTool, TaskMemoryTool, WebScraperTool agent = Agent() agent.add_task( ToolkitTask( "Load https://www.griptape.ai, summarize it, and store it in a file called griptape.txt", - tools=[WebScraper(off_prompt=True), FileManager(off_prompt=True), TaskMemoryClient(off_prompt=True)], + tools=[WebScraperTool(off_prompt=True), FileManagerTool(off_prompt=True), TaskMemoryTool(off_prompt=True)], ), ) diff --git a/docs/griptape-framework/structures/src/tasks_5.py b/docs/griptape-framework/structures/src/tasks_5.py index 5435433032..a0d537aa79 100644 --- a/docs/griptape-framework/structures/src/tasks_5.py +++ b/docs/griptape-framework/structures/src/tasks_5.py @@ -1,10 +1,10 @@ from griptape.structures import Agent from griptape.tasks import ToolTask -from griptape.tools import Calculator +from griptape.tools import CalculatorTool # Initialize the agent and add a task agent = Agent() -agent.add_task(ToolTask(tool=Calculator())) +agent.add_task(ToolTask(tool=CalculatorTool())) # Run the agent with a prompt agent.run("Give me the answer for 5*4.") diff --git a/docs/griptape-framework/structures/task-memory.md b/docs/griptape-framework/structures/task-memory.md index 6b858ff5be..99adf09b7f 100644 --- a/docs/griptape-framework/structures/task-memory.md +++ b/docs/griptape-framework/structures/task-memory.md @@ -231,7 +231,7 @@ Today, these include: - [TaskMemoryClient](../../griptape-tools/official-tools/task-memory-client.md) - [FileManager](../../griptape-tools/official-tools/file-manager.md) -- [AwsS3Client](../../griptape-tools/official-tools/aws-s3-client.md) +- [AwsS3Tool](../../griptape-tools/official-tools/aws-s3-client.md) - [GoogleDriveClient](../../griptape-tools/official-tools/google-drive-client.md) - [GoogleDocsClient](../../griptape-tools/official-tools/google-docs-client.md) diff --git a/docs/griptape-framework/tools/src/index_1.py b/docs/griptape-framework/tools/src/index_1.py index 52d8ac8e75..488dcfbc8b 100644 --- a/docs/griptape-framework/tools/src/index_1.py +++ b/docs/griptape-framework/tools/src/index_1.py @@ -1,13 +1,13 @@ from griptape.structures import Pipeline from griptape.tasks import ToolkitTask -from griptape.tools import FileManager, TaskMemoryClient, WebScraper +from griptape.tools import FileManagerTool, TaskMemoryTool, WebScraperTool pipeline = Pipeline() pipeline.add_tasks( ToolkitTask( "Load https://www.griptape.ai, summarize it, and store it in a file called griptape.txt", - tools=[WebScraper(off_prompt=True), FileManager(off_prompt=True), TaskMemoryClient(off_prompt=False)], + tools=[WebScraperTool(off_prompt=True), FileManagerTool(off_prompt=True), TaskMemoryTool(off_prompt=False)], ), ) diff --git a/docs/griptape-tools/official-tools/audio-transcription-client.md b/docs/griptape-tools/official-tools/audio-transcription-client.md index 271144d5b3..e70f2f7f78 100644 --- a/docs/griptape-tools/official-tools/audio-transcription-client.md +++ b/docs/griptape-tools/official-tools/audio-transcription-client.md @@ -1,4 +1,4 @@ -# AudioTranscriptionClient +# AudioTranscriptionTool This Tool enables [Agents](../../griptape-framework/structures/agents.md) to transcribe speech from text using [Audio Transcription Engines](../../reference/griptape/engines/audio/audio_transcription_engine.md) and [Audio Transcription Drivers](../../reference/griptape/drivers/audio_transcription/index.md). diff --git a/docs/griptape-tools/official-tools/aws-iam-client.md b/docs/griptape-tools/official-tools/aws-iam-client.md index 22b4115a30..32f460f950 100644 --- a/docs/griptape-tools/official-tools/aws-iam-client.md +++ b/docs/griptape-tools/official-tools/aws-iam-client.md @@ -1,4 +1,4 @@ -# AwsIamClient +# AwsIamTool This tool enables LLMs to make AWS IAM API requests. @@ -10,13 +10,13 @@ This tool enables LLMs to make AWS IAM API requests. Input: List all my IAM users [09/11/23 16:45:51] INFO Subtask f2f0809ee10d4538972ed01fdd6a2fb8 Thought: To list all IAM users, I can use the - AwsIamClient tool with the list_users activity. + AwsIamTool tool with the list_users activity. This activity does not require any input. - Action: {"name": "AwsIamClient", + Action: {"name": "AwsIamTool", "path": "list_users"} [09/11/23 16:45:52] INFO Subtask f2f0809ee10d4538972ed01fdd6a2fb8 - Response: Output of "AwsIamClient.list_users" + Response: Output of "AwsIamTool.list_users" was stored in memory with memory_name "TaskMemory" and artifact_namespace "51d22a018a434904a5da3bb8d4f763f7" diff --git a/docs/griptape-tools/official-tools/aws-s3-client.md b/docs/griptape-tools/official-tools/aws-s3-client.md index 70ca79a20f..3813644c89 100644 --- a/docs/griptape-tools/official-tools/aws-s3-client.md +++ b/docs/griptape-tools/official-tools/aws-s3-client.md @@ -1,4 +1,4 @@ -# AwsS3Client +# AwsS3Tool This tool enables LLMs to make AWS S3 API requests. @@ -10,14 +10,14 @@ This tool enables LLMs to make AWS S3 API requests. Input: List all my S3 buckets. [09/11/23 16:49:41] INFO Subtask 9fc44f5c8e73447ba737283cb2ef7f5d Thought: To list all S3 buckets, I can use the - "list_s3_buckets" activity of the "AwsS3Client" + "list_s3_buckets" activity of the "AwsS3Tool" tool. This activity doesn't require any input. - Action: {"name": "AwsS3Client", + Action: {"name": "AwsS3Tool", "path": "list_s3_buckets"} [09/11/23 16:49:42] INFO Subtask 9fc44f5c8e73447ba737283cb2ef7f5d Response: Output of - "AwsS3Client.list_s3_buckets" was stored in memory + "AwsS3Tool.list_s3_buckets" was stored in memory with memory_name "TaskMemory" and artifact_namespace "f2592085fd4a430286a46770ea508cc9" diff --git a/docs/griptape-tools/official-tools/src/audio_transcription_client_1.py b/docs/griptape-tools/official-tools/src/audio_transcription_client_1.py index d2c54e0c99..bc25fd1fad 100644 --- a/docs/griptape-tools/official-tools/src/audio_transcription_client_1.py +++ b/docs/griptape-tools/official-tools/src/audio_transcription_client_1.py @@ -1,11 +1,11 @@ from griptape.drivers import OpenAiAudioTranscriptionDriver from griptape.engines import AudioTranscriptionEngine from griptape.structures import Agent -from griptape.tools.audio_transcription_client.tool import AudioTranscriptionClient +from griptape.tools.audio_transcription.tool import AudioTranscriptionTool driver = OpenAiAudioTranscriptionDriver(model="whisper-1") -tool = AudioTranscriptionClient( +tool = AudioTranscriptionTool( off_prompt=False, engine=AudioTranscriptionEngine( audio_transcription_driver=driver, diff --git a/docs/griptape-tools/official-tools/src/aws_iam_client_1.py b/docs/griptape-tools/official-tools/src/aws_iam_client_1.py index 8fda315536..89718010fc 100644 --- a/docs/griptape-tools/official-tools/src/aws_iam_client_1.py +++ b/docs/griptape-tools/official-tools/src/aws_iam_client_1.py @@ -1,10 +1,10 @@ import boto3 from griptape.structures import Agent -from griptape.tools import AwsIamClient +from griptape.tools import AwsIamTool # Initialize the AWS IAM client -aws_iam_client = AwsIamClient(session=boto3.Session()) +aws_iam_client = AwsIamTool(session=boto3.Session()) # Create an agent with the AWS IAM client tool agent = Agent(tools=[aws_iam_client]) diff --git a/docs/griptape-tools/official-tools/src/aws_s3_client_1.py b/docs/griptape-tools/official-tools/src/aws_s3_client_1.py index e1ba42525c..973a0b8819 100644 --- a/docs/griptape-tools/official-tools/src/aws_s3_client_1.py +++ b/docs/griptape-tools/official-tools/src/aws_s3_client_1.py @@ -1,13 +1,13 @@ import boto3 from griptape.structures import Agent -from griptape.tools import AwsS3Client, TaskMemoryClient +from griptape.tools import AwsS3Tool, TaskMemoryTool # Initialize the AWS S3 client -aws_s3_client = AwsS3Client(session=boto3.Session(), off_prompt=True) +aws_s3_client = AwsS3Tool(session=boto3.Session(), off_prompt=True) # Create an agent with the AWS S3 client tool -agent = Agent(tools=[aws_s3_client, TaskMemoryClient(off_prompt=False)]) +agent = Agent(tools=[aws_s3_client, TaskMemoryTool(off_prompt=False)]) # Task to list all the AWS S3 buckets agent.run("List all my S3 buckets.") diff --git a/docs/griptape-tools/official-tools/src/calculator_1.py b/docs/griptape-tools/official-tools/src/calculator_1.py index b28bb92b2e..1263cad457 100644 --- a/docs/griptape-tools/official-tools/src/calculator_1.py +++ b/docs/griptape-tools/official-tools/src/calculator_1.py @@ -1,8 +1,8 @@ from griptape.structures import Agent -from griptape.tools import Calculator +from griptape.tools import CalculatorTool -# Create an agent with the Calculator tool -agent = Agent(tools=[Calculator()]) +# Create an agent with the CalculatorTool tool +agent = Agent(tools=[CalculatorTool()]) # Run the agent with a task to perform the arithmetic calculation of \(10^5\) agent.run("What is 10 raised to the power of 5?") diff --git a/docs/griptape-tools/official-tools/src/computer_1.py b/docs/griptape-tools/official-tools/src/computer_1.py index 7fa22a46b5..b0892d4257 100644 --- a/docs/griptape-tools/official-tools/src/computer_1.py +++ b/docs/griptape-tools/official-tools/src/computer_1.py @@ -1,10 +1,10 @@ from griptape.structures import Agent -from griptape.tools import Computer +from griptape.tools import ComputerTool -# Initialize the Computer tool -computer = Computer() +# Initialize the ComputerTool tool +computer = ComputerTool() -# Create an agent with the Computer tool +# Create an agent with the ComputerTool tool agent = Agent(tools=[computer]) # Create a file using the shell command diff --git a/docs/griptape-tools/official-tools/src/date_time_1.py b/docs/griptape-tools/official-tools/src/date_time_1.py index 735b773077..f806e50911 100644 --- a/docs/griptape-tools/official-tools/src/date_time_1.py +++ b/docs/griptape-tools/official-tools/src/date_time_1.py @@ -1,8 +1,8 @@ from griptape.structures import Agent -from griptape.tools import DateTime +from griptape.tools import DateTimeTool -# Create an agent with the DateTime tool -agent = Agent(tools=[DateTime()]) +# Create an agent with the DateTimeTool tool +agent = Agent(tools=[DateTimeTool()]) # Fetch the current date and time agent.run("What is the current date and time?") diff --git a/docs/griptape-tools/official-tools/src/email_client_1.py b/docs/griptape-tools/official-tools/src/email_client_1.py index e93a74f34f..ae69b11ecf 100644 --- a/docs/griptape-tools/official-tools/src/email_client_1.py +++ b/docs/griptape-tools/official-tools/src/email_client_1.py @@ -1,8 +1,8 @@ import os -from griptape.tools import EmailClient +from griptape.tools import EmailTool -email_client = EmailClient( +email_client = EmailTool( smtp_host=os.environ.get("SMTP_HOST"), smtp_port=int(os.environ.get("SMTP_PORT", 465)), smtp_password=os.environ.get("SMTP_PASSWORD"), diff --git a/docs/griptape-tools/official-tools/src/file_manager_1.py b/docs/griptape-tools/official-tools/src/file_manager_1.py index 16adf669c3..0b5596d2bf 100644 --- a/docs/griptape-tools/official-tools/src/file_manager_1.py +++ b/docs/griptape-tools/official-tools/src/file_manager_1.py @@ -1,10 +1,10 @@ from pathlib import Path from griptape.structures import Agent -from griptape.tools import FileManager +from griptape.tools import FileManagerTool -# Initialize the FileManager tool with the current directory as its base -file_manager_tool = FileManager() +# Initialize the FileManagerTool tool with the current directory as its base +file_manager_tool = FileManagerTool() # Add the tool to the Agent agent = Agent(tools=[file_manager_tool]) diff --git a/docs/griptape-tools/official-tools/src/google_cal_client_1.py b/docs/griptape-tools/official-tools/src/google_cal_client_1.py index 1b99d9ec48..53fe251a5a 100644 --- a/docs/griptape-tools/official-tools/src/google_cal_client_1.py +++ b/docs/griptape-tools/official-tools/src/google_cal_client_1.py @@ -1,10 +1,10 @@ import os from griptape.structures import Agent -from griptape.tools import GoogleCalendarClient +from griptape.tools import GoogleCalendarTool -# Create the GoogleCalendarClient tool -google_calendar_tool = GoogleCalendarClient( +# Create the GoogleCalendarTool tool +google_calendar_tool = GoogleCalendarTool( service_account_credentials={ "type": os.environ["GOOGLE_ACCOUNT_TYPE"], "project_id": os.environ["GOOGLE_PROJECT_ID"], @@ -20,7 +20,7 @@ owner_email=os.environ["GOOGLE_OWNER_EMAIL"], ) -# Set up an agent using the GoogleCalendarClient tool +# Set up an agent using the GoogleCalendarTool tool agent = Agent(tools=[google_calendar_tool]) # Task: Get upcoming events from a Google calendar diff --git a/docs/griptape-tools/official-tools/src/google_docs_client_1.py b/docs/griptape-tools/official-tools/src/google_docs_client_1.py index 473bfbfd8b..0d8e8a3cb1 100644 --- a/docs/griptape-tools/official-tools/src/google_docs_client_1.py +++ b/docs/griptape-tools/official-tools/src/google_docs_client_1.py @@ -1,10 +1,10 @@ import os from griptape.structures import Agent -from griptape.tools import GoogleDocsClient +from griptape.tools import GoogleDocsTool -# Create the GoogleDocsClient tool -google_docs_tool = GoogleDocsClient( +# Create the GoogleDocsTool tool +google_docs_tool = GoogleDocsTool( service_account_credentials={ "type": os.environ["GOOGLE_ACCOUNT_TYPE"], "project_id": os.environ["GOOGLE_PROJECT_ID"], @@ -20,7 +20,7 @@ owner_email=os.environ["GOOGLE_OWNER_EMAIL"], ) -# Set up an agent using the GoogleDocsClient tool +# Set up an agent using the GoogleDocsTool tool agent = Agent(tools=[google_docs_tool]) # Task: Create a new Google Doc and save content to it diff --git a/docs/griptape-tools/official-tools/src/google_drive_client_1.py b/docs/griptape-tools/official-tools/src/google_drive_client_1.py index a020b1a967..d8e43a6dbe 100644 --- a/docs/griptape-tools/official-tools/src/google_drive_client_1.py +++ b/docs/griptape-tools/official-tools/src/google_drive_client_1.py @@ -1,10 +1,10 @@ import os from griptape.structures import Agent -from griptape.tools import GoogleDriveClient +from griptape.tools import GoogleDriveTool -# Create the GoogleDriveClient tool -google_drive_tool = GoogleDriveClient( +# Create the GoogleDriveTool tool +google_drive_tool = GoogleDriveTool( service_account_credentials={ "type": os.environ["GOOGLE_ACCOUNT_TYPE"], "project_id": os.environ["GOOGLE_PROJECT_ID"], @@ -20,7 +20,7 @@ owner_email=os.environ["GOOGLE_OWNER_EMAIL"], ) -# Set up an agent using the GoogleDriveClient tool +# Set up an agent using the GoogleDriveTool tool agent = Agent(tools=[google_drive_tool]) # Task: Save content to my Google Drive (default directory is root) diff --git a/docs/griptape-tools/official-tools/src/google_gmail_client_1.py b/docs/griptape-tools/official-tools/src/google_gmail_client_1.py index e9a075fa8e..44e0ceb392 100644 --- a/docs/griptape-tools/official-tools/src/google_gmail_client_1.py +++ b/docs/griptape-tools/official-tools/src/google_gmail_client_1.py @@ -1,10 +1,10 @@ import os from griptape.structures import Agent -from griptape.tools import GoogleGmailClient +from griptape.tools import GoogleGmailTool -# Create the GoogleGmailClient tool -gmail_tool = GoogleGmailClient( +# Create the GoogleGmailTool tool +gmail_tool = GoogleGmailTool( service_account_credentials={ "type": os.environ["GOOGLE_ACCOUNT_TYPE"], "project_id": os.environ["GOOGLE_PROJECT_ID"], @@ -20,7 +20,7 @@ owner_email=os.environ["GOOGLE_OWNER_EMAIL"], ) -# Set up an agent using the GoogleGmailClient tool +# Set up an agent using the GoogleGmailTool tool agent = Agent(tools=[gmail_tool]) # Task: Create a draft email in GMail diff --git a/docs/griptape-tools/official-tools/src/griptape_cloud_knowledge_base_client_1.py b/docs/griptape-tools/official-tools/src/griptape_cloud_knowledge_base_client_1.py index 9cfd09a225..b8c294f6bb 100644 --- a/docs/griptape-tools/official-tools/src/griptape_cloud_knowledge_base_client_1.py +++ b/docs/griptape-tools/official-tools/src/griptape_cloud_knowledge_base_client_1.py @@ -1,9 +1,9 @@ import os from griptape.structures import Agent -from griptape.tools import GriptapeCloudKnowledgeBaseClient +from griptape.tools import GriptapeCloudKnowledgeBaseTool -knowledge_base_client = GriptapeCloudKnowledgeBaseClient( +knowledge_base_client = GriptapeCloudKnowledgeBaseTool( description="Contains information about the company and its operations", api_key=os.environ["GRIPTAPE_CLOUD_API_KEY"], knowledge_base_id=os.environ["GRIPTAPE_CLOUD_KB_ID"], diff --git a/docs/griptape-tools/official-tools/src/image_query_client_1.py b/docs/griptape-tools/official-tools/src/image_query_client_1.py index 177154d2d4..032a6a4c2e 100644 --- a/docs/griptape-tools/official-tools/src/image_query_client_1.py +++ b/docs/griptape-tools/official-tools/src/image_query_client_1.py @@ -1,7 +1,7 @@ from griptape.drivers import OpenAiImageQueryDriver from griptape.engines import ImageQueryEngine from griptape.structures import Agent -from griptape.tools import ImageQueryClient +from griptape.tools import ImageQueryTool # Create an Image Query Driver. driver = OpenAiImageQueryDriver(model="gpt-4o") @@ -12,7 +12,7 @@ ) # Create an Image Query Client configured to use the engine. -tool = ImageQueryClient( +tool = ImageQueryTool( image_query_engine=engine, ) diff --git a/docs/griptape-tools/official-tools/src/inpainting_image_generation_client_1.py b/docs/griptape-tools/official-tools/src/inpainting_image_generation_client_1.py index 1042a4567a..5821e1b40d 100644 --- a/docs/griptape-tools/official-tools/src/inpainting_image_generation_client_1.py +++ b/docs/griptape-tools/official-tools/src/inpainting_image_generation_client_1.py @@ -1,7 +1,7 @@ from griptape.drivers import AmazonBedrockImageGenerationDriver, BedrockStableDiffusionImageGenerationModelDriver from griptape.engines import InpaintingImageGenerationEngine from griptape.structures import Agent -from griptape.tools import InpaintingImageGenerationClient +from griptape.tools import InpaintingImageGenerationTool # Create a driver configured to use Stable Diffusion via Bedrock. driver = AmazonBedrockImageGenerationDriver( @@ -15,7 +15,7 @@ ) # Create a tool configured to use the engine. -tool = InpaintingImageGenerationClient( +tool = InpaintingImageGenerationTool( engine=engine, ) diff --git a/docs/griptape-tools/official-tools/src/openweather_client_1.py b/docs/griptape-tools/official-tools/src/openweather_client_1.py index 2156e24da2..b592620fae 100644 --- a/docs/griptape-tools/official-tools/src/openweather_client_1.py +++ b/docs/griptape-tools/official-tools/src/openweather_client_1.py @@ -1,11 +1,11 @@ import os from griptape.structures import Agent -from griptape.tools import OpenWeatherClient +from griptape.tools import OpenWeatherTool agent = Agent( tools=[ - OpenWeatherClient( + OpenWeatherTool( api_key=os.environ["OPENWEATHER_API_KEY"], ), ] diff --git a/docs/griptape-tools/official-tools/src/outpainting_image_generation_client_1.py b/docs/griptape-tools/official-tools/src/outpainting_image_generation_client_1.py index bc7eb85855..79606a9658 100644 --- a/docs/griptape-tools/official-tools/src/outpainting_image_generation_client_1.py +++ b/docs/griptape-tools/official-tools/src/outpainting_image_generation_client_1.py @@ -1,7 +1,7 @@ from griptape.drivers import AmazonBedrockImageGenerationDriver, BedrockStableDiffusionImageGenerationModelDriver from griptape.engines import OutpaintingImageGenerationEngine from griptape.structures import Agent -from griptape.tools import OutpaintingImageGenerationClient +from griptape.tools import OutpaintingImageGenerationTool # Create a driver configured to use Stable Diffusion via Bedrock. driver = AmazonBedrockImageGenerationDriver( @@ -15,7 +15,7 @@ ) # Create a tool configured to use the engine. -tool = OutpaintingImageGenerationClient( +tool = OutpaintingImageGenerationTool( engine=engine, ) diff --git a/docs/griptape-tools/official-tools/src/prompt_image_generation_client_1.py b/docs/griptape-tools/official-tools/src/prompt_image_generation_client_1.py index f75f904b6c..0173cc185d 100644 --- a/docs/griptape-tools/official-tools/src/prompt_image_generation_client_1.py +++ b/docs/griptape-tools/official-tools/src/prompt_image_generation_client_1.py @@ -1,7 +1,7 @@ from griptape.drivers import AmazonBedrockImageGenerationDriver, BedrockStableDiffusionImageGenerationModelDriver from griptape.engines import PromptImageGenerationEngine from griptape.structures import Agent -from griptape.tools import PromptImageGenerationClient +from griptape.tools import PromptImageGenerationTool # Create a driver configured to use Stable Diffusion via Bedrock. driver = AmazonBedrockImageGenerationDriver( @@ -15,7 +15,7 @@ ) # Create a tool configured to use the engine. -tool = PromptImageGenerationClient( +tool = PromptImageGenerationTool( engine=engine, ) diff --git a/docs/griptape-tools/official-tools/src/rag_client_1.py b/docs/griptape-tools/official-tools/src/rag_client_1.py index 01e71e2534..5a1a504113 100644 --- a/docs/griptape-tools/official-tools/src/rag_client_1.py +++ b/docs/griptape-tools/official-tools/src/rag_client_1.py @@ -4,7 +4,7 @@ from griptape.engines.rag.modules import PromptResponseRagModule, VectorStoreRetrievalRagModule from griptape.engines.rag.stages import ResponseRagStage, RetrievalRagStage from griptape.structures import Agent -from griptape.tools import RagClient +from griptape.tools import RagTool vector_store_driver = LocalVectorStoreDriver(embedding_driver=OpenAiEmbeddingDriver()) @@ -15,7 +15,7 @@ vector_store_driver.upsert_text_artifact(artifact=artifact, namespace="griptape") -rag_client = RagClient( +rag_client = RagTool( description="Contains information about Griptape", off_prompt=False, rag_engine=RagEngine( diff --git a/docs/griptape-tools/official-tools/src/rest_api_client_1.py b/docs/griptape-tools/official-tools/src/rest_api_client_1.py index 0268742834..2093163b72 100644 --- a/docs/griptape-tools/official-tools/src/rest_api_client_1.py +++ b/docs/griptape-tools/official-tools/src/rest_api_client_1.py @@ -5,13 +5,13 @@ from griptape.memory.structure import ConversationMemory from griptape.structures import Pipeline from griptape.tasks import ToolkitTask -from griptape.tools import RestApiClient +from griptape.tools import RestApiTool config.drivers = DriverConfig( prompt=OpenAiChatPromptDriver(model="gpt-4o", temperature=0.1), ) -posts_client = RestApiClient( +posts_client = RestApiTool( base_url="https://jsonplaceholder.typicode.com", path="posts", description="Allows for creating, updating, deleting, patching, and getting posts.", diff --git a/docs/griptape-tools/official-tools/src/sql_client_1.py b/docs/griptape-tools/official-tools/src/sql_client_1.py index 3e89d6096d..f7630891fc 100644 --- a/docs/griptape-tools/official-tools/src/sql_client_1.py +++ b/docs/griptape-tools/official-tools/src/sql_client_1.py @@ -5,7 +5,7 @@ from griptape.drivers import AmazonRedshiftSqlDriver from griptape.loaders import SqlLoader from griptape.structures import Agent -from griptape.tools import SqlClient +from griptape.tools import SqlTool session = boto3.Session() @@ -17,7 +17,7 @@ ) ) -sql_tool = SqlClient( +sql_tool = SqlTool( sql_loader=sql_loader, table_name="people", table_description="contains information about tech industry professionals", diff --git a/docs/griptape-tools/official-tools/src/structure_run_client_1.py b/docs/griptape-tools/official-tools/src/structure_run_client_1.py index 10f48b80d2..575092ce67 100644 --- a/docs/griptape-tools/official-tools/src/structure_run_client_1.py +++ b/docs/griptape-tools/official-tools/src/structure_run_client_1.py @@ -2,13 +2,13 @@ from griptape.drivers import GriptapeCloudStructureRunDriver from griptape.structures import Agent -from griptape.tools import StructureRunClient +from griptape.tools import StructureRunTool base_url = os.environ["GRIPTAPE_CLOUD_BASE_URL"] api_key = os.environ["GRIPTAPE_CLOUD_API_KEY"] structure_id = os.environ["GRIPTAPE_CLOUD_STRUCTURE_ID"] -structure_run_tool = StructureRunClient( +structure_run_tool = StructureRunTool( description="RAG Expert Agent - Structure to invoke with natural language queries about the topic of Retrieval Augmented Generation", driver=GriptapeCloudStructureRunDriver( base_url=base_url, @@ -17,7 +17,7 @@ ), ) -# Set up an agent using the StructureRunClient tool +# Set up an agent using the StructureRunTool tool agent = Agent(tools=[structure_run_tool]) # Task: Ask the Griptape Cloud Hosted Structure about modular RAG diff --git a/docs/griptape-tools/official-tools/src/task_memory_client_1.py b/docs/griptape-tools/official-tools/src/task_memory_client_1.py index e9c2562a1d..f5c2c487f9 100644 --- a/docs/griptape-tools/official-tools/src/task_memory_client_1.py +++ b/docs/griptape-tools/official-tools/src/task_memory_client_1.py @@ -1,4 +1,4 @@ from griptape.structures import Agent -from griptape.tools import TaskMemoryClient, WebScraper +from griptape.tools import TaskMemoryTool, WebScraperTool -Agent(tools=[WebScraper(off_prompt=True), TaskMemoryClient(off_prompt=False)]) +Agent(tools=[WebScraperTool(off_prompt=True), TaskMemoryTool(off_prompt=False)]) diff --git a/docs/griptape-tools/official-tools/src/text_to_speech_client_1.py b/docs/griptape-tools/official-tools/src/text_to_speech_client_1.py index c6a03b80d7..376113d633 100644 --- a/docs/griptape-tools/official-tools/src/text_to_speech_client_1.py +++ b/docs/griptape-tools/official-tools/src/text_to_speech_client_1.py @@ -3,7 +3,7 @@ from griptape.drivers import ElevenLabsTextToSpeechDriver from griptape.engines import TextToSpeechEngine from griptape.structures import Agent -from griptape.tools.text_to_speech_client.tool import TextToSpeechClient +from griptape.tools.text_to_speech.tool import TextToSpeechTool driver = ElevenLabsTextToSpeechDriver( api_key=os.environ["ELEVEN_LABS_API_KEY"], @@ -11,7 +11,7 @@ voice="Matilda", ) -tool = TextToSpeechClient( +tool = TextToSpeechTool( engine=TextToSpeechEngine( text_to_speech_driver=driver, ), diff --git a/docs/griptape-tools/official-tools/src/variation_image_generation_client_1.py b/docs/griptape-tools/official-tools/src/variation_image_generation_client_1.py index 6c4432d52c..209d97a7be 100644 --- a/docs/griptape-tools/official-tools/src/variation_image_generation_client_1.py +++ b/docs/griptape-tools/official-tools/src/variation_image_generation_client_1.py @@ -1,7 +1,7 @@ from griptape.drivers import AmazonBedrockImageGenerationDriver, BedrockStableDiffusionImageGenerationModelDriver from griptape.engines import VariationImageGenerationEngine from griptape.structures import Agent -from griptape.tools import VariationImageGenerationClient +from griptape.tools import VariationImageGenerationTool # Create a driver configured to use Stable Diffusion via Bedrock. driver = AmazonBedrockImageGenerationDriver( @@ -17,7 +17,7 @@ ) # Create a tool configured to use the engine. -tool = VariationImageGenerationClient( +tool = VariationImageGenerationTool( engine=engine, ) diff --git a/docs/griptape-tools/official-tools/src/variation_image_generation_client_2.py b/docs/griptape-tools/official-tools/src/variation_image_generation_client_2.py index d98aec1990..036b75d483 100644 --- a/docs/griptape-tools/official-tools/src/variation_image_generation_client_2.py +++ b/docs/griptape-tools/official-tools/src/variation_image_generation_client_2.py @@ -1,7 +1,7 @@ from griptape.drivers import AmazonBedrockImageGenerationDriver, BedrockStableDiffusionImageGenerationModelDriver from griptape.engines import PromptImageGenerationEngine, VariationImageGenerationEngine from griptape.structures import Agent -from griptape.tools import PromptImageGenerationClient, VariationImageGenerationClient +from griptape.tools import PromptImageGenerationTool, VariationImageGenerationTool # Create a driver configured to use Stable Diffusion via Bedrock. driver = AmazonBedrockImageGenerationDriver( @@ -17,7 +17,7 @@ ) # Create a prompt image generation client configured to use the engine. -prompt_tool = PromptImageGenerationClient( +prompt_tool = PromptImageGenerationTool( engine=prompt_engine, ) @@ -27,7 +27,7 @@ ) # Create a variation image generation client configured to use the engine. -variation_tool = VariationImageGenerationClient( +variation_tool = VariationImageGenerationTool( engine=variation_engine, ) diff --git a/docs/griptape-tools/official-tools/src/vector_store_client_1.py b/docs/griptape-tools/official-tools/src/vector_store_client_1.py index df9117960f..57ca7b25b4 100644 --- a/docs/griptape-tools/official-tools/src/vector_store_client_1.py +++ b/docs/griptape-tools/official-tools/src/vector_store_client_1.py @@ -2,7 +2,7 @@ from griptape.drivers import LocalVectorStoreDriver, OpenAiEmbeddingDriver from griptape.loaders import WebLoader from griptape.structures import Agent -from griptape.tools import TaskMemoryClient, VectorStoreClient +from griptape.tools import TaskMemoryTool, VectorStoreTool vector_store_driver = LocalVectorStoreDriver( embedding_driver=OpenAiEmbeddingDriver(), @@ -13,13 +13,13 @@ raise Exception(artifacts.value) vector_store_driver.upsert_text_artifacts({"griptape": artifacts}) -vector_db = VectorStoreClient( +vector_db = VectorStoreTool( description="This DB has information about the Griptape Python framework", vector_store_driver=vector_store_driver, query_params={"namespace": "griptape"}, off_prompt=True, ) -agent = Agent(tools=[vector_db, TaskMemoryClient(off_prompt=False)]) +agent = Agent(tools=[vector_db, TaskMemoryTool(off_prompt=False)]) agent.run("what is Griptape?") diff --git a/docs/griptape-tools/official-tools/src/web_scraper_1.py b/docs/griptape-tools/official-tools/src/web_scraper_1.py index 138e8600fe..7716acde41 100644 --- a/docs/griptape-tools/official-tools/src/web_scraper_1.py +++ b/docs/griptape-tools/official-tools/src/web_scraper_1.py @@ -1,6 +1,6 @@ from griptape.structures import Agent -from griptape.tools import TaskMemoryClient, WebScraper +from griptape.tools import TaskMemoryTool, WebScraperTool -agent = Agent(tools=[WebScraper(off_prompt=True), TaskMemoryClient(off_prompt=False)]) +agent = Agent(tools=[WebScraperTool(off_prompt=True), TaskMemoryTool(off_prompt=False)]) agent.run("Based on https://www.griptape.ai/, tell me what griptape is") diff --git a/docs/griptape-tools/official-tools/src/web_search_1.py b/docs/griptape-tools/official-tools/src/web_search_1.py index 70603a693e..3469ad7f9c 100644 --- a/docs/griptape-tools/official-tools/src/web_search_1.py +++ b/docs/griptape-tools/official-tools/src/web_search_1.py @@ -2,10 +2,10 @@ from griptape.drivers import GoogleWebSearchDriver from griptape.structures import Agent -from griptape.tools import WebSearch +from griptape.tools import WebSearchTool -# Initialize the WebSearch tool with necessary parameters -web_search_tool = WebSearch( +# Initialize the WebSearchTool tool with necessary parameters +web_search_tool = WebSearchTool( web_search_driver=GoogleWebSearchDriver( api_key=os.environ["GOOGLE_API_KEY"], search_id=os.environ["GOOGLE_API_SEARCH_ID"], @@ -15,7 +15,7 @@ ), ) -# Set up an agent using the WebSearch tool +# Set up an agent using the WebSearchTool tool agent = Agent(tools=[web_search_tool]) # Task: Search the web for a specific query diff --git a/docs/griptape-tools/official-tools/src/web_search_2.py b/docs/griptape-tools/official-tools/src/web_search_2.py index b40eac0941..dd9c326556 100644 --- a/docs/griptape-tools/official-tools/src/web_search_2.py +++ b/docs/griptape-tools/official-tools/src/web_search_2.py @@ -4,11 +4,11 @@ from griptape.drivers import GoogleWebSearchDriver from griptape.structures import Agent -from griptape.tools import WebSearch +from griptape.tools import WebSearchTool agent = Agent( tools=[ - WebSearch( + WebSearchTool( web_search_driver=GoogleWebSearchDriver( api_key=os.environ["GOOGLE_API_KEY"], search_id=os.environ["GOOGLE_API_SEARCH_ID"], diff --git a/docs/griptape-tools/official-tools/vector-store-client.md b/docs/griptape-tools/official-tools/vector-store-client.md index 8fd280ec95..04e38f0e06 100644 --- a/docs/griptape-tools/official-tools/vector-store-client.md +++ b/docs/griptape-tools/official-tools/vector-store-client.md @@ -1,4 +1,4 @@ -The [VectorStoreClient](../../reference/griptape/tools/vector_store_client/tool.md) enables LLMs to query vector stores. +The [VectorStoreTool](../../reference/griptape/tools/vector_store_client/tool.md) enables LLMs to query vector stores. Here is an example of how it can be used with a local vector store driver: diff --git a/griptape/tools/__init__.py b/griptape/tools/__init__.py index d99b63b6ca..20c492ea48 100644 --- a/griptape/tools/__init__.py +++ b/griptape/tools/__init__.py @@ -1,67 +1,67 @@ from .base_tool import BaseTool -from .base_image_generation_client import BaseImageGenerationClient -from .calculator.tool import Calculator -from .web_search.tool import WebSearch -from .web_scraper.tool import WebScraper -from .sql_client.tool import SqlClient -from .email_client.tool import EmailClient -from .rest_api_client.tool import RestApiClient -from .file_manager.tool import FileManager -from .vector_store_client.tool import VectorStoreClient -from .date_time.tool import DateTime -from .task_memory_client.tool import TaskMemoryClient -from .base_aws_client import BaseAwsClient -from .aws_iam_client.tool import AwsIamClient -from .aws_s3_client.tool import AwsS3Client -from .computer.tool import Computer -from .base_google_client import BaseGoogleClient -from .google_gmail.tool import GoogleGmailClient -from .google_cal.tool import GoogleCalendarClient -from .google_docs.tool import GoogleDocsClient -from .google_drive.tool import GoogleDriveClient -from .openweather_client.tool import OpenWeatherClient -from .prompt_image_generation_client.tool import PromptImageGenerationClient -from .variation_image_generation_client.tool import VariationImageGenerationClient -from .inpainting_image_generation_client.tool import InpaintingImageGenerationClient -from .outpainting_image_generation_client.tool import OutpaintingImageGenerationClient -from .griptape_cloud_knowledge_base_client.tool import GriptapeCloudKnowledgeBaseClient -from .structure_run_client.tool import StructureRunClient -from .image_query_client.tool import ImageQueryClient -from .rag_client.tool import RagClient -from .text_to_speech_client.tool import TextToSpeechClient -from .audio_transcription_client.tool import AudioTranscriptionClient +from .base_image_generation_tool import BaseImageGenerationTool +from .calculator.tool import CalculatorTool +from .web_search.tool import WebSearchTool +from .web_scraper.tool import WebScraperTool +from .sql.tool import SqlTool +from .email.tool import EmailTool +from .rest_api.tool import RestApiTool +from .file_manager.tool import FileManagerTool +from .vector_store.tool import VectorStoreTool +from .date_time.tool import DateTimeTool +from .task_memory.tool import TaskMemoryTool +from .base_aws_tool import BaseAwsTool +from .aws_iam.tool import AwsIamTool +from .aws_s3.tool import AwsS3Tool +from .computer.tool import ComputerTool +from .base_google_tool import BaseGoogleTool +from .google_gmail.tool import GoogleGmailTool +from .google_cal.tool import GoogleCalendarTool +from .google_docs.tool import GoogleDocsTool +from .google_drive.tool import GoogleDriveTool +from .openweather.tool import OpenWeatherTool +from .prompt_image_generation.tool import PromptImageGenerationTool +from .variation_image_generation.tool import VariationImageGenerationTool +from .inpainting_image_generation.tool import InpaintingImageGenerationTool +from .outpainting_image_generation.tool import OutpaintingImageGenerationTool +from .griptape_cloud_knowledge_base.tool import GriptapeCloudKnowledgeBaseTool +from .structure_run.tool import StructureRunTool +from .image_query.tool import ImageQueryTool +from .rag.tool import RagTool +from .text_to_speech.tool import TextToSpeechTool +from .audio_transcription.tool import AudioTranscriptionTool __all__ = [ "BaseTool", - "BaseImageGenerationClient", - "BaseAwsClient", - "AwsIamClient", - "AwsS3Client", - "BaseGoogleClient", - "GoogleGmailClient", - "GoogleDocsClient", - "GoogleCalendarClient", - "GoogleDriveClient", - "Calculator", - "WebSearch", - "WebScraper", - "SqlClient", - "EmailClient", - "RestApiClient", - "FileManager", - "VectorStoreClient", - "DateTime", - "TaskMemoryClient", - "Computer", - "OpenWeatherClient", - "PromptImageGenerationClient", - "VariationImageGenerationClient", - "InpaintingImageGenerationClient", - "OutpaintingImageGenerationClient", - "GriptapeCloudKnowledgeBaseClient", - "StructureRunClient", - "ImageQueryClient", - "RagClient", - "TextToSpeechClient", - "AudioTranscriptionClient", + "BaseImageGenerationTool", + "BaseAwsTool", + "AwsIamTool", + "AwsS3Tool", + "BaseGoogleTool", + "GoogleGmailTool", + "GoogleDocsTool", + "GoogleCalendarTool", + "GoogleDriveTool", + "CalculatorTool", + "WebSearchTool", + "WebScraperTool", + "SqlTool", + "EmailTool", + "RestApiTool", + "FileManagerTool", + "VectorStoreTool", + "DateTimeTool", + "TaskMemoryTool", + "ComputerTool", + "OpenWeatherTool", + "PromptImageGenerationTool", + "VariationImageGenerationTool", + "InpaintingImageGenerationTool", + "OutpaintingImageGenerationTool", + "GriptapeCloudKnowledgeBaseTool", + "StructureRunTool", + "ImageQueryTool", + "RagTool", + "TextToSpeechTool", + "AudioTranscriptionTool", ] diff --git a/griptape/tools/audio_transcription_client/__init__.py b/griptape/tools/audio_transcription/__init__.py similarity index 100% rename from griptape/tools/audio_transcription_client/__init__.py rename to griptape/tools/audio_transcription/__init__.py diff --git a/griptape/tools/audio_transcription_client/manifest.yml b/griptape/tools/audio_transcription/manifest.yml similarity index 100% rename from griptape/tools/audio_transcription_client/manifest.yml rename to griptape/tools/audio_transcription/manifest.yml diff --git a/griptape/tools/audio_transcription_client/tool.py b/griptape/tools/audio_transcription/tool.py similarity index 98% rename from griptape/tools/audio_transcription_client/tool.py rename to griptape/tools/audio_transcription/tool.py index 62cd9e7a5c..4174db2090 100644 --- a/griptape/tools/audio_transcription_client/tool.py +++ b/griptape/tools/audio_transcription/tool.py @@ -17,7 +17,7 @@ @define -class AudioTranscriptionClient(BaseTool): +class AudioTranscriptionTool(BaseTool): """A tool that can be used to generate transcriptions from input audio.""" engine: AudioTranscriptionEngine = field(kw_only=True) diff --git a/griptape/tools/aws_iam_client/__init__.py b/griptape/tools/aws_iam/__init__.py similarity index 100% rename from griptape/tools/aws_iam_client/__init__.py rename to griptape/tools/aws_iam/__init__.py diff --git a/griptape/tools/aws_iam_client/manifest.yml b/griptape/tools/aws_iam/manifest.yml similarity index 100% rename from griptape/tools/aws_iam_client/manifest.yml rename to griptape/tools/aws_iam/manifest.yml diff --git a/griptape/tools/aws_iam_client/tool.py b/griptape/tools/aws_iam/tool.py similarity index 97% rename from griptape/tools/aws_iam_client/tool.py rename to griptape/tools/aws_iam/tool.py index 1be0251f04..8d22dd3c95 100644 --- a/griptape/tools/aws_iam_client/tool.py +++ b/griptape/tools/aws_iam/tool.py @@ -6,7 +6,7 @@ from schema import Literal, Schema from griptape.artifacts import ErrorArtifact, ListArtifact, TextArtifact -from griptape.tools import BaseAwsClient +from griptape.tools import BaseAwsTool from griptape.utils.decorators import activity if TYPE_CHECKING: @@ -14,7 +14,7 @@ @define -class AwsIamClient(BaseAwsClient): +class AwsIamTool(BaseAwsTool): iam_client: Client = field(default=Factory(lambda self: self.session.client("iam"), takes_self=True), kw_only=True) @activity( diff --git a/griptape/tools/aws_s3_client/__init__.py b/griptape/tools/aws_s3/__init__.py similarity index 100% rename from griptape/tools/aws_s3_client/__init__.py rename to griptape/tools/aws_s3/__init__.py diff --git a/griptape/tools/aws_s3_client/manifest.yml b/griptape/tools/aws_s3/manifest.yml similarity index 100% rename from griptape/tools/aws_s3_client/manifest.yml rename to griptape/tools/aws_s3/manifest.yml diff --git a/griptape/tools/aws_s3_client/tool.py b/griptape/tools/aws_s3/tool.py similarity index 99% rename from griptape/tools/aws_s3_client/tool.py rename to griptape/tools/aws_s3/tool.py index 8f67195a1d..24d091d711 100644 --- a/griptape/tools/aws_s3_client/tool.py +++ b/griptape/tools/aws_s3/tool.py @@ -7,7 +7,7 @@ from schema import Literal, Schema from griptape.artifacts import BlobArtifact, ErrorArtifact, InfoArtifact, ListArtifact, TextArtifact -from griptape.tools import BaseAwsClient +from griptape.tools import BaseAwsTool from griptape.utils.decorators import activity if TYPE_CHECKING: @@ -15,7 +15,7 @@ @define -class AwsS3Client(BaseAwsClient): +class AwsS3Tool(BaseAwsTool): s3_client: Client = field(default=Factory(lambda self: self.session.client("s3"), takes_self=True), kw_only=True) @activity( diff --git a/griptape/tools/base_aws_client.py b/griptape/tools/base_aws_tool.py similarity index 95% rename from griptape/tools/base_aws_client.py rename to griptape/tools/base_aws_tool.py index 8c6d02e2b1..72fc545834 100644 --- a/griptape/tools/base_aws_client.py +++ b/griptape/tools/base_aws_tool.py @@ -14,7 +14,7 @@ @define -class BaseAwsClient(BaseTool, ABC): +class BaseAwsTool(BaseTool, ABC): session: boto3.Session = field(kw_only=True) @activity(config={"description": "Can be used to get current AWS account and IAM principal."}) diff --git a/griptape/tools/base_google_client.py b/griptape/tools/base_google_tool.py similarity index 98% rename from griptape/tools/base_google_client.py rename to griptape/tools/base_google_tool.py index 2a38d8ffe8..c40a583cf3 100644 --- a/griptape/tools/base_google_client.py +++ b/griptape/tools/base_google_tool.py @@ -9,7 +9,7 @@ @define -class BaseGoogleClient(BaseTool, ABC): +class BaseGoogleTool(BaseTool, ABC): DRIVE_FILE_SCOPES = ["https://www.googleapis.com/auth/drive.file"] DRIVE_AUTH_SCOPES = ["https://www.googleapis.com/auth/drive"] diff --git a/griptape/tools/base_griptape_cloud_client.py b/griptape/tools/base_griptape_cloud_tool.py similarity index 93% rename from griptape/tools/base_griptape_cloud_client.py rename to griptape/tools/base_griptape_cloud_tool.py index 4f56929573..7ee8f2dfc5 100644 --- a/griptape/tools/base_griptape_cloud_client.py +++ b/griptape/tools/base_griptape_cloud_tool.py @@ -8,7 +8,7 @@ @define -class BaseGriptapeCloudClient(BaseTool, ABC): +class BaseGriptapeCloudTool(BaseTool, ABC): """Base class for Griptape Cloud clients. Attributes: diff --git a/griptape/tools/base_image_generation_client.py b/griptape/tools/base_image_generation_tool.py similarity index 88% rename from griptape/tools/base_image_generation_client.py rename to griptape/tools/base_image_generation_tool.py index e85336d23a..487c6d1ba4 100644 --- a/griptape/tools/base_image_generation_client.py +++ b/griptape/tools/base_image_generation_tool.py @@ -5,7 +5,7 @@ @define -class BaseImageGenerationClient(BlobArtifactFileOutputMixin, BaseTool): +class BaseImageGenerationTool(BlobArtifactFileOutputMixin, BaseTool): """A base class for tools that generate images from text prompts.""" PROMPT_DESCRIPTION = "Features and qualities to include in the generated image, descriptive and succinct." diff --git a/griptape/tools/calculator/manifest.yml b/griptape/tools/calculator/manifest.yml index 7173134959..f4d475dc9c 100644 --- a/griptape/tools/calculator/manifest.yml +++ b/griptape/tools/calculator/manifest.yml @@ -1,5 +1,5 @@ version: "v1" -name: Calculator +name: CalculatorTool description: Tool for making simple calculations in Python. contact_email: hello@griptape.ai legal_info_url: https://www.griptape.ai/legal \ No newline at end of file diff --git a/griptape/tools/calculator/tool.py b/griptape/tools/calculator/tool.py index e8fcb1ed4e..ed128987ff 100644 --- a/griptape/tools/calculator/tool.py +++ b/griptape/tools/calculator/tool.py @@ -5,7 +5,7 @@ from griptape.utils.decorators import activity -class Calculator(BaseTool): +class CalculatorTool(BaseTool): @activity( config={ "description": "Can be used for computing simple numerical or algebraic calculations in Python", diff --git a/griptape/tools/computer/manifest.yml b/griptape/tools/computer/manifest.yml index 706c32b5bf..258631ae14 100644 --- a/griptape/tools/computer/manifest.yml +++ b/griptape/tools/computer/manifest.yml @@ -1,5 +1,5 @@ version: "v1" -name: Computer +name: ComputerTool description: Tool that allows LLMs to run Python code and access the shell contact_email: hello@griptape.ai legal_info_url: https://www.griptape.ai/legal \ No newline at end of file diff --git a/griptape/tools/computer/tool.py b/griptape/tools/computer/tool.py index 4e996c63c6..e2da2d9f84 100644 --- a/griptape/tools/computer/tool.py +++ b/griptape/tools/computer/tool.py @@ -23,7 +23,7 @@ @define -class Computer(BaseTool): +class ComputerTool(BaseTool): local_workdir: Optional[str] = field(default=None, kw_only=True) container_workdir: str = field(default="/griptape", kw_only=True) env_vars: dict = field(factory=dict, kw_only=True) diff --git a/griptape/tools/date_time/tool.py b/griptape/tools/date_time/tool.py index 728a3449a2..5181dbe3e6 100644 --- a/griptape/tools/date_time/tool.py +++ b/griptape/tools/date_time/tool.py @@ -7,7 +7,7 @@ from griptape.utils.decorators import activity -class DateTime(BaseTool): +class DateTimeTool(BaseTool): @activity(config={"description": "Can be used to return current date and time."}) def get_current_datetime(self, _: dict) -> BaseArtifact: try: diff --git a/griptape/tools/email_client/__init__.py b/griptape/tools/email/__init__.py similarity index 100% rename from griptape/tools/email_client/__init__.py rename to griptape/tools/email/__init__.py diff --git a/griptape/tools/email_client/manifest.yml b/griptape/tools/email/manifest.yml similarity index 100% rename from griptape/tools/email_client/manifest.yml rename to griptape/tools/email/manifest.yml diff --git a/griptape/tools/email_client/tool.py b/griptape/tools/email/tool.py similarity index 99% rename from griptape/tools/email_client/tool.py rename to griptape/tools/email/tool.py index 26c13bb9fc..f5e7f0247c 100644 --- a/griptape/tools/email_client/tool.py +++ b/griptape/tools/email/tool.py @@ -16,7 +16,7 @@ @define -class EmailClient(BaseTool): +class EmailTool(BaseTool): """Tool for working with email. Attributes: diff --git a/griptape/tools/file_manager/tool.py b/griptape/tools/file_manager/tool.py index c0cb691ea0..a3e17a8c47 100644 --- a/griptape/tools/file_manager/tool.py +++ b/griptape/tools/file_manager/tool.py @@ -12,8 +12,8 @@ @define -class FileManager(BaseTool): - """FileManager is a tool that can be used to list, load, and save files. +class FileManagerTool(BaseTool): + """FileManagerTool is a tool that can be used to list, load, and save files. Attributes: file_manager_driver: File Manager Driver to use to list, load, and save files. diff --git a/griptape/tools/google_cal/tool.py b/griptape/tools/google_cal/tool.py index 70f685605d..de9c4e8e1d 100644 --- a/griptape/tools/google_cal/tool.py +++ b/griptape/tools/google_cal/tool.py @@ -7,12 +7,12 @@ from schema import Literal, Optional, Schema from griptape.artifacts import ErrorArtifact, InfoArtifact, ListArtifact, TextArtifact -from griptape.tools import BaseGoogleClient +from griptape.tools import BaseGoogleTool from griptape.utils.decorators import activity @define -class GoogleCalendarClient(BaseGoogleClient): +class GoogleCalendarTool(BaseGoogleTool): CREATE_EVENT_SCOPES = ["https://www.googleapis.com/auth/calendar"] GET_UPCOMING_EVENTS_SCOPES = ["https://www.googleapis.com/auth/calendar"] diff --git a/griptape/tools/google_docs/tool.py b/griptape/tools/google_docs/tool.py index b3564b9b24..be40b09dab 100644 --- a/griptape/tools/google_docs/tool.py +++ b/griptape/tools/google_docs/tool.py @@ -6,12 +6,12 @@ from schema import Literal, Optional, Schema from griptape.artifacts import ErrorArtifact, InfoArtifact -from griptape.tools import BaseGoogleClient +from griptape.tools import BaseGoogleTool from griptape.utils.decorators import activity @define -class GoogleDocsClient(BaseGoogleClient): +class GoogleDocsTool(BaseGoogleTool): DOCS_SCOPES = ["https://www.googleapis.com/auth/documents"] DEFAULT_FOLDER_PATH = "root" diff --git a/griptape/tools/google_drive/tool.py b/griptape/tools/google_drive/tool.py index 37122a56bb..1642ebaf7c 100644 --- a/griptape/tools/google_drive/tool.py +++ b/griptape/tools/google_drive/tool.py @@ -9,12 +9,12 @@ from schema import Literal, Or, Schema from griptape.artifacts import BlobArtifact, ErrorArtifact, InfoArtifact, ListArtifact, TextArtifact -from griptape.tools import BaseGoogleClient +from griptape.tools import BaseGoogleTool from griptape.utils.decorators import activity @define -class GoogleDriveClient(BaseGoogleClient): +class GoogleDriveTool(BaseGoogleTool): LIST_FILES_SCOPES = ["https://www.googleapis.com/auth/drive.readonly"] GOOGLE_EXPORT_MIME_MAPPING = { diff --git a/griptape/tools/google_gmail/tool.py b/griptape/tools/google_gmail/tool.py index 853b8850ff..2cc9591685 100644 --- a/griptape/tools/google_gmail/tool.py +++ b/griptape/tools/google_gmail/tool.py @@ -8,12 +8,12 @@ from schema import Literal, Schema from griptape.artifacts import ErrorArtifact, InfoArtifact -from griptape.tools import BaseGoogleClient +from griptape.tools import BaseGoogleTool from griptape.utils.decorators import activity @define -class GoogleGmailClient(BaseGoogleClient): +class GoogleGmailTool(BaseGoogleTool): CREATE_DRAFT_EMAIL_SCOPES = ["https://www.googleapis.com/auth/gmail.compose"] owner_email: str = field(kw_only=True) diff --git a/griptape/tools/griptape_cloud_knowledge_base_client/__init__.py b/griptape/tools/griptape_cloud_knowledge_base/__init__.py similarity index 100% rename from griptape/tools/griptape_cloud_knowledge_base_client/__init__.py rename to griptape/tools/griptape_cloud_knowledge_base/__init__.py diff --git a/griptape/tools/griptape_cloud_knowledge_base_client/manifest.yml b/griptape/tools/griptape_cloud_knowledge_base/manifest.yml similarity index 100% rename from griptape/tools/griptape_cloud_knowledge_base_client/manifest.yml rename to griptape/tools/griptape_cloud_knowledge_base/manifest.yml diff --git a/griptape/tools/griptape_cloud_knowledge_base_client/tool.py b/griptape/tools/griptape_cloud_knowledge_base/tool.py similarity index 94% rename from griptape/tools/griptape_cloud_knowledge_base_client/tool.py rename to griptape/tools/griptape_cloud_knowledge_base/tool.py index 0c544524d5..6772212256 100644 --- a/griptape/tools/griptape_cloud_knowledge_base_client/tool.py +++ b/griptape/tools/griptape_cloud_knowledge_base/tool.py @@ -7,12 +7,12 @@ from schema import Literal, Schema from griptape.artifacts import ErrorArtifact, TextArtifact -from griptape.tools.base_griptape_cloud_client import BaseGriptapeCloudClient +from griptape.tools.base_griptape_cloud_tool import BaseGriptapeCloudTool from griptape.utils.decorators import activity @define -class GriptapeCloudKnowledgeBaseClient(BaseGriptapeCloudClient): +class GriptapeCloudKnowledgeBaseTool(BaseGriptapeCloudTool): """Tool for querying a Griptape Cloud Knowledge Base. Attributes: diff --git a/griptape/tools/image_query_client/__init__.py b/griptape/tools/image_query/__init__.py similarity index 100% rename from griptape/tools/image_query_client/__init__.py rename to griptape/tools/image_query/__init__.py diff --git a/griptape/tools/image_query_client/manifest.yml b/griptape/tools/image_query/manifest.yml similarity index 100% rename from griptape/tools/image_query_client/manifest.yml rename to griptape/tools/image_query/manifest.yml diff --git a/griptape/tools/image_query_client/tool.py b/griptape/tools/image_query/tool.py similarity index 99% rename from griptape/tools/image_query_client/tool.py rename to griptape/tools/image_query/tool.py index a10929b130..97772d5467 100644 --- a/griptape/tools/image_query_client/tool.py +++ b/griptape/tools/image_query/tool.py @@ -17,7 +17,7 @@ @define -class ImageQueryClient(BaseTool): +class ImageQueryTool(BaseTool): image_query_engine: ImageQueryEngine = field(kw_only=True) image_loader: ImageLoader = field(default=Factory(lambda: ImageLoader()), kw_only=True) diff --git a/griptape/tools/inpainting_image_generation_client/__init__.py b/griptape/tools/inpainting_image_generation/__init__.py similarity index 100% rename from griptape/tools/inpainting_image_generation_client/__init__.py rename to griptape/tools/inpainting_image_generation/__init__.py diff --git a/griptape/tools/inpainting_image_generation_client/manifest.yml b/griptape/tools/inpainting_image_generation/manifest.yml similarity index 100% rename from griptape/tools/inpainting_image_generation_client/manifest.yml rename to griptape/tools/inpainting_image_generation/manifest.yml diff --git a/griptape/tools/inpainting_image_generation_client/requirements.txt b/griptape/tools/inpainting_image_generation/requirements.txt similarity index 100% rename from griptape/tools/inpainting_image_generation_client/requirements.txt rename to griptape/tools/inpainting_image_generation/requirements.txt diff --git a/griptape/tools/inpainting_image_generation_client/tool.py b/griptape/tools/inpainting_image_generation/tool.py similarity index 93% rename from griptape/tools/inpainting_image_generation_client/tool.py rename to griptape/tools/inpainting_image_generation/tool.py index e8979efb0f..d32f481d9d 100644 --- a/griptape/tools/inpainting_image_generation_client/tool.py +++ b/griptape/tools/inpainting_image_generation/tool.py @@ -8,7 +8,7 @@ from griptape.artifacts import ErrorArtifact, ImageArtifact from griptape.loaders import ImageLoader -from griptape.tools.base_image_generation_client import BaseImageGenerationClient +from griptape.tools.base_image_generation_tool import BaseImageGenerationTool from griptape.utils.decorators import activity from griptape.utils.load_artifact_from_memory import load_artifact_from_memory @@ -17,7 +17,7 @@ @define -class InpaintingImageGenerationClient(BaseImageGenerationClient): +class InpaintingImageGenerationTool(BaseImageGenerationTool): """A tool that can be used to generate prompted inpaintings of an image. Attributes: @@ -34,8 +34,8 @@ class InpaintingImageGenerationClient(BaseImageGenerationClient): "description": "Modifies an image within a specified mask area using image and mask files.", "schema": Schema( { - Literal("prompt", description=BaseImageGenerationClient.PROMPT_DESCRIPTION): str, - Literal("negative_prompt", description=BaseImageGenerationClient.NEGATIVE_PROMPT_DESCRIPTION): str, + Literal("prompt", description=BaseImageGenerationTool.PROMPT_DESCRIPTION): str, + Literal("negative_prompt", description=BaseImageGenerationTool.NEGATIVE_PROMPT_DESCRIPTION): str, Literal( "image_file", description="The path to an image file to be used as a base to generate variations from.", @@ -63,8 +63,8 @@ def image_inpainting_from_file(self, params: dict[str, dict[str, str]]) -> Image "description": "Modifies an image within a specified mask area using image and mask artifacts in memory.", "schema": Schema( { - Literal("prompt", description=BaseImageGenerationClient.PROMPT_DESCRIPTION): str, - Literal("negative_prompt", description=BaseImageGenerationClient.NEGATIVE_PROMPT_DESCRIPTION): str, + Literal("prompt", description=BaseImageGenerationTool.PROMPT_DESCRIPTION): str, + Literal("negative_prompt", description=BaseImageGenerationTool.NEGATIVE_PROMPT_DESCRIPTION): str, "memory_name": str, "image_artifact_namespace": str, "image_artifact_name": str, diff --git a/griptape/tools/openweather_client/__init__.py b/griptape/tools/openweather/__init__.py similarity index 100% rename from griptape/tools/openweather_client/__init__.py rename to griptape/tools/openweather/__init__.py diff --git a/griptape/tools/openweather_client/manifest.yml b/griptape/tools/openweather/manifest.yml similarity index 100% rename from griptape/tools/openweather_client/manifest.yml rename to griptape/tools/openweather/manifest.yml diff --git a/griptape/tools/openweather_client/tool.py b/griptape/tools/openweather/tool.py similarity index 99% rename from griptape/tools/openweather_client/tool.py rename to griptape/tools/openweather/tool.py index 4a7edb0f6d..311db733bb 100644 --- a/griptape/tools/openweather_client/tool.py +++ b/griptape/tools/openweather/tool.py @@ -13,7 +13,7 @@ @define -class OpenWeatherClient(BaseTool): +class OpenWeatherTool(BaseTool): BASE_URL = "https://api.openweathermap.org/data/3.0/onecall" GEOCODING_URL = "https://api.openweathermap.org/geo/1.0/direct" US_STATE_CODES = [ diff --git a/griptape/tools/outpainting_image_generation_client/__init__.py b/griptape/tools/outpainting_image_generation/__init__.py similarity index 100% rename from griptape/tools/outpainting_image_generation_client/__init__.py rename to griptape/tools/outpainting_image_generation/__init__.py diff --git a/griptape/tools/outpainting_image_generation_client/manifest.yml b/griptape/tools/outpainting_image_generation/manifest.yml similarity index 100% rename from griptape/tools/outpainting_image_generation_client/manifest.yml rename to griptape/tools/outpainting_image_generation/manifest.yml diff --git a/griptape/tools/outpainting_image_generation_client/requirements.txt b/griptape/tools/outpainting_image_generation/requirements.txt similarity index 100% rename from griptape/tools/outpainting_image_generation_client/requirements.txt rename to griptape/tools/outpainting_image_generation/requirements.txt diff --git a/griptape/tools/outpainting_image_generation_client/tool.py b/griptape/tools/outpainting_image_generation/tool.py similarity index 93% rename from griptape/tools/outpainting_image_generation_client/tool.py rename to griptape/tools/outpainting_image_generation/tool.py index 800d88e705..afa39e178c 100644 --- a/griptape/tools/outpainting_image_generation_client/tool.py +++ b/griptape/tools/outpainting_image_generation/tool.py @@ -8,7 +8,7 @@ from griptape.artifacts import ErrorArtifact, ImageArtifact from griptape.loaders import ImageLoader -from griptape.tools import BaseImageGenerationClient +from griptape.tools import BaseImageGenerationTool from griptape.utils.decorators import activity from griptape.utils.load_artifact_from_memory import load_artifact_from_memory @@ -17,7 +17,7 @@ @define -class OutpaintingImageGenerationClient(BaseImageGenerationClient): +class OutpaintingImageGenerationTool(BaseImageGenerationTool): """A tool that can be used to generate prompted outpaintings of an image. Attributes: @@ -34,8 +34,8 @@ class OutpaintingImageGenerationClient(BaseImageGenerationClient): "description": "Modifies an image outside a specified mask area using image and mask files.", "schema": Schema( { - Literal("prompt", description=BaseImageGenerationClient.PROMPT_DESCRIPTION): str, - Literal("negative_prompt", description=BaseImageGenerationClient.NEGATIVE_PROMPT_DESCRIPTION): str, + Literal("prompt", description=BaseImageGenerationTool.PROMPT_DESCRIPTION): str, + Literal("negative_prompt", description=BaseImageGenerationTool.NEGATIVE_PROMPT_DESCRIPTION): str, Literal( "image_file", description="The path to an image file to be used as a base to generate variations from.", @@ -61,8 +61,8 @@ def image_outpainting_from_file(self, params: dict[str, dict[str, str]]) -> Imag "description": "Modifies an image outside a specified mask area using image and mask artifacts in memory.", "schema": Schema( { - Literal("prompt", description=BaseImageGenerationClient.PROMPT_DESCRIPTION): str, - Literal("negative_prompt", description=BaseImageGenerationClient.NEGATIVE_PROMPT_DESCRIPTION): str, + Literal("prompt", description=BaseImageGenerationTool.PROMPT_DESCRIPTION): str, + Literal("negative_prompt", description=BaseImageGenerationTool.NEGATIVE_PROMPT_DESCRIPTION): str, "memory_name": str, "image_artifact_namespace": str, "mask_artifact_namespace": str, diff --git a/griptape/tools/prompt_image_generation_client/__init__.py b/griptape/tools/prompt_image_generation/__init__.py similarity index 100% rename from griptape/tools/prompt_image_generation_client/__init__.py rename to griptape/tools/prompt_image_generation/__init__.py diff --git a/griptape/tools/prompt_image_generation_client/manifest.yml b/griptape/tools/prompt_image_generation/manifest.yml similarity index 100% rename from griptape/tools/prompt_image_generation_client/manifest.yml rename to griptape/tools/prompt_image_generation/manifest.yml diff --git a/griptape/tools/prompt_image_generation_client/requirements.txt b/griptape/tools/prompt_image_generation/requirements.txt similarity index 100% rename from griptape/tools/prompt_image_generation_client/requirements.txt rename to griptape/tools/prompt_image_generation/requirements.txt diff --git a/griptape/tools/prompt_image_generation_client/tool.py b/griptape/tools/prompt_image_generation/tool.py similarity index 87% rename from griptape/tools/prompt_image_generation_client/tool.py rename to griptape/tools/prompt_image_generation/tool.py index 771b4e41da..6cd6ac5602 100644 --- a/griptape/tools/prompt_image_generation_client/tool.py +++ b/griptape/tools/prompt_image_generation/tool.py @@ -5,7 +5,7 @@ from attrs import define, field from schema import Literal, Schema -from griptape.tools import BaseImageGenerationClient +from griptape.tools import BaseImageGenerationTool from griptape.utils.decorators import activity if TYPE_CHECKING: @@ -14,7 +14,7 @@ @define -class PromptImageGenerationClient(BaseImageGenerationClient): +class PromptImageGenerationTool(BaseImageGenerationTool): """A tool that can be used to generate an image from a text prompt. Attributes: @@ -30,8 +30,8 @@ class PromptImageGenerationClient(BaseImageGenerationClient): "description": "Generates an image from text prompts.", "schema": Schema( { - Literal("prompt", description=BaseImageGenerationClient.PROMPT_DESCRIPTION): str, - Literal("negative_prompt", description=BaseImageGenerationClient.NEGATIVE_PROMPT_DESCRIPTION): str, + Literal("prompt", description=BaseImageGenerationTool.PROMPT_DESCRIPTION): str, + Literal("negative_prompt", description=BaseImageGenerationTool.NEGATIVE_PROMPT_DESCRIPTION): str, } ), }, diff --git a/griptape/tools/rag_client/__init__.py b/griptape/tools/rag/__init__.py similarity index 100% rename from griptape/tools/rag_client/__init__.py rename to griptape/tools/rag/__init__.py diff --git a/griptape/tools/rag_client/manifest.yml b/griptape/tools/rag/manifest.yml similarity index 100% rename from griptape/tools/rag_client/manifest.yml rename to griptape/tools/rag/manifest.yml diff --git a/griptape/tools/rag_client/requirements.txt b/griptape/tools/rag/requirements.txt similarity index 100% rename from griptape/tools/rag_client/requirements.txt rename to griptape/tools/rag/requirements.txt diff --git a/griptape/tools/rag_client/tool.py b/griptape/tools/rag/tool.py similarity index 97% rename from griptape/tools/rag_client/tool.py rename to griptape/tools/rag/tool.py index 613e254af1..8608493d15 100644 --- a/griptape/tools/rag_client/tool.py +++ b/griptape/tools/rag/tool.py @@ -14,7 +14,7 @@ @define(kw_only=True) -class RagClient(BaseTool): +class RagTool(BaseTool): """Tool for querying a RAG engine. Attributes: diff --git a/griptape/tools/rest_api_client/__init__.py b/griptape/tools/rest_api/__init__.py similarity index 100% rename from griptape/tools/rest_api_client/__init__.py rename to griptape/tools/rest_api/__init__.py diff --git a/griptape/tools/rest_api_client/manifest.yml b/griptape/tools/rest_api/manifest.yml similarity index 100% rename from griptape/tools/rest_api_client/manifest.yml rename to griptape/tools/rest_api/manifest.yml diff --git a/griptape/tools/rest_api_client/tool.py b/griptape/tools/rest_api/tool.py similarity index 99% rename from griptape/tools/rest_api_client/tool.py rename to griptape/tools/rest_api/tool.py index b27beda0e7..24ab4c93eb 100644 --- a/griptape/tools/rest_api_client/tool.py +++ b/griptape/tools/rest_api/tool.py @@ -14,7 +14,7 @@ @define -class RestApiClient(BaseTool): +class RestApiTool(BaseTool): """A tool for making REST API requests. Attributes: diff --git a/griptape/tools/sql_client/__init__.py b/griptape/tools/sql/__init__.py similarity index 100% rename from griptape/tools/sql_client/__init__.py rename to griptape/tools/sql/__init__.py diff --git a/griptape/tools/sql_client/manifest.yml b/griptape/tools/sql/manifest.yml similarity index 100% rename from griptape/tools/sql_client/manifest.yml rename to griptape/tools/sql/manifest.yml diff --git a/griptape/tools/sql_client/tool.py b/griptape/tools/sql/tool.py similarity index 98% rename from griptape/tools/sql_client/tool.py rename to griptape/tools/sql/tool.py index 2de598c6b7..a84bb87bed 100644 --- a/griptape/tools/sql_client/tool.py +++ b/griptape/tools/sql/tool.py @@ -14,7 +14,7 @@ @define -class SqlClient(BaseTool): +class SqlTool(BaseTool): sql_loader: SqlLoader = field(kw_only=True) schema_name: Optional[str] = field(default=None, kw_only=True) table_name: str = field(kw_only=True) diff --git a/griptape/tools/structure_run_client/__init__.py b/griptape/tools/structure_run/__init__.py similarity index 100% rename from griptape/tools/structure_run_client/__init__.py rename to griptape/tools/structure_run/__init__.py diff --git a/griptape/tools/structure_run_client/manifest.yml b/griptape/tools/structure_run/manifest.yml similarity index 100% rename from griptape/tools/structure_run_client/manifest.yml rename to griptape/tools/structure_run/manifest.yml diff --git a/griptape/tools/structure_run_client/tool.py b/griptape/tools/structure_run/tool.py similarity index 97% rename from griptape/tools/structure_run_client/tool.py rename to griptape/tools/structure_run/tool.py index f4f6c37862..cda4f0b355 100644 --- a/griptape/tools/structure_run_client/tool.py +++ b/griptape/tools/structure_run/tool.py @@ -14,7 +14,7 @@ @define -class StructureRunClient(BaseTool): +class StructureRunTool(BaseTool): """Tool for running a Structure. Attributes: diff --git a/griptape/tools/task_memory_client/__init__.py b/griptape/tools/task_memory/__init__.py similarity index 100% rename from griptape/tools/task_memory_client/__init__.py rename to griptape/tools/task_memory/__init__.py diff --git a/griptape/tools/task_memory_client/manifest.yml b/griptape/tools/task_memory/manifest.yml similarity index 100% rename from griptape/tools/task_memory_client/manifest.yml rename to griptape/tools/task_memory/manifest.yml diff --git a/griptape/tools/task_memory_client/tool.py b/griptape/tools/task_memory/tool.py similarity index 98% rename from griptape/tools/task_memory_client/tool.py rename to griptape/tools/task_memory/tool.py index 160a54d857..dfd6c7c4b2 100644 --- a/griptape/tools/task_memory_client/tool.py +++ b/griptape/tools/task_memory/tool.py @@ -9,7 +9,7 @@ @define -class TaskMemoryClient(BaseTool): +class TaskMemoryTool(BaseTool): @activity( config={ "description": "Can be used to summarize memory content", diff --git a/griptape/tools/text_to_speech_client/__init__.py b/griptape/tools/text_to_speech/__init__.py similarity index 100% rename from griptape/tools/text_to_speech_client/__init__.py rename to griptape/tools/text_to_speech/__init__.py diff --git a/griptape/tools/text_to_speech_client/manifest.yml b/griptape/tools/text_to_speech/manifest.yml similarity index 100% rename from griptape/tools/text_to_speech_client/manifest.yml rename to griptape/tools/text_to_speech/manifest.yml diff --git a/griptape/tools/text_to_speech_client/tool.py b/griptape/tools/text_to_speech/tool.py similarity index 95% rename from griptape/tools/text_to_speech_client/tool.py rename to griptape/tools/text_to_speech/tool.py index 295641fd3d..95a42d0aef 100644 --- a/griptape/tools/text_to_speech_client/tool.py +++ b/griptape/tools/text_to_speech/tool.py @@ -15,7 +15,7 @@ @define -class TextToSpeechClient(BlobArtifactFileOutputMixin, BaseTool): +class TextToSpeechTool(BlobArtifactFileOutputMixin, BaseTool): """A tool that can be used to generate speech from input text. Attributes: diff --git a/griptape/tools/variation_image_generation_client/__init__.py b/griptape/tools/variation_image_generation/__init__.py similarity index 100% rename from griptape/tools/variation_image_generation_client/__init__.py rename to griptape/tools/variation_image_generation/__init__.py diff --git a/griptape/tools/variation_image_generation_client/manifest.yml b/griptape/tools/variation_image_generation/manifest.yml similarity index 100% rename from griptape/tools/variation_image_generation_client/manifest.yml rename to griptape/tools/variation_image_generation/manifest.yml diff --git a/griptape/tools/variation_image_generation_client/requirements.txt b/griptape/tools/variation_image_generation/requirements.txt similarity index 100% rename from griptape/tools/variation_image_generation_client/requirements.txt rename to griptape/tools/variation_image_generation/requirements.txt diff --git a/griptape/tools/variation_image_generation_client/tool.py b/griptape/tools/variation_image_generation/tool.py similarity index 91% rename from griptape/tools/variation_image_generation_client/tool.py rename to griptape/tools/variation_image_generation/tool.py index 5f836c5b19..9691f62068 100644 --- a/griptape/tools/variation_image_generation_client/tool.py +++ b/griptape/tools/variation_image_generation/tool.py @@ -8,7 +8,7 @@ from griptape.artifacts import ErrorArtifact, ImageArtifact from griptape.loaders import ImageLoader -from griptape.tools.base_image_generation_client import BaseImageGenerationClient +from griptape.tools.base_image_generation_tool import BaseImageGenerationTool from griptape.utils.decorators import activity from griptape.utils.load_artifact_from_memory import load_artifact_from_memory @@ -17,7 +17,7 @@ @define -class VariationImageGenerationClient(BaseImageGenerationClient): +class VariationImageGenerationTool(BaseImageGenerationTool): """A tool that can be used to generate prompted variations of an image. Attributes: @@ -34,8 +34,8 @@ class VariationImageGenerationClient(BaseImageGenerationClient): "description": "Generates a variation of a given input image file.", "schema": Schema( { - Literal("prompt", description=BaseImageGenerationClient.PROMPT_DESCRIPTION): str, - Literal("negative_prompt", description=BaseImageGenerationClient.NEGATIVE_PROMPT_DESCRIPTION): str, + Literal("prompt", description=BaseImageGenerationTool.PROMPT_DESCRIPTION): str, + Literal("negative_prompt", description=BaseImageGenerationTool.NEGATIVE_PROMPT_DESCRIPTION): str, Literal( "image_file", description="The path to an image file to be used as a base to generate variations from.", @@ -61,8 +61,8 @@ def image_variation_from_file(self, params: dict[str, dict[str, str]]) -> ImageA "description": "Generates a variation of a given input image artifact in memory.", "schema": Schema( { - Literal("prompt", description=BaseImageGenerationClient.PROMPT_DESCRIPTION): str, - Literal("negative_prompt", description=BaseImageGenerationClient.NEGATIVE_PROMPT_DESCRIPTION): str, + Literal("prompt", description=BaseImageGenerationTool.PROMPT_DESCRIPTION): str, + Literal("negative_prompt", description=BaseImageGenerationTool.NEGATIVE_PROMPT_DESCRIPTION): str, "memory_name": str, "artifact_namespace": str, "artifact_name": str, diff --git a/griptape/tools/vector_store_client/__init__.py b/griptape/tools/vector_store/__init__.py similarity index 100% rename from griptape/tools/vector_store_client/__init__.py rename to griptape/tools/vector_store/__init__.py diff --git a/griptape/tools/vector_store_client/manifest.yml b/griptape/tools/vector_store/manifest.yml similarity index 100% rename from griptape/tools/vector_store_client/manifest.yml rename to griptape/tools/vector_store/manifest.yml diff --git a/griptape/tools/vector_store_client/requirements.txt b/griptape/tools/vector_store/requirements.txt similarity index 100% rename from griptape/tools/vector_store_client/requirements.txt rename to griptape/tools/vector_store/requirements.txt diff --git a/griptape/tools/vector_store_client/tool.py b/griptape/tools/vector_store/tool.py similarity index 98% rename from griptape/tools/vector_store_client/tool.py rename to griptape/tools/vector_store/tool.py index a0c638eef9..71902b1c7b 100644 --- a/griptape/tools/vector_store_client/tool.py +++ b/griptape/tools/vector_store/tool.py @@ -14,7 +14,7 @@ @define(kw_only=True) -class VectorStoreClient(BaseTool): +class VectorStoreTool(BaseTool): """A tool for querying a vector database. Attributes: diff --git a/griptape/tools/web_scraper/tool.py b/griptape/tools/web_scraper/tool.py index 782e85d372..c27aaa0660 100644 --- a/griptape/tools/web_scraper/tool.py +++ b/griptape/tools/web_scraper/tool.py @@ -10,7 +10,7 @@ @define -class WebScraper(BaseTool): +class WebScraperTool(BaseTool): web_loader: WebLoader = field(default=Factory(lambda: WebLoader()), kw_only=True) @activity( diff --git a/griptape/tools/web_search/tool.py b/griptape/tools/web_search/tool.py index 43f975acd9..557c26a523 100644 --- a/griptape/tools/web_search/tool.py +++ b/griptape/tools/web_search/tool.py @@ -14,7 +14,7 @@ @define -class WebSearch(BaseTool): +class WebSearchTool(BaseTool): web_search_driver: BaseWebSearchDriver = field(kw_only=True) @activity( diff --git a/mkdocs.yml b/mkdocs.yml index 175918e87d..0de7b6b8f1 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -129,8 +129,8 @@ nav: - Tools: - Overview: "griptape-tools/index.md" - Official Tools: - - AwsIamClient: "griptape-tools/official-tools/aws-iam-client.md" - - AwsS3Client: "griptape-tools/official-tools/aws-s3-client.md" + - AwsIamTool: "griptape-tools/official-tools/aws-iam-client.md" + - AwsS3Tool: "griptape-tools/official-tools/aws-s3-client.md" - Calculator: "griptape-tools/official-tools/calculator.md" - Computer: "griptape-tools/official-tools/computer.md" - DateTime: "griptape-tools/official-tools/date-time.md" @@ -145,7 +145,7 @@ nav: - RestApiClient: "griptape-tools/official-tools/rest-api-client.md" - SqlClient: "griptape-tools/official-tools/sql-client.md" - TaskMemoryClient: "griptape-tools/official-tools/task-memory-client.md" - - VectorStoreClient: "griptape-tools/official-tools/vector-store-client.md" + - VectorStoreTool: "griptape-tools/official-tools/vector-store-client.md" - WebScraper: "griptape-tools/official-tools/web-scraper.md" - WebSearch: "griptape-tools/official-tools/web-search.md" - PromptImageGenerationClient: "griptape-tools/official-tools/prompt-image-generation-client.md" @@ -154,7 +154,7 @@ nav: - OutpaintingImageGenerationClient: "griptape-tools/official-tools/outpainting-image-generation-client.md" - ImageQueryClient: "griptape-tools/official-tools/image-query-client.md" - TextToSpeechClient: "griptape-tools/official-tools/text-to-speech-client.md" - - AudioTranscriptionClient: "griptape-tools/official-tools/audio-transcription-client.md" + - AudioTranscriptionTool: "griptape-tools/official-tools/audio-transcription-client.md" - GriptapeCloudKnowledgeBaseClient: "griptape-tools/official-tools/griptape-cloud-knowledge-base-client.md" - RagClient: "griptape-tools/official-tools/rag-client.md" - Custom Tools: diff --git a/tests/integration/tasks/test_tool_task.py b/tests/integration/tasks/test_tool_task.py index aee0af1107..426dde995a 100644 --- a/tests/integration/tasks/test_tool_task.py +++ b/tests/integration/tasks/test_tool_task.py @@ -10,10 +10,10 @@ class TestToolTask: def structure_tester(self, request): from griptape.structures import Agent from griptape.tasks import ToolTask - from griptape.tools import Calculator + from griptape.tools import CalculatorTool return StructureTester( - Agent(tasks=[ToolTask(tool=Calculator())], conversation_memory=None, prompt_driver=request.param) + Agent(tasks=[ToolTask(tool=CalculatorTool())], conversation_memory=None, prompt_driver=request.param) ) def test_tool_task(self, structure_tester): diff --git a/tests/integration/tasks/test_toolkit_task.py b/tests/integration/tasks/test_toolkit_task.py index 8dfcfdc734..5cb1aa0dc7 100644 --- a/tests/integration/tasks/test_toolkit_task.py +++ b/tests/integration/tasks/test_toolkit_task.py @@ -14,18 +14,18 @@ def structure_tester(self, request): from griptape.drivers import GoogleWebSearchDriver from griptape.structures import Agent - from griptape.tools import TaskMemoryClient, WebScraper, WebSearch + from griptape.tools import TaskMemoryTool, WebScraperTool, WebSearchTool return StructureTester( Agent( tools=[ - WebSearch( + WebSearchTool( web_search_driver=GoogleWebSearchDriver( api_key=os.environ["GOOGLE_API_KEY"], search_id=os.environ["GOOGLE_API_SEARCH_ID"] ) ), - WebScraper(off_prompt=True), - TaskMemoryClient(off_prompt=False), + WebScraperTool(off_prompt=True), + TaskMemoryTool(off_prompt=False), ], conversation_memory=None, prompt_driver=request.param, diff --git a/tests/integration/tools/test_calculator.py b/tests/integration/tools/test_calculator.py index 2547b947d8..c209a9a2cb 100644 --- a/tests/integration/tools/test_calculator.py +++ b/tests/integration/tools/test_calculator.py @@ -11,9 +11,9 @@ class TestCalculator: ) def structure_tester(self, request): from griptape.structures import Agent - from griptape.tools import Calculator + from griptape.tools import CalculatorTool - return StructureTester(Agent(tools=[Calculator()], conversation_memory=None, prompt_driver=request.param)) + return StructureTester(Agent(tools=[CalculatorTool()], conversation_memory=None, prompt_driver=request.param)) def test_calculate(self, structure_tester): structure_tester.run("What is 7 times 3 divided by 5 plus 10.") diff --git a/tests/integration/tools/test_file_manager.py b/tests/integration/tools/test_file_manager.py index 8a283c6e85..4b52991755 100644 --- a/tests/integration/tools/test_file_manager.py +++ b/tests/integration/tools/test_file_manager.py @@ -11,9 +11,9 @@ class TestFileManager: ) def structure_tester(self, request): from griptape.structures import Agent - from griptape.tools import FileManager + from griptape.tools import FileManagerTool - return StructureTester(Agent(tools=[FileManager()], conversation_memory=None, prompt_driver=request.param)) + return StructureTester(Agent(tools=[FileManagerTool()], conversation_memory=None, prompt_driver=request.param)) def test_save_content_to_disk(self, structure_tester): structure_tester.run('Write the content "Hello World!" to a file called "poem.txt".') diff --git a/tests/integration/tools/test_google_docs_client.py b/tests/integration/tools/test_google_docs_client.py index 4d70aac17b..fb9c58ba83 100644 --- a/tests/integration/tools/test_google_docs_client.py +++ b/tests/integration/tools/test_google_docs_client.py @@ -13,12 +13,12 @@ class TestGoogleDocsClient: ) def structure_tester(self, request): from griptape.structures import Agent - from griptape.tools import GoogleDocsClient + from griptape.tools import GoogleDocsTool return StructureTester( Agent( tools=[ - GoogleDocsClient( + GoogleDocsTool( service_account_credentials={ "type": os.environ["GOOGLE_ACCOUNT_TYPE"], "project_id": os.environ["GOOGLE_PROJECT_ID"], diff --git a/tests/integration/tools/test_google_drive_client.py b/tests/integration/tools/test_google_drive_client.py index 23ebb1b328..50002e9c46 100644 --- a/tests/integration/tools/test_google_drive_client.py +++ b/tests/integration/tools/test_google_drive_client.py @@ -13,12 +13,12 @@ class TestGoogleDriveClient: ) def structure_tester(self, request): from griptape.structures import Agent - from griptape.tools import GoogleDriveClient + from griptape.tools import GoogleDriveTool return StructureTester( Agent( tools=[ - GoogleDriveClient( + GoogleDriveTool( service_account_credentials={ "type": os.environ["GOOGLE_ACCOUNT_TYPE"], "project_id": os.environ["GOOGLE_PROJECT_ID"], diff --git a/tests/unit/tools/test_aws_iam.py b/tests/unit/tools/test_aws_iam_tool.py similarity index 56% rename from tests/unit/tools/test_aws_iam.py rename to tests/unit/tools/test_aws_iam_tool.py index 54dbaa5fb9..fb2b1e3813 100644 --- a/tests/unit/tools/test_aws_iam.py +++ b/tests/unit/tools/test_aws_iam_tool.py @@ -1,11 +1,11 @@ import boto3 import pytest -from griptape.tools import AwsIamClient +from griptape.tools import AwsIamTool from tests.utils.aws import mock_aws_credentials -class TestAwsIamClient: +class TestAwsIamTool: @pytest.fixture(autouse=True) def _run_before_and_after_tests(self): mock_aws_credentials() @@ -14,18 +14,18 @@ def test_get_user_policy(self): value = {"user_name": "test_user", "policy_name": "test_policy"} assert ( "error returning policy document" - in AwsIamClient(session=boto3.Session()).get_user_policy({"values": value}).value + in AwsIamTool(session=boto3.Session()).get_user_policy({"values": value}).value ) def test_list_mfa_devices(self): - assert "error listing mfa devices" in AwsIamClient(session=boto3.Session()).list_mfa_devices({}).value + assert "error listing mfa devices" in AwsIamTool(session=boto3.Session()).list_mfa_devices({}).value def test_list_user_policies(self): value = {"user_name": "test_user"} assert ( "error listing iam user policies" - in AwsIamClient(session=boto3.Session()).list_user_policies({"values": value}).value + in AwsIamTool(session=boto3.Session()).list_user_policies({"values": value}).value ) def test_list_users(self): - assert "error listing s3 users" in AwsIamClient(session=boto3.Session()).list_users({}).value + assert "error listing s3 users" in AwsIamTool(session=boto3.Session()).list_users({}).value diff --git a/tests/unit/tools/test_aws_s3.py b/tests/unit/tools/test_aws_s3_tool.py similarity index 58% rename from tests/unit/tools/test_aws_s3.py rename to tests/unit/tools/test_aws_s3_tool.py index 5c6a4c1513..9c4c34e0b0 100644 --- a/tests/unit/tools/test_aws_s3.py +++ b/tests/unit/tools/test_aws_s3_tool.py @@ -1,42 +1,38 @@ import boto3 import pytest -from griptape.tools import AwsS3Client +from griptape.tools import AwsS3Tool from tests.utils.aws import mock_aws_credentials -class TestAwsS3Client: +class TestAwsS3Tool: @pytest.fixture(autouse=True) def _run_before_and_after_tests(self): mock_aws_credentials() def test_get_bucket_acl(self): value = {"bucket_name": "bucket_test"} - assert ( - "error getting bucket acl" in AwsS3Client(session=boto3.Session()).get_bucket_acl({"values": value}).value - ) + assert "error getting bucket acl" in AwsS3Tool(session=boto3.Session()).get_bucket_acl({"values": value}).value def test_get_bucket_policy(self): value = {"bucket_name": "bucket_test"} assert ( "error getting bucket policy" - in AwsS3Client(session=boto3.Session()).get_bucket_policy({"values": value}).value + in AwsS3Tool(session=boto3.Session()).get_bucket_policy({"values": value}).value ) def test_get_object_acl(self): value = {"bucket_name": "bucket_test", "object_key": "key_test"} - assert ( - "error getting object acl" in AwsS3Client(session=boto3.Session()).get_object_acl({"values": value}).value - ) + assert "error getting object acl" in AwsS3Tool(session=boto3.Session()).get_object_acl({"values": value}).value def test_list_s3_buckets(self): - assert "error listing s3 buckets" in AwsS3Client(session=boto3.Session()).list_s3_buckets({}).value + assert "error listing s3 buckets" in AwsS3Tool(session=boto3.Session()).list_s3_buckets({}).value def test_list_objects(self): value = {"bucket_name": "bucket_test"} assert ( "error listing objects in bucket" - in AwsS3Client(session=boto3.Session()).list_objects({"values": value}).value + in AwsS3Tool(session=boto3.Session()).list_objects({"values": value}).value ) def test_upload_memory_artifacts_to_s3(self): @@ -48,7 +44,7 @@ def test_upload_memory_artifacts_to_s3(self): } assert ( "memory not found" - in AwsS3Client(session=boto3.Session()).upload_memory_artifacts_to_s3({"values": value}).value + in AwsS3Tool(session=boto3.Session()).upload_memory_artifacts_to_s3({"values": value}).value ) def test_upload_content_to_s3(self): @@ -56,13 +52,12 @@ def test_upload_content_to_s3(self): assert ( "error uploading objects" - in AwsS3Client(session=boto3.Session()).upload_content_to_s3({"values": value}).value + in AwsS3Tool(session=boto3.Session()).upload_content_to_s3({"values": value}).value ) def test_download_objects(self): value = {"objects": {"bucket_name": "bucket_test", "object_key": "test.txt"}} assert ( - "error downloading objects" - in AwsS3Client(session=boto3.Session()).download_objects({"values": value}).value + "error downloading objects" in AwsS3Tool(session=boto3.Session()).download_objects({"values": value}).value ) diff --git a/tests/unit/tools/test_calculator.py b/tests/unit/tools/test_calculator.py index 72a5252109..e598867f9d 100644 --- a/tests/unit/tools/test_calculator.py +++ b/tests/unit/tools/test_calculator.py @@ -1,6 +1,6 @@ -from griptape.tools import Calculator +from griptape.tools import CalculatorTool class TestCalculator: def test_calculate(self): - assert Calculator().calculate({"values": {"expression": "5 * 5"}}).value == "25" + assert CalculatorTool().calculate({"values": {"expression": "5 * 5"}}).value == "25" diff --git a/tests/unit/tools/test_computer.py b/tests/unit/tools/test_computer.py index 95de18ae3c..1f6e5c7a6c 100644 --- a/tests/unit/tools/test_computer.py +++ b/tests/unit/tools/test_computer.py @@ -1,13 +1,13 @@ import pytest -from griptape.tools import Computer +from griptape.tools import ComputerTool from tests.mocks.docker.fake_api_client import make_fake_client class TestComputer: @pytest.fixture() def computer(self): - return Computer(docker_client=make_fake_client(), install_dependencies_on_init=False) + return ComputerTool(docker_client=make_fake_client(), install_dependencies_on_init=False) def test_execute_code(self, computer): assert computer.execute_code({"values": {"code": "print(1)", "filename": "foo.py"}}).value == "hello world" diff --git a/tests/unit/tools/test_date_time.py b/tests/unit/tools/test_date_time.py index c534ae69bf..9fa2ce4bbe 100644 --- a/tests/unit/tools/test_date_time.py +++ b/tests/unit/tools/test_date_time.py @@ -1,28 +1,28 @@ from datetime import datetime -from griptape.tools import DateTime +from griptape.tools import DateTimeTool class TestDateTime: def test_get_current_datetime(self): - result = DateTime().get_current_datetime({}) + result = DateTimeTool().get_current_datetime({}) time_delta = datetime.strptime(result.value, "%Y-%m-%d %H:%M:%S.%f") - datetime.now() assert abs(time_delta.total_seconds()) <= 1000 def test_get_past_relative_datetime(self): - result = DateTime().get_relative_datetime({"values": {"relative_date_string": "5 min ago"}}) + result = DateTimeTool().get_relative_datetime({"values": {"relative_date_string": "5 min ago"}}) time_delta = datetime.strptime(result.value, "%Y-%m-%d %H:%M:%S.%f") - datetime.now() assert abs(time_delta.total_seconds()) <= 1000 - result = DateTime().get_relative_datetime({"values": {"relative_date_string": "2 min ago, 12 seconds"}}) + result = DateTimeTool().get_relative_datetime({"values": {"relative_date_string": "2 min ago, 12 seconds"}}) time_delta = datetime.strptime(result.value, "%Y-%m-%d %H:%M:%S.%f") - datetime.now() assert abs(time_delta.total_seconds()) <= 1000 def test_get_future_relative_datetime(self): - result = DateTime().get_relative_datetime({"values": {"relative_date_string": "in 1 min, 36 seconds"}}) + result = DateTimeTool().get_relative_datetime({"values": {"relative_date_string": "in 1 min, 36 seconds"}}) time_delta = datetime.strptime(result.value, "%Y-%m-%d %H:%M:%S.%f") - datetime.now() assert abs(time_delta.total_seconds()) <= 1000 def test_get_invalid_relative_datetime(self): - result = DateTime().get_relative_datetime({"values": {"relative_date_string": "3 days from now"}}) + result = DateTimeTool().get_relative_datetime({"values": {"relative_date_string": "3 days from now"}}) assert result.type == "ErrorArtifact" diff --git a/tests/unit/tools/test_email_client.py b/tests/unit/tools/test_email_tool.py similarity index 94% rename from tests/unit/tools/test_email_client.py rename to tests/unit/tools/test_email_tool.py index cf99009b8a..c15d8ca6df 100644 --- a/tests/unit/tools/test_email_client.py +++ b/tests/unit/tools/test_email_tool.py @@ -2,14 +2,14 @@ from griptape.artifacts import ErrorArtifact, InfoArtifact, ListArtifact, TextArtifact from griptape.loaders.email_loader import EmailLoader -from griptape.tools import EmailClient +from griptape.tools import EmailTool class TestEmailClient: @pytest.fixture(autouse=True) def mock_email_loader(self, mocker): mock_email_loader = mocker.patch( - "griptape.tools.email_client.tool.EmailLoader", + "griptape.tools.email.tool.EmailLoader", EmailQuery=EmailLoader.EmailQuery, # Prevents mocking the nested EmailQuery class ).return_value mock_email_loader.load.return_value = ListArtifact([TextArtifact("fake-email-content")]) @@ -29,7 +29,7 @@ def mock_smtp_ssl(self, mocker): @pytest.fixture() def client(self): - return EmailClient( + return EmailTool( username="fake-username", password="fake-password", smtp_host="foobar.com", @@ -63,7 +63,7 @@ def test_retrieve(self, client, mock_email_loader, values, query): def test_retrieve_when_email_max_retrieve_count_set(self, mock_email_loader): # Given - client = EmailClient(email_max_retrieve_count=84, mailboxes={"INBOX": "default mailbox for incoming email"}) + client = EmailTool(email_max_retrieve_count=84, mailboxes={"INBOX": "default mailbox for incoming email"}) # When client.retrieve({"values": {"label": "fake-label"}}) @@ -91,7 +91,7 @@ def test_send(self, client, send_params): def test_send_when_smtp_overrides_set(self, send_params): # Given - client = EmailClient( + client = EmailTool( smtp_host="smtp-host", smtp_port=86, smtp_use_ssl=False, diff --git a/tests/unit/tools/test_file_manager.py b/tests/unit/tools/test_file_manager.py index 57dd2c83ec..dccf2f1a2d 100644 --- a/tests/unit/tools/test_file_manager.py +++ b/tests/unit/tools/test_file_manager.py @@ -9,14 +9,14 @@ from griptape.artifacts.error_artifact import ErrorArtifact from griptape.drivers.file_manager.local_file_manager_driver import LocalFileManagerDriver from griptape.loaders.text_loader import TextLoader -from griptape.tools import FileManager +from griptape.tools import FileManagerTool from tests.utils import defaults class TestFileManager: @pytest.fixture() def file_manager(self): - return FileManager( + return FileManagerTool( input_memory=[defaults.text_task_memory("Memory1")], file_manager_driver=LocalFileManagerDriver(workdir=os.path.abspath(os.path.dirname(__file__))), ) @@ -47,7 +47,7 @@ def test_load_files_from_disk_with_encoding(self, file_manager): assert isinstance(result.value[0], TextArtifact) def test_load_files_from_disk_with_encoding_failure(self): - file_manager = FileManager( + file_manager = FileManagerTool( file_manager_driver=LocalFileManagerDriver( default_loader=TextLoader(encoding="utf-8"), loaders={}, @@ -65,7 +65,9 @@ def test_save_memory_artifacts_to_disk_for_one_artifact(self, temp_dir): memory.store_artifact("foobar", artifact) - file_manager = FileManager(input_memory=[memory], file_manager_driver=LocalFileManagerDriver(workdir=temp_dir)) + file_manager = FileManagerTool( + input_memory=[memory], file_manager_driver=LocalFileManagerDriver(workdir=temp_dir) + ) result = file_manager.save_memory_artifacts_to_disk( { "values": { @@ -88,7 +90,9 @@ def test_save_memory_artifacts_to_disk_for_multiple_artifacts(self, temp_dir): for a in artifacts: memory.store_artifact("foobar", a) - file_manager = FileManager(input_memory=[memory], file_manager_driver=LocalFileManagerDriver(workdir=temp_dir)) + file_manager = FileManagerTool( + input_memory=[memory], file_manager_driver=LocalFileManagerDriver(workdir=temp_dir) + ) result = file_manager.save_memory_artifacts_to_disk( { "values": { @@ -105,7 +109,7 @@ def test_save_memory_artifacts_to_disk_for_multiple_artifacts(self, temp_dir): assert result.value == "Successfully saved memory artifacts to disk" def test_save_content_to_file(self, temp_dir): - file_manager = FileManager(file_manager_driver=LocalFileManagerDriver(workdir=temp_dir)) + file_manager = FileManagerTool(file_manager_driver=LocalFileManagerDriver(workdir=temp_dir)) result = file_manager.save_content_to_file( {"values": {"path": os.path.join("test", "foobar.txt"), "content": "foobar"}} ) @@ -114,7 +118,7 @@ def test_save_content_to_file(self, temp_dir): assert result.value == "Successfully saved file" def test_save_content_to_file_with_encoding(self, temp_dir): - file_manager = FileManager( + file_manager = FileManagerTool( file_manager_driver=LocalFileManagerDriver(default_loader=TextLoader(encoding="utf-8"), workdir=temp_dir) ) result = file_manager.save_content_to_file( @@ -125,7 +129,7 @@ def test_save_content_to_file_with_encoding(self, temp_dir): assert result.value == "Successfully saved file" def test_save_and_load_content_to_file_with_encoding(self, temp_dir): - file_manager = FileManager( + file_manager = FileManagerTool( file_manager_driver=LocalFileManagerDriver(loaders={"txt": TextLoader(encoding="ascii")}, workdir=temp_dir) ) result = file_manager.save_content_to_file( @@ -135,7 +139,7 @@ def test_save_and_load_content_to_file_with_encoding(self, temp_dir): assert Path(os.path.join(temp_dir, "test", "foobar.txt")).read_text() == "foobar" assert result.value == "Successfully saved file" - file_manager = FileManager( + file_manager = FileManagerTool( file_manager_driver=LocalFileManagerDriver( default_loader=TextLoader(encoding="ascii"), loaders={}, workdir=temp_dir ) diff --git a/tests/unit/tools/test_google_docs_client.py b/tests/unit/tools/test_google_docs_tool.py similarity index 87% rename from tests/unit/tools/test_google_docs_client.py rename to tests/unit/tools/test_google_docs_tool.py index a42fddda32..1d954fdf7f 100644 --- a/tests/unit/tools/test_google_docs_client.py +++ b/tests/unit/tools/test_google_docs_tool.py @@ -4,9 +4,9 @@ class TestGoogleDocsClient: @pytest.fixture() def mock_docs_client(self): - from griptape.tools import GoogleDocsClient + from griptape.tools import GoogleDocsTool - return GoogleDocsClient(owner_email="tony@griptape.ai", service_account_credentials={}) + return GoogleDocsTool(owner_email="tony@griptape.ai", service_account_credentials={}) def test_append_text(self, mock_docs_client): params = {"file_path": "test_folder/test_document", "text": "Appending this text"} diff --git a/tests/unit/tools/test_google_drive_client.py b/tests/unit/tools/test_google_drive_tool.py similarity index 69% rename from tests/unit/tools/test_google_drive_client.py rename to tests/unit/tools/test_google_drive_tool.py index 55f3c168ff..dcaac4772e 100644 --- a/tests/unit/tools/test_google_drive_client.py +++ b/tests/unit/tools/test_google_drive_tool.py @@ -1,11 +1,11 @@ from griptape.artifacts import ErrorArtifact -from griptape.tools import GoogleDriveClient +from griptape.tools import GoogleDriveTool class TestGoogleDriveClient: def test_list_files(self): value = {"folder_path": "root"} # This can be any folder path you want to test - result = GoogleDriveClient(owner_email="tony@griptape.ai", service_account_credentials={}).list_files( + result = GoogleDriveTool(owner_email="tony@griptape.ai", service_account_credentials={}).list_files( {"values": value} ) @@ -14,16 +14,16 @@ def test_list_files(self): def test_save_content_to_drive(self): value = {"path": "/path/to/your/file.txt", "content": "Sample content for the file."} - result = GoogleDriveClient( - owner_email="tony@griptape.ai", service_account_credentials={} - ).save_content_to_drive({"values": value}) + result = GoogleDriveTool(owner_email="tony@griptape.ai", service_account_credentials={}).save_content_to_drive( + {"values": value} + ) assert isinstance(result, ErrorArtifact) assert "error saving file to Google Drive" in result.value def test_download_files(self): value = {"file_paths": ["example_folder/example_file.txt"]} - result = GoogleDriveClient(owner_email="tony@griptape.ai", service_account_credentials={}).download_files( + result = GoogleDriveTool(owner_email="tony@griptape.ai", service_account_credentials={}).download_files( {"values": value} ) @@ -33,7 +33,7 @@ def test_download_files(self): def test_search_files(self): value = {"search_mode": "name", "file_name": "search_file_name.txt"} - result = GoogleDriveClient(owner_email="tony@griptape.ai", service_account_credentials={}).search_files( + result = GoogleDriveTool(owner_email="tony@griptape.ai", service_account_credentials={}).search_files( {"values": value} ) @@ -43,7 +43,7 @@ def test_search_files(self): def test_share_file(self): value = {"file_path": "/path/to/your/file.txt", "email_address": "sample_email@example.com", "role": "reader"} - result = GoogleDriveClient(owner_email="tony@griptape.ai", service_account_credentials={}).share_file( + result = GoogleDriveTool(owner_email="tony@griptape.ai", service_account_credentials={}).share_file( {"values": value} ) diff --git a/tests/unit/tools/test_google_gmail_client.py b/tests/unit/tools/test_google_gmail_tool.py similarity index 68% rename from tests/unit/tools/test_google_gmail_client.py rename to tests/unit/tools/test_google_gmail_tool.py index 7dcf1de384..cc9b907ae2 100644 --- a/tests/unit/tools/test_google_gmail_client.py +++ b/tests/unit/tools/test_google_gmail_tool.py @@ -1,4 +1,4 @@ -from griptape.tools import GoogleGmailClient +from griptape.tools import GoogleGmailTool class TestGoogleGmailClient: @@ -6,7 +6,7 @@ def test_create_draft_email(self): value = {"subject": "stacey's mom", "from": "test@test.com", "body": "got it going on"} assert ( "error creating draft email" - in GoogleGmailClient(service_account_credentials={}, owner_email="tony@griptape.ai") + in GoogleGmailTool(service_account_credentials={}, owner_email="tony@griptape.ai") .create_draft_email({"values": value}) .value ) diff --git a/tests/unit/tools/test_griptape_cloud_knowledge_base_client.py b/tests/unit/tools/test_griptape_cloud_knowledge_base_tool.py similarity index 87% rename from tests/unit/tools/test_griptape_cloud_knowledge_base_client.py rename to tests/unit/tools/test_griptape_cloud_knowledge_base_tool.py index 7d75d8670c..711f4f1742 100644 --- a/tests/unit/tools/test_griptape_cloud_knowledge_base_client.py +++ b/tests/unit/tools/test_griptape_cloud_knowledge_base_tool.py @@ -7,7 +7,7 @@ class TestGriptapeCloudKnowledgeBaseClient: @pytest.fixture() def client(self, mocker): - from griptape.tools import GriptapeCloudKnowledgeBaseClient + from griptape.tools import GriptapeCloudKnowledgeBaseTool mock_response = mocker.Mock() mock_response.status_code = 201 @@ -19,45 +19,45 @@ def client(self, mocker): mock_response.json.return_value = {"description": "fizz buzz"} mocker.patch("requests.get", return_value=mock_response) - return GriptapeCloudKnowledgeBaseClient( + return GriptapeCloudKnowledgeBaseTool( base_url="https://api.griptape.ai", api_key="foo bar", knowledge_base_id="1" ) @pytest.fixture() def client_no_description(self, mocker): - from griptape.tools import GriptapeCloudKnowledgeBaseClient + from griptape.tools import GriptapeCloudKnowledgeBaseTool mock_response = mocker.Mock() mock_response.json.return_value = {} mock_response.status_code = 200 mocker.patch("requests.get", return_value=mock_response) - return GriptapeCloudKnowledgeBaseClient( + return GriptapeCloudKnowledgeBaseTool( base_url="https://api.griptape.ai", api_key="foo bar", knowledge_base_id="1" ) @pytest.fixture() def client_kb_not_found(self, mocker): - from griptape.tools import GriptapeCloudKnowledgeBaseClient + from griptape.tools import GriptapeCloudKnowledgeBaseTool mock_response = mocker.Mock() mock_response.json.return_value = {} mock_response.status_code = 404 mocker.patch("requests.get", return_value=mock_response) - return GriptapeCloudKnowledgeBaseClient( + return GriptapeCloudKnowledgeBaseTool( base_url="https://api.griptape.ai", api_key="foo bar", knowledge_base_id="1" ) @pytest.fixture() def client_kb_error(self, mocker): - from griptape.tools import GriptapeCloudKnowledgeBaseClient + from griptape.tools import GriptapeCloudKnowledgeBaseTool mock_response = mocker.Mock() mock_response.status_code = 500 mocker.patch("requests.post", return_value=mock_response, side_effect=exceptions.RequestException("error")) - return GriptapeCloudKnowledgeBaseClient( + return GriptapeCloudKnowledgeBaseTool( base_url="https://api.griptape.ai", api_key="foo bar", knowledge_base_id="1" ) diff --git a/tests/unit/tools/test_inpainting_image_generation_client.py b/tests/unit/tools/test_inpainting_image_generation_tool.py similarity index 88% rename from tests/unit/tools/test_inpainting_image_generation_client.py rename to tests/unit/tools/test_inpainting_image_generation_tool.py index 0c5e49f9a7..6a383c836e 100644 --- a/tests/unit/tools/test_inpainting_image_generation_client.py +++ b/tests/unit/tools/test_inpainting_image_generation_tool.py @@ -6,7 +6,7 @@ import pytest from griptape.artifacts import ImageArtifact -from griptape.tools import InpaintingImageGenerationClient +from griptape.tools import InpaintingImageGenerationTool class TestInpaintingImageGenerationClient: @@ -26,12 +26,12 @@ def image_loader(self) -> Mock: return loader @pytest.fixture() - def image_generator(self, image_generation_engine, image_loader) -> InpaintingImageGenerationClient: - return InpaintingImageGenerationClient(engine=image_generation_engine, image_loader=image_loader) + def image_generator(self, image_generation_engine, image_loader) -> InpaintingImageGenerationTool: + return InpaintingImageGenerationTool(engine=image_generation_engine, image_loader=image_loader) def test_validate_output_configs(self, image_generation_engine) -> None: with pytest.raises(ValueError): - InpaintingImageGenerationClient(engine=image_generation_engine, output_dir="test", output_file="test") + InpaintingImageGenerationTool(engine=image_generation_engine, output_dir="test", output_file="test") def test_image_inpainting(self, image_generator, path_from_resource_path) -> None: image_generator.engine.run.return_value = Mock( @@ -55,7 +55,7 @@ def test_image_inpainting_with_outfile( self, image_generation_engine, image_loader, path_from_resource_path ) -> None: outfile = f"{tempfile.gettempdir()}/{str(uuid.uuid4())}.png" - image_generator = InpaintingImageGenerationClient( + image_generator = InpaintingImageGenerationTool( engine=image_generation_engine, output_file=outfile, image_loader=image_loader ) @@ -78,7 +78,7 @@ def test_image_inpainting_with_outfile( assert os.path.exists(outfile) def test_image_inpainting_from_memory(self, image_generation_engine, image_artifact): - image_generator = InpaintingImageGenerationClient(engine=image_generation_engine) + image_generator = InpaintingImageGenerationTool(engine=image_generation_engine) memory = Mock() memory.load_artifacts = Mock(return_value=[image_artifact]) image_generator.find_input_memory = Mock(return_value=memory) diff --git a/tests/unit/tools/test_openweather_client.py b/tests/unit/tools/test_openweather_tool.py similarity index 92% rename from tests/unit/tools/test_openweather_client.py rename to tests/unit/tools/test_openweather_tool.py index 89b80e1648..44acaf5711 100644 --- a/tests/unit/tools/test_openweather_client.py +++ b/tests/unit/tools/test_openweather_tool.py @@ -3,12 +3,12 @@ import pytest from griptape.artifacts import ErrorArtifact -from griptape.tools import OpenWeatherClient +from griptape.tools import OpenWeatherTool @pytest.fixture() def client(): - return OpenWeatherClient(api_key="YOUR_API_KEY") + return OpenWeatherTool(api_key="YOUR_API_KEY") class MockResponse: @@ -21,9 +21,9 @@ def json(self): def mock_requests_get(*args, **kwargs): - if args[0] == OpenWeatherClient.GEOCODING_URL: + if args[0] == OpenWeatherTool.GEOCODING_URL: return MockResponse([{"lat": 40.7128, "lon": -74.0061}], 200) - elif args[0] == OpenWeatherClient.BASE_URL: + elif args[0] == OpenWeatherTool.BASE_URL: return MockResponse({"weather": "sunny"}, 200) return MockResponse(None, 404) diff --git a/tests/unit/tools/test_outpainting_image_variation_client.py b/tests/unit/tools/test_outpainting_image_variation_tool.py similarity index 88% rename from tests/unit/tools/test_outpainting_image_variation_client.py rename to tests/unit/tools/test_outpainting_image_variation_tool.py index 13d8df0822..0db59d9245 100644 --- a/tests/unit/tools/test_outpainting_image_variation_client.py +++ b/tests/unit/tools/test_outpainting_image_variation_tool.py @@ -6,7 +6,7 @@ import pytest from griptape.artifacts import ImageArtifact -from griptape.tools import OutpaintingImageGenerationClient +from griptape.tools import OutpaintingImageGenerationTool class TestOutpaintingImageGenerationClient: @@ -26,12 +26,12 @@ def image_loader(self, image_artifact) -> Mock: return loader @pytest.fixture() - def image_generator(self, image_generation_engine, image_loader) -> OutpaintingImageGenerationClient: - return OutpaintingImageGenerationClient(engine=image_generation_engine, image_loader=image_loader) + def image_generator(self, image_generation_engine, image_loader) -> OutpaintingImageGenerationTool: + return OutpaintingImageGenerationTool(engine=image_generation_engine, image_loader=image_loader) def test_validate_output_configs(self, image_generation_engine) -> None: with pytest.raises(ValueError): - OutpaintingImageGenerationClient(engine=image_generation_engine, output_dir="test", output_file="test") + OutpaintingImageGenerationTool(engine=image_generation_engine, output_dir="test", output_file="test") def test_image_outpainting(self, image_generator, path_from_resource_path) -> None: image_generator.engine.run.return_value = Mock( @@ -55,7 +55,7 @@ def test_image_outpainting_with_outfile( self, image_generation_engine, image_loader, path_from_resource_path ) -> None: outfile = f"{tempfile.gettempdir()}/{str(uuid.uuid4())}.png" - image_generator = OutpaintingImageGenerationClient( + image_generator = OutpaintingImageGenerationTool( engine=image_generation_engine, output_file=outfile, image_loader=image_loader ) @@ -78,7 +78,7 @@ def test_image_outpainting_with_outfile( assert os.path.exists(outfile) def test_image_outpainting_from_memory(self, image_generation_engine, image_artifact): - image_generator = OutpaintingImageGenerationClient(engine=image_generation_engine) + image_generator = OutpaintingImageGenerationTool(engine=image_generation_engine) memory = Mock() memory.load_artifacts = Mock(return_value=[image_artifact]) image_generator.find_input_memory = Mock(return_value=memory) diff --git a/tests/unit/tools/test_prompt_image_generation_client.py b/tests/unit/tools/test_prompt_image_generation_tool.py similarity index 79% rename from tests/unit/tools/test_prompt_image_generation_client.py rename to tests/unit/tools/test_prompt_image_generation_tool.py index 276e334737..9a69aa89a3 100644 --- a/tests/unit/tools/test_prompt_image_generation_client.py +++ b/tests/unit/tools/test_prompt_image_generation_tool.py @@ -5,7 +5,7 @@ import pytest -from griptape.tools import PromptImageGenerationClient +from griptape.tools import PromptImageGenerationTool class TestPromptImageGenerationClient: @@ -14,12 +14,12 @@ def image_generation_engine(self) -> Mock: return Mock() @pytest.fixture() - def image_generator(self, image_generation_engine) -> PromptImageGenerationClient: - return PromptImageGenerationClient(engine=image_generation_engine) + def image_generator(self, image_generation_engine) -> PromptImageGenerationTool: + return PromptImageGenerationTool(engine=image_generation_engine) def test_validate_output_configs(self, image_generation_engine) -> None: with pytest.raises(ValueError): - PromptImageGenerationClient(engine=image_generation_engine, output_dir="test", output_file="test") + PromptImageGenerationTool(engine=image_generation_engine, output_dir="test", output_file="test") def test_generate_image(self, image_generator) -> None: image_generator.engine.run.return_value = Mock( @@ -34,7 +34,7 @@ def test_generate_image(self, image_generator) -> None: def test_generate_image_with_outfile(self, image_generation_engine) -> None: outfile = f"{tempfile.gettempdir()}/{str(uuid.uuid4())}.png" - image_generator = PromptImageGenerationClient(engine=image_generation_engine, output_file=outfile) + image_generator = PromptImageGenerationTool(engine=image_generation_engine, output_file=outfile) image_generator.engine.run.return_value = Mock( # pyright: ignore[reportFunctionMemberAccess] value=b"image data", format="png", width=512, height=512, model="test model", prompt="test prompt" diff --git a/tests/unit/tools/test_rag_client.py b/tests/unit/tools/test_rag_tool.py similarity index 75% rename from tests/unit/tools/test_rag_client.py rename to tests/unit/tools/test_rag_tool.py index 60a0df722f..e5a82dda14 100644 --- a/tests/unit/tools/test_rag_client.py +++ b/tests/unit/tools/test_rag_tool.py @@ -1,5 +1,5 @@ from griptape.drivers import LocalVectorStoreDriver -from griptape.tools import RagClient +from griptape.tools import RagTool from tests.mocks.mock_embedding_driver import MockEmbeddingDriver from tests.mocks.mock_prompt_driver import MockPromptDriver from tests.utils.defaults import rag_engine @@ -8,6 +8,6 @@ class TestRagClient: def test_search(self): vector_store_driver = LocalVectorStoreDriver(embedding_driver=MockEmbeddingDriver()) - tool = RagClient(description="Test", rag_engine=rag_engine(MockPromptDriver(), vector_store_driver)) + tool = RagTool(description="Test", rag_engine=rag_engine(MockPromptDriver(), vector_store_driver)) assert tool.search({"values": {"query": "test"}}).value[0].value == "mock output" diff --git a/tests/unit/tools/test_rest_api_client.py b/tests/unit/tools/test_rest_api_tool.py similarity index 92% rename from tests/unit/tools/test_rest_api_client.py rename to tests/unit/tools/test_rest_api_tool.py index 58f21d1f15..70d63478ee 100644 --- a/tests/unit/tools/test_rest_api_client.py +++ b/tests/unit/tools/test_rest_api_tool.py @@ -6,9 +6,9 @@ class TestRestApi: @pytest.fixture() def client(self): - from griptape.tools import RestApiClient + from griptape.tools import RestApiTool - return RestApiClient(base_url="http://www.griptape.ai", description="Griptape website.") + return RestApiTool(base_url="http://www.griptape.ai", description="Griptape website.") def test_put(self, client): assert isinstance(client.post({"values": {"body": {}}}), BaseArtifact) diff --git a/tests/unit/tools/test_sql_client.py b/tests/unit/tools/test_sql_tool.py similarity index 89% rename from tests/unit/tools/test_sql_client.py rename to tests/unit/tools/test_sql_tool.py index 8ab61fc8f0..79f3d3378f 100644 --- a/tests/unit/tools/test_sql_client.py +++ b/tests/unit/tools/test_sql_tool.py @@ -4,7 +4,7 @@ from griptape.drivers import SqlDriver from griptape.loaders import SqlLoader -from griptape.tools import SqlClient +from griptape.tools import SqlTool class TestSqlClient: @@ -22,14 +22,14 @@ def driver(self): def test_execute_query(self, driver): with sqlite3.connect(":memory:"): - client = SqlClient(sql_loader=SqlLoader(sql_driver=driver), table_name="test_table", engine_name="sqlite") + client = SqlTool(sql_loader=SqlLoader(sql_driver=driver), table_name="test_table", engine_name="sqlite") result = client.execute_query({"values": {"sql_query": "SELECT * from test_table;"}}) assert len(result.value) == 1 assert result.value[0].value == {"id": 1, "name": "Alice", "age": 25, "city": "New York"} def test_execute_query_description(self, driver): - client = SqlClient( + client = SqlTool( sql_loader=SqlLoader(sql_driver=driver), table_name="test_table", table_description="foobar", diff --git a/tests/unit/tools/test_structure_run_client.py b/tests/unit/tools/test_structure_run_tool.py similarity index 79% rename from tests/unit/tools/test_structure_run_client.py rename to tests/unit/tools/test_structure_run_tool.py index ee76d4da17..3e68e01839 100644 --- a/tests/unit/tools/test_structure_run_client.py +++ b/tests/unit/tools/test_structure_run_tool.py @@ -2,7 +2,8 @@ from griptape.drivers.structure_run.local_structure_run_driver import LocalStructureRunDriver from griptape.structures import Agent -from griptape.tools import StructureRunClient +from griptape.tools import StructureRunTool +from tests.mocks.mock_prompt_driver import MockPromptDriver class TestStructureRunClient: @@ -10,7 +11,7 @@ class TestStructureRunClient: def client(self): agent = Agent() - return StructureRunClient( + return StructureRunTool( description="foo bar", driver=LocalStructureRunDriver(structure_factory_fn=lambda: agent) ) diff --git a/tests/unit/tools/test_task_memory_client.py b/tests/unit/tools/test_task_memory_tool.py similarity index 83% rename from tests/unit/tools/test_task_memory_client.py rename to tests/unit/tools/test_task_memory_tool.py index 4276b89ec5..33aa394bc7 100644 --- a/tests/unit/tools/test_task_memory_client.py +++ b/tests/unit/tools/test_task_memory_tool.py @@ -1,14 +1,14 @@ import pytest from griptape.artifacts import TextArtifact -from griptape.tools import TaskMemoryClient +from griptape.tools import TaskMemoryTool from tests.utils import defaults class TestTaskMemoryClient: @pytest.fixture() def tool(self): - return TaskMemoryClient(off_prompt=True, input_memory=[defaults.text_task_memory("TestMemory")]) + return TaskMemoryTool(off_prompt=True, input_memory=[defaults.text_task_memory("TestMemory")]) def test_summarize(self, tool): tool.input_memory[0].store_artifact("foo", TextArtifact("test")) diff --git a/tests/unit/tools/test_text_to_speech_client.py b/tests/unit/tools/test_text_to_speech_tool.py similarity index 76% rename from tests/unit/tools/test_text_to_speech_client.py rename to tests/unit/tools/test_text_to_speech_tool.py index 0b9061aa6d..a3926d45e1 100644 --- a/tests/unit/tools/test_text_to_speech_client.py +++ b/tests/unit/tools/test_text_to_speech_tool.py @@ -5,7 +5,7 @@ import pytest -from griptape.tools.text_to_speech_client.tool import TextToSpeechClient +from griptape.tools.text_to_speech.tool import TextToSpeechTool class TestTextToSpeechClient: @@ -14,12 +14,12 @@ def text_to_speech_engine(self) -> Mock: return Mock() @pytest.fixture() - def text_to_speech_client(self, text_to_speech_engine) -> TextToSpeechClient: - return TextToSpeechClient(engine=text_to_speech_engine) + def text_to_speech_client(self, text_to_speech_engine) -> TextToSpeechTool: + return TextToSpeechTool(engine=text_to_speech_engine) def test_validate_output_configs(self, text_to_speech_engine) -> None: with pytest.raises(ValueError): - TextToSpeechClient(engine=text_to_speech_engine, output_dir="test", output_file="test") + TextToSpeechTool(engine=text_to_speech_engine, output_dir="test", output_file="test") def test_text_to_speech(self, text_to_speech_client) -> None: text_to_speech_client.engine.run.return_value = Mock(value=b"audio data", format="mp3") @@ -30,7 +30,7 @@ def test_text_to_speech(self, text_to_speech_client) -> None: def test_text_to_speech_with_outfile(self, text_to_speech_engine) -> None: outfile = f"{tempfile.gettempdir()}/{str(uuid.uuid4())}.mp3" - text_to_speech_client = TextToSpeechClient(engine=text_to_speech_engine, output_file=outfile) + text_to_speech_client = TextToSpeechTool(engine=text_to_speech_engine, output_file=outfile) text_to_speech_client.engine.run.return_value = Mock(value=b"audio data", format="mp3") # pyright: ignore[reportFunctionMemberAccess] diff --git a/tests/unit/tools/test_transcription_client.py b/tests/unit/tools/test_transcription_tool.py similarity index 84% rename from tests/unit/tools/test_transcription_client.py rename to tests/unit/tools/test_transcription_tool.py index 8b54e891b2..44201636f4 100644 --- a/tests/unit/tools/test_transcription_client.py +++ b/tests/unit/tools/test_transcription_tool.py @@ -3,7 +3,7 @@ import pytest from griptape.artifacts import AudioArtifact -from griptape.tools.audio_transcription_client.tool import AudioTranscriptionClient +from griptape.tools.audio_transcription.tool import AudioTranscriptionTool class TestTranscriptionClient: @@ -27,11 +27,11 @@ def mock_path(self, mocker) -> Mock: return mocker def test_init_transcription_client(self, transcription_engine, audio_loader) -> None: - assert AudioTranscriptionClient(engine=transcription_engine, audio_loader=audio_loader) + assert AudioTranscriptionTool(engine=transcription_engine, audio_loader=audio_loader) @patch("builtins.open", mock_open(read_data=b"audio data")) def test_transcribe_audio_from_disk(self, transcription_engine, audio_loader) -> None: - client = AudioTranscriptionClient(engine=transcription_engine, audio_loader=audio_loader) + client = AudioTranscriptionTool(engine=transcription_engine, audio_loader=audio_loader) client.engine.run.return_value = Mock(value="transcription") # pyright: ignore[reportFunctionMemberAccess] text_artifact = client.transcribe_audio_from_disk(params={"values": {"path": "audio.wav"}}) @@ -40,7 +40,7 @@ def test_transcribe_audio_from_disk(self, transcription_engine, audio_loader) -> assert text_artifact.value == "transcription" def test_transcribe_audio_from_memory(self, transcription_engine, audio_loader) -> None: - client = AudioTranscriptionClient(engine=transcription_engine, audio_loader=audio_loader) + client = AudioTranscriptionTool(engine=transcription_engine, audio_loader=audio_loader) memory = Mock() memory.load_artifacts = Mock(return_value=[AudioArtifact(value=b"audio data", format="wav", name="name")]) client.find_input_memory = Mock(return_value=memory) diff --git a/tests/unit/tools/test_variation_image_generation_client.py b/tests/unit/tools/test_variation_image_generation_tool.py similarity index 89% rename from tests/unit/tools/test_variation_image_generation_client.py rename to tests/unit/tools/test_variation_image_generation_tool.py index 0db454f922..22eb6da8af 100644 --- a/tests/unit/tools/test_variation_image_generation_client.py +++ b/tests/unit/tools/test_variation_image_generation_tool.py @@ -6,7 +6,7 @@ import pytest from griptape.artifacts import ImageArtifact -from griptape.tools import VariationImageGenerationClient +from griptape.tools import VariationImageGenerationTool class TestVariationImageGenerationClient: @@ -26,12 +26,12 @@ def image_loader(self) -> Mock: return loader @pytest.fixture() - def image_generator(self, image_generation_engine, image_loader) -> VariationImageGenerationClient: - return VariationImageGenerationClient(engine=image_generation_engine, image_loader=image_loader) + def image_generator(self, image_generation_engine, image_loader) -> VariationImageGenerationTool: + return VariationImageGenerationTool(engine=image_generation_engine, image_loader=image_loader) def test_validate_output_configs(self, image_generation_engine, image_loader) -> None: with pytest.raises(ValueError): - VariationImageGenerationClient( + VariationImageGenerationTool( engine=image_generation_engine, output_dir="test", output_file="test", image_loader=image_loader ) @@ -54,7 +54,7 @@ def test_image_variation(self, image_generator, path_from_resource_path) -> None def test_image_variation_with_outfile(self, image_generation_engine, image_loader, path_from_resource_path) -> None: outfile = f"{tempfile.gettempdir()}/{str(uuid.uuid4())}.png" - image_generator = VariationImageGenerationClient( + image_generator = VariationImageGenerationTool( engine=image_generation_engine, output_file=outfile, image_loader=image_loader ) @@ -76,7 +76,7 @@ def test_image_variation_with_outfile(self, image_generation_engine, image_loade assert os.path.exists(outfile) def test_image_variation_from_memory(self, image_generation_engine, image_artifact): - image_generator = VariationImageGenerationClient(engine=image_generation_engine) + image_generator = VariationImageGenerationTool(engine=image_generation_engine) memory = Mock() memory.load_artifacts = Mock(return_value=[image_artifact]) image_generator.find_input_memory = Mock(return_value=memory) diff --git a/tests/unit/tools/test_vector_store_client.py b/tests/unit/tools/test_vector_store_tool.py similarity index 78% rename from tests/unit/tools/test_vector_store_client.py rename to tests/unit/tools/test_vector_store_tool.py index b02dda2266..ea52a13ea3 100644 --- a/tests/unit/tools/test_vector_store_client.py +++ b/tests/unit/tools/test_vector_store_tool.py @@ -2,18 +2,18 @@ from griptape.artifacts import ListArtifact, TextArtifact from griptape.drivers import LocalVectorStoreDriver -from griptape.tools import VectorStoreClient +from griptape.tools import VectorStoreTool from tests.mocks.mock_embedding_driver import MockEmbeddingDriver -class TestVectorStoreClient: +class TestVectorStoreTool: @pytest.fixture(autouse=True) def _mock_try_run(self, mocker): mocker.patch("griptape.drivers.OpenAiEmbeddingDriver.try_embed_chunk", return_value=[0, 1]) def test_search(self): driver = LocalVectorStoreDriver(embedding_driver=MockEmbeddingDriver()) - tool = VectorStoreClient(description="Test", vector_store_driver=driver) + tool = VectorStoreTool(description="Test", vector_store_driver=driver) driver.upsert_text_artifacts({"test": [TextArtifact("foo"), TextArtifact("bar")]}) @@ -21,8 +21,8 @@ def test_search(self): def test_search_with_namespace(self): driver = LocalVectorStoreDriver(embedding_driver=MockEmbeddingDriver()) - tool1 = VectorStoreClient(description="Test", vector_store_driver=driver, query_params={"namespace": "test"}) - tool2 = VectorStoreClient(description="Test", vector_store_driver=driver, query_params={"namespace": "test2"}) + tool1 = VectorStoreTool(description="Test", vector_store_driver=driver, query_params={"namespace": "test"}) + tool2 = VectorStoreTool(description="Test", vector_store_driver=driver, query_params={"namespace": "test2"}) driver.upsert_text_artifacts({"test": [TextArtifact("foo"), TextArtifact("bar")]}) @@ -31,7 +31,7 @@ def test_search_with_namespace(self): def test_custom_process_query_output_fn(self): driver = LocalVectorStoreDriver(embedding_driver=MockEmbeddingDriver()) - tool1 = VectorStoreClient( + tool1 = VectorStoreTool( description="Test", vector_store_driver=driver, process_query_output_fn=lambda es: ListArtifact([e.vector for e in es]), diff --git a/tests/unit/tools/test_web_scraper.py b/tests/unit/tools/test_web_scraper.py index 30362ce65c..0fdc761b48 100644 --- a/tests/unit/tools/test_web_scraper.py +++ b/tests/unit/tools/test_web_scraper.py @@ -6,9 +6,9 @@ class TestWebScraper: @pytest.fixture() def scraper(self): - from griptape.tools import WebScraper + from griptape.tools import WebScraperTool - return WebScraper() + return WebScraperTool() def test_get_content(self, scraper): assert isinstance( diff --git a/tests/unit/tools/test_web_search.py b/tests/unit/tools/test_web_search.py index 17ff610e05..c1f9555ea1 100644 --- a/tests/unit/tools/test_web_search.py +++ b/tests/unit/tools/test_web_search.py @@ -1,7 +1,7 @@ import pytest from griptape.artifacts import BaseArtifact, ErrorArtifact, TextArtifact -from griptape.tools import WebSearch +from griptape.tools import WebSearchTool class TestWebSearch: @@ -11,7 +11,7 @@ def websearch_tool(self, mocker): driver = mocker.Mock() mocker.patch.object(driver, "search", return_value=mock_response) - return WebSearch(web_search_driver=driver) + return WebSearchTool(web_search_driver=driver) @pytest.fixture() def websearch_tool_with_error(self, mocker): @@ -19,7 +19,7 @@ def websearch_tool_with_error(self, mocker): driver = mocker.Mock() mocker.patch.object(driver, "search", side_effect=mock_response) - return WebSearch(web_search_driver=driver) + return WebSearchTool(web_search_driver=driver) def test_search(self, websearch_tool): assert isinstance(websearch_tool.search({"values": {"query": "foo bar"}}), BaseArtifact)