Skip to content

Commit 45e0365

Browse files
Added user feedback format
1 parent 2452001 commit 45e0365

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

articles/ai-studio/how-to/develop/trace-local-sdk.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ In this article you'll learn how to trace your application with Azure AI Foundry
3131
## Tracing using Azure AI Foundry Project
3232
# [Python](#tab/python)
3333
The best way to get started using the Azure AI Foundry SDK is by using a project. AI projects connect together different data, assets, and services you need to build AI applications. The AI project client allows you to easily access these project components from your code by using a single connection string. First follow steps to [create an AI Project](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/create-projects?tabs=ai-studio) if you don't have one already.
34-
To enable tracing, first ensure your project has an attached Application Insights resource. Go to the **Tracing** page of your project and follow instructions to create or attach Application Insights. If one was enabled, you can get the Application Insights connection string, and observe the full execution path through Azure Monitor.
34+
To enable tracing, first ensure your project has an attached Application Insights resource. Go to the **Tracing** page of your project in Azure AI Foundry portal and follow instructions to create or attach Application Insights. If one was enabled, you can get the Application Insights connection string, and observe the full execution path through Azure Monitor.
3535

3636
Make sure to install following packages via
3737

@@ -62,11 +62,11 @@ project_client.telemetry.enable(destination=sys.stdout)
6262

6363
# [JavaScript](#tab/javascript)
6464

65-
Tracing is not yet integrated into the projects package. For instructions on how to instrument and log traces from the Azure AI Inferencing package, see [JavaScript samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-inference-rest/samples/v1-beta/typescript/src).
65+
Tracing is not yet integrated into the Azure AI Projects SDK for JS. For instructions on how to instrument and log traces from the Azure AI Inference package, see [JavaScript samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-inference-rest/samples/v1-beta/typescript/src).
6666

6767
# [C#](#tab/csharp)
6868

69-
Tracing is not yet integrated into the projects package. For instructions on how to instrument and log traces from the Azure AI Inferencing package, see [azure-sdk-for-dotnet](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/ai/Azure.AI.Inference/samples/Sample8_ChatCompletionsWithOpenTelemetry.md).
69+
Tracing is not yet integrated into the Azure AI Projects SDK for C#. For instructions on how to instrument and log traces from the Azure AI Inference package, see [azure-sdk-for-dotnet](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/ai/Azure.AI.Inference/samples/Sample8_ChatCompletionsWithOpenTelemetry.md).
7070

7171
----
7272

@@ -92,7 +92,7 @@ Currently this is supported in Python only.
9292

9393
----
9494

95-
## Tracing using Azure AI Inference SDK
95+
## Enable Tracing using Azure AI Inference SDK
9696

9797
### Installation
9898

@@ -195,7 +195,7 @@ AIInferenceInstrumentor().instrument()
195195

196196
```
197197

198-
It's also possible to uninstrument the Azure AI Inferencing API by using the uninstrument call. After this call, the traces will no longer be emitted by the Azure AI Inferencing API until instrument is called again:
198+
It's also possible to uninstrument the Azure AI Inference API by using the uninstrument call. After this call, the traces will no longer be emitted by the Azure AI Inference API until instrument is called again:
199199

200200
```python
201201
AIInferenceInstrumentor().uninstrument()
@@ -306,7 +306,32 @@ Currently this is supported in Python only.
306306

307307
## Attach User feedback to traces
308308

309+
309310
To attach user feedback to traces and visualize them in Azure AI Foundry portal using OpenTelemetry's semantic conventions, you can instrument your application enabling tracing and logging user feedback. By correlating feedback traces with their respective chat request traces using the response ID, you can use view and manage these traces in Azure AI Foundry portal. OpenTelemetry's specification allows for standardized and enriched trace data, which can be analyzed in Azure AI Foundry portal for performance optimization and user experience insights. This approach helps you use the full power of OpenTelemetry for enhanced observability in your applications.
311+
Please follow the following format to log user feedback:
312+
The user feedback evaluation event can be captured if and only if user provided a reaction to GenAI model response.
313+
It SHOULD, when possible, be parented to the GenAI span describing such response.
314+
315+
<!-- prettier-ignore-start -->
316+
<!-- markdownlint-capture -->
317+
<!-- markdownlint-disable -->
318+
The event name MUST be `gen_ai.evaluation.user_feedback`.
319+
320+
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
321+
|---|---|---|---|---|---|
322+
| [`gen_ai.response.id`](/docs/attributes-registry/gen-ai.md) | string | The unique identifier for the completion. | `chatcmpl-123` | `Required` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
323+
| [`gen_ai.evaluation.score`](/docs/attributes-registry/gen-ai.md) | double | Quantified score calculated based on the user reaction in [-1.0, 1.0] range with 0 representing a neutral reaction. | `0.42` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
324+
325+
326+
<!-- markdownlint-restore -->
327+
<!-- prettier-ignore-end -->
328+
<!-- END AUTOGENERATED TEXT -->
329+
330+
The user feedback event body has the following structure:
331+
332+
| Body Field | Type | Description | Examples | Requirement Level |
333+
|---|---|---|---|---|
334+
| `comment` | string | Additional details about the user feedback | `"I did not like it"` | `Opt-in` |
310335

311336
## Related content
312337

0 commit comments

Comments
 (0)