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, parameters, available tools, and additional directives. 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, parameter descriptions, or body.

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
Param: param1: The description of param1

Tool instructions go here.

Tool Directives

Tool directives are key-value pairs defined at the beginning of a tool block, before the tool body. 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.
Parameter / ArgsParameters for the tool. Each parameter is defined in the format param-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.
CredentialCredential tool to call to set credentials as environment variables before doing anything else. One per line.
AgentsA comma-separated list of agents that are available to the tool.
Share ToolsA comma-separated list of tools that are shared by the tool.
ContextA comma-separated list of context tools available to the tool.
Share ContextA comma-separated list of context tools shared by this tool with any tool including this tool in its context.

Tool Body

The tool body contains the instructions for the tool. It can be a natural language prompt or a command to execute. Commands must start with #! followed by the interpreter (e.g. #!/bin/bash, #!python3). Parameters can be referenced in the body using the format ${param1}.

Name: echo-ai
Description: A tool that echos the input
Parameter: input: The input

Just return only "${input}"

---
Name: echo-command
Description: A tool that echos the input
Parameter: input: The input

#!/bin/bash

echo "${input}"