Groundedness measures whether an AI response is supported by its sources rather than speculative or fabricated. It is one of the metrics used to assess LLM output quality, alongside coherence and fluency. section 13.5.1 section 12.6
Azure Content Safety provides groundedness detection to check whether responses are based on factual sources. This complements evaluation approaches such as traditional text metrics, task-specific benchmarks, and human evaluation. section 13.5.1 section 12.6
Listing 13.2 Groundedness detection example
# Build the request payload
payload = {
"domain": "Medical",
"task": "Summarization",
"text": "Ms Johnson has been in the hospital after experiencing
a stroke.",
"groundingSources": ["Our patient, Ms. Johnson, presented with
persistent fatigue, unexplained weight loss, and frequent
night sweats. After a series of tests, she was diagnosed ..."],
"reasoning": false
})
headers = {
"Content-Type": "application/json",
"Ocp-Apim-Subscription-Key": CONTENT_SAFETY_KEY
}
# Send the API request
url = f"{CONTENT_SAFETY_ENDPOINT}/contentsafety/
text:detectGroundedness?api-version={API_VERSION}"
response = requests.post(url, headers=headers,
json=payload, timeout=10)
if response.status_code == 200:
result = response.json()
print("detectGroundedness result:", result)
else:
print("Error:", response.status_code, response.text)
The request example submits a medical-summary response and its grounding source to the groundedness detection endpoint. section 13.5.1
The illustrated response flags ungrounded content and identifies a specific text span. Treat the result as an evaluation signal; the example does not explain how to calibrate or interpret the score beyond the returned fields. section 13.5.1



