liveBook · Manning

Protected material detection

As explained in Generative AI in Action

Protected material detection is the identification of generated content that matches copyrighted or otherwise owned source material.

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

How Generative AI in Action covers it

How deep it goes
Explains indexed-text matching, configurable blocking, and an API request, without detailing matching internals.
Examples
Uses song lyrics resembling Taylor Swift’s “Mastermind” and a Python request to detect protected material.
What it assumes
Assumes access to an Azure Content Safety endpoint, API version, subscription key, and basic HTTP JSON requests.
What you can do after
Operate/configure Azure Content Safety to inspect generated text and block detected matches.
How it connects
Connects protected material detection with Azure OpenAI Content Safety, prompt shields, groundedness detection, copyright, and public source code.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Generative AI in Action. The section links point to the parts of the book it draws on.