Skip to content

Commit 22e0293

Browse files
committed
Docs Overhaul
A relatively big overhaul of the docs and the readme. Signed-off-by: Craig Jellick <[email protected]> Signed-off-by: Nick Hale <[email protected]>
1 parent e9dcf89 commit 22e0293

17 files changed

+1025
-458
lines changed

README.md

+17-264
Original file line numberDiff line numberDiff line change
@@ -1,280 +1,33 @@
11
# GPTScript
22

3-
[![Discord](https://img.shields.io/discord/1204558420984864829?label=Discord)](https://discord.gg/9sSf4UyAMC)
3+
![Demo](docs/static/img/demo.gif)
44

5-
## Overview
5+
GPTScript is a framework that allows Large Language Models (LLMs) to operate and interact with various systems. These systems can range from local executables to complex applications with OpenAPI schemas, SDK libraries, or any RAG-based solutions. GPTScript is designed to easily integrate any system, whether local or remote, with your LLM using just a few lines of prompts.
66

7-
GPTScript is a new scripting language to automate your interaction with a Large Language Model (LLM), namely OpenAI. The ultimate goal is to create a natural language programming experience. The syntax of GPTScript is largely natural language, making it very easy to learn and use.
8-
Natural language prompts can be mixed with traditional scripts such as bash and python or even external HTTP service
9-
calls. With GPTScript you can do just about anything, like [plan a vacation](./examples/travel-agent.gpt),
10-
[edit a file](./examples/add-go-mod-dep.gpt), [run some SQL](./examples/sqlite-download.gpt), or [build a mongodb/flask app](./examples/hacker-news-headlines.gpt). Here are some common use cases for GPTScript:
7+
Here are some sample use cases of GPTScript:
8+
1. Chat with a local CLI - [Try it!](https://docs.gptscript.ai/examples/cli)
9+
2. Chat with an OpenAPI compliant endpoint - [Try it!](https://docs.gptscript.ai/examples/api)
10+
3. Chat with local files and directories - [Try it!](https://docs.gptscript.ai/examples/local-files)
11+
4. Run an automated workflow - [Try it!](https://docs.gptscript.ai/examples/workflow)
1112

12-
1. [Retrieval-Augmented Generation (RAG)](./docs/README-USECASES.md#retrieval)
13-
2. [Task Automation](./docs/README-USECASES.md#task-automation)
14-
3. [Agents and Assistants](./docs/README-USECASES.md#agents-and-assistants)
15-
4. [Data Analysis](./docs/README-USECASES.md#data-analysis)
16-
5. [Vision, Image, and Audio](./docs/README-USECASES.md#vision-image-and-audio)
17-
6. [Memory Management](./docs/README-USECASES.md#memory-management)
18-
7. [Chatbots](./docs/README-USECASES.md#chatbots)
1913

20-
| :memo: | We are currently exploring options for interacting with local models using GPTScript. |
21-
| ------ | :------------------------------------------------------------------------------------ |
22-
23-
The following example illustrates how GPTScript allows you to accomplish a complex task by writing instructions in English:
24-
25-
```yaml
26-
# example.gpt
27-
28-
Tools: sys.download, sys.exec, sys.remove
29-
30-
Download https://www.sqlitetutorial.net/wp-content/uploads/2018/03/chinook.zip to a
31-
random file. Then expand the archive to a temporary location as there is a sqlite
32-
database in it.
33-
34-
First inspect the schema of the database to understand the table structure.
35-
36-
Form and run a SQL query to find the artist with the most number of albums and output
37-
the result of that.
38-
39-
When done remove the database file and the downloaded content.
40-
```
41-
42-
```shell
43-
$ gptscript ./example.gpt
44-
```
45-
46-
```
47-
OUTPUT:
48-
49-
The artist with the most number of albums in the database is Iron Maiden, with a total
50-
of 21 albums.
14+
### Getting started
15+
MacOS and Linux:
5116
```
52-
53-
## Quick Start
54-
55-
### 1. Install the latest release
56-
57-
#### Homebrew (macOS and Linux)
58-
59-
```shell
60-
brew install gptscript-ai/tap/gptscript
17+
brew install gptscript-ai/tap/gptscript
18+
gptscript github.com/gptscript-ai/llm-basics-demo
6119
```
6220

63-
#### Install Script (macOS and Linux):
64-
65-
```shell
66-
curl https://get.gptscript.ai/install.sh | sh
21+
Windows:
6722
```
68-
69-
### Scoop (Windows)
70-
71-
```shell
72-
scoop bucket add extras # If 'extras' is not already enabled
73-
scoop install gptscript
74-
```
75-
76-
#### WinGet (Windows)
77-
78-
```shell
7923
winget install gptscript-ai.gptscript
24+
gptscript github.com/gptscript-ai/llm-basics-demo
8025
```
8126

82-
#### Manually
83-
84-
Download and install the archive for your platform and architecture from the [releases page](https://github.com/gptscript-ai/gptscript/releases).
85-
86-
### 2. Get an API key from [OpenAI](https://platform.openai.com/api-keys).
87-
88-
#### macOS and Linux
89-
90-
```shell
91-
export OPENAI_API_KEY="your-api-key"
92-
```
93-
94-
#### Windows
95-
96-
```powershell
97-
$env:OPENAI_API_KEY = 'your-api-key'
98-
```
99-
100-
### 3. Run Hello World
101-
102-
```shell
103-
gptscript https://get.gptscript.ai/echo.gpt --input 'Hello, World!'
104-
```
105-
106-
```
107-
OUTPUT:
108-
109-
Hello, World!
110-
```
111-
112-
The model used by default is `gpt-4o` and you must have access to that model in your OpenAI account.
113-
114-
### 4. Extra Credit: Examples and Run Debugging UI
115-
116-
Clone examples and run debugging UI
117-
118-
```shell
119-
git clone https://github.com/gptscript-ai/gptscript
120-
cd gptscript/examples
121-
122-
# Run the debugging UI
123-
gptscript --server
124-
```
125-
126-
## How it works
127-
128-
**_GPTScript is composed of tools._** Each tool performs a series of actions similar to a function. Tools have available
129-
to them other tools that can be invoked similar to a function call. While similar to a function, the tools are
130-
primarily implemented with a natural language prompt. **_The interaction of the tools is determined by the AI model_**,
131-
the model determines if the tool needs to be invoked and what arguments to pass. Tools are intended to be implemented
132-
with a natural language prompt but can also be implemented with a command or HTTP call.
133-
134-
### Example
135-
136-
Below are two tool definitions, separated by `---`. The first tool does not require a name or description, but
137-
every tool after name and description are required. The first tool, has the parameter `tools: bob` meaning that the tool named `bob` is available to be called if needed.
138-
139-
```yaml
140-
tools: bob
141-
142-
Ask Bob how he is doing and let me know exactly what he said.
143-
144-
---
145-
name: bob
146-
description: I'm Bob, a friendly guy.
147-
args: question: The question to ask Bob.
148-
149-
When asked how I am doing, respond with "Thanks for asking "${question}", I'm doing great fellow friendly AI tool!"
150-
```
151-
152-
Put the above content in a file named `bob.gpt` and run the following command:
153-
154-
```shell
155-
$ gptscript bob.gpt
156-
```
157-
158-
```
159-
OUTPUT:
160-
161-
Bob said, "Thanks for asking 'How are you doing?', I'm doing great fellow friendly AI tool!"
162-
```
163-
164-
Tools can be implemented by invoking a program instead of a natural language prompt. The below
165-
example is the same as the previous example but implements Bob using python.
166-
167-
```yaml
168-
Tools: bob
169-
170-
Ask Bob how he is doing and let me know exactly what he said.
171-
172-
---
173-
Name: bob
174-
Description: I'm Bob, a friendly guy.
175-
Args: question: The question to ask Bob.
176-
177-
#!python3
178-
179-
import os
180-
181-
print(f"Thanks for asking {os.environ['question']}, I'm doing great fellow friendly AI tool!")
182-
```
183-
184-
With these basic building blocks you can create complex scripts with AI interacting with AI, your local system, data,
185-
or external services.
186-
187-
## GPT File Reference
188-
189-
### Extension
190-
191-
GPTScript files use the `.gpt` extension by convention.
192-
193-
### File Structure
194-
195-
A GPTScript file has one or more tools in the file. Each tool is separated by three dashes `---` alone on a line.
196-
197-
```yaml
198-
Name: tool1
199-
Description: This is tool1
200-
201-
Do sample tool stuff.
202-
203-
---
204-
Name: tool2
205-
Description: This is tool2
206-
207-
Do more sample tool stuff.
208-
```
209-
210-
### Tool Definition
211-
212-
A tool starts with a preamble that defines the tool's name, description, args, available tools and additional parameters.
213-
The preamble is followed by the tool's body, which contains the instructions for the tool. Comments in
214-
the preamble are lines starting with `#` and are ignored by the parser. Comments are not really encouraged
215-
as the text is typically more useful in the description, argument descriptions or instructions.
216-
217-
```yaml
218-
Name: tool-name
219-
# This is a comment in the preamble.
220-
Description: Tool description
221-
# This tool can invoke tool1 or tool2 if needed
222-
Tools: tool1, tool2
223-
Args: arg1: The description of arg1
224-
225-
Tool instructions go here.
226-
```
227-
228-
#### Tool Parameters
229-
230-
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):
231-
232-
233-
| Key | Description |
234-
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
235-
| `Name` | The name of the tool. |
236-
| `Model Name` | The OpenAI model to use, by default it uses "gpt-4-turbo" |
237-
| `Description` | The description of the tool. It is important that this properly describes the tool's purpose as the description is used by the LLM. |
238-
| `Internal Prompt`| Setting this to `false` will disable the built-in system prompt for this tool. |
239-
| `Tools` | A comma-separated list of tools that are available to be called by this tool. |
240-
| `Args` | Arguments for the tool. Each argument is defined in the format `arg-name: description`. |
241-
| `Max Tokens` | Set to a number if you wish to limit the maximum number of tokens that can be generated by the LLM. |
242-
| `JSON Response` | Setting to `true` will cause the LLM to respond in a JSON format. If you set true you must also include instructions in the tool. |
243-
| `Temperature` | A floating-point number representing the temperature parameter. By default, the temperature is 0. Set to a higher number for more creativity. |
244-
245-
246-
#### Tool Body
247-
248-
The tool body contains the instructions for the tool which can be a natural language prompt or
249-
a command to execute. Commands must start with `#!` followed by the interpreter (e.g. `#!/bin/bash`, `#!python3`)
250-
a text that will be placed in a file and passed to the interpreter. Arguments can be references in the instructions
251-
using the format `${arg1}`.
252-
253-
```yaml
254-
name: echo-ai
255-
description: A tool that echos the input
256-
args: input: The input
257-
258-
Just return only "${input}"
259-
260-
---
261-
name: echo-command
262-
description: A tool that echos the input
263-
args: input: The input
264-
265-
#!/bin/bash
266-
267-
echo "${input}"
268-
```
269-
270-
## Built in Tools
271-
272-
There are several built in tools to do basic things like read/write files, download http content and execute commands.
273-
Run `gptscript --list-tools` to list all the built-in tools.
274-
275-
## Examples
276-
277-
For more examples check out the [examples](examples) directory.
27+
A few notes:
28+
- You'll need an [OpenAI API key](https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key)
29+
- On Windows, after installing gptscript you may need to restart your terminal for the changes to take effect
30+
- The above script is a simple chat-based assistant. You can ask it questions and it will answer to the best of its ability.
27831

27932
## Community
28033

docs/docs/01-overview.md

+35-33
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,41 @@
22
title: Overview
33
slug: /
44
---
5+
import Tabs from '@theme/Tabs';
6+
import TabItem from '@theme/TabItem';
57

68
[![Discord](https://img.shields.io/discord/1204558420984864829?label=Discord)](https://discord.gg/9sSf4UyAMC)
79

8-
GPTScript is a new scripting language to automate your interaction with a Large Language Model (LLM), namely OpenAI. The ultimate goal is to create a natural language programming experience. The syntax of GPTScript is largely natural language, making it very easy to learn and use. Natural language prompts can be mixed with traditional scripts such as bash and python or even external HTTP service calls. With GPTScript you can do just about anything, like [plan a vacation](https://github.com/gptscript-ai/gptscript/blob/main/examples/travel-agent.gpt), [edit a file](https://github.com/gptscript-ai/gptscript/blob/main/examples/add-go-mod-dep.gpt), [run some SQL](https://github.com/gptscript-ai/gptscript/blob/main/examples/sqlite-download.gpt), or [build a mongodb/flask app](https://github.com/gptscript-ai/gptscript/blob/main/examples/hacker-news-headlines.gpt).
9-
10-
:::note
11-
We are currently exploring options for interacting with local models using GPTScript.
12-
:::
13-
14-
```yaml
15-
# example.gpt
16-
17-
Tools: sys.download, sys.exec, sys.remove
18-
19-
Download https://www.sqlitetutorial.net/wp-content/uploads/2018/03/chinook.zip to a
20-
random file. Then expand the archive to a temporary location as there is a sqlite
21-
database in it.
22-
23-
First inspect the schema of the database to understand the table structure.
24-
25-
Form and run a SQL query to find the artist with the most number of albums and output
26-
the result of that.
27-
28-
When done remove the database file and the downloaded content.
29-
```
30-
```shell
31-
$ gptscript ./example.gpt
32-
```
33-
```
34-
OUTPUT:
35-
36-
The artist with the most number of albums in the database is Iron Maiden, with a total
37-
of 21 albums.
38-
```
39-
40-
For more examples check out the [examples](https://github.com/gptscript-ai/gptscript/blob/main/examples) directory.
10+
![Demo](/img/demo.gif)
11+
12+
GPTScript is a framework that allows Large Language Models (LLMs) to operate and interact with various systems. These systems can range from local executables to complex applications with OpenAPI schemas, SDK libraries, or any RAG-based solutions. GPTScript is designed to easily integrate any system, whether local or remote, with your LLM using just a few lines of prompts.
13+
14+
Here are some sample use cases of GPTScript:
15+
1. Chat with a local CLI - [Try it!](examples/cli)
16+
2. Chat with an OpenAPI compliant endpoint - [Try it!](examples/api)
17+
3. Chat with local files and directories - [Try it!](examples/local-files)
18+
4. Run an automated workflow - [Try it!](examples/workflow)
19+
20+
### Getting Started
21+
22+
<Tabs>
23+
<TabItem value="MacOS and Linux">
24+
```shell
25+
brew install gptscript-ai/tap/gptscript
26+
gptscript github.com/gptscript-ai/llm-basics-demo
27+
```
28+
A few notes:
29+
- You'll need an [OpenAI API key](https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key)
30+
- The above script is a simple chat-based assistant. You can ask it questions and it will answer to the best of its ability.
31+
</TabItem>
32+
<TabItem value="Windows">
33+
```shell
34+
winget install gptscript-ai.gptscript
35+
gptscript github.com/gptscript-ai/llm-basics-demo
36+
```
37+
A few notes:
38+
- You'll need an [OpenAI API key](https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key)
39+
- After installing gptscript you may need to restart your terminal for the changes to take effect
40+
- The above script is a simple chat-based assistant. You can ask it questions and it will answer to the best of its ability.
41+
</TabItem>
42+
</Tabs>

0 commit comments

Comments
 (0)