Python: fix for Python: parameters mentioned in a SK prompt are not synced wi… (#6807)

fixes #6806

### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### 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 😄
This commit is contained in:
Eduard van Valkenburg
2024-06-19 06:35:05 +00:00
committed by GitHub
parent 3e8a93616f
commit 9f205c3245
2 changed files with 7 additions and 3 deletions
@@ -75,10 +75,8 @@ class KernelPromptTemplate(PromptTemplateBase):
# is a named arg block.
self._add_if_missing(sub_block.variable.name, seen)
def _add_if_missing(self, variable_name: str, seen: set | None = None):
def _add_if_missing(self, variable_name: str, seen: set):
# Convert variable_name to lower case to handle case-insensitivity
if not seen:
seen = set()
if variable_name and variable_name.lower() not in seen:
seen.add(variable_name.lower())
self.prompt_template_config.input_variables.append(InputVariable(name=variable_name))