Prompt file format

Our file format for serializing Prompts to store alongside your source code.

.prompt file format

Our .prompt file format is a serialized representation of a Prompt, designed to be human-readable and suitable for checking into your version control systems alongside your code. This allows technical teams to maintain the source of truth for their prompts within their existing version control workflow.

Format

The format is heavily inspired by MDX, with model and parameters specified in a YAML header alongside a JSX-inspired syntax for chat templates.

1---
2model: gpt-4o
3temperature: 0.7
4max_tokens: -1
5provider: openai
6endpoint: chat
7---
8<system>
9 You are a friendly assistant.
10</system>

Multi-modality and images

Images can be specified using nested <image> tags within a <user> message. To specify text alongside the image, use a <text> tag.

Image and Text
1---
2model: gpt-4o
3temperature: 0.7
4max_tokens: -1
5provider: openai
6endpoint: chat
7tools: []
8---
9<system>
10 You are a friendly assistant.
11</system>
12
13<user>
14 <text>
15 What is in this image?
16 </text>
17 <image url="https://upload.wikimedia.org/wikipedia/commons/8/89/Antidorcas_marsupialis%2C_male_%28Etosha%2C_2012%29.jpg" />
18</user>

Tools, tool calls, and tool responses

Specify the tools available to the model as a JSON list in the YAML header.

Tool calls in assistant messages can be added with nested <tool> tags. A <tool> tag within an <assistant> tag denotes a tool call of type: "function", and requires the attributes name and id. The text wrapped in a <tool> tag should be a JSON-formatted string containing the tool call’s arguments.

Tool call responses can then be added with <tool> tags after the <assistant> message.

1---
2model: gpt-4o
3temperature: 0.7
4max_tokens: -1
5provider: openai
6endpoint: chat
7tools: [
8 {
9 "name": "get_current_weather",
10 "description": "Get the current weather in a given location",
11 "parameters": {
12 "type": "object",
13 "properties": {
14 "location": {
15 "type": "string",
16 "name": "Location",
17 "description": "The city and state, e.g. San Francisco, CA"
18 },
19 "unit": {
20 "type": "string",
21 "name": "Unit",
22 "enum": [
23 "celsius",
24 "fahrenheit"
25 ]
26 }
27 },
28 "required": [
29 "location"
30 ]
31 }
32 }
33]
34---
35<system>
36 You are a friendly assistant.
37</system>
38
39<user>
40 What is the weather in SF?
41</user>
42
43<assistant>
44 <tool name="get_current_weather" id="call_1ZUCTfyeDnpqiZbIwpF6fLGt">
45 {
46 "location": "San Francisco, CA"
47 }
48 </tool>
49</assistant>
50
51<tool name="get_current_weather" id="call_1ZUCTfyeDnpqiZbIwpF6fLGt">
52 Cloudy with a chance of meatballs.
53</tool>