Skip to content

Commit c6b5c64

Browse files
authored
Merge pull request #170 from StrongMonkey/fix-examples
Fix: fix existing examples to be able to use remote tools
2 parents 5d97004 + 87fbe15 commit c6b5c64

File tree

6 files changed

+11
-163
lines changed

6 files changed

+11
-163
lines changed

examples/recipegenerator/index.js

-104
This file was deleted.

examples/recipegenerator/package.json

-20
This file was deleted.

examples/recipegenerator/recipegenerator.gpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tools: sys.find, sys.read, sys.write, recipegenerator, tool.gpt
1+
tools: sys.find, sys.read, sys.write, recipegenerator, github.com/gptscript-ai/vision
22

33
Perform the following steps in order:
44

@@ -13,4 +13,4 @@ description: Generate a recipe from the list of ingredients
1313
args: ingredients: a list of available ingredients.
1414
tools: sys.read
1515

16-
Generate 1 new recipe based on the ingredients list
16+
Generate 1 new recipe based on the ingredients list

examples/recipegenerator/tool.gpt

-11
This file was deleted.

examples/story-book/README.md

+4-21
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,7 @@ by `index.html` which has some JS/CSS to make the story styling consistent and r
55

66
## Usage Instructions
77

8-
1. **Install and bootstrap the `image-generation` tool.**
9-
10-
This tool uses the `image-generation` tool, which is in a separate repository. To install and bootstrap the `image-generation` tool, starting at the root of `gptscript` run the following commands:
11-
12-
> Note: We'll soon have package management that handles tools installation for you, but until then, you have to manually clone and boostrap tools.
13-
14-
```shell
15-
cd .. # This assumes you're starting at the root of the gptscript project. We want image-generation to be a sibling of gptscript.
16-
git clone https://github.com/gptscript-ai/image-generation
17-
cd image-generation
18-
make bootstrap
19-
source .venv/bin/activate
20-
cd ../gptscript # returns you back to your original directory
21-
```
22-
23-
> Note: You can install the python dependencies manually by running `pip install -r requirements.txt` in the root of the cloned repository. This prevents the need to run `make bootstrap` or activate the virtual environment.
24-
25-
2. **Run the `story-book.gpt` script.**
8+
1. **Run the `story-book.gpt` script.**
269

2710
In the same terminal session where the virtual environment (venv) is now activated, navigate to the `story-book` example directory and run the `story-book.gpt` script:
2811

@@ -31,11 +14,11 @@ by `index.html` which has some JS/CSS to make the story styling consistent and r
3114
gptscript story-book.gpt --prompt "Goldilocks" --pages 3
3215
```
3316

34-
3. **View the story.**
17+
2. **View the story.**
3518

3619
Open `index.html` in your browser to view the generated story.
3720

38-
4. (optional) **Generate a new story.**
21+
3. (optional) **Generate a new story.**
3922

4023
To generate another story, you'll first need to delete the existing `pages` directory. In the `examples/story-book` directory, run the following command:
4124
@@ -47,4 +30,4 @@ by `index.html` which has some JS/CSS to make the story styling consistent and r
4730
4831
```shell
4932
gptscript story-book.gpt --prompt "The Three Little Pigs" --pages 5
50-
```
33+
```

examples/story-book/story-book.gpt

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Do the following steps sequentially:
1010
to write a story based on the prompt.
1111
3. Take ${story} and break it up into ${pages} logical "pages" of text.
1212
4. For each page:
13-
- Call story-illustrator to illustrate it. Be sure to include any relevant characters to include when
13+
- Call story-illustrator to illustrate it. Be sure to include any relevant characters to include when
1414
asking it to illustrate the page.
1515
- Download the illustration to a file at pages/<page_number>.png.
1616
5. For each page and its illustration write an html file with the text on top and image below it to pages/page<page number>.html.
@@ -37,7 +37,7 @@ Do the following steps sequentially:
3737
}
3838
</style>
3939
```
40-
6. Edit the "pages" variable array in index.html to serve the pages you created. Do not
40+
6. Edit the "pages" variable array in index.html to serve the pages you created. Do not
4141
edit anything else. Do not edit the page select field.
4242

4343
---
@@ -49,12 +49,12 @@ Write a story with a tone for children based on ${prompt}.
4949

5050
---
5151
name: story-illustrator
52-
tools: ../../../image-generation/tool.gpt
52+
tools: github.com/gptscript-ai/image-generation
5353
description: Generates a illustration for a children's story
5454
args: text: The text of the page to illustrate
5555

5656
Think of a good prompt to generate an image to represent $text. Make sure to
57-
include the name of any relevant characters in your prompt. Then use that prompt to
57+
include the name of any relevant characters in your prompt. Then use that prompt to
5858
generate an illustration. Append any prompt that you have with ". In an pointilism cartoon
5959
children's book style with no text in it". Only return the URL of the illustration.
6060

@@ -66,4 +66,4 @@ args: dir: Path to the directory to be created
6666

6767
#!bash
6868

69-
mkdir ${dir}
69+
mkdir ${dir}

0 commit comments

Comments
 (0)