SIGN IN SIGN UP

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

0 0 11 C#
Python: Add the Python process framework (#9363) ### Motivation and Context An initial PR to add the foundational pieces of the Python Process framework, which holds it design to be similar to dotnet in that step types are added to a process builder, and later on, when the step is run, it is first instantiated and the proper state is provided. <!-- 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 Adding the initial process framework components: - Closes #9354 **TODO** - more unit tests will be added to increase the code coverage. Currently there are several files with no (or low) code coverage. - more samples will either be added to this PR or a subsequent PR <!-- 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-10-24 13:37:45 -04:00
# Copyright (c) Microsoft. All rights reserved.
Python: Support Process State Management (#11637) ### Motivation and Context SK Python processes have been missing support to be able to serialize and deserialize JSON state for a process and its steps. This PR brings in the functionality to allow the developer to do so. The `getting_started_with_processes` step03 has been update to reflect this latest functionality. It is possible to dump a JSON state to a file, and reload the state to continue running the process. State metadata that handles the version for steps is managed via a decorator: ```python @kernel_process_step_metadata("CutFoodStep.V1") class CutFoodStep(KernelProcessStep): class Functions(Enum): ChopFood = "ChopFood" SliceFood = "SliceFood" ``` If no decorator/state is supplied the step will be built with a default state version of "v1" which aligns with .Net. <!-- 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 Support state and versioning management for Python processes. - Update samples to reflect changes. - Closes #9584 <!-- 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 - [ ] I didn't break anyone :smile:
2025-04-29 07:51:11 +09:00
from enum import Enum
from semantic_kernel.utils.feature_stage_decorator import experimental
Python: Add the Python process framework (#9363) ### Motivation and Context An initial PR to add the foundational pieces of the Python Process framework, which holds it design to be similar to dotnet in that step types are added to a process builder, and later on, when the step is run, it is first instantiated and the proper state is provided. <!-- 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 Adding the initial process framework components: - Closes #9354 **TODO** - more unit tests will be added to increase the code coverage. Currently there are several files with no (or low) code coverage. - more samples will either be added to this PR or a subsequent PR <!-- 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-10-24 13:37:45 -04:00
END_PROCESS_ID: str = "Microsoft.SemanticKernel.Process.EndStep"
Python: Support Process State Management (#11637) ### Motivation and Context SK Python processes have been missing support to be able to serialize and deserialize JSON state for a process and its steps. This PR brings in the functionality to allow the developer to do so. The `getting_started_with_processes` step03 has been update to reflect this latest functionality. It is possible to dump a JSON state to a file, and reload the state to continue running the process. State metadata that handles the version for steps is managed via a decorator: ```python @kernel_process_step_metadata("CutFoodStep.V1") class CutFoodStep(KernelProcessStep): class Functions(Enum): ChopFood = "ChopFood" SliceFood = "SliceFood" ``` If no decorator/state is supplied the step will be built with a default state version of "v1" which aligns with .Net. <!-- 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 Support state and versioning management for Python processes. - Update samples to reflect changes. - Closes #9584 <!-- 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 - [ ] I didn't break anyone :smile:
2025-04-29 07:51:11 +09:00
@experimental
class ProcessSupportedComponents(str, Enum):
"""Supported Process Components."""
Step = "Step"
Process = "Process"