Python: Fix parameter propagation bug in Plan Object Model (#2388)

### Motivation and Context

Initially called out and fixed by @joowon-dm-snu in
https://github.com/microsoft/semantic-kernel/pull/2223

This PR closes
[#2094](https://github.com/microsoft/semantic-kernel/issues/2094)

There was a bug in the Plan Object Model that propagates the name of the
step parameter to the next step. It should be propagating the
parameter's value


### Description
In addition to making the code change to fix the bug, also added a unit
test that covers the changed code.

Below image shows the before and after of the test with the fix. 


![image](https://github.com/microsoft/semantic-kernel/assets/54643756/7217f42a-a2ac-4491-a709-bea9be7328e3)

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

Co-authored-by: Abby Harrison <[email protected]>
This commit is contained in:
Abby Harrison
2023-08-10 00:30:34 +00:00
committed by GitHub
co-authored by Abby Harrison
parent 274c4fd410
commit b9c77f45e7
2 changed files with 32 additions and 1 deletions
+1 -1
View File
@@ -410,7 +410,7 @@ class Plan(SKFunctionBase):
expanded_value = self.expand_from_variables(variables, param_var)
if expanded_value.lower() == param_var.lower():
step_variables.set(param_var, expanded_value)
step_variables.set(param_var, step.parameters._variables[param_var])
elif variables.contains_key(param_var):
step_variables.set(param_var, variables[param_var])
elif self._state.contains_key(param_var):