Skip to content

Commit 36308df

Browse files
Merge pull request #271457 from PatrickFarley/minor-updates
Minor updates
2 parents b80a57b + 8fe253f commit 36308df

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

articles/ai-services/content-safety/quickstart-groundedness.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Follow this guide to use Azure AI Content Safety Groundedness detection to check
2626

2727
## Check groundedness without reasoning
2828

29-
In the simple case without the _reasoning_ feature, the Groundedness detection API classifies the ungroundedness of the submitted content as `true` or `false` and provides a confidence score.
29+
In the simple case without the _reasoning_ feature, the Groundedness detection API classifies the ungroundedness of the submitted content as `true` or `false`.
3030

3131
#### [cURL](#tab/curl)
3232

@@ -104,19 +104,17 @@ Create a new Python file named _quickstart.py_. Open the new file in your prefer
104104
105105
---
106106
107-
> [!TIP]
108-
> To test a summarization task instead of a question answering (QnA) task, use the following sample JSON body:
109-
>
110-
> ```json
111-
> {
112-
> "Domain": "Medical",
113-
> "Task": "Summarization",
114-
> "Text": "Ms Johnson has been in the hospital after experiencing a stroke.",
115-
> "GroundingSources": ["Our patient, Ms. Johnson, presented with persistent fatigue, unexplained weight loss, and frequent night sweats. After a series of tests, she was diagnosed with Hodgkin’s lymphoma, a type of cancer that affects the lymphatic system. The diagnosis was confirmed through a lymph node biopsy revealing the presence of Reed-Sternberg cells, a characteristic of this disease. She was further staged using PET-CT scans. Her treatment plan includes chemotherapy and possibly radiation therapy, depending on her response to treatment. The medical team remains optimistic about her prognosis given the high cure rate of Hodgkin’s lymphoma."],
116-
> "Reasoning": false
117-
> }
118-
> ```
107+
To test a summarization task instead of a question answering (QnA) task, use the following sample JSON body:
119108
109+
```json
110+
{
111+
"domain": "Medical",
112+
"task": "Summarization",
113+
"text": "Ms Johnson has been in the hospital after experiencing a stroke.",
114+
"groundingSources": ["Our patient, Ms. Johnson, presented with persistent fatigue, unexplained weight loss, and frequent night sweats. After a series of tests, she was diagnosed with Hodgkin’s lymphoma, a type of cancer that affects the lymphatic system. The diagnosis was confirmed through a lymph node biopsy revealing the presence of Reed-Sternberg cells, a characteristic of this disease. She was further staged using PET-CT scans. Her treatment plan includes chemotherapy and possibly radiation therapy, depending on her response to treatment. The medical team remains optimistic about her prognosis given the high cure rate of Hodgkin’s lymphoma."],
115+
"reasoning": false
116+
}
117+
```
120118

121119
The following fields must be included in the URL:
122120

@@ -134,7 +132,7 @@ The parameters in the request body are defined in this table:
134132
| - `query` | (Optional) This represents the question in a QnA task. Character limit: 7,500. | String |
135133
| **text** | (Required) The LLM output text to be checked. Character limit: 7,500. | String |
136134
| **groundingSources** | (Required) Uses an array of grounding sources to validate AI-generated text. Up to 55,000 characters of grounding sources can be analyzed in a single request. | String array |
137-
| **reasoning** | (Optional) Specifies whether to use the reasoning feature. The default value is `false`. If `true`, you need to bring your own Azure OpenAI resources to provide an explanation. Be careful: using reasoning increases the processing time and incurs extra fees.| Boolean |
135+
| **reasoning** | (Optional) Specifies whether to use the reasoning feature. The default value is `false`. If `true`, you need to bring your own Azure OpenAI GPT-4 Turbo resources to provide an explanation. Be careful: using reasoning increases the processing time.| Boolean |
138136

139137
### Interpret the API response
140138

@@ -157,18 +155,20 @@ The JSON objects in the output are defined here:
157155
| Name | Description | Type |
158156
| :------------------ | :----------- | ------- |
159157
| **ungroundedDetected** | Indicates whether the text exhibits ungroundedness. | Boolean |
160-
| **confidenceScore** | The confidence value of the _ungrounded_ designation. The score ranges from 0 to 1. | Float |
161158
| **ungroundedPercentage** | Specifies the proportion of the text identified as ungrounded, expressed as a number between 0 and 1, where 0 indicates no ungrounded content and 1 indicates entirely ungrounded content.| Float |
162159
| **ungroundedDetails** | Provides insights into ungrounded content with specific examples and percentages.| Array |
163-
| -**`Text`** | The specific text that is ungrounded. | String |
160+
| -**`text`** | The specific text that is ungrounded. | String |
164161

165162
## Check groundedness with reasoning
166163

