You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/machine-learning/prompt-flow/how-to-evaluate-semantic-kernel.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,16 +12,16 @@ ms.topic: how-to
12
12
author: lgayhardt
13
13
ms.author: lagayhar
14
14
ms.reviewer: chenlujiao
15
-
ms.date: 10/11/2024
15
+
ms.date: 10/14/2024
16
16
---
17
17
18
18
# Evaluate Semantic Kernel with prompt flow
19
19
20
-
This article describes the seamless integration between prompt flow and [Semantic Kernel](/semantic-kernel/overview/), and demonstrates how to evaluate Semantic Kernal plugins and planners by using prompt flow. In the rapidly evolving landscape of AI orchestration, a comprehensive evaluation of your plugins and planners is important for optimal performance.
20
+
This article describes the seamless integration between prompt flow and [Semantic Kernel](/semantic-kernel/overview/), and demonstrates how to evaluate Semantic Kernel plugins and planners by using prompt flow. In the rapidly evolving landscape of AI orchestration, a comprehensive evaluation of your plugins and planners is important for optimal performance.
21
21
22
-
Semantic Kernel is an open-source SDK that lets you easily combine AI services with programming languages like C# and Python to create AI apps that combine the best of both worlds. Semantic Kernel provides [plugins](/semantic-kernel/ai-orchestration/plugins) and [planners](/semantic-kernel/ai-orchestration/planners), which are powerful tools that use AI capabilities to optimize operations, thereby driving efficiency and accuracy in planning.
22
+
Semantic Kernel is an open-source SDK that lets you easily combine AI services with programming languages like C# and Python to create AI apps that combine the best of both worlds. Semantic Kernel provides [plugins](/semantic-kernel/ai-orchestration/plugins) and [planners](/semantic-kernel/ai-orchestration/planners), which are powerful tools that use AI capabilities to optimize operations, thus driving efficiency and accuracy in planning.
23
23
24
-
As you build plugins and add them to planners, it's important to make sure they work as intended. Adding more plugins increases the potential for errors. Testing plugins and planners used to be a manual, time-consuming process. Now you can use prompt flow to automate this process.
24
+
As you build and add more plugins to planners, the potential for errors increases, so it's important to make sure they work as intended. Testing plugins and planners used to be a manual, time-consuming process. Now you can use prompt flow to automate this process.
25
25
26
26
The integration of Semantic Kernel with prompt flow allows you to:
27
27
@@ -30,23 +30,23 @@ The integration of Semantic Kernel with prompt flow allows you to:
30
30
31
31
## Prerequisites
32
32
33
-
- Before you start developing the flow, you must install the [Semantic Kernel package](/semantic-kernel/get-started/quick-start-guide/?toc=%2Fsemantic-kernel%2Ftoc.json&tabs=python)in your *requirements.txt* for the executor. For more information, see [How to manage compute session](how-to-manage-compute-session.md).
33
+
- Before you start developing the flow, you must add the [Semantic Kernel package](/semantic-kernel/get-started/quick-start-guide/?toc=%2Fsemantic-kernel%2Ftoc.json&tabs=python)to your *requirements.txt* for the executor to install. For more information, see [Manage prompt flow compute session](how-to-manage-compute-session.md).
34
34
35
35
- To use Semantic Kernel to consume Azure OpenAI or OpenAI resources in a prompt flow, you must create a custom connection.
36
36
37
-
1. Obtain the keys you specified for the resources in environment variables or in an *.env* file.
37
+
1. Obtain the keys you specified for the resources in environment variables or an *.env* file.
38
38
39
39
1. Select **Create** from the **Connection** tab on the Azure Machine Learning studio **Prompt flow** page, and select **Custom** provider.
40
40
41
41
1. Convert the keys from environment variables to key-value pairs in the custom connection.
42
42
43
43
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/custom-connection-for-semantic-kernel.png" alt-text="Screenshot of custom connection." lightbox = "./media/how-to-evaluate-semantic-kernel/custom-connection-for-semantic-kernel.png":::
44
44
45
-
1.You can now use this custom connection to invoke your Azure OpenAI or OpenAI model within the flow.
45
+
You can now use this custom connection to invoke your Azure OpenAI or OpenAI model within the flow.
46
46
47
47
## Create a flow with Semantic Kernel
48
48
49
-
Similar to the integration of LangChain with prompt flow, Semantic Kernel supports Python and can operate in a Python node within a prompt flow.
49
+
Similar to the [integration of LangChain with prompt flow](how-to-integrate-with-langchain.md), Semantic Kernel supports Python and can operate in a Python node within a prompt flow.
50
50
51
51
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/prompt-flow-end-result.png" alt-text="Diagram of prompt flow with Semantic Kernel." border="false":::
52
52
@@ -55,8 +55,8 @@ For this example, you create a flow with a Semantic Kernel planner that solves m
55
55
1. From the **Prompt flow** page, select **Create**.
56
56
1. On the **Create a new flow** screen, select **Create** in the **Standard flow** tile.
57
57
1. At the top of the new flow, select **+ Python** to create a new Python node, and name the node *math_planner*.
58
-
1. Select **+** at the top of the **Files** tab to upload reference files such as the **MathPlugin**.
59
-
1. Update the code in *math_planner.py* to set up the connection and define the input and output of the planner node.
58
+
1. Select **+** at the top of the **Files** tab to upload reference files such as the MathPlugin from the Semantic Kernel package.
59
+
1. Update the the *math_planner.py* code to set up the connection and define the input and output of the planner node.
60
60
61
61
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/set-connection-in-python.png" alt-text="Screenshot of setting custom connection in python node.":::
62
62
@@ -68,34 +68,34 @@ For this example, you create a flow with a Semantic Kernel planner that solves m
68
68
69
69
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/semantic-kernel-flow.png" alt-text="Screenshot of creating a flow with semantic kernel planner." lightbox = "./media/how-to-evaluate-semantic-kernel/semantic-kernel-flow.png":::
70
70
71
-
###Batch test your plugins and planners
71
+
## Batch test your plugins and planners
72
72
73
73
Instead of manually testing each different scenario, you can automatically run large batches of tests using prompt flow and benchmark data.
74
74
75
-
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/using-batch-runs-with-prompt-flow.png" alt-text="Diagram showing batch runs with prompt flow for Semantic Kernel." border="false":::
76
-
77
75
Use batches with prompt flow to run batch tests on your planner that uses the math plugin. By defining several word problems, you can quickly test any changes to your plugins or planners so you can catch regressions early.
78
76
79
-
Once your flow has passed a single test run, you can create a batch test in prompt flow.
77
+
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/using-batch-runs-with-prompt-flow.png" alt-text="Diagram showing batch runs with prompt flow for Semantic Kernel." border="false":::
78
+
79
+
Once your flow passes a single test run, you can create a batch test in prompt flow.
80
80
81
81
1. Create your benchmark data in a *.jsonl* file as a list of JSON objects that contain the input and the correct ground truth.
82
-
1.Select**Evaluate** from the top menu.
83
-
1. Complete the **Basic settings**and the **Batch run settings** by uploading your data file.
82
+
1.In the prompt flow, select**Evaluate** from the top menu.
83
+
1. Complete the **Basic settings**, upload your data file, and complete the **Batch run settings**.
84
84
1. For this test, skip the optional **Evaluation settings** and select **Review + submit**, then select **Submit** to submit the batch run.
85
85
86
86
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/semantic-kernel-test-data.png" alt-text="Screenshot of data of batch runs with prompt flow for Semantic Kernel." lightbox = "./media/how-to-evaluate-semantic-kernel/semantic-kernel-test-data.png":::
87
87
88
-
1.Select your run on the prompt flow **Runs** page.
88
+
1.When the run finishes, select the run name on the prompt flow **Runs** page.
89
89
90
90
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/run.png" alt-text="Screenshot of the run list." lightbox = "./media/how-to-evaluate-semantic-kernel/run.png":::
91
91
92
-
1.Select **Details** at the top of the run page.
92
+
1.At the top of the run page, select **Details**.
93
93
94
94
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/run-detail.png" alt-text="Screenshot of the run detail." lightbox = "./media/how-to-evaluate-semantic-kernel/run-detail.png":::
95
95
96
96
1. On the **Details** page, select the **Outputs** tab to see the results.
97
97
98
-
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/run-output.png" alt-text="Screenshot of the run output." lightbox = "./media/how-to-evaluate-semantic-kernel/run-output.png":::
98
+
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/run-output.png" alt-text="Screenshot of the run output." lightbox = "./media/how-to-evaluate-semantic-kernel/run-output.png":::
99
99
100
100
## Evaluate accuracy
101
101
@@ -131,7 +131,7 @@ If you find that your plugins and planners aren't performing as well as they sho
131
131
132
132
A combination of these three actions can turn a failing planner into a winning one. By the end of the enhancement and evaluation process, you should have a planner that can correctly answer all of the benchmark data.
133
133
134
-
Through the process of enhancing your plugins and planners in prompt flow, you can use the runs to monitor your experimental progress. Each iteration allows you to submit a batch run with an evaluation run at the same time.
134
+
Throughout the process of enhancing your plugins and planners in prompt flow, you can use the runs to monitor your experimental progress. Each iteration allows you to submit a batch run with an evaluation run at the same time.
135
135
136
136
:::image type="content" source="./media/how-to-evaluate-semantic-kernel/batch-evaluation.png" alt-text="Screenshot of batch run with evaluation." lightbox = "./media/how-to-evaluate-semantic-kernel/batch-evaluation.png":::
137
137
@@ -145,7 +145,7 @@ The **Visualize outputs** screen shows a detailed table with a line-by-line comp
0 commit comments