Spaces:
Running
Running
geekyrakshit
commited on
Commit
·
6779bd2
1
Parent(s):
f00294f
update: isolate presidio dependencies
Browse files
guardrails_genie/guardrails/__init__.py
CHANGED
@@ -1,9 +1,12 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
7 |
from guardrails_genie.guardrails.injection import (
|
8 |
PromptInjectionClassifierGuardrail,
|
9 |
PromptInjectionLlamaGuardrail,
|
|
|
1 |
+
try:
|
2 |
+
from guardrails_genie.guardrails.entity_recognition import (
|
3 |
+
PresidioEntityRecognitionGuardrail,
|
4 |
+
RegexEntityRecognitionGuardrail,
|
5 |
+
RestrictedTermsJudge,
|
6 |
+
TransformersEntityRecognitionGuardrail,
|
7 |
+
)
|
8 |
+
except ImportError:
|
9 |
+
pass
|
10 |
from guardrails_genie.guardrails.injection import (
|
11 |
PromptInjectionClassifierGuardrail,
|
12 |
PromptInjectionLlamaGuardrail,
|
guardrails_genie/guardrails/entity_recognition/__init__.py
CHANGED
@@ -3,10 +3,12 @@ import warnings
|
|
3 |
from .llm_judge_entity_recognition_guardrail import RestrictedTermsJudge
|
4 |
|
5 |
try:
|
6 |
-
from .presidio_entity_recognition_guardrail import
|
|
|
|
|
7 |
except ImportError:
|
8 |
warnings.warn(
|
9 |
-
"Presidio is not installed.
|
10 |
)
|
11 |
|
12 |
from .regex_entity_recognition_guardrail import RegexEntityRecognitionGuardrail
|
|
|
3 |
from .llm_judge_entity_recognition_guardrail import RestrictedTermsJudge
|
4 |
|
5 |
try:
|
6 |
+
from .presidio_entity_recognition_guardrail import (
|
7 |
+
PresidioEntityRecognitionGuardrail,
|
8 |
+
)
|
9 |
except ImportError:
|
10 |
warnings.warn(
|
11 |
+
"Presidio is not installed. If you want to use `PresidioEntityRecognitionGuardrail`, you can install the required packages using `pip install -e .[presidio]`"
|
12 |
)
|
13 |
|
14 |
from .regex_entity_recognition_guardrail import RegexEntityRecognitionGuardrail
|