> ## Documentation Index
> Fetch the complete documentation index at: https://docs.murnitur.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Full Example

<img style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/murnitur/H5Gxz8F5bfRiPNQG/images/interceptions.png?fit=max&auto=format&n=H5Gxz8F5bfRiPNQG&q=85&s=93dcce60b39e4e1ae3b974948efe6abc" width="3360" height="1880" data-path="images/interceptions.png" />

<CodeGroup>
  ```python python theme={null}
  from murnitur import Guard
  from murnitur.guard import Payload, RuleSet

  # Define the rulesets
  rulesets: list[RuleSet] = [
      {
          "rules": [
              {
                  "metric": "pii",
                  "operator": "contains",
                  "value": ["email", "ssn", "address", "phone_number"]
              }
          ],
          "action": {
              "type": "OVERRIDE",
              "fallback": "Sorry, I can't provide personal identifiable information."
          }
      },
      {
          "rules": [
              {
                  "metric": "tone",
                  "operator": "contains",
                  "value": ["sadness", "anger", "annoyance"]
              }
          ],
          "action": {
              "type": "FLAG",
              "fallback": "Content flagged for inappropriate tone."
          }
      }
  ]

  # Sample input and output data
  payload: Payload = {
    "input": "User's input data containing email: user@example.com and phone number: 123-456-7890",
    "output": "Generated output with sensitive information: SSN: 123-45-6789"
  }

  # Set up Murnitur Shield
  response = Guard.shield(
      payload=payload,
      rulesets=rulesets,
      config={
          "group": "production",  # Adjust the group as per your environment
          "murnitur_key": "your_api_key_here"  # Replace with your actual API key
      }
  )

  # Return the response
  print(response.text)
  ```

  ```typescript typescript theme={null}
  import { Guard, Payload, RuleSet } from "murnitur"

  // Define the rulesets
  const rulesets: RuleSet[] = [
      {
          rules: [
              {
                  metric: "pii",
                  operator: "contains",
                  value: ["email", "ssn", "address", "phone_number"]
              }
          ],
          action: {
              type: "OVERRIDE",
              fallback: "Sorry, I can't provide personal identifiable information."
          }
      },
      {
          rules: [
              {
                  metric: "tone",
                  operator: "contains",
                  value: ["sadness", "anger", "annoyance"]
              }
          ],
          action: {
              type: "FLAG",
              fallback: "Content flagged for inappropriate tone."
          }
      }
  ]

  // Sample input and output data
  const payload: Payload = {
    input: "User's input data containing email: user@example.com and phone number: 123-456-7890",
    output: "Generated output with sensitive information: SSN: 123-45-6789"
  }

  // Set up Murnitur Shield
  const response = Guard.shield(
      payload,
      rulesets,
      {
          "group": "production",  // Adjust the group as per your environment
          "murnitur_key": "your_api_key_here"  // Replace with your actual API key
      }
  )

  // Return the response
  console.log(response.text)
  ```
</CodeGroup>

<img style={{ borderRadius: "0.5rem" }} src="https://mintcdn.com/murnitur/H5Gxz8F5bfRiPNQG/images/interception.png?fit=max&auto=format&n=H5Gxz8F5bfRiPNQG&q=85&s=cdec3260bbf3121e935a805a4bcc8747" width="3360" height="1880" data-path="images/interception.png" />
