Skip to content

Commit fa454aa

Browse files
committed
Prompt flow docs
1 parent 113a8a6 commit fa454aa

148 files changed

Lines changed: 5549 additions & 48 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.terminal.activateEnvironment": true
3+
}

samples/dotnet/12-Create-ChatGPT-Plugin/Solution/.gitignore renamed to samples/dotnet/12-Evaluate-with-Prompt-Flow/.gitignore

File renamed without changes.

samples/dotnet/12-Create-ChatGPT-Plugin/Solution/.vscode/extensions.json renamed to samples/dotnet/12-Evaluate-with-Prompt-Flow/.vscode/extensions.json

File renamed without changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
// Use IntelliSense to find out which attributes exist for C# debugging
6+
// Use hover for the description of the existing attributes
7+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/bin/Debug/net6.0/11-Planner.dll",
14+
"args": [],
15+
"cwd": "${workspaceFolder}",
16+
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17+
"console": "integratedTerminal",
18+
"stopAtEntry": false
19+
},
20+
{
21+
"name": ".NET Core Attach",
22+
"type": "coreclr",
23+
"request": "attach"
24+
}
25+
]
26+
}

samples/dotnet/12-Create-ChatGPT-Plugin/Solution/.vscode/settings.json renamed to samples/dotnet/12-Evaluate-with-Prompt-Flow/.vscode/settings.json

File renamed without changes.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/11-Planner.csproj",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/11-Planner.csproj",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"--project",
36+
"${workspaceFolder}/11-Planner.csproj"
37+
],
38+
"problemMatcher": "$msCompile"
39+
}
40+
]
41+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
3+
using System.Text.Json;
4+
using Microsoft.Extensions.Logging;
5+
using Microsoft.SemanticKernel;
6+
using Microsoft.SemanticKernel.Planning;
7+
8+
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
9+
{
10+
builder
11+
.SetMinimumLevel(0)
12+
.AddDebug();
13+
});
14+
15+
// Create kernel
16+
IKernel kernel = new KernelBuilder()
17+
// Add a text or chat completion service using either:
18+
// .WithAzureTextCompletionService()
19+
// .WithAzureChatCompletionService()
20+
// .WithOpenAITextCompletionService()
21+
// .WithOpenAIChatCompletionService()
22+
.WithCompletionService()
23+
.WithLoggerFactory(loggerFactory)
24+
.Build();
25+
26+
// Add the math plugin
27+
var mathPlugin = kernel.ImportSkill(new Plugins.MathPlugin.Math(), "MathPlugin");
28+
29+
// Create a planner
30+
var planner = new SequentialPlanner(kernel);
31+
32+
var ask = "If my investment of 2130.23 dollars increased by 23%, how much would I have after I spent $5 on a latte?";
33+
var plan = await planner.CreatePlanAsync(ask);
34+
35+
Console.WriteLine("Plan:\n");
36+
Console.WriteLine(JsonSerializer.Serialize(plan, new JsonSerializerOptions { WriteIndented = true }));
37+
38+
var result = (await kernel.RunAsync(plan)).Result;
39+
40+
Console.WriteLine("Plan results:");
41+
Console.WriteLine(result.Trim());
Lines changed: 66 additions & 0 deletions

samples/dotnet/12-Create-ChatGPT-Plugin/Solution/config/Env.cs renamed to samples/dotnet/12-Evaluate-with-Prompt-Flow/config/Env.cs

File renamed without changes.

samples/dotnet/12-Create-ChatGPT-Plugin/Solution/config/KernelBuilderExtensions.cs renamed to samples/dotnet/12-Evaluate-with-Prompt-Flow/config/KernelBuilderExtensions.cs

File renamed without changes.

0 commit comments

Comments
 (0)