SIGN IN SIGN UP

Integrate cutting-edge LLM technology quickly and easily into your apps

0 0 14 C#
Python: rebuilt exceptions structure; pythonic version (#5231) ### 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. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
# Copyright (c) Microsoft. All rights reserved.
# Even though there is no strict separation between errors and exceptions in Python, it is a good practice to use:
# - Exceptions for exceptional conditions that a reasonable application may wish to catch.
# - Errors for exceptional conditions that are not reasonable to catch.
# for instance syntax errors in a template should be called ...Error,
# while rendering of the same template should raise an ...Exception.
# every error should derive from KernelException (including errors)
# all raised exceptions should use the raise ... from exc syntax to preserve the original traceback
class KernelException(Exception):
"""The base class for all Semantic Kernel exceptions."""
Python: rebuilt exceptions structure; pythonic version (#5231) ### 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. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
pass
class KernelServiceNotFoundError(KernelException):
"""Raised when a service is not found in the kernel."""
Python: rebuilt exceptions structure; pythonic version (#5231) ### 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. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
pass
class KernelPluginNotFoundError(KernelException):
"""Raised when a plugin is not found in the kernel."""
Python: rebuilt exceptions structure; pythonic version (#5231) ### 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. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
pass
Python: Introduce operations to handle OpenAI plugins, improve OpenAPI plugins, and allow for auth (#5695) ### Motivation and Context Python had the ability to handle operations for OpenAPI plugins, but at a basic level. It did not have the ability to handle OpenAI plugins, nor did it allow the user to configure an authentication callback. This PR brings in that functionality. <!-- 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 This PR: - Allows a user to handle OpenAI plugins with/without auth. Closes #5355 - Improves the functionality around handling OpenAPI specs. - Introduces an auth callback mechanism to allow for REST API calls to use auth - Introduces OpenAI/OpenAPI function execution settings. - Provides two new kernel examples that show how to handle a simple OpenAI plugin (Klarna) as well as a more complex plugin (Azure Key Vault) that requires auth. - Updates unit tests. <!-- 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: --> - [X] The code builds clean without any errors or warnings - [X] 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 - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone :smile:
2024-04-01 08:01:08 -07:00
class KernelPluginInvalidConfigurationError(KernelException):
"""Raised when a plugin configuration is invalid."""
Python: Introduce operations to handle OpenAI plugins, improve OpenAPI plugins, and allow for auth (#5695) ### Motivation and Context Python had the ability to handle operations for OpenAPI plugins, but at a basic level. It did not have the ability to handle OpenAI plugins, nor did it allow the user to configure an authentication callback. This PR brings in that functionality. <!-- 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 This PR: - Allows a user to handle OpenAI plugins with/without auth. Closes #5355 - Improves the functionality around handling OpenAPI specs. - Introduces an auth callback mechanism to allow for REST API calls to use auth - Introduces OpenAI/OpenAPI function execution settings. - Provides two new kernel examples that show how to handle a simple OpenAI plugin (Klarna) as well as a more complex plugin (Azure Key Vault) that requires auth. - Updates unit tests. <!-- 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: --> - [X] The code builds clean without any errors or warnings - [X] 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 - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone :smile:
2024-04-01 08:01:08 -07:00
pass
Python: rebuilt exceptions structure; pythonic version (#5231) ### 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. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
class KernelFunctionNotFoundError(KernelException):
"""Raised when a function is not found in the kernel."""
Python: rebuilt exceptions structure; pythonic version (#5231) ### 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. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
pass
class KernelFunctionAlreadyExistsError(KernelException):
"""Raised when a function is already registered in the kernel."""
Python: rebuilt exceptions structure; pythonic version (#5231) ### 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. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
pass
class KernelInvokeException(KernelException):
"""Raised when an error occurs while invoking a function in the kernel."""
Python: rebuilt exceptions structure; pythonic version (#5231) ### 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. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
pass
Python: implement filters (#5681) ### 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. --> This pull request includes significant changes across multiple files, mainly related to the addition of hooks and the modification of function invocations in the `semantic_kernel` module. The changes also include the addition of a new sample and a YAML file, and modifications to the `__init__.py` files. Removals: * [`python/semantic_kernel/events`](diffhunk://#diff-ebda9504832b19ab83239a92c9a6d5f8c744deff9fef86071c13956ec92bb010L1-L11): Removed the previously used events. New Exceptions: * [`python/semantic_kernel/exceptions/kernel_exceptions.py`](diffhunk://#diff-450aaa5595a8b22cd6ee212eb79b7d6b0d4e9c1072063ef32018a3e7d3fdf21dR41-R48): Added new exception classes `OperationCancelledException` and `HookInvalidSignatureError`. [[1]](diffhunk://#diff-450aaa5595a8b22cd6ee212eb79b7d6b0d4e9c1072063ef32018a3e7d3fdf21dR41-R48) [[2]](diffhunk://#diff-450aaa5595a8b22cd6ee212eb79b7d6b0d4e9c1072063ef32018a3e7d3fdf21dR57-R58) Fixes: #3038 Fixes: #6276 ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone :smile:
2024-05-17 23:05:56 +02:00
class OperationCancelledException(KernelException):
"""Raised when an operation is cancelled."""
Python: implement filters (#5681) ### 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. --> This pull request includes significant changes across multiple files, mainly related to the addition of hooks and the modification of function invocations in the `semantic_kernel` module. The changes also include the addition of a new sample and a YAML file, and modifications to the `__init__.py` files. Removals: * [`python/semantic_kernel/events`](diffhunk://#diff-ebda9504832b19ab83239a92c9a6d5f8c744deff9fef86071c13956ec92bb010L1-L11): Removed the previously used events. New Exceptions: * [`python/semantic_kernel/exceptions/kernel_exceptions.py`](diffhunk://#diff-450aaa5595a8b22cd6ee212eb79b7d6b0d4e9c1072063ef32018a3e7d3fdf21dR41-R48): Added new exception classes `OperationCancelledException` and `HookInvalidSignatureError`. [[1]](diffhunk://#diff-450aaa5595a8b22cd6ee212eb79b7d6b0d4e9c1072063ef32018a3e7d3fdf21dR41-R48) [[2]](diffhunk://#diff-450aaa5595a8b22cd6ee212eb79b7d6b0d4e9c1072063ef32018a3e7d3fdf21dR57-R58) Fixes: #3038 Fixes: #6276 ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone :smile:
2024-05-17 23:05:56 +02:00
pass
Python: rebuilt exceptions structure; pythonic version (#5231) ### 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. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
__all__ = [
"KernelException",
"KernelFunctionAlreadyExistsError",
"KernelFunctionNotFoundError",
"KernelInvokeException",
"KernelPluginInvalidConfigurationError",
Python: rebuilt exceptions structure; pythonic version (#5231) ### 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. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
"KernelPluginNotFoundError",
"KernelServiceNotFoundError",
Python: implement filters (#5681) ### 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. --> This pull request includes significant changes across multiple files, mainly related to the addition of hooks and the modification of function invocations in the `semantic_kernel` module. The changes also include the addition of a new sample and a YAML file, and modifications to the `__init__.py` files. Removals: * [`python/semantic_kernel/events`](diffhunk://#diff-ebda9504832b19ab83239a92c9a6d5f8c744deff9fef86071c13956ec92bb010L1-L11): Removed the previously used events. New Exceptions: * [`python/semantic_kernel/exceptions/kernel_exceptions.py`](diffhunk://#diff-450aaa5595a8b22cd6ee212eb79b7d6b0d4e9c1072063ef32018a3e7d3fdf21dR41-R48): Added new exception classes `OperationCancelledException` and `HookInvalidSignatureError`. [[1]](diffhunk://#diff-450aaa5595a8b22cd6ee212eb79b7d6b0d4e9c1072063ef32018a3e7d3fdf21dR41-R48) [[2]](diffhunk://#diff-450aaa5595a8b22cd6ee212eb79b7d6b0d4e9c1072063ef32018a3e7d3fdf21dR57-R58) Fixes: #3038 Fixes: #6276 ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone :smile:
2024-05-17 23:05:56 +02:00
"OperationCancelledException",
Python: rebuilt exceptions structure; pythonic version (#5231) ### 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. --> The existing Exceptions structure was very much inspired by dotnet, this is now replaced with a pythonic implementations. This means all Exceptions derive from KernelException and then specialise for different purposes. Closes #2194 ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Added folder for all exception types, all can be imported through `from semantic_kernel.exceptions import ...` no need for a user to know which file the relevant one is in, but keeps things tidy for developers. Removed old KernelException, added back subtypes for the errorcodes. Went through everything to make sure the `raise ... from exc` pattern is used as much as possible as that returns a better stacktrace. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] 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 - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone :smile:
2024-02-28 19:53:53 +01:00
]