-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Tools | ||
|
||
Tools can be used to execute arbitrary actions in a request/response format. They can be given to an LLM so the LLM can take appropriate action based on the metadata of the Tool. | ||
|
||
## Create a Tool | ||
|
||
1. [Connect Your GitHub Account in your Griptape Cloud account](https://cloud.griptape.ai/account) | ||
1. Install the [Griptape Cloud GitHub app to your GitHub account or organization](https://github.com/apps/griptape-cloud/installations/new/) | ||
- Be sure to allow the app access to `All Repositories` or select the specific repositories you need | ||
1. Ensure your repository has a Tool Config YAML file | ||
- To learn more see [Tool Config YAML](tool-config.md) | ||
|
||
You can now [create a Tool in the Griptape Cloud console](https://cloud.griptape.ai/tools/create) by providing your GitHub repository information. | ||
|
||
### Quickstart With Samples and Templates | ||
|
||
To get started with Tools in the Cloud, deploy one of the [griptape-sample-tools from GitHub](https://github.com/griptape-ai/griptape-sample-tools/tree/main). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Running a Tool | ||
|
||
Once your Tool is created and deployed, you can run your Tool one of three ways outlined below. | ||
|
||
## From the Cloud Console | ||
|
||
Go to the `Test` tab of your Tool to open the generated OpenAPI spec. From there, the Swagger UI can be used to create test requests. | ||
|
||
## From the API | ||
|
||
The API route for Tool activities is in the form of `https://cloud.griptape.ai/api/tools/{tool_id}/activities/{activity_name}`, where `tool_id` is the resource UUID of your created Tool, and `activity_name` is the name of the activity as defined in your `BaseTool` class. The activity routes will only accept an http POST method. | ||
|
||
To fetch the OpenAPI schema, the route is `https://cloud.griptape.ai/api/tools/{tool_id}/openapi`. | ||
|
||
```bash | ||
export GT_CLOUD_API_KEY="<your API key here>" | ||
export GT_CLOUD_TOOL_ID="<your tool ID here>" | ||
export TOOL_ACTIVITY_URL="https://api.griptape.com/v1/tools/${GT_CLOUD_TOOL_ID}/activities/my_activity" | ||
|
||
response=$(curl -X POST -H "Authorization: Bearer ${GT_CLOUD_API_KEY}" --json '{"my_key": "my_value"}' ${TOOL_ACTIVITY_URL}) | ||
echo "my_activity response: ${response}" | ||
``` | ||
|
||
## Using the Griptape Framework | ||
|
||
The Griptape framework provides a [`GriptapeCloudToolTool`](../../griptape-tools/official-tools/griptape-cloud-tool-tool.md) for interacting with your deployed Tools. Simply pass your Tool resource UUID as the `tool_id` kwarg, and the schema and activity methods will be dynamically set on the Tool. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
## Overview | ||
|
||
Tool repositories require a configuration file which informs Griptape Cloud of your Managed Tool's dependencies and how it needs to build and run. | ||
|
||
## Tool Config File Schema | ||
|
||
All relative paths are based off of the directory in which the `tool_config.yaml` file is located. | ||
|
||
The schema for the configuration file is as follows: | ||
|
||
```yaml | ||
version: 1.0 | ||
runtime: python3 | ||
runtime_version: 3.12 | ||
build: | ||
pre_build_install_script: scripts/my-pre-build-install-script.sh | ||
post_build_install_script: scripts/my-post-build-install-script.sh | ||
requirements_file: requirements.txt | ||
cache_build_dependencies: | ||
enabled: false | ||
watched_files: | ||
- requirements.txt | ||
- scripts/my-pre-build-install-script.sh | ||
- scripts/my-post-build-install-script.sh | ||
run: | ||
init_tool_function: init_tool | ||
init_tool_file: tool.py | ||
tool_file: tool.py | ||
``` | ||
### Configuration Fields | ||
#### version | ||
The Tool Config schema version number. | ||
#### runtime | ||
The runtime environment to use for the Tool. | ||
#### runtime_version | ||
The specific version of the runtime environment for the Tool. | ||
#### build (OPTIONAL) | ||
The build-time configuration for the Tool. | ||
- **pre_build_install_script** - The path to your pre_build_install_script, for running during the Tool build prior to dependency installation. This path is relative to the structure configuration file. Or absolute from the repository root if a forward slash is used: `/my-pre-build-install-script.sh`. | ||
- **post_build_install_script** - The path to your post_build_install_script, for running during the Tool build after dependency installation. This path is relative to the structure configuration file. Or absolute from the repository root if a forward slash is used: `/my-post-build-install-script.sh`. | ||
- **requirements_file** - The path to your Tool's requirements.txt file. | ||
- **cache_build_dependencies** - Defines the configuration for caching build dependencies in order to speed up Deployments | ||
- **enabled** - Defines whether the build dependency caching is on or off | ||
- **watched_files** - Defines the particular files that will trigger cache invalidation, resulting in a full rebuild of the Tool and dependencies | ||
|
||
#### run (REQUIRED) | ||
|
||
The run-time configuration for the Tool. | ||
|
||
- **tool_file**: The file that contains the Griptape `BaseTool`-derived class. The default value is `tool.py`. | ||
- **init_tool_file**: The file that contains your `init_tool` function. The default value is `tool.py`. | ||
- **init_tool_function**: The function that will be called. The function takes no arguments and returns an instance of your `Tool`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters