From a8552ea7913c99cf4398192c720d43d4a021c5c8 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Tue, 13 Feb 2024 17:45:05 -0700 Subject: [PATCH] README Updates --- README.md | 35 +++++++++++++++++++++++++++-------- examples/add-go-mod-dep.gpt | 4 ++-- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e16fc6d4..831cc627 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -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 @@ -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, @@ -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 @@ -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 @@ -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) diff --git a/examples/add-go-mod-dep.gpt b/examples/add-go-mod-dep.gpt index c2708568..e43d3a6b 100644 --- a/examples/add-go-mod-dep.gpt +++ b/examples/add-go-mod-dep.gpt @@ -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