Skip to content

Commit 0718812

Browse files
committed
deleted snapshots; note to remote eval config key;replace AI studio reference to AI project
1 parent dc1ffbb commit 0718812

File tree

6 files changed

+17
-20
lines changed

6 files changed

+17
-20
lines changed

articles/ai-studio/how-to/develop/evaluate-sdk.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Evaluate your Generative AI application with the Azure AI Evaluation SDK
3-
titleSuffix: Azure AI Studio
3+
titleSuffix: Azure AI project
44
description: This article provides instructions on how to evaluate a Generative AI application with the Azure AI Evaluation SDK.
55
manager: scottpolly
66
ms.service: azure-ai-studio
@@ -22,7 +22,7 @@ author: lgayhardt
2222
2323
To thoroughly assess the performance of your generative AI application when applied to a substantial dataset, you can evaluate a Generative AI application in your development environment with the Azure AI evaluation SDK. Given either a test dataset or a target, your generative AI application generations are quantitatively measured with both mathematical based metrics and AI-assisted quality and safety evaluators. Built-in or custom evaluators can provide you with comprehensive insights into the application's capabilities and limitations.
2424

25-
In this article, you learn how to run evaluators on a single row of data, a larger test dataset on an application target with built-in evaluators using the Azure AI evaluation SDK both locally and remotely, then track the results and evaluation logs in Azure AI Studio.
25+
In this article, you learn how to run evaluators on a single row of data, a larger test dataset on an application target with built-in evaluators using the Azure AI evaluation SDK both locally and remotely, then track the results and evaluation logs in Azure AI project.
2626

2727
## Getting started
2828

@@ -182,7 +182,7 @@ Here's an example of the result:
182182

183183
### Risk and safety evaluators
184184

185-
When you use AI-assisted risk and safety metrics, a GPT model isn't required. Instead of `model_config`, provide your `azure_ai_project` information. This accesses the Azure AI Studio safety evaluations back-end service, which provisions a GPT model specific to harms evaluation that can generate content risk severity scores and reasoning to enable the safety evaluators.
185+
When you use AI-assisted risk and safety metrics, a GPT model isn't required. Instead of `model_config`, provide your `azure_ai_project` information. This accesses the Azure AI project safety evaluations back-end service, which provisions a GPT model specific to harms evaluation that can generate content risk severity scores and reasoning to enable the safety evaluators.
186186

187187
#### Region support
188188

