Skip to main content

GPT File Reference

Extension

GPTScript files use the .gpt extension by convention.

File Structure

A GPTScript file has one or more tools in the file. Each tool is separated by three dashes --- alone on a line.

Name: tool1
Description: This is tool1

Do sample tool stuff.

---
Name: tool2
Description: This is tool2

Do more sample tool stuff.

Tool Definition

A tool starts with a preamble that defines the tool's name, description, args, available tools and additional parameters. The preamble is followed by the tool's body, which contains the instructions for the tool. Comments in the preamble are lines starting with # and are ignored by the parser. Comments are not really encouraged as the text is typically more useful in the description, argument descriptions or instructions.

Name: tool-name
# This is a comment in the preamble.
Description: Tool description
# This tool can invoke tool1 or tool2 if needed
Tools: tool1, tool2
Args: arg1: The description of arg1

Tool instructions go here.

Tool Parameters

Tool parameters are key-value pairs defined at the beginning of a tool block, before any instructional text. They are specified in the format key: value. The parser recognizes the following keys (case-insensitive and spaces are ignored):

KeyDescription
NameThe name of the tool.
Model NameThe LLM model to use, by default it uses "gpt-4-turbo".
Global Model NameThe LLM model to use for all the tools.
DescriptionThe description of the tool. It is important that this properly describes the tool's purpose as the description is used by the LLM.
Internal PromptSetting this to false will disable the built-in system prompt for this tool.
ToolsA comma-separated list of tools that are available to be called by this tool.
Global ToolsA comma-separated list of tools that are available to be called by all tools.
CredentialsA comma-separated list of credential tools to run before the main tool.
ArgsArguments for the tool. Each argument is defined in the format arg-name: description.
Max TokensSet to a number if you wish to limit the maximum number of tokens that can be generated by the LLM.
JSON ResponseSetting to true will cause the LLM to respond in a JSON format. If you set true you must also include instructions in the tool.
TemperatureA floating-point number representing the temperature parameter. By default, the temperature is 0. Set to a higher number for more creativity.
ChatSetting it to true will enable an interactive chat session for the tool.

Tool Body

The tool body contains the instructions for the tool which can be a natural language prompt or a command to execute. Commands must start with #! followed by the interpreter (e.g. #!/bin/bash, #!python3) a text that will be placed in a file and passed to the interpreter. Arguments can be references in the instructions using the format ${arg1}.

name: echo-ai
description: A tool that echos the input
args: input: The input

Just return only "${input}"

---
name: echo-command
description: A tool that echos the input
args: input: The input

#!/bin/bash

echo "${input}"