Exploring the Promptfile Playground
The Promptfile Playground is an interactive sandbox for testing your .prompt
files. This intuitive environment enables you to experiment with your prompts effortlessly. When working in the Playground, syntax highlighting is consistently maintained in the 'Input' box and during conversation rendering. To display your responses with syntax highlighting, enclose them within triple backticks and a language identifier. For instance, a JavaScript response from the LLM will be displayed neatly with syntax highlighting, as shown:
<Assistant>
```js
const foo = "bar";
```
</Assistant>
Engaging with Your .prompt
File
Executing your Promptfile in the Playground triggers a sequence of interactive actions:
-
Variable Inputs: If your Promptfile contains variables, the Playground will first request the respective inputs. If your Promptfile doesn't contain any variables, this step is skipped, and the process moves directly to the next stage.
-
LLM Query: The Playground will then query the Language Learning Model (LLM) defined at the start of your file (e.g.,
gpt-3.5-turbo
) with the blocks you've provided in your Promptfile. A generated response is produced, allowing for continuation of the conversation. -
Continuing the Conversation: You are provided with a chat interface to continue the conversation with the LLM. Any messages you write here are wrapped in an
<User>
block before being sent to the model, forming a seamless and iterative chat session.
These steps lead to an ongoing interaction where the LLM response and your subsequent inputs create a dynamic conversation. The flow of this process can be monitored by inputting a response and then opening the session file, located at the top-right corner of the Playground.

Navigating the Playground
Crafting Your First .prompt
File in VS Code
Looking for inspiration? Check out our examples and copy one into your Promptfile.
Activating the Playground:
Choose either of these options to launch the Playground:
- Press
Command (⌘) + Enter (↩)
. - Execute the
Promptfile: run playground
command from the VS Code Command Palette.
Continuing the Conversation
To sustain the dialogue with the LLM, simply enter a new text into the Response
box.
Reviewing Conversation History
You can revisit your past exchanges by clicking on a session ID. This action opens the selected conversation history as a Promptfile in a new VS Code tab.
Tracking Token Usage
Monitor your token consumption at the bottom of the editor within your Promptfile. For token counting, Promptfile currently employs tiktoken (opens in a new tab).
Accessing the Session Promptfile
To view what's displayed in the Playground, click Open session file
.
Sharing Your Promptfile as a GitHub Gist
To publish your Promptfile as a GitHub Gist, create a personal access token with read/write permissions to create a Gist. You can learn how to do this here (opens in a new tab). Save your GitHub token in the Promptfile settings by pressing Command (⌘) + Shift (⇧) + P,
searching for Promptfile: open settings, and pasting your keys in the VS Code setting.
Alternatively, you can define your API key in your environment as GITHUB_TOKEN
.

Keeping Your File and Playground in Sync
The Playground includes a status indicator positioned next to your Promptfile name, assisting in tracking the synchronization status between the Playground and any modifications to your file. If you make changes in your file, remember to save them and then initiate a New Session
in the Playground for those changes to take effect.
- Orange Dot: An orange dot indicates that the Playground is running an outdated version of your Promptfile. To update the Playground with your latest changes, click the
New Session
button to restart the session. - No Dot: If there's no dot, it signifies that your Playground is up-to-date with the most recent version of your Promptfile.

With the Playground's interactive and intuitive features, you can refine and perfect your .prompt files effectively. Happy experimenting!