Skip to content

Commit

Permalink
Refactor/tools (#1361)
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter authored Nov 21, 2024
1 parent 9728558 commit c016350
Show file tree
Hide file tree
Showing 50 changed files with 147 additions and 2,249 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **BREAKING**: Updated `numpy` to `~2.0.2` and `pandas` to `^2.2`.
- **BREAKING**: Renamed `StructureRunTask.driver` to `StructureRunTask.structure_run_driver`.
- **BREAKING**: Renamed `StructureRunTool.driver` to `StructureRunTool.structure_run_driver`.
- **BREAKING**: Moved the following Google Tools to the [Griptape Google Extension](https://github.com/griptape-ai/griptape-google):
- `GoogleCalendarTool`
- `GoogleDocsTool`
- `GoogleDriveTool`
- `GoogleGmailTool`
- **BREAKING**: Moved the following AWS Tools to the [Griptape AWS Extension](https://github.com/griptape-ai/griptape-google):
- `AwsCliTool`
- `AwsIamTool`
- `AwsPricingTool`
- `AwsS3Tool`
- **BREAKING**: Moved the `OpenWeatherTool` to the [Griptape Open Weather Extension](https://github.com/griptape-ai/griptape-open-weather)
- **BREAKING**: Removed `GriptapeCloudKnowledgeBaseTool`. Use a RAG Engine with `GriptapeCloudVectorStoreDriver` instead.
- File Manager Driver path logic has been improved.
- `LocalFileManagerDriver.workdir` can now be a relative path or absolute path. Relative paths will be prefixed with the current working directory.
- `AmazonS3FileManagerDriver.workdir` can now be a relative path or absolute path. Relative paths will be prefixed with `/`.
Expand Down
134 changes: 134 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,140 @@ StructureRunTool(
)
```

### Moved Google Tools To Griptape Google Extension

Google tools have been moved to the `griptape-google` extension. Install the extension to use Google tools.

```bash
poetry add git+https://github.com/griptape-ai/griptape-google.git
```

#### Before

```python
from griptape.tools import GoogleGmailTool
```

#### After

```python
from griptape.google.tools import GoogleGmailTool
```

### Moved AWS Tools To Griptape AWS Extension

AWS tools have been moved to the `griptape-aws` extension. Install the extension to use AWS tools.

```bash
poetry add git+https://github.com/griptape-ai/griptape-aws.git
```

#### Before

```python
from griptape.tools import AwsS3Tool
```

#### After

```python
from griptape.aws.tools import AwsS3Tool
```

### Moved `OpenWeatherTool` To Griptape OpenWeather Extension

`OpenWeatherTool` has been moved to the `griptape-openweather` extension. Install the extension to use the tool.

```bash
poetry add git+https://github.com/griptape-ai/griptape-open-weather.git
```

#### Before

```python
from griptape.tools import OpenWeatherTool
```

#### After

```python
from griptape.openweather.tools import OpenWeatherTool
```

### Removed `GriptapeCloudKnowledgeBaseTool`

`GriptapeCloudKnowledgeBaseTool` has been removed. Build a RAG Engine with a `GriptapeCloudVectorStoreDriver` instead.

#### Before

```python
import os

from griptape.structures import Agent
from griptape.tools import GriptapeCloudKnowledgeBaseTool

knowledge_base_client = GriptapeCloudKnowledgeBaseTool(
description="Contains information about the company and its operations",
api_key=os.environ["GT_CLOUD_API_KEY"],
knowledge_base_id=os.environ["GT_CLOUD_KB_ID"],
)

agent = Agent(
tools=[
knowledge_base_client,
]
)

agent.run("What is the company's corporate travel policy?")
```

#### After

```python
from __future__ import annotations

import os

from griptape.drivers import GriptapeCloudVectorStoreDriver
from griptape.engines.rag import RagEngine
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 RagTool

engine = RagEngine(
retrieval_stage=RetrievalRagStage(
retrieval_modules=[
VectorStoreRetrievalRagModule(
vector_store_driver=GriptapeCloudVectorStoreDriver(
api_key=os.environ["GT_CLOUD_API_KEY"],
knowledge_base_id=os.environ["GT_CLOUD_KB_ID"],
)
)
]
),
response_stage=ResponseRagStage(
response_modules=[PromptResponseRagModule()],
),
)

agent = Agent(
tools=[
RagTool(
description="Contains information about the company and its operations",
rag_engine=engine,
),
],
)
agent.run("What is the company's corporate travel policy?")
```

## 0.33.X to 0.34.X

### `AnthropicDriversConfig` Embedding Driver
Expand Down
2 changes: 1 addition & 1 deletion docs/griptape-cloud/knowledge-bases/accessing-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ curl -H "Authorization: Bearer ${GT_CLOUD_API_KEY}" --json '{"query": "test ques

## Using the Griptape Framework

You can use the [GriptapeCloudVectorStoreDriver](../../griptape-framework/drivers/vector-store-drivers.md/#griptape-cloud-knowledge-base) to query your Knowledge Base with Griptape and the [GriptapeCloudKnowledgeBaseTool](../../griptape-tools/official-tools/griptape-cloud-knowledge-base-tool.md) to search.
You can use the [GriptapeCloudVectorStoreDriver](../../griptape-framework/drivers/vector-store-drivers.md/#griptape-cloud-knowledge-base) to query your Knowledge Base with Griptape.
65 changes: 0 additions & 65 deletions docs/griptape-tools/official-tools/aws-iam-tool.md

This file was deleted.

42 changes: 0 additions & 42 deletions docs/griptape-tools/official-tools/aws-s3-tool.md

This file was deleted.

7 changes: 0 additions & 7 deletions docs/griptape-tools/official-tools/google-calendar-tool.md

This file was deleted.

34 changes: 0 additions & 34 deletions docs/griptape-tools/official-tools/google-docs-tool.md

This file was deleted.

31 changes: 0 additions & 31 deletions docs/griptape-tools/official-tools/google-drive-tool.md

This file was deleted.

32 changes: 0 additions & 32 deletions docs/griptape-tools/official-tools/google-gmail-tool.md

This file was deleted.

This file was deleted.

Loading

0 comments on commit c016350

Please sign in to comment.