Skip to content

bug(py/ai): Prompt input.default from dotprompt not passed to DevUI #4535

@yesudeep

Description

@yesudeep

Summary

The Python SDK's prompt.py drops the input.default field when constructing the prompt metadata for the reflection API. This is the same issue as #4534 but for the Python SDK.

Root Cause

In py/packages/genkit/src/genkit/blocks/prompt.py, the load_prompt_metadata() function builds the input dict without the default key:

'input': {
    'jsonSchema': input_schema.get('schema') if input_schema and isinstance(input_schema, dict) else None,
},

But dotprompt's PromptInputConfig has a default field containing default values for input variables. This field is part of the dotprompt spec (spec/variables.yaml) and is supported by all 6 implementations (JS, Python, Go, Dart, Java, Rust).

Fix

Add default to the input dict:

'input': {
    'default': input_schema.get('default') if input_schema and isinstance(input_schema, dict) else None,
    'jsonSchema': input_schema.get('schema') if input_schema and isinstance(input_schema, dict) else None,
},

Impact

  • DevUI prompt input forms don't show default values from .prompt files
  • Users must manually enter values that are already specified as defaults in the prompt definition

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions