5
5
GPTScript is a new scripting language to automate your interaction with a Large Language Model (LLM), namely OpenAI.
6
6
The syntax of GPTScript is largely natural language, making it very easy to learn and use.
7
7
Natural language prompts can be mixed with traditional scripts such as bash and python or even external HTTP service
8
- calls.
8
+ calls. With GPTScript you can do just about anything like [ plan a vacation] ( ./examples/travel-agent.gpt ) ,
9
+ [ 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 ) .
9
10
10
11
``` yaml
11
12
# example.gpt
@@ -63,6 +64,17 @@ export OPENAI_API_KEY="your-api-key"
63
64
gptscript https://get.gptscript.ai/echo.gpt --input ' Hello, World!'
64
65
```
65
66
67
+ ### 4. Extra Credit: Examples and Run Debugging UI
68
+
69
+ Clone examples and run debugging UI
70
+ ``` shell
71
+ git clone https://github.com/gptscript-ai/gptscript
72
+ cd gptscript/examples
73
+
74
+ # Run the debugging UI
75
+ gptscript --server
76
+ ```
77
+
66
78
## How it works
67
79
68
80
*** GPTScript is composed of tools.*** Each tool performs a series of actions similar to a function. Tools have available
@@ -96,7 +108,7 @@ OUTPUT:
96
108
Bob said, " Thanks for asking 'How are you doing?', I'm doing great fellow friendly AI tool!"
97
109
```
98
110
Tools can be implemented by invoking a program instead of a natural language prompt. The below
99
- example is the same as the previous example but implements Bob using bash .
111
+ example is the same as the previous example but implements Bob using python .
100
112
101
113
``` yaml
102
114
Tools : bob
@@ -108,9 +120,11 @@ Name: bob
108
120
Description : I'm Bob, a friendly guy.
109
121
Args : question: The question to ask Bob.
110
122
111
- # !/bin/bash
123
+ # !python3
124
+
125
+ import os
112
126
113
- echo "Thanks for asking ${ question}, I'm doing great fellow friendly AI tool!"
127
+ print(f "Thanks for asking {os.environ[' question'] }, I'm doing great fellow friendly AI tool!")
114
128
```
115
129
116
130
With these basic building blocks you can create complex scripts with AI interacting with AI, your local system, data,
@@ -146,7 +160,7 @@ as the text is typically more useful in the description, argument descriptions o
146
160
147
161
``` yaml
148
162
Name : tool-name
149
- # This is a comment in the preamble. Comments don't typically provide much value
163
+ # This is a comment in the preamble.
150
164
Description : Tool description
151
165
# This tool can invoke tool1 or tool2 if needed
152
166
Tools : tool1, tool2
@@ -169,13 +183,14 @@ description is used by the LLM to determine if the tool is to be invoked.
169
183
default system prompt to instruct the AI to behave more like a script engine and not a "helpful assistant."
170
184
171
185
` Tools ` : A comma-separated list of tools that are available to be called by this tool. A tool can only call the tools
172
- that are defined here.
186
+ that are defined here. A tool name can reference a name in the current file, or a file relative to the current directory
187
+ of the tool file, a http(s) URL, or a file in GitHub using github.com/username/repo/file.gpt format. When referencing
188
+ a file or URL the tool loaded is the first tool in the file. To reference a specific tool in a file or URL use the
189
+ syntax ` tool-name from file-or-url ` .
173
190
174
191
` Args ` : Arguments for the tool. Each argument is defined in the format ` arg-name: description ` . All arguments are essentially
175
192
strings. No other type really exists as all input and output to tools is text based.
176
193
177
- ` Vision ` : If set to true this model will use vision capabilities. Vision models currently do not support the ` Args ` or ` Tools ` parameters.
178
-
179
194
` Max Tokens ` : Set to a number if you wish to limit the maximum number of tokens that can be generated by the LLM.
180
195
181
196
` 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
@@ -211,6 +226,10 @@ echo "${input}"
211
226
212
227
For more examples check out the [ examples] ( examples ) directory.
213
228
229
+ ## Community
230
+
231
+ Join us on Discord: [ ![ Discord] ( https://img.shields.io/discord/1204558420984864829?label=Discord )] ( https://discord.gg/9sSf4UyAMC )
232
+
214
233
## License
215
234
216
235
Copyright (c) 2023 [ Acorn Labs, Inc.] ( http://acorn.io )
0 commit comments