Skip to content

Python: Verify that plugin names are unique. #6433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

stefan521
Copy link
Contributor

@stefan521 stefan521 commented May 28, 2024

Motivation and Context

Addresses #6383

It should not be possible to add two or more plugins with the same name. The .Net version validates that plugin names are unique. I'm adding a similar check in Python.

Description

All the methods to register plugins, such as add_plugins and add_plugin_from_openapi end up in add_plugin so that's where I added the validation.

Contribution Checklist

@stefan521 stefan521 requested a review from a team as a code owner May 28, 2024 22:07
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label May 28, 2024
@stefan521 stefan521 changed the title Python: Verify that plugin names are unique. #6383 Python: Verify that plugin names are unique. May 28, 2024
@markwallace-microsoft
Copy link
Member

Py3.10 Test Coverage

Python 3.10 Test Coverage Report •
FileStmtsMissCoverMissing
semantic_kernel/functions
   kernel_function_extension.py126993%45, 47, 338, 358–360, 396, 398, 408
TOTAL612688186% 

Python 3.10 Unit Test Overview

Tests Skipped Failures Errors Time
1394 1 💤 0 ❌ 0 🔥 16.261s ⏱️

@moonbox3
Copy link
Contributor

This was by design since plugins are a Python dictionary, and by default in Python, dictionaries overwrite an existing key if the same key is added.

@moonbox3
Copy link
Contributor

As commented above, this is by design and the Pythonic way of handling it. We're not going to move forward with this change.

@moonbox3 moonbox3 closed this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests for the Python Semantic Kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants