Skip to content

Commit

Permalink
README Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Feb 14, 2024
1 parent 06541ff commit a8552ea
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
GPTScript is a new scripting language to automate your interaction with a Large Language Model (LLM), namely OpenAI.
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.
calls. With GPTScript you can do just about anything like [plan a vacation](./examples/travel-agent.gpt),
[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).

```yaml
# example.gpt
Expand Down Expand Up @@ -63,6 +64,17 @@ export OPENAI_API_KEY="your-api-key"
gptscript https://get.gptscript.ai/echo.gpt --input 'Hello, World!'
```

### 4. Extra Credit: Examples and Run Debugging UI

Clone examples and run debugging UI
```shell
git clone https://github.com/gptscript-ai/gptscript
cd gptscript/examples

# Run the debugging UI
gptscript --server
```

## How it works

***GPTScript is composed of tools.*** Each tool performs a series of actions similar to a function. Tools have available
Expand Down Expand Up @@ -96,7 +108,7 @@ OUTPUT:
Bob said, "Thanks for asking 'How are you doing?', I'm doing great fellow friendly AI tool!"
```
Tools can be implemented by invoking a program instead of a natural language prompt. The below
example is the same as the previous example but implements Bob using bash.
example is the same as the previous example but implements Bob using python.

```yaml
Tools: bob
Expand All @@ -108,9 +120,11 @@ Name: bob
Description: I'm Bob, a friendly guy.
Args: question: The question to ask Bob.

#!/bin/bash
#!python3

import os

echo "Thanks for asking ${question}, I'm doing great fellow friendly AI tool!"
print(f"Thanks for asking {os.environ['question']}, I'm doing great fellow friendly AI tool!")
```

With these basic building blocks you can create complex scripts with AI interacting with AI, your local system, data,
Expand Down Expand Up @@ -146,7 +160,7 @@ as the text is typically more useful in the description, argument descriptions o

```yaml
Name: tool-name
# This is a comment in the preamble. Comments don't typically provide much value
# This is a comment in the preamble.
Description: Tool description
# This tool can invoke tool1 or tool2 if needed
Tools: tool1, tool2
Expand All @@ -169,13 +183,14 @@ description is used by the LLM to determine if the tool is to be invoked.
default system prompt to instruct the AI to behave more like a script engine and not a "helpful assistant."

`Tools`: A comma-separated list of tools that are available to be called by this tool. A tool can only call the tools
that are defined here.
that are defined here. A tool name can reference a name in the current file, or a file relative to the current directory
of the tool file, a http(s) URL, or a file in GitHub using github.com/username/repo/file.gpt format. When referencing
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
syntax `tool-name from file-or-url`.

`Args`: Arguments for the tool. Each argument is defined in the format `arg-name: description`. All arguments are essentially
strings. No other type really exists as all input and output to tools is text based.

`Vision`: If set to true this model will use vision capabilities. Vision models currently do not support the `Args` or `Tools` parameters.

`Max Tokens`: Set to a number if you wish to limit the maximum number of tokens that can be generated by the LLM.

`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
Expand Down Expand Up @@ -211,6 +226,10 @@ echo "${input}"

For more examples check out the [examples](examples) directory.

## Community

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

## License

Copyright (c) 2023 [Acorn Labs, Inc.](http://acorn.io)
Expand Down
4 changes: 2 additions & 2 deletions examples/add-go-mod-dep.gpt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tools: sys.read, sys.write, sys.exec
tools: sys.read, sys.write

Edit the go.mod file and add ${package} version ${version} as a dependency in it
Edit the go.mod file and add k8s.io/api version v0.29.0 as a dependency in it

0 comments on commit a8552ea

Please sign in to comment.