File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,12 @@ export interface GenerateOptions<
170
170
context ?: ActionContext ;
171
171
/** Abort signal for the generate request. */
172
172
abortSignal ?: AbortSignal ;
173
+ /**
174
+ * Additional metadata describing the GenerateOptions, used by tooling. If
175
+ * this is an instance of a rendered dotprompt, will contain any prompt
176
+ * metadata contained in the original frontmatter.
177
+ **/
178
+ metadata ?: Record < string , any > ;
173
179
}
174
180
175
181
export async function toGenerateRequest (
Original file line number Diff line number Diff line change @@ -330,6 +330,11 @@ function definePromptAsync<
330
330
...resolvedOptions ?. config ,
331
331
...renderOptions ?. config ,
332
332
} ,
333
+ metadata : resolvedOptions . metadata ?. metadata
334
+ ? {
335
+ prompt : resolvedOptions . metadata ?. metadata ,
336
+ }
337
+ : undefined ,
333
338
} ) ;
334
339
// if config is empty and it was not explicitly passed in, we delete it, don't want {}
335
340
if ( Object . keys ( opts . config ) . length === 0 && ! renderOptions ?. config ) {
@@ -842,6 +847,7 @@ function loadPrompt(
842
847
...promptMetadata ,
843
848
template : parsedPrompt . template ,
844
849
} ,
850
+ metadata : { ...promptMetadata . raw ?. [ 'metadata' ] } ,
845
851
} ,
846
852
maxTurns : promptMetadata . raw ?. [ 'maxTurns' ] ,
847
853
toolChoice : promptMetadata . raw ?. [ 'toolChoice' ] ,
You can’t perform that action at this time.
0 commit comments