@@ -428,15 +428,15 @@ result = evaluate(
428428
}
429429
}
430430
},
431-
# Optionally provide your AI Studio project information to track your evaluation results in your Azure AI Studio project
431+
# Optionally provide your Azure AI project information to track your evaluation results in your Azure AI project
432432
azure_ai_project = azure_ai_project,
433433
# Optionally provide an output path to dump a json of metric summary, row level data and metric and studio URL
434434
output_path="./myevalresults.json"
435435
)
436436
```
437437

438438
> [!TIP]
439-
> Get the contents of the `result.studio_url` property for a link to view your logged evaluation results in Azure AI Studio.
439+
> Get the contents of the `result.studio_url` property for a link to view your logged evaluation results in your Azure AI project.
440440
441441
The evaluator outputs results in a dictionary which contains aggregate `metrics` and row-level data and metrics. An example of an output:
442442

@@ -479,7 +479,7 @@ The evaluator outputs results in a dictionary which contains aggregate `metrics`
479479

480480
### Requirements for `evaluate()`
481481

482-
The `evaluate()` API has a few requirements for the data format that it accepts and how it handles evaluator parameter key names so that the charts in your AI Studio evaluation results show up properly.
482+
The `evaluate()` API has a few requirements for the data format that it accepts and how it handles evaluator parameter key names so that the charts of the evaluation results in your Azure AI project show up properly.
483483

484484
#### Data format
485485

@@ -496,7 +496,7 @@ The `evaluate()` API only accepts data in the JSONLines format. For all built-in
496496

497497
#### Evaluator parameter format
498498

499-
When passing in your built-in evaluators, it's important to specify the right keyword mapping in the `evaluators` parameter list. The following is the keyword mapping required for the results from your built-in evaluators to show up in the UI when logged to Azure AI Studio.
499+
When passing in your built-in evaluators, it's important to specify the right keyword mapping in the `evaluators` parameter list. The following is the keyword mapping required for the results from your built-in evaluators to show up in the UI when logged to your Azure AI project.
500500

501501
| Evaluator | keyword param |
502502
|---------------------------|-------------------|
@@ -568,14 +568,13 @@ result = evaluate(
568568
After local evaluations of your generative AI applications, you may want to trigger remote evaluations for pre-deployment testing and even continuously evaluate your applications for post-deployment monitoring. Azure AI Project SDK offers such capabilities via a Python API and supports all of the features available in local evaluations. Follow the steps below to submit your remote evaluation on your data using built-in or custom evaluators.
569569

570570
> [!NOTE]
571-
> Remote evaluations are only supported in the same [regions](#region-support) as AI-assisted risk and safety metrics.
571+
> Remote evaluations are only supported in East US 2 and Sweden Central regions.
572572
573573

574574
### Prerequisites
575575
- Azure AI project in `EastUS2` region. If you do not have an existing project, follow the guide [How to create Azure AI project](../create-projects.md?tabs=ai-studio) to create one.
576576
- Azure OpenAI Deployment with GPT model supporting `chat completion`, for example `gpt-4`.
577577
- `Connection String` for Azure AI project to easily create `AIProjectClient` object. You can get the **Project connection string** under **Project details** from the project's **Overview** page.
578-
![Connection string](image.png)
579578
- Make sure you are first logged into your Azure subscription by running `az login`.
580579

581580
### Installation Instructions
@@ -618,15 +617,12 @@ We provide two ways to register your data in Azure AI project required for remot
618617
data_id = project_client.upload_file("./evaluate_test_data.jsonl")
619618
```
620619
**From UI**: Alternatively, you can upload new data or update existing data versions by following the UI walkthrough under the **Data** tab of your Azure AI project.
621-
![Upload Dataset](image-2.png)
622620

623621
2. Given existing datasets uploaded to your Project:
624622
- **From SDK**: if you already know the dataset name you created, construct the dataset id in this format: `/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.MachineLearningServices/workspaces/<project-name>/data/<dataset-name>/versions/<version-number>`
625623

