-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python: Add step03 getting started with processes samples. (#9427)
### Motivation and Context Add step03 getting started with processes samples to show how to create kernel processes related to food preparation and food ordering tasks. <!-- 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 Add step03 getting started with processes samples. - Make `emit_event` async - Simplify how one can create an event to emit by allowing the process_event to be a string, along with kwargs: ``` await context.emit_event(process_event=CommonEvents.StartBRequested.value, data="Get Going B") ``` <!-- 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 😄
- Loading branch information
Showing
26 changed files
with
1,224 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
python/samples/getting_started_with_processes/step03/models/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright (c) Microsoft. All rights reserved. | ||
|
||
from samples.getting_started_with_processes.step03.models.food_ingredients import FoodIngredients | ||
from samples.getting_started_with_processes.step03.models.food_order_item import FoodItem | ||
|
||
__all__ = ["FoodIngredients", "FoodItem"] |
15 changes: 15 additions & 0 deletions
15
python/samples/getting_started_with_processes/step03/models/food_ingredients.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) Microsoft. All rights reserved. | ||
|
||
from enum import Enum | ||
|
||
|
||
class FoodIngredients(str, Enum): | ||
POTATOES = "Potatoes" | ||
FISH = "Fish" | ||
BUNS = "Buns" | ||
SAUCE = "Sauce" | ||
CONDIMENTS = "Condiments" | ||
NONE = "None" | ||
|
||
def to_friendly_string(self) -> str: | ||
return self.value |
13 changes: 13 additions & 0 deletions
13
python/samples/getting_started_with_processes/step03/models/food_order_item.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (c) Microsoft. All rights reserved. | ||
|
||
from enum import Enum | ||
|
||
|
||
class FoodItem(str, Enum): | ||
POTATO_FRIES = "Potato Fries" | ||
FRIED_FISH = "Fried Fish" | ||
FISH_SANDWICH = "Fish Sandwich" | ||
FISH_AND_CHIPS = "Fish & Chips" | ||
|
||
def to_friendly_string(self) -> str: | ||
return self.value |
7 changes: 7 additions & 0 deletions
7
python/samples/getting_started_with_processes/step03/processes/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright (c) Microsoft. All rights reserved. | ||
|
||
from samples.getting_started_with_processes.step03.processes.fish_and_chips_process import FishAndChipsProcess | ||
from samples.getting_started_with_processes.step03.processes.fish_sandwich_process import FishSandwichProcess | ||
from samples.getting_started_with_processes.step03.processes.fried_fish_process import FriedFishProcess | ||
|
||
__all__ = ["FishAndChipsProcess", "FriedFishProcess", "FishSandwichProcess"] |
Oops, something went wrong.