Skip to content

Commit

Permalink
Merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter committed Aug 13, 2024
2 parents e64e1c6 + 0574f0d commit 336c46b
Show file tree
Hide file tree
Showing 232 changed files with 669 additions and 655 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **BREAKING**: Changed `CsvExtractionEngine.column_names` from a `run` argument to a class attribute.
- **BREAKING**: Removed `JsonExtractionTask`, and `CsvExtractionTask` use `ExtractionTask` instead.
- **BREAKING**: Removed `TaskMemoryClient`, use `RagClient`, `ExtractionTool`, or `PromptSummaryClient` instead.
- **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.
- `RagClient` now can be used to search through Artifacts stored in Task Memory.
- 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
12 changes: 6 additions & 6 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, PromptSummaryTool
from griptape.tools import WebScraperTool, FileManagerTool, PromptSummaryTool

agent = Agent(
input="Load {{ args[0] }}, summarize it, and store it in a file called {{ args[1] }}.",
tools=[
WebScraper(off_prompt=True),
WebScraperTool(off_prompt=True),
PromptSummaryTool(off_prompt=True),
FileManager()
FileManagerTool()
]
)
agent.run("https://griptape.ai", "griptape.txt")
Expand All @@ -110,7 +110,7 @@ And here is the output:
Actions: [
{
"tag": "call_62kBnkswnk9Y6GH6kn1GIKk6",
"name": "WebScraper",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
Expand All @@ -120,7 +120,7 @@ And here is the output:
}
]
[08/12/24 14:48:17] INFO Subtask ebe23832cbe2464fb9ecde9fcee7c30f
Response: Output of "WebScraper.get_content" was stored in memory with memory_name "TaskMemory" and artifact_namespace
Response: Output of "WebScraperTool.get_content" was stored in memory with memory_name "TaskMemory" and artifact_namespace
"cecca28eb0c74bcd8c7119ed7f790c95"
[08/12/24 14:48:18] INFO Subtask dca04901436d49d2ade86cd6b4e1038a
Actions: [
Expand All @@ -145,7 +145,7 @@ And here is the output:
Actions: [
{
"tag": "call_eKvIUIw45aRYKDBpT1gGKc9b",
"name": "FileManager",
"name": "FileManagerTool",
"path": "save_memory_artifacts_to_disk",
"input": {
"values": {
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
8 changes: 4 additions & 4 deletions docs/examples/src/multi_agent_workflow_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from griptape.tasks import PromptTask, StructureRunTask
from griptape.tools import (
PromptSummaryTool,
WebScraper,
WebSearch,
WebScraperTool,
WebSearchTool,
)

WRITERS = [
Expand All @@ -29,13 +29,13 @@ 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,
),
PromptSummaryTool(off_prompt=False),
Expand Down
4 changes: 2 additions & 2 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 QueryTool, WebScraper
from griptape.tools import QueryTool, 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,7 +41,7 @@

loader = Agent(
tools=[
WebScraper(off_prompt=True),
WebScraperTool(off_prompt=True),
],
)
asker = Agent(
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 QueryTool, RagClient
from griptape.tools import RagTool

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, QueryTool(off_prompt=False)])
agent = Agent(tools=[rag_tool])
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,7 +4,7 @@
VoyageAiEmbeddingDriver,
)
from griptape.structures import Agent
from griptape.tools import PromptSummaryTool, WebScraper
from griptape.tools import PromptSummaryTool, WebScraperTool

config.drivers = DriverConfig(
prompt=OpenAiChatPromptDriver(model="gpt-4o"),
Expand All @@ -17,7 +17,7 @@
)

agent = Agent(
tools=[WebScraper(off_prompt=True), PromptSummaryTool(off_prompt=False)],
tools=[WebScraperTool(off_prompt=True), PromptSummaryTool(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")
Loading

0 comments on commit 336c46b

Please sign in to comment.