Skip to content

Commit 41de01e

Browse files
committed
refactor: change structure of docs site
Signed-off-by: tylerslaton <[email protected]>
1 parent 72c0b0e commit 41de01e

File tree

12 files changed

+85
-43
lines changed

12 files changed

+85
-43
lines changed

docs/docs/tools/01-authoring/01-overview.md renamed to docs/docs/100-tools/01-using.md

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
# Overview
2-
1+
# Using Tools
32
In GPTScript, tools are used to extend the capabilities of a script. The idea behind them is that AI performs better when it has very specific instructions for a given task. Tools are a way to break-up the problem into smaller and more focused pieces where each tool is responsible for a specific task. A typical flow like this is to have a main script that imports a set of tools it can use to accomplish its goal.
43

5-
## Using Tools
6-
74
GPTScripts can utilize tools in one of three ways:
85
1. Built-in system tools
96
2. In-script tools
@@ -50,21 +47,3 @@ Take this image and search the web for similar images. Write links for the top 5
5047
```
5148

5249
External tools are tools that are defined by a `tool.gpt` file in their root directory. They can be imported into a GPTScript by specifying the path to the tool's root directory.
53-
54-
## Authoring External Tools
55-
You can author your own tools for your own use or to share with others. The process for authoring a tool is as simple as creating a `tool.gpt` file in the root directory of your tool This file is itself a GPTScript that defines the tool's name, description, and what it should do.
56-
57-
Here's an example of the `tool.gpt` file for the `image-generation` tool:
58-
59-
```yaml
60-
description: I am a tool that can generate images based on arguments that are sent to me. I return a list of URLs to the generated images.
61-
args: prompt: (required) The text prompt based on which the GPT model will generate a response
62-
args: model: (optional) The model to use for image generation. Defaults to "dall-e-3".
63-
args: size: (optional) The size of the image to generate, format WxH (e.g. 1024x1024). Defaults to 1024x1024.
64-
args: quality: (optional) The quality of the generated image. Allowed values are "standard" or "hd". Default is "standard".
65-
args: number: (optional) The number of images to generate. Defaults to 1.
66-
67-
#!/usr/bin/env python3 ./cli.py --prompt="${prompt}" --model="${model}" --size="${size}" --quality="${quality}" --number="${number}"
68-
```
69-
70-
At the bottom you'll notice a shebang line that specifies the command to run when the tool is invoked. This is the exact command that will be executed when the tool is used in a GPTScript. Doing this with tools allows for a high degree of reliability that the tool would not otherwise have.

docs/docs/tools/01-authoring/02-binary-tools.md renamed to docs/docs/100-tools/02-authoring.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1-
# Binary Tools
1+
# Authoring Tools
2+
3+
You can author your own tools for your use or to share with others. The process for authoring a tool is as simple as creating a `tool.gpt` file in the root directory of your tool This file is itself a GPTScript that defines the tool's name, description, and what it should do.
4+
5+
Here's an example of the `tool.gpt` file for the `image-generation` tool:
6+
7+
```yaml
8+
description: I am a tool that can generate images based on arguments that are sent to me. I return a list of URLs to the generated images.
9+
args: prompt: (required) The text prompt based on which the GPT model will generate a response
10+
args: model: (optional) The model to use for image generation. Defaults to "dall-e-3".
11+
args: size: (optional) The size of the image to generate, format WxH (e.g. 1024x1024). Defaults to 1024x1024.
12+
args: quality: (optional) The quality of the generated image. Allowed values are "standard" or "hd". Default is "standard".
13+
args: number: (optional) The number of images to generate. Defaults to 1.
14+
15+
#!/usr/bin/env python3 ./cli.py --prompt="${prompt}" --model="${model}" --size="${size}" --quality="${quality}" --number="${number}"
16+
```
17+
18+
At the bottom you'll notice a shebang line that specifies the command to run when the tool is invoked. This is the exact command that will be executed when the tool is used in a GPTScript. Doing this with tools allows for a high degree of reliability that the tool would not otherwise have.
19+
20+
## Binary Tools
221
GPTScript can call binaries and scripts located on your system or externally. This is done by defining a `tool.gpt` file in the same directory that the binary or script is located. In that `tool.gpt` file, you call it directly using the `#!` directive.
322

423
For example:

docs/docs/tools/02-offerings/01-image-generation.md renamed to docs/docs/100-tools/03-offerings/01-image-generation.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
# Image Generation
22

3-
## Overview
4-
53
The `image-generation` tool leverages OpenAI's DALL-E model to convert textual descriptions into images. It offers a versatile approach to creating visual content, making it suitable for a wide range of applications, from content creation to design assistance.
64

75
For more information, check out the tool [here](https://github.com/gptscript-ai/image-generation)
86

7+
## Installation
8+
We are working on an process where installation of tools will be as simple as
9+
referencing the tool's link in your GPTScript. For now, you can follow the steps below to install the image-generation tool.
10+
11+
1. Clone the image-generation tool repository [from GitHub](https://github.com/gptscript-ai/image-generation).
12+
13+
```shell
14+
git clone https://github.com/gptscript-ai/image-generation
15+
```
16+
17+
2. Run `make bootstrap` to setup the python venv and install the required dependencies.
18+
19+
```shell
20+
make bootstrap
21+
```
22+
23+
3. Reference `<path-to-the-repo>/tool.gpt` in your GPTScript.
24+
925
## Usage
1026
To use the Image Generation tool, you need to make sure that the OPENAI_API_KEY environment variable is set to your OpenAI API key. You can obtain an API key from the OpenAI platform if you don't already have one.
1127

1228
With that setup, you can use it in any GPTScript like so:
1329

14-
:::tip
15-
This script assumes you have the `image-generation` tool repo cloned locally and located at `./image-generation`. The ability to import tools from remote
16-
locations is coming soon.
17-
:::
18-
1930
```
20-
tools: ./image-generation, sys.write
31+
tools: ./image-generation/tool.gpt, sys.download, sys.write
2132
2233
Generate an image of a city skyline at night with a resolution of 512x512 pixels.
2334

docs/docs/tools/02-offerings/02-system.md renamed to docs/docs/100-tools/03-offerings/02-system.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,12 @@ Writes content to a specified file.
104104

105105
- `content`: The content to be written to the file.
106106
- `filename`: The filename where the content should be written.
107+
108+
## sys.append
109+
110+
Appends the contents to a file.
111+
112+
#### Arguments
113+
114+
- `content`: The content to append.
115+
- `filename`: The name of the file to append to.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Offerings",
3+
"collapsible": true,
4+
"link": {
5+
"type": "generated-index",
6+
"title": "Offerings"
7+
}
8+
}
File renamed without changes.

docs/docs/100-tools/_category_.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"label": "Tools"
3+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"label": "Cookbook",
3+
"collapsible": true,
4+
"link": {
5+
"type": "generated-index",
6+
"title": "Cookbook"
7+
},
8+
"customProps": {
9+
"description": "Explore the various things you can do with GPTScript and how to do them."
10+
}
11+
}

docs/docs/tools/01-authoring/_category_.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/docs/tools/02-offerings/_category_.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)