-
Notifications
You must be signed in to change notification settings - Fork 888
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Executor] Support applying default value and ensuring type for flex …
…flow (#2923) # Description In this PR, we support applying default value and ensuring type provided for flex flow. If the input is not provided then we will apply the default value defined in the yaml, also we will check whether the input type is consistent with the type defined in yaml. An example yaml file: ``` entry: my_flow:MyClass init: input_init: type: string default: input_init inputs: input_1: type: string input_2: type: string default: input_2 ``` # All Promptflow Contribution checklist: - [x] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [x] **I have read the [contribution guidelines](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [x] Title of the pull request is clear and informative. - [x] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [x] Pull request includes test coverage for the included changes. --------- Co-authored-by: Lina Tang <[email protected]>
- Loading branch information
Showing
10 changed files
with
113 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/promptflow/tests/test_configs/eager_flows/flow_with_signature/flow.flex.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
entry: my_flow:MyClass | ||
init: | ||
input_init: | ||
type: string | ||
default: input_init | ||
inputs: | ||
input_1: | ||
type: string | ||
input_2: | ||
type: string | ||
default: input_2 |
2 changes: 2 additions & 0 deletions
2
src/promptflow/tests/test_configs/eager_flows/flow_with_signature/inputs.jsonl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"input_1": "input_1"} | ||
{"input_1": "input_1"} |
6 changes: 6 additions & 0 deletions
6
src/promptflow/tests/test_configs/eager_flows/flow_with_signature/my_flow.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class MyClass: | ||
def __init__(self, input_init: str = "default_input_init"): | ||
pass | ||
|
||
def __call__(self, input_1, input_2: str = "default_input_2"): | ||
return {"output": input_2} |
11 changes: 11 additions & 0 deletions
11
src/promptflow/tests/test_configs/eager_flows/flow_with_wrong_type/flow.flex.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
entry: my_flow:MyClass | ||
init: | ||
input_init: | ||
type: string | ||
default: input_init | ||
inputs: | ||
input_1: | ||
type: string | ||
input_2: | ||
type: int | ||
default: input_2 |
6 changes: 6 additions & 0 deletions
6
src/promptflow/tests/test_configs/eager_flows/flow_with_wrong_type/my_flow.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class MyClass: | ||
def __init__(self, input_init: str = "default_input_init"): | ||
pass | ||
|
||
def __call__(self, input_1, input_2: str = "default_input_2"): | ||
return {"output": input_2} |