Blog

Introducing tools.gptscript.ai – Simplifying Documentation for GPTScript Tools

March 27, 2024 by tyler slaton

We’re thrilled to present tools.gptscript.ai, a new website that streamlines the documentation process for tools within the GPTScript ecosystem.

What are GPTScript Tools?

GPTScript consists of tools, which work like functions. These tools can use other tools in a way that’s similar to calling a function. Instead of traditional code, tools are mainly controlled by typing in natural language. The AI model decides when and how to use each tool, including what information to provide. Although they’re designed for natural language, tools can also be used with commands or HTTP calls.

An example of this is our image generation tool, which is a python CLI that has been bundled in such a way that the LLM understands how to use it.

name: image-generation
description: Generates images based on the specified parameters and returns a list of URLs to the generated images.
args: prompt: (required) The text prompt based on which the GPT model will generate a response
args: size: (optional) The size of the image to generate, format WxH (e.g. 1024x1024). Defaults to 1024x1024.
args: quality: (optional) The quality of the generated image. Allowed values are "standard" or "hd". Default is "standard".
args: number: (optional) The number of images to generate. Defaults to 1.

#!/usr/bin/env python3 ${GPTSCRIPT_TOOL_DIR}/cli.py --prompt="${prompt}" --size="${size}" --quality="${quality}" --number="${number}"

However, it isn’t necessary to always create a tool that uses a CLI. A simpler example is the tool for tools.gptscript.ai itself.

name: tool-search
tools: sys.http.get
description: Finds a tool that matches the prompt provided, if one exists.
args: prompt: Prompt that describes a tool to be found

Do each of the following one after the other.
1. Go to "https://tools.gptscript.ai/api/search?page=-1". DO NOT CHANGE THIS URL IN ANY WAY.
2. From the response, look for a tool that is described by ${prompt}.
3. Return a list of names and URLs for each tool you find. Each URL should be in
   the form of https://tools.gptscript.ai/{github url without https://}. If more than one
   result comes from the same array then just bundle them together under then name of the
   first tool in the array.

One last thing that is important to understand is that tools can be called by other tools. For example, the recipe-generator example in the GPTScript repo imports the Vision tool directly from github.

tools: sys.find, sys.read, sys.write, recipegenerator, github.com/gptscript-ai/vision

Perform the following steps in order:

1. Give me a list of ingredients from the pictures named with grocery in their name located in the current directory and put those extracted ingredients into a list.
2. For each picture analyzed in the previous step, write the ingredients identified into one file name ingredients.md.
3. Based on these ingredients list, suggest me one recipe that is quick to cook and create a new recipe.md file with the recipe

---
name: recipegenerator
description: Generate a recipe from the list of ingredients
args: ingredients: a list of available ingredients.
tools: sys.read

Generate 1 new recipe based on the ingredients list

Why is this needed?

GPTScript tools are essentially self-documenting. Having to provide the necessary context for their use when delegated to the LLM is beneficial to both humans and scripts. We take this concept a step further at tools.gptscript.ai by auto-generating documentation for your GPTScript tool. Simply create a GitHub repository and let our website manage the indexing. After the initial indexing, users can easily search your tool’s documentation, which is automatically reindexed daily. This allows you to concentrate on tool creation while we take care of the documentation.

How It Works

To have your tool appear on tools.gptscript.ai, do these two steps:

1. Make a Public GitHub Repository

This repository needs to have at least a tool.gpt file for indexing. You can also add a examples folder or single example.gpt with GPTScripts to show how your tool works.

2. Get Your Documentation Indexed

After making your GitHub repository, go to https://tools.gptscript.ai/github.com/your-org/you-repo or paste it on the link into the site’s search bar. We will then automatically index the documentation from your repository and show it on the tools.gptscript.ai website. For example, to create documentation for github.com/gptscript-ai/image-generation, we went to tools.gptscript.ai/github.com/gptscript-ai/image-generation. This made the tool searchable and its documentation visible on the website.

It worth noting again that any tool that you index will be automatically reindexed every day, no manual intervention required. However, you can force a reindex every hour via the refresh button on each tool’s documentation page. When performing a reindex, we will remove your index if your repository is no longer viewable (either that you made it private or deleted it).

Want to learn more?

We’ve open-sourced tools.gptscript.ai at https://github.com/gptscript-ai/tools. Feel free to stop by the repository if you’re curious about how things are implemented or would like to contribute to it. Otherwise, have fun finding tools to script against your favorite LLMs!

Related Articles