Skip to content

Commit b480dc8

Browse files
authored
docs: explain how to set args from the command line (#543)
Signed-off-by: Grant Linville <[email protected]>
1 parent 9d1e1e4 commit b480dc8

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

docs/docs/03-tools/02-authoring.md

+14-8
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ Create a file called `tool.gpt` with the following contents:
3131

3232
```
3333
Description: Returns the contents of a webpage.
34-
Args: url: The URL of the webpage.
34+
Param: url: The URL of the webpage.
3535
3636
#!/usr/bin/env python3 ${GPTSCRIPT_TOOL_DIR}/tool.py
3737
```
3838

3939
:::tip
40-
Every arg becomes an environment variable when the tool is invoked. So instead of accepting args using flags like `--size="${size}"`, your program can just read the `size` environment variable.
40+
Every param becomes an environment variable when the tool is invoked. So instead of accepting params using flags like `--size="${size}"`, your program can just read the `size` environment variable.
4141
:::
4242

4343
The `GPTSCRIPT_TOOL_DIR` environment variable is automatically populated by GPTScript so that the tool
@@ -57,9 +57,15 @@ Tools: github.com/<user>/<repo name>
5757
Get the contents of https://github.com
5858
```
5959

60+
You can also run the tool directly and set the parameter from the command line using a JSON string:
61+
62+
```bash
63+
gptscript github.com/<user>/<repo name> '{"url": "https://github.com"}'
64+
```
65+
6066
## Sharing Tools
6167

62-
GPTScript is designed to easily export and import tools. Doing this is currently based entirely around the use of GitHub repositories. You can export a tool by creating a GitHub repository and ensureing you have the `tool.gpt` file in the root of the repository. You can then import the tool into a GPTScript by specifying the URL of the repository in the `tools` section of the script. For example, we can leverage the `image-generation` tool by adding the following line to a GPTScript:
68+
GPTScript is designed to easily export and import tools. Doing this is currently based entirely around the use of GitHub repositories. You can export a tool by creating a GitHub repository and ensuring you have the `tool.gpt` file in the root of the repository. You can then import the tool into a GPTScript by specifying the URL of the repository in the `tools` section of the script. For example, we can leverage the `image-generation` tool by adding the following line to a GPTScript:
6369

6470
```yaml
6571
tools: github.com/gptscript-ai/dalle-image-generation
@@ -71,11 +77,11 @@ Generate an image of a city skyline at night.
7177

7278
GPTScript can execute any binary that you ask it to. However, it can also manage the installation of a language runtime and dependencies for you. Currently this is only supported for a few languages. Here are the supported languages and examples of tools written in those languages:
7379

74-
| Language | Example |
75-
|----------|----------------------------------------------------------------------------------------------------------------|
76-
| `Python` | [Image Generation](https://github.com/gptscript-ai/dalle-image-generation) - Generate images based on a prompt |
77-
| `Node.js` | [Vision](https://github.com/gptscript-ai/gpt4-v-vision) - Analyze and interpret images |
78-
| `Golang` | [Search](https://github.com/gptscript-ai/search) - Use various providers to search the internet |
80+
| Language | Example |
81+
|-----------|----------------------------------------------------------------------------------------------------------------|
82+
| `Python` | [Image Generation](https://github.com/gptscript-ai/dalle-image-generation) - Generate images based on a prompt |
83+
| `Node.js` | [Vision](https://github.com/gptscript-ai/gpt4-v-vision) - Analyze and interpret images |
84+
| `Golang` | [Search](https://github.com/gptscript-ai/search) - Use various providers to search the internet |
7985

8086

8187
### Automatic Documentation

0 commit comments

Comments
 (0)