Skip to content

Commit

Permalink
Fixes parsing and setting step variables.
Browse files Browse the repository at this point in the history
Code change suggested by @amritpal-singh-98
  • Loading branch information
juliomenendez committed Jan 19, 2024
1 parent 67d8574 commit 8017462
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions python/semantic_kernel/planning/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,19 +402,17 @@ def get_next_step_variables(self, variables: ContextVariables, step: "Plan") ->
elif param.name in self._state and (self._state[param.name] is not None and self._state[param.name] != ""):
step_variables.set(param.name, self._state[param.name])

for param_var in step.parameters.variables:
if param_var in step_variables:
for param_name, param_val in step.parameters.variables.items():
if param_name in step_variables:
continue

expanded_value = self.expand_from_variables(variables, param_var)
if expanded_value.lower() == param_var.lower():
step_variables.set(param_var, step.parameters.variables[param_var])
elif param_var in variables:
step_variables.set(param_var, variables[param_var])
elif param_var in self._state:
step_variables.set(param_var, self._state[param_var])
if param_name in variables:
step_variables.set(param_name, param_val)
elif param_name in self._state:
step_variables.set(param_name, self._state[param_name])
else:
step_variables.set(param_var, expanded_value)
expanded_value = self.expand_from_variables(variables, param_val)
step_variables.set(param_name, expanded_value)

for item in variables.variables:
if item not in step_variables:
Expand Down

0 comments on commit 8017462

Please sign in to comment.