-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.Net: Fixing Processes food samples diagram links + step name fix (#9262
) ### Description - Fixing Processes Food Samples links to respective diagrams + adding some steps specific names - Reorganizing Process Food Samples in 2 files -> allows to build concepts in more detail later: more samples to be added in another PR in the near future ### 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
1 parent
e23d636
commit 992c27c
Showing
8 changed files
with
70 additions
and
50 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
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
54 changes: 54 additions & 0 deletions
54
dotnet/samples/GettingStartedWithProcesses/Step03/Step03b_FoodOrdering.cs
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,54 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using Microsoft.SemanticKernel; | ||
using Step03.Models; | ||
using Step03.Processes; | ||
|
||
namespace Step03; | ||
|
||
/// <summary> | ||
/// Demonstrate creation of <see cref="KernelProcess"/> and | ||
/// eliciting different food related events. | ||
/// For visual reference of the processes used here check the diagram in: https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/GettingStartedWithProcesses/README.md#step03b_foodOrdering | ||
/// </summary> | ||
public class Step03b_FoodOrdering(ITestOutputHelper output) : BaseTest(output, redirectSystemConsoleOutput: true) | ||
{ | ||
// Target Open AI Services | ||
protected override bool ForceOpenAI => true; | ||
|
||
[Fact] | ||
public async Task UseSingleOrderFriedFishAsync() | ||
{ | ||
await UsePrepareFoodOrderProcessSingleItemAsync(FoodItem.FriedFish); | ||
} | ||
|
||
[Fact] | ||
public async Task UseSingleOrderPotatoFriesAsync() | ||
{ | ||
await UsePrepareFoodOrderProcessSingleItemAsync(FoodItem.PotatoFries); | ||
} | ||
|
||
[Fact] | ||
public async Task UseSingleOrderFishSandwichAsync() | ||
{ | ||
await UsePrepareFoodOrderProcessSingleItemAsync(FoodItem.FishSandwich); | ||
} | ||
|
||
[Fact] | ||
public async Task UseSingleOrderFishAndChipsAsync() | ||
{ | ||
await UsePrepareFoodOrderProcessSingleItemAsync(FoodItem.FishAndChips); | ||
} | ||
|
||
protected async Task UsePrepareFoodOrderProcessSingleItemAsync(FoodItem foodItem) | ||
{ | ||
Kernel kernel = CreateKernelWithChatCompletion(); | ||
KernelProcess kernelProcess = SingleFoodItemProcess.CreateProcess().Build(); | ||
|
||
using var runningProcess = await kernelProcess.StartAsync(kernel, new KernelProcessEvent() | ||
{ | ||
Id = SingleFoodItemProcess.ProcessEvents.SingleOrderReceived, | ||
Data = foodItem | ||
}); | ||
} | ||
} |