Azure / Azure/azure-sdk-for-python

Running Promptflow with empty default input parameter via pipeline fails

Open
#38,892 2 comments 0 reactions 1 assignee Claimed by @luigiw View on GitHub
Client customer-reported needs-team-attention question Service Attention
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:
![Image](https://github.com/user-attachments/assets/f5dbc69e-6ac8-45ad-81e9-affb3039fbf8)
A fragment from `flow.dag.yaml` with empty default input parameter:
![Image](https://github.com/user-attachments/assets/0e95fea1-6f73-44f8-a4a6-04b232a96063)
Example of jinja2 prompt with empty input parameter:
![Image](https://github.com/user-attachments/assets/b0975119-02a3-4997-957a-7daf44a90cc2)

**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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.