| Developed by | David Tam |
|---|---|
| Date of development | Aug 13, 2024 |
| Validator type | Format |
| License | Apache 2 |
| Input/Output | Output |
Identifies internal domains in a string output.
finds internal domains in a string output like "internal.example.com" or "example.internal".
-
Dependencies:
- guardrails-ai>=0.4.0
-
Dev Dependencies:
- pytest
- pyright
- ruff
$ guardrails hub install hub://guardrails/internal_domainsIn this example, we apply the validator to a string output generated by an LLM.
# Import Guard and Validator
from guardrails.hub 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