Skip to content

Commit

Permalink
Update README to describe custom json context
Browse files Browse the repository at this point in the history
  • Loading branch information
cannoneyed committed Jul 23, 2023
1 parent f962e51 commit 7d012e6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,22 @@ updating the text editor, and handles user choices.
Defines how the data from the `Context` is combined with an `Operation` state to
construct text that will be sent to a mode, and parses model output.

## Customizing context

The Wordcraft application uses few-shot examples for constructing prompts to
send to the model. The style of the generated text is influenced by these
examples, and you can customize Wordcraft's style or genre by editing these
examples. These examples are found in `/app/context/json`, and follow a schema
defined in `/app/context/schema`.

## Adding new controls

To add a new custom control (e.g. a button that translates into pig latin):

- Create a new `PigLatinExamples` in `/app/context/examples`
- Create a new `pigLatinSchema` in `/app/context/schema.ts`
- Create a new `pig_latin_examples.json` in `/app/context/json/`
- Register the examples int the `WordCraftContext` constructor
(`/app/context/index.ts`)
- Create a corresponding prompt handler in `/app/models/palm/prompts`
- Register that prompt handler with the underlying `Model` class in
`/app/models/palm/index.ts`
Expand Down

0 comments on commit 7d012e6

Please sign in to comment.