Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename all Tools for better naming consistency #1060

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
]
Comment on lines 96 to 100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

)
agent.run("https://griptape.ai", "griptape.txt")
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/src/load_query_and_chat_marqo_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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,
)
Expand Down
12 changes: 6 additions & 6 deletions docs/examples/src/multi_agent_workflow_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/src/multiple_agent_shared_memory_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/src/query_webpage_astra_db_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -49,9 +49,9 @@
raise Exception(artifacts.value)
vector_store_driver.upsert_text_artifacts({namespace: artifacts})

vector_store_tool = RagClient(
rag_tool = RagTool(
description="A DataStax blog post",
rag_engine=engine,
)
agent = Agent(tools=[vector_store_tool, TaskMemoryClient(off_prompt=False)])
agent = Agent(tools=[rag_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?")
6 changes: 3 additions & 3 deletions docs/examples/src/talk_to_a_pdf_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -25,7 +25,7 @@
response_modules=[PromptResponseRagModule(prompt_driver=OpenAiChatPromptDriver(model="gpt-4o"))]
),
)
vector_store_tool = RagClient(
rag_tool = RagTool(
description="Contains information about the Attention Is All You Need paper. "
"Use it to answer any related questions.",
rag_engine=engine,
Expand All @@ -37,6 +37,6 @@

vector_store.upsert_text_artifacts({namespace: artifacts})

agent = Agent(tools=[vector_store_tool])
agent = Agent(tools=[rag_tool])

Chat(agent).start()
6 changes: 3 additions & 3 deletions docs/examples/src/talk_to_a_webpage_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -33,7 +33,7 @@

vector_store_driver.upsert_text_artifacts({namespace: artifacts})

vector_store_tool = RagClient(
rag_tool = RagTool(
description="Contains information about physics. " "Use it to answer any physics-related questions.",
rag_engine=engine,
)
Expand All @@ -45,7 +45,7 @@
rules=[Rule("Always introduce yourself as a physics tutor"), Rule("Be truthful. Only discuss physics.")],
)
],
tools=[vector_store_tool],
tools=[rag_tool],
)

Chat(agent).start()
6 changes: 3 additions & 3 deletions docs/examples/src/talk_to_redshift_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -19,15 +19,15 @@
)
)

sql_tool = SqlClient(
sql_tool = SqlTool(
sql_loader=sql_loader,
table_name="people",
table_description="contains information about tech industry professionals",
engine_name="redshift",
)

agent = Agent(
tools=[sql_tool, FileManager()],
tools=[sql_tool, FileManagerTool()],
rulesets=[
Ruleset(
name="HumansOrg Agent",
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/talk-to-a-pdf.md
Original file line number Diff line number Diff line change
@@ -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/tool.md) tool to use it during conversations.

```python
--8<-- "docs/examples/src/talk_to_a_pdf_1.py"
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/talk-to-a-webpage.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This example demonstrates how to vectorize a webpage and setup a Griptape agent with rules and the [RagClient](../reference/griptape/tools/rag_client/tool.md) tool to use it during conversations.
This example demonstrates how to vectorize a webpage and setup a Griptape agent with rules and the [RagClient](../reference/griptape/tools/rag/tool.md) tool to use it during conversations.

```python
--8<-- "docs/examples/src/talk_to_a_webpage_1.py"
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions docs/griptape-framework/drivers/src/embedding_drivers_10.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
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"),
embedding=VoyageAiEmbeddingDriver(),
)

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")
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -11,7 +11,7 @@

agent = Agent(
tools=[
PromptImageGenerationClient(engine=engine),
PromptImageGenerationTool(engine=engine),
]
)

Expand Down
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -16,7 +16,7 @@

agent = Agent(
tools=[
PromptImageGenerationClient(engine=engine),
PromptImageGenerationTool(engine=engine),
]
)

Expand Down
Original file line number Diff line number Diff line change
@@ -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()

Expand All @@ -14,7 +14,7 @@

agent = Agent(
tools=[
PromptImageGenerationClient(engine=engine),
PromptImageGenerationTool(engine=engine),
]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -16,7 +16,7 @@

agent = Agent(
tools=[
PromptImageGenerationClient(engine=engine),
PromptImageGenerationTool(engine=engine),
]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -16,7 +16,7 @@

agent = Agent(
tools=[
PromptImageGenerationClient(engine=engine),
PromptImageGenerationTool(engine=engine),
]
)

Expand Down
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -12,7 +12,7 @@

agent = Agent(
tools=[
PromptImageGenerationClient(engine=engine),
PromptImageGenerationTool(engine=engine),
]
)

Expand Down
4 changes: 2 additions & 2 deletions docs/griptape-framework/drivers/src/prompt_drivers_10.py
Original file line number Diff line number Diff line change
@@ -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")
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
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"],
model="eleven_multilingual_v2",
voice="Matilda",
)

tool = TextToSpeechClient(
tool = TextToSpeechTool(
engine=TextToSpeechEngine(
text_to_speech_driver=driver,
),
Expand Down
Loading
Loading