You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: third_party/docsite/src/content/docs/getting-started.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Getting Started
2
+
title: Get started
3
3
hide_breadcrumbs: true
4
4
---
5
5
importCalloutfrom"@/components/Callout.astro";
@@ -24,9 +24,9 @@ An executable prompt template is a file that contains not only the text of a pro
24
24
25
25
This combination of features makes it possible to treat a Dotprompt file as an executable unit, streamlining the process of working with AI models and ensuring consistency across different uses of the same prompt.
26
26
27
-
## Example `.prompt`file
27
+
## Example file
28
28
29
-
Here's an example of a Dotprompt file that extracts structured data from provided text:
29
+
Here's an example of a Dotprompt file that extracts structured data from the provided text:
30
30
31
31
```handlebars
32
32
---
@@ -39,7 +39,7 @@ output:
39
39
schema:
40
40
title?: string, the title of the article if it has one
41
41
summary: string, a 3-sentence summary of the text
42
-
tags?(array, a list of string tag category for the text): string,
42
+
tags?(array, a list of string tag category for the text): string,
43
43
---
44
44
45
45
Extract the requested information from the given text. If a piece of information is not present, omit that field from the output.
@@ -57,7 +57,7 @@ This Dotprompt file:
57
57
58
58
When executed, this prompt would take a text input, analyze it using the specified AI model, and return a structured JSON object with the extracted information.
59
59
60
-
## Installation
60
+
## Install and set up
61
61
62
62
The remainder of this getting started guide will use the reference Dotprompt implementation included as part of the [Firebase Genkit](https://github.com/firebase/genkit) GenAI framework. To use other implementations of Dotprompt, see the [list of Implementations](/implementations).
Copy file name to clipboardExpand all lines: third_party/docsite/src/content/docs/reference.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Reference Docs
2
+
title: Reference docs
3
3
---
4
4
5
5
A Dotprompt template format is made up of four parts:
@@ -15,9 +15,9 @@ output:
15
15
{{! (3) the Template Content goes here }}
16
16
```
17
17
18
-
When executed, a Dotprompt template renders into (4) Common Model Interface.
18
+
When executed, a Dotprompt template renders into (4) Common Model Interface.
19
19
20
-
## Reference Docs
20
+
## Reference docs
21
21
22
22
1.**[Prompt Frontmatter](/reference/frontmatter):** Included at the start of a Dotprompt template, frontmatter includes model configuration, input/output formatList, and tooling MediaMetadata.
23
23
2.**[Picoschema](/reference/picoschema):** The compact, YAML-optimized schema representation used for describing structured data in a Dotprompt template.
Copy file name to clipboardExpand all lines: third_party/docsite/src/content/docs/reference/frontmatter.mdx
+15-7Lines changed: 15 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Prompt Frontmatter
2
+
title: Prompt frontmatter
3
3
sort_order: 1
4
4
---
5
5
@@ -17,7 +17,7 @@ Prompt template goes here.
17
17
18
18
All frontmatter fields are considered optional in a given `.prompt` file, as Dotprompt implementations may provide default values for any or all of them. If no frontmatter fields need to be specified in a given file, the frontmatter may be omitted entirely and only a prompt template provided.
19
19
20
-
## Full Example
20
+
## Full example
21
21
22
22
Here's an example of a Dotprompt frontmatter:
23
23
@@ -26,7 +26,7 @@ Here's an example of a Dotprompt frontmatter:
26
26
name: greetingPrompt
27
27
variant: formal
28
28
model: googleai/gemini-1.5-flash
29
-
tools:
29
+
tools:
30
30
- timeOfDay
31
31
config:
32
32
version: gemini-1.5-flash-latest
@@ -52,25 +52,30 @@ metadata:
52
52
---
53
53
```
54
54
55
-
## Available Fields
55
+
## Available fields
56
56
57
57
### `name`
58
+
58
59
-**Type:**`string`
59
60
-**Description:** The name of the prompt. If unspecified, inferred by the filename of the loaded prompt (e.g. `myPrompt.prompt` has an inferred name of `myPrompt`).
60
61
61
62
### `variant`
63
+
62
64
-**Type:**`string`
63
65
-**Description:** The variant name for the prompt. If unspecified, inferred by the filename of the loaded prompt (e.g. `myPrompt.variant1.prompt` has inferred name of `myPrompt` and inferred variant of `variant1`).
64
66
65
67
### `model`
68
+
66
69
-**Type:**`string` or `ModelArgument<Options>`
67
70
-**Description:** The name of the model to use for this prompt, e.g., `googleai/gemini-1.5-flash-latest`. The Dotprompt implementation is responsible for resolving a string model name to an executable model.
68
71
69
72
### `tools`
73
+
70
74
-**Type:**`string[]`
71
75
-**Description:** Names of tools (registered in the Dotprompt implementation) to allow use of in this prompt.
72
76
73
77
### `config`
78
+
74
79
-**Type:**`object`
75
80
-**Description:** Configuration to be passed to the model implementation as a `Map<string,any>`. The specific configuration options vary depending on the model implementation.
76
81
-**Common Config:** Model implementations should respect the following config properties where applicable:
@@ -107,6 +112,7 @@ metadata:
107
112
-**Example:**`["END", "\n\n", "User:"]`
108
113
109
114
### `input`
115
+
110
116
-**Type:**`object`
111
117
-**Description:** Defines the input variables the prompt. If `input` is not specified, the implementation should accept any `Map<string,any>` values as input and pass them to the prompt template.
112
118
-**Properties:**
@@ -118,22 +124,24 @@ metadata:
118
124
-**Description:** Schema representing the input values for the prompt. Must correspond to a JSON Schema `object` type.
119
125
120
126
### `output`
127
+
121
128
-**Type:**`object`
122
129
-**Description:** Defines the expected model output format.
123
130
-**Properties:**
124
131
-`format`:
125
132
-**Type:**`string`
126
133
-**Common Values:**`json`, `text`
127
-
-**Description:** Desired output format for this prompt. Output formats are implementation-specific, but
134
+
-**Description:** Desired output format for this prompt. Output formats are implementation-specific, but
128
135
-`schema`:
129
136
-**Type:**[Schema](schema)
130
137
-**Description:** Schema representing the expected output from the prompt. Must correspond to a JSON Schema `object` type.
131
138
132
139
### `metadata`
140
+
133
141
-**Type:**`Map<string, any>`
134
142
-**Description:** Arbitrary metadata to be used by code, tools, and libraries.
135
143
136
-
## Frontmatter Extensions
144
+
## Frontmatter extensions
137
145
138
146
In the frontmatter, Dotprompt implementations will automatically collect namespaced fields (i.e. fields with a `.` in them) into a special `ext` property on the resulting metadata. For example, the following frontmatter:
139
147
@@ -169,4 +177,4 @@ Would be parsed into this equivalent metadata:
169
177
}
170
178
```
171
179
172
-
Note that nested namespaces are flattened into dotted keys to avoid conflicts between nested properties and nested namespaces.
180
+
Note that nested namespaces are flattened into dotted keys to avoid conflicts between nested properties and nested namespaces.
Copy file name to clipboardExpand all lines: third_party/docsite/src/content/docs/reference/model.mdx
+46-14Lines changed: 46 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@ Dotprompt implementations are not required to conform to any specific structured
7
7
8
8
In the future, a Dotprompt "spec test" will be made available that exercises the various parts of Dotprompt and compares the results to this common model request format.
9
9
10
-
## GenerateRequest
10
+
## `GenerateRequest`
11
11
12
-
### Full Example
12
+
### Full example
13
13
14
14
```json
15
15
{
@@ -113,132 +113,159 @@ In the future, a Dotprompt "spec test" will be made available that exercises the
113
113
]
114
114
}
115
115
```
116
+
116
117
### Properties
117
118
118
119
#### `messages`
120
+
119
121
-**Type:**`array` of [Message](#message) objects.
120
122
-**Description:** The conversation history and current prompt.
121
123
122
124
#### `config`
125
+
123
126
-**Type:**[ModelConfig](#modelconfig)
124
127
-**Description:** Configuration options for the model.
125
128
126
129
#### `tools`
130
+
127
131
-**Type:**`array` of [ToolDefinition](#tooldefinition)
128
132
-**Description:** Definitions of tools available to the model.
129
133
130
134
#### `output`
135
+
131
136
-**Type:**[Output](#output)
132
137
-**Description:** Specification for the desired output format.
133
138
134
139
#### `context`
140
+
135
141
-**Type:**`array` of [Document](#document)
136
142
-**Description:** Grounding context documents for the model.
137
143
138
-
## Message
144
+
## `Message`
139
145
140
146
A message represents a single "turn" in a multi-turn conversation. Each message must have a role and specified content.
141
147
142
148
### Properties
143
149
144
150
#### `role`
151
+
145
152
-**Type:**`string`
146
153
-**Description:** The role of the message sender. Can be "system", "user", "model", or "tool".
147
154
148
155
#### `content`
156
+
149
157
-**Type:**`array` of [Part](#part)
150
158
-**Description:** The content of the message, which can include text, media, tool requests, and tool responses.
151
159
152
160
#### `metadata`
161
+
153
162
-**Type:**`object`
154
163
-**Description:** Optional. Additional metadata for the message.
155
164
156
-
## Part
165
+
## `Part`
157
166
158
167
A `Part` object can be one of the following types:
159
168
160
-
### TextPart
169
+
### `TextPart`
161
170
162
171
#### `text`
172
+
163
173
-**Type:**`string`
164
174
-**Description:** The text content of the message.
165
175
166
-
### MediaPart
176
+
### `MediaPart`
167
177
168
178
#### `media`
179
+
169
180
-**Type:**`object`
170
181
-**Description:** Contains media information.
171
182
172
183
#### `media.contentType`
184
+
173
185
-**Type:**`string`
174
186
-**Description:** Optional. The media content type. Inferred from data URI if not provided.
175
187
176
188
#### `media.url`
189
+
177
190
-**Type:**`string`
178
191
-**Description:** A `data:` or `https:` URI containing the media content.
179
192
180
-
### ToolRequestPart
193
+
### `ToolRequestPart`
181
194
182
195
#### `toolRequest`
196
+
183
197
-**Type:**`object`
184
198
-**Description:** A request for a tool to be executed.
185
199
186
200
#### `toolRequest.ref`
201
+
187
202
-**Type:**`string`
188
203
-**Description:** Optional. The call ID or reference for a specific request.
189
204
190
205
#### `toolRequest.name`
206
+
191
207
-**Type:**`string`
192
208
-**Description:** The name of the tool to call.
193
209
194
210
#### `toolRequest.input`
211
+
195
212
-**Type:**`any`
196
213
-**Description:** Optional. The input parameters for the tool, usually a JSON object.
197
214
198
-
### ToolResponsePart
215
+
### `ToolResponsePart`
199
216
200
217
#### `toolResponse`
218
+
201
219
-**Type:**`object`
202
220
-**Description:** A provided response to a tool call.
203
221
204
222
#### `toolResponse.ref`
223
+
205
224
-**Type:**`string`
206
225
-**Description:** Optional. The call ID or reference for a specific request.
207
226
208
227
#### `toolResponse.name`
228
+
209
229
-**Type:**`string`
210
230
-**Description:** The name of the tool.
211
231
212
232
#### `toolResponse.output`
233
+
213
234
-**Type:**`any`
214
235
-**Description:** Optional. The output data returned from the tool, usually a JSON object.
215
236
216
-
## ModelConfig
237
+
## `ModelConfig`
217
238
218
239
`ModelConfig` is an arbitrary `Map<string,any>` that depends on the specific implementation of the underlying model. However, the following common configuration options should be respected in implementation whenever applicable:
219
240
220
-
### Common Config Properties
241
+
### Common config properties
242
+
221
243
#### `temperature`
244
+
222
245
-**Type:**`number`
223
246
-**Description:** Optional. Controls the randomness of the model's output.
224
247
225
248
#### `maxOutputTokens`
249
+
226
250
-**Type:**`number`
227
251
-**Description:** Optional. Limits the maximum number of tokens in the model's response.
228
252
229
253
#### `topK`
254
+
230
255
-**Type:**`number`
231
256
-**Description:** Optional. Limits the number of highest probability vocabulary tokens to consider at each step.
232
257
233
258
#### `topP`
259
+
234
260
-**Type:**`number`
235
261
-**Description:** Optional. Sets a probability threshold for token selection.
236
262
237
263
#### `stopSequences`
264
+
238
265
-**Type:**`array` of `string`
239
266
-**Description:** Optional. Sequences that, if encountered, will cause the model to stop generating further output.
240
267
241
-
## Tool Object
268
+
## `Tool` object
242
269
243
270
### `name`
244
271
-**Type:**`string`
@@ -256,27 +283,32 @@ A `Part` object can be one of the following types:
256
283
-**Type:**`object`
257
284
-**Description:** Optional. A JSON Schema object describing the expected output from the tool.
258
285
259
-
## Output Object
286
+
## `OutputOptions` object
260
287
261
288
### `format`
289
+
262
290
-**Type:**`string`
263
291
-**Description:** Optional. The desired output format. All implementations should support `json` and `text` at a minimum.
264
292
265
293
### `schema`
294
+
266
295
-**Type:**`object`
267
296
-**Description:** Optional. A JSON Schema object describing the expected structure of the output.
268
297
269
-
## Document Object
298
+
## `Document` Object
270
299
271
300
### `id`
301
+
272
302
-**Type:**`string`
273
303
-**Description:** A unique identifier for the document.
274
304
275
305
### `content`
306
+
276
307
-**Type:**`string`
277
308
-**Description:** The text content of the document.
278
309
279
310
### `metadata`
311
+
280
312
-**Type:**`object`
281
313
-**Description:** Optional. Additional metadata for the document.
282
314
@@ -289,4 +321,4 @@ A `Part` object can be one of the following types:
289
321
- The `context` array provides additional information that may be relevant to the task but isn't part of the direct conversation history.
290
322
- The `candidates` field determines how many alternative responses the model should generate.
291
323
292
-
This interface provides a flexible and powerful way to interact with GenAI models, supporting various types of inputs, outputs, and model configurations.
324
+
This interface provides a flexible and powerful way to interact with GenAI models, supporting various types of inputs, outputs, and model configurations.
0 commit comments