Guardrails AI
Internal Domains
Identifies internal domains in a string output.
Data Leakage

Overview

updated 5 days
Developed by:
David Tam
Date of development:
Aug 13, 2024
Validator type:
Format
License:
MIT
Input/Output:
Output

Install

pip
pip install guardrails-ai-internal-domains
usage
from guardrails import Guard
from guardrails_ai.internal_domains import InternalDomains

guard = Guard().use(InternalDomains)
guard.validate("some text")
Description

Identifies internal domains in a string output.

(Optional) Intended Use

finds internal domains in a string output like "internal.example.com" or "example.internal".

Requirements
  • Dependencies:

    • guardrails-ai>=0.4.0
  • Dev Dependencies:

    • pytest
    • pyright
    • ruff
Installation
pip install guardrails-ai-internal-domains
Usage Examples
Validating string output via Python

In this example, we apply the validator to a string output generated by an LLM.

# Import Guard and Validator
from guardrails_ai.internal_domains import InternalDomains
from guardrails import Guard

# Setup Guard
guard = Guard.use(
    InternalDomains(internal_domains= ["internal.example.com"]),
)

guard.validate("This is a string with no domains except a reference to https://www.example.com")  # Validator passes
guard.validate("This string includes a link to https://internal.example.com/wiki/welcome-guide")  # Validator fails
License

MIT — © Guardrails AI.