References

.prompt files

Our file format for serialising prompts to store alongside your source code.

Our .prompt file format is a serialized version of a model config that is designed to be human-readable and suitable for checking into your version control systems alongside your code.

Format

The .prompt file is heavily inspired by MDX, with model and hyperparameters specified in a YAML header alongside a JSX-inspired format for your Chat Template.

Basic examples

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