Skip to content

Fix: fix existing examples to be able to use remote tools #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 0 additions & 104 deletions examples/recipegenerator/index.js

This file was deleted.

20 changes: 0 additions & 20 deletions examples/recipegenerator/package.json

This file was deleted.

4 changes: 2 additions & 2 deletions examples/recipegenerator/recipegenerator.gpt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tools: sys.find, sys.read, sys.write, recipegenerator, tool.gpt
tools: sys.find, sys.read, sys.write, recipegenerator, github.com/gptscript-ai/vision

Perform the following steps in order:

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

Generate 1 new recipe based on the ingredients list
Generate 1 new recipe based on the ingredients list
11 changes: 0 additions & 11 deletions examples/recipegenerator/tool.gpt

This file was deleted.

25 changes: 4 additions & 21 deletions examples/story-book/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,7 @@ by `index.html` which has some JS/CSS to make the story styling consistent and r

## Usage Instructions

1. **Install and bootstrap the `image-generation` tool.**

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:

> Note: We'll soon have package management that handles tools installation for you, but until then, you have to manually clone and boostrap tools.

```shell
cd .. # This assumes you're starting at the root of the gptscript project. We want image-generation to be a sibling of gptscript.
git clone https://github.com/gptscript-ai/image-generation
cd image-generation
make bootstrap
source .venv/bin/activate
cd ../gptscript # returns you back to your original directory
```

> 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.

2. **Run the `story-book.gpt` script.**
1. **Run the `story-book.gpt` script.**

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:

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

3. **View the story.**
2. **View the story.**

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

4. (optional) **Generate a new story.**
3. (optional) **Generate a new story.**

To generate another story, you'll first need to delete the existing `pages` directory. In the `examples/story-book` directory, run the following command:

Expand All @@ -47,4 +30,4 @@ by `index.html` which has some JS/CSS to make the story styling consistent and r

```shell
gptscript story-book.gpt --prompt "The Three Little Pigs" --pages 5
```
```
10 changes: 5 additions & 5 deletions examples/story-book/story-book.gpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Do the following steps sequentially:
to write a story based on the prompt.
3. Take ${story} and break it up into ${pages} logical "pages" of text.
4. For each page:
- Call story-illustrator to illustrate it. Be sure to include any relevant characters to include when
- Call story-illustrator to illustrate it. Be sure to include any relevant characters to include when
asking it to illustrate the page.
- Download the illustration to a file at pages/<page_number>.png.
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.
Expand All @@ -37,7 +37,7 @@ Do the following steps sequentially:
}
</style>
```
6. Edit the "pages" variable array in index.html to serve the pages you created. Do not
6. Edit the "pages" variable array in index.html to serve the pages you created. Do not
edit anything else. Do not edit the page select field.

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

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

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

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

#!bash

mkdir ${dir}
mkdir ${dir}