Introduction

Promptfile: Engineer Prompts Faster

Promptfile is an open-source tool designed to make the process of writing and testing prompts quick and straightforward. Its syntax is similar to Markdown, adding to its simplicity.

You can create and refine your prompts directly in VS Code.

.prompt files are easy to read and debug. Simply run a command to test your work, and immediately see the results in the VS Code Playground.

When your prompt is polished, it can be converted into a function that integrates seamlessly into your code. This makes Promptfile a convenient addition to any TypeScript, JavaScript, Python, or Ruby project.

🔑
Your prompt, your keys, your control. Keys are stored locally.

Key Features

Stay in VS Code

  • Leverage features like syntax highlighting, IntelliSense, and tools like GitHub Copilot. This gives a familiar developer experience while crafting prompts.

Isolate Code from Prompts

  • Unlike code, prompts can behave unpredictably. By separating them, you gain better control over your project.

Designed for Rapid Iterations

  • Modify model providers with a single line, keep track of token usage, and perform real-time testing.

Quickstart

You can be up and running in under a few minutes. For comprehensive step-by-step instructions, please consult our Getting Started Guide.

Install the VS Code extension (opens in a new tab)

Add your OpenAI or Anthropic API Key using the "Promptfile: open settings" command in the VS Code Command Palette. If you need help, visit this section of our guide.

Craft your first .prompt file

Create a file named example.prompt and paste the content from the given example.prompt file into it.

---
model: gpt-3.5-turbo
---
 
<System>
You are HaikuGPT. Always respond to the user in the form of a haiku.
</System>
 
<User>
Write me a haiku about the ocean
</User>

Execute the .prompt file: Command (⌘) + Enter (↩)

Your .prompt file will run in the Promptfile Playground.

Quickly switch models

By just changing the frontmatter of your .prompt file, you can switch to a different model and update the settings of the model. Different models need different things, so let us worry about what makes a valid request to that model. We provide diagnostics to help you make a valid request regardless of the model you are using.

Explore More Promptfile Features in our Cookbook

Discover more about using Promptfile by exploring the examples in our Cookbook.

Why Choose Promptfile?

Promptfile offers a superior templating syntax and playground for your prompts. When your project's early stages involve crafting a prompt, Promptfile makes this the smoothest part of your journey. It eliminates the cumbersome steps of parsing, concatenating, and formatting requests for Language Models, speeding up your iteration and testing cycles.

In our experience, we found ourselves spending substantial time tweaking prompts in OpenAI's playground and exporting them as unmanageable JSONs that we wouldn't revisit. Like you, we craved speed, the ability to iterate quickly, and a focus on the real goal: building useful applications with Language Models. And so, Promptfile was born.

Try Promptfile and see the difference:

---
model: gpt-3.5-turbo
---
 
<System>
You are a programming assistant tasked with writing performant, concise, beautiful TypeScript code. Respond to the User's message with fenced TypeScript code. Do not include any other content in your response.
</System>
 
 
<User>
How do I add two numbers?
</User>
 
 
<Assistant>
```ts
function addNumbers(a: number, b: number): number {
  return a + b;
}
```
</Assistant>
 
 
<User>
Write me a function that creates an array of 10 random odd integers between 0 and 20
</User>
 
 
<Assistant>
```ts
function generateRandomOddIntegers(): number[] {
  const oddIntegers: number[] = []
 
  while (oddIntegers.length < 10) {
    const randomInt = Math.floor(Math.random() * 21)
 
    if (randomInt % 2 !== 0) {
      oddIntegers.push(randomInt)
    }
  }
 
  return oddIntegers
}
```
</Assistant>
 
 
<User>
Write me a function to find a prime number
</User>