Skip to content

Commit

Permalink
.Net: Hook up memory in SequentialPlanner examples (microsoft#2196)
Browse files Browse the repository at this point in the history
### Description
Adding the memory configuration and some comments to the
SequentialPlanner samples in KernelSyntaxExamples.

### Contribution Checklist
- [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
shawncal authored Jul 27, 2023
1 parent 6692903 commit 14d76cc
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ private static async Task MemorySampleAsync()
{
Console.WriteLine("======== Sequential Planner - Create and Execute Plan using Memory ========");

// IMPORTANT: Register an embedding generation service and a memory store. The Planner will
// use these to generate and store embeddings for the function descriptions.
var kernel = new KernelBuilder()
.WithLogger(ConsoleLogger.Logger)
.WithAzureChatCompletionService(
Expand Down Expand Up @@ -210,7 +212,8 @@ private static async Task MemorySampleAsync()

var goal = "Create a book with 3 chapters about a group of kids in a club called 'The Thinking Caps.'";

var planner = new SequentialPlanner(kernel, new SequentialPlannerConfig { RelevancyThreshold = 0.5 });
// IMPORTANT: To use memory and embeddings to find relevant skills in the planner, set the 'Memory' property on the planner config.
var planner = new SequentialPlanner(kernel, new SequentialPlannerConfig { RelevancyThreshold = 0.5, Memory = kernel.Memory });

var plan = await planner.CreatePlanAsync(goal);

Expand Down

0 comments on commit 14d76cc

Please sign in to comment.