Protected material detection identifies generated text that matches copyrighted or otherwise owned content, helping enterprises protect intellectual property and meet legal requirements. section 13.5.1
Azure OpenAI Content Safety applies the technique by:
- Comparing generated language with indexed third-party text, including song lyrics, articles, recipes, selected web content, and public GitHub source code. section 13.5.1
- Blocking text from display when a match is found, with protection strictness configurable for enterprise needs. section 13.5.1
Checking generated text
Send the text to the Azure Content Safety text:detectProtectedMaterial endpoint with a JSON payload and subscription-key header. For example, lyrics resembling “Mastermind” can produce an error indicating protected material. section 13.5.1
Listing 13.3 Protected material detection example
# The text to be analyzed
text_to_analyze = " Once upon a time The planets and the fates
and all the stars aligned"
# Set up the API request
url = f"{CONTENT_SAFETY_ENDPOINT}/contentsafety/
text:detectProtectedMaterial?api-version={API_VERSION}"
headers = {
"Content-Type": "application/json",
"Ocp-Apim-Subscription-Key": CONTENT_SAFETY_KEY
}
data = {"text": text_to_analyze}
# Send the API request
response = requests.post(url, headers=headers, json=data, timeout=10)
result = response.json()
print("Analysis result:", result)
Use the request listing to inspect the endpoint, headers, payload, timeout, and response handling. section 13.5.1
