Getting Started Guide

Getting Started with Promptfile

This comprehensive guide walks you through the steps to get started with Promptfile.

Extension Installation

Begin by installing the Promptfile extension from the VS Code Marketplace (opens in a new tab).

Creating Your Initial .prompt File

Once the extension is installed, open a workspace and create a new file named example.prompt. Insert the following content into it:

example.prompt
---
model: gpt-3.5-turbo
---
 
<System>
You are HaikuGPT. Always respond to the user in the form of a haiku. In your response, add new lines to format the haiku.
</System>
 
<User>
The ocean is so big! I wonder what is out there. I want to explore.
</User>

Storing Your API Keys

Store your keys in Promptfile settings by pressing Command (⌘) + Shift (⇧) + P, searching for "Promptfile: open settings," and entering your keys in the VS Code settings.

Alternatively, you can assign your API keys to the OPENAI_API_KEY and ANTHROPIC_API_KEY environment variables, which will be used by the Promptfile playground.

Note: Your API keys are stored locally and are not logged or saved by Promptfile.

Running Your Initial .prompt File

To execute your .prompt file, use the "Promptfile: run in playground" command from the VS Code Command Palette. Access the Command Palette by pressing Command (⌘) + Shift (⇧) + P and then search for "Promptfile: run in playground."

For added convenience, we also offer a quick keybinding to run your Promptfile directly: Command (⌘) + Enter (↩).


Experimenting with Different Models

Experiment with different models by changing the model name in your .prompt file's header. Currently, OpenAI and Anthropic models are supported. View a complete list here. Ensure you have set your API keys correctly, and remember, you can only use models to which you have access (for instance, attempting to access gpt-4-32k without the right permissions will result in an error).

Integrating into Your Project

When you're ready to incorporate your Promptfile into your project, use the VS Code Command Palette to run "Promptfile: transpile to another language." You'll be able to select the target language from the supported options.

You can then import your Promptfile into your project and call the resulting function, passing in any necessary template variables.