Azure / Azure/azure-sdk-for-python
Running Promptflow with empty default input parameter via pipeline fails
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 3.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 193
Description
- **Package Name**: azure.ai.ml
- **Package Version**: 1.18.0
- **Operating System**: Win11
- **Python Version**: 3.12.7
**Describe the bug**
Promptflow by default supports running flows with empty default parameters (additional handling can be done using conditional checks in jinja2 prompts). Loading a `flow.dag.yaml` file via `load_component()` inside of a fuction with `@pipeline()` decorator yields "Can't build command text for [redacted], moduleId [redacted] executionId [redacted]: Assignment for parameter emptyByDefaultParameter is not specified" in Azure AI | Machine Learning Studio (see attached images). Such behavior is unexpected since running Promptflow flow directly runs without issues with empty input parameters and jinja2 prompts used in prompting becomes less useful since some conditional checks will not be reached.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a chat Promptflow with empty input parameter.
2. Create a job from a function decorated with `@pipeline`.
3. The method should contain a flow component which is loaded from `flow.dag.yaml` file containing empty input parameter.
4. Run the created job, notice error message in Azure AI | Machine Learning Studio.
To create a pipeline job, load a flow as a component and create a job using the pipeline a tutorial was followed: https://microsoft.github.io/promptflow/tutorials/pipeline.html
**Expected behavior**
It is expected that if no parameter is provided (or a parameter is passed as '') to the default empty input parameter the flow should run successfully by using an empty value which can be handled by jinja2 prompts.
**Screenshots**
The code used to create a flow component:

A fragment from `flow.dag.yaml` with empty default input parameter:

Example of jinja2 prompt with empty input parameter:

**Additional context**
Currently I have tried not passing the default parameter, passing '' and None without any progress. A workaround can be done using a hardcoded default value and checking for in jinja2 prompt but it is against clean code practices.
Contributor guide
Assessment
This issue has not been assessed yet.