From 52051a290612f9a87fee1d6c253406b1c0afe23a Mon Sep 17 00:00:00 2001 From: Yesudeep Mangalapilly Date: Mon, 9 Feb 2026 13:34:04 -0800 Subject: [PATCH 1/2] fix(js/ai): pass input.default from dotprompt to DevUI reflection API The promptMetadata function and the dotprompt file loading path were only passing the input schema but not the default values. This meant the DevUI could never pre-fill prompt input forms with defaults specified in .prompt files or DefinePrompt calls. Add the default key to the input object in both locations. Fixes #4534 --- js/ai/src/prompt.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/ai/src/prompt.ts b/js/ai/src/prompt.ts index 1c489ad189..70b4002410 100644 --- a/js/ai/src/prompt.ts +++ b/js/ai/src/prompt.ts @@ -331,8 +331,8 @@ function definePromptAsync< }, metadata: resolvedOptions.metadata?.metadata ? { - prompt: resolvedOptions.metadata?.metadata, - } + prompt: resolvedOptions.metadata?.metadata, + } : undefined, }); @@ -432,6 +432,7 @@ function promptMetadata(options: PromptConfig) { ...options.metadata?.prompt, config: options.config, input: { + default: options.input?.default, schema: options.input ? toJsonSchema(options.input) : undefined, }, name: options.name.includes('.') @@ -855,6 +856,7 @@ function loadPrompt( format: promptMetadata.output?.format, }, input: { + default: promptMetadata.input?.default, jsonSchema: promptMetadata.input?.schema, }, metadata, From f308af3e0e24d6f55c0050a843e6d6203323c292 Mon Sep 17 00:00:00 2001 From: Yesudeep Mangalapilly Date: Mon, 9 Feb 2026 13:39:30 -0800 Subject: [PATCH 2/2] fix(js/ai): add default field to PromptConfig.input interface Update the TypeScript interface to include the default property on input for type safety, matching the dotprompt spec. --- js/ai/src/prompt.ts | 1 + py/samples/framework-evaluator-demo/prompts/hello.prompt | 3 +++ py/samples/framework-prompt-demo/prompts/recipe.prompt | 2 ++ py/samples/framework-prompt-demo/prompts/story.prompt | 3 +++ py/samples/web-endpoints-hello/prompts/code_review.prompt | 3 +++ 5 files changed, 12 insertions(+) diff --git a/js/ai/src/prompt.ts b/js/ai/src/prompt.ts index 70b4002410..29e2b6cf7f 100644 --- a/js/ai/src/prompt.ts +++ b/js/ai/src/prompt.ts @@ -116,6 +116,7 @@ export interface PromptConfig< input?: { schema?: I; jsonSchema?: JSONSchema7; + default?: Record; }; system?: string | Part | Part[] | PartsResolver>; prompt?: string | Part | Part[] | PartsResolver>; diff --git a/py/samples/framework-evaluator-demo/prompts/hello.prompt b/py/samples/framework-evaluator-demo/prompts/hello.prompt index c51d31d169..8d0913e0b6 100644 --- a/py/samples/framework-evaluator-demo/prompts/hello.prompt +++ b/py/samples/framework-evaluator-demo/prompts/hello.prompt @@ -1,8 +1,11 @@ --- +model: googleai/gemini-3-flash-preview config: temperature: 0.75 topK: 10 input: + default: + query: "fibonacci function" schema: query: string --- diff --git a/py/samples/framework-prompt-demo/prompts/recipe.prompt b/py/samples/framework-prompt-demo/prompts/recipe.prompt index a8f4bf4bc1..5754817b42 100644 --- a/py/samples/framework-prompt-demo/prompts/recipe.prompt +++ b/py/samples/framework-prompt-demo/prompts/recipe.prompt @@ -1,6 +1,8 @@ --- model: googleai/gemini-3-flash-preview input: + default: + food: "banana bread" schema: food: string ingredients?(array): string diff --git a/py/samples/framework-prompt-demo/prompts/story.prompt b/py/samples/framework-prompt-demo/prompts/story.prompt index 981317bfb1..8a08d626c5 100644 --- a/py/samples/framework-prompt-demo/prompts/story.prompt +++ b/py/samples/framework-prompt-demo/prompts/story.prompt @@ -1,6 +1,9 @@ --- model: googleai/gemini-3-flash-preview input: + default: + subject: "a brave little toaster" + personality: "courageous" schema: subject: string personality?: string diff --git a/py/samples/web-endpoints-hello/prompts/code_review.prompt b/py/samples/web-endpoints-hello/prompts/code_review.prompt index ee636421ac..fbc7f9e8af 100644 --- a/py/samples/web-endpoints-hello/prompts/code_review.prompt +++ b/py/samples/web-endpoints-hello/prompts/code_review.prompt @@ -1,6 +1,9 @@ --- model: googleai/gemini-3-flash-preview input: + default: + code: "def add(a, b):\n return a + b" + language: "python" schema: code: string language?: string