167164
The Groundedness detection API provides the option to include _reasoning_ in the API response. With reasoning enabled, the response includes a `"reasoning"` field that details specific instances and explanations for any detected ungroundedness. Be careful: using reasoning increases the processing time and incurs extra fees.
168165

169166
### Bring your own GPT deployment
170167

171-
In order to use your Azure OpenAI resource to enable the reasoning feature, use Managed Identity to allow your Content Safety resource to access the Azure OpenAI resource:
168+
> [!TIP]
169+
> At the moment, we only support **Azure OpenAI GPT-4 Turbo** resources and do not support other GPT types. Your GPT-4 Turbo resources can be deployed in any region; however, we recommend that they be located in the same region as the content safety resources to minimize potential latency.
170+
171+
In order to use your Azure OpenAI GPT4-Turbo resource to enable the reasoning feature, use Managed Identity to allow your Content Safety resource to access the Azure OpenAI resource:
172172

173173
1. Enable Managed Identity for Azure AI Content Safety.
174174

@@ -188,7 +188,7 @@ In order to use your Azure OpenAI resource to enable the reasoning feature, use
188188

189189
### Make the API request
190190

191-
In your request to the Groundedness detection API, set the `"Reasoning"` body parameter to `true`, and provide the other needed parameters:
191+
In your request to the Groundedness detection API, set the `"reasoning"` body parameter to `true`, and provide the other needed parameters:
192192

193193
```json
194194
{
@@ -295,8 +295,8 @@ The parameters in the request body are defined in this table:
295295
| **text** | (Required) The LLM output text to be checked. Character limit: 7,500. | String |
296296
| **groundingSources** | (Required) Uses an array of grounding sources to validate AI-generated text. Up to 55,000 characters of grounding sources can be analyzed in a single request. | String array |
297297
| **reasoning** | (Optional) Set to `true`, the service uses Azure OpenAI resources to provide an explanation. Be careful: using reasoning increases the processing time and incurs extra fees.| Boolean |
298-
| **llmResource** | (Optional) If you want to use your own Azure OpenAI resources instead of our default GPT resources, add this field and include the subfields for the resources used. If you don't want to use your own resources, remove this field from the input. | String |
299-
| - `resourceType `| Specifies the type of resource being used. Currently it only allows `AzureOpenAI`. | Enum|
298+
| **llmResource** | (Required) If you want to use your own Azure OpenAI GPT4-Turbo resource to enable reasoning, add this field and include the subfields for the resources used. | String |
299+
| - `resourceType `| Specifies the type of resource being used. Currently it only allows `AzureOpenAI`. We only support Azure OpenAI GPT-4 Turbo resources and do not support other GPT types. Your GPT-4 Turbo resources can be deployed in any region; however, we recommend that they be located in the same region as the content safety resources to minimize potential latency. | Enum|
300300
| - `azureOpenAIEndpoint `| Your endpoint URL for Azure OpenAI service. | String |
301301
| - `azureOpenAIDeploymentName` | The name of the specific GPT deployment to use. | String|
302302
@@ -332,10 +332,9 @@ The JSON objects in the output are defined here:
332332
| Name | Description | Type |
333333
| :------------------ | :----------- | ------- |
334334
| **ungroundedDetected** | Indicates whether the text exhibits ungroundedness. | Boolean |
335-
| **confidenceScore** | The confidence value of the _ungrounded_ designation. The score ranges from 0 to 1. | Float |
336335
| **ungroundedPercentage** | Specifies the proportion of the text identified as ungrounded, expressed as a number between 0 and 1, where 0 indicates no ungrounded content and 1 indicates entirely ungrounded content.| Float |
337336
| **ungroundedDetails** | Provides insights into ungrounded content with specific examples and percentages.| Array |
338-
| -**`Text`** | The specific text that is ungrounded. | String |
337+
| -**`text`** | The specific text that is ungrounded. | String |
339338
| -**`offset`** | An object describing the position of the ungrounded text in various encoding. | String |
340339
| - `offset > utf8` | The offset position of the ungrounded text in UTF-8 encoding. | Integer |
341340
| - `offset > utf16` | The offset position of the ungrounded text in UTF-16 encoding. | Integer |
@@ -344,7 +343,7 @@ The JSON objects in the output are defined here:
344343
| - `length > utf8` | The length of the ungrounded text in UTF-8 encoding. | Integer |
345344
| - `length > utf16` | The length of the ungrounded text in UTF-16 encoding. | Integer |
346345
| - `length > codePoint` | The length of the ungrounded text in terms of Unicode code points. |Integer |
347-
| -**`Reason`** | Offers explanations for detected ungroundedness. | String |
346+
| -**`reason`** | Offers explanations for detected ungroundedness. | String |
348347

349348
## Clean up resources
350349

0 commit comments

Comments
 (0)