626624
- **From UI**: If you don't know the dataset name, locate it under the **Data** tab of your Azure AI project and construct the dataset id as in the format above.
627625
628-
![Select Dataset](image-1.png)
629-
630626
631627
### Specifying evaluators from Evaluator library
632628
We provide a list of built-in evaluators registered in the [Evaluator library](../evaluate-generative-ai-app.md#view-and-manage-the-evaluators-in-the-evaluator-library) under **Evaluation** tab of your Azure AI project. You can also register custom evaluators and use them for remote evaluation. We provide two ways to specify registered evaluators:
@@ -640,14 +636,12 @@ print("F1 Score evaluator id:", F1ScoreEvaluator.id)
640636
- **From UI**: Follows these steps to fetch evaluator ids after they are registered to your project:
641637
- Select on **Evaluation** of your Azure AI project;
642638
- Select Evaluator library;
643-
![Navigate to Evaluator library](image-3.png)
644639
- Select your evaluator(s) of choice by comparing the descriptions;
645640
- Copy its "Asset ID" which will be your evaluator id, for example, `azureml://registries/azureml/models/Groundedness-Pro-Evaluator/versions/1`.
646-
![Locate Evaluator ID](image-4.png)
647641
648642
#### Specifying custom evaluators
649643
650-
- For code-based custom evaluators, register them to your AI Studio project and fetch the evaluator ids with the following:
644+
- For code-based custom evaluators, register them to your Azure AI project and fetch the evaluator ids with the following:
651645
652646
```python
653647
from azure.ai.ml import MLClient
@@ -690,7 +684,7 @@ print("Versioned evaluator id:", registered_evaluator.id)
690684
691685
After registering your custom evaluator to your Azure AI project, you can view it in your [Evaluator library](../evaluate-generative-ai-app.md#view-and-manage-the-evaluators-in-the-evaluator-library) under **Evaluation** tab in your Azure AI project.
692686
693-
- For prompt-based custom evaluators, use this snippet to register them. For example, let's register our `FriendlinessEvaluator` built as described in [Prompt-based evaluators](#Prompt-based-evaluators):
687+
- For prompt-based custom evaluators, use this snippet to register them. For example, let's register our `FriendlinessEvaluator` built as described in [Prompt-based evaluators](#prompt-based-evaluators):
694688

695689

696690
```python
@@ -735,7 +729,9 @@ versioned_evaluator = ml_client.evaluators.get(evaluator_name, version=1)
735729
print("Versioned evaluator id:", registered_evaluator.id)
736730
```
737731

738-
After logging your custom evaluator to your AI Studio project, you can view it in your [Evaluator library](../evaluate-generative-ai-app.md#view-and-manage-the-evaluators-in-the-evaluator-library) under **Evaluation** tab of your Azure AI project.
732+
733+
734+
After logging your custom evaluator to your Azure AI project, you can view it in your [Evaluator library](../evaluate-generative-ai-app.md#view-and-manage-the-evaluators-in-the-evaluator-library) under **Evaluation** tab of your Azure AI project.
739735

740736

741737
### Remote evaluation with Azure AI Project SDK
@@ -753,7 +749,7 @@ from azure.ai.evaluation import F1ScoreEvaluator, RelevanceEvaluator, ViolenceEv
753749
deployment_name = os.environ.get("AZURE_OPENAI_DEPLOYMENT")
754750
api_version = os.environ.get("AZURE_OPENAI_API_VERSION")
755751
756-
# Create an Azure AI Client from a connection string. Avaiable on project overview page on Azure AI Studio UI.
752+
# Create an Azure AI Client from a connection string. Avaiable on project overview page on Azure AI project UI.
757753
project_client = AIProjectClient.from_connection_string(
758754
credential=DefaultAzureCredential(),
759755
conn_str="<connection_string>"
@@ -773,6 +769,7 @@ evaluation = Evaluation(
773769
description="Evaluation of dataset",
774770
data=Dataset(id=data_id),
775771
evaluators={
772+
# Note the evaluator configuration key must follow a naming convention: it must start with a letter and contain only alphanumeric characters and underscores. Take "f1_score" as example: "f1score" or "f1_evaluator" will also be acceptable, but "f1-score-eval" or "1score" will result in errors.
776773
"f1_score": EvaluatorConfiguration(
777774
id=F1ScoreEvaluator.id,
778775
),
@@ -808,7 +805,7 @@ get_evaluation_response = project_client.evaluations.get(evaluation_response.id)
808805
print("----------------------------------------------------------------")
809806
print("Created evaluation, evaluation ID: ", get_evaluation_response.id)
810807
print("Evaluation status: ", get_evaluation_response.status)
811-
print("AI Studio URI: ", get_evaluation_response.properties["AiStudioEvaluationUri"])
808+
print("AI project URI: ", get_evaluation_response.properties["AiStudioEvaluationUri"])
812809
print("----------------------------------------------------------------")
813810
```
814811

@@ -833,6 +830,6 @@ evaluation = client.evaluations.create(
833830
- [Azure AI Evaluation SDK Troubleshooting guide](https://aka.ms/azureaieval-tsg)
834831
- [Learn more about the evaluation metrics](../../concepts/evaluation-metrics-built-in.md)
835832
- [Learn more about simulating test datasets for evaluation](./simulator-interaction-data.md)
836-
- [View your evaluation results in Azure AI Studio](../../how-to/evaluate-results.md)
833+
- [View your evaluation results in Azure AI project](../../how-to/evaluate-results.md)
837834
- [Get started building a chat app using the Azure AI SDK](../../quickstarts/get-started-code.md)
838835
- [Get started with evaluation samples](https://aka.ms/aistudio/eval-samples)
-527 KB
Binary file not shown.
-184 KB
Binary file not shown.
-358 KB
Binary file not shown.
-366 KB
Binary file not shown.
-267 KB
Binary file not shown.

0 commit comments

Comments
 (0)