Spaces:
Running
Running
geekyrakshit
commited on
Commit
•
f00294f
1
Parent(s):
fdb575d
update: isolate presidio dependencies
Browse files
guardrails_genie/guardrails/entity_recognition/__init__.py
CHANGED
@@ -1,5 +1,14 @@
|
|
|
|
|
|
1 |
from .llm_judge_entity_recognition_guardrail import RestrictedTermsJudge
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
from .regex_entity_recognition_guardrail import RegexEntityRecognitionGuardrail
|
4 |
from .transformers_entity_recognition_guardrail import (
|
5 |
TransformersEntityRecognitionGuardrail,
|
|
|
1 |
+
import warnings
|
2 |
+
|
3 |
from .llm_judge_entity_recognition_guardrail import RestrictedTermsJudge
|
4 |
+
|
5 |
+
try:
|
6 |
+
from .presidio_entity_recognition_guardrail import PresidioEntityRecognitionGuardrail
|
7 |
+
except ImportError:
|
8 |
+
warnings.warn(
|
9 |
+
"Presidio is not installed. You can install it using `pip install -e .[presidio]`"
|
10 |
+
)
|
11 |
+
|
12 |
from .regex_entity_recognition_guardrail import RegexEntityRecognitionGuardrail
|
13 |
from .transformers_entity_recognition_guardrail import (
|
14 |
TransformersEntityRecognitionGuardrail,
|
guardrails_genie/utils.py
CHANGED
@@ -1,18 +1,5 @@
|
|
1 |
-
import os
|
2 |
-
|
3 |
import pandas as pd
|
4 |
-
import pymupdf4llm
|
5 |
import weave
|
6 |
-
import weave.trace
|
7 |
-
from firerequests import FireRequests
|
8 |
-
|
9 |
-
|
10 |
-
@weave.op()
|
11 |
-
def get_markdown_from_pdf_url(url: str) -> str:
|
12 |
-
FireRequests().download(url, "temp.pdf", show_progress=False)
|
13 |
-
markdown = pymupdf4llm.to_markdown("temp.pdf", show_progress=False)
|
14 |
-
os.remove("temp.pdf")
|
15 |
-
return markdown
|
16 |
|
17 |
|
18 |
class EvaluationCallManager:
|
|
|
|
|
|
|
1 |
import pandas as pd
|
|
|
2 |
import weave
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
|
5 |
class EvaluationCallManager:
|
pyproject.toml
CHANGED
@@ -9,25 +9,27 @@ dependencies = [
|
|
9 |
"evaluate>=0.4.3",
|
10 |
"google-generativeai>=0.8.3",
|
11 |
"openai>=1.52.2",
|
12 |
-
"isort>=5.13.2",
|
13 |
-
"black>=24.10.0",
|
14 |
-
"ruff>=0.6.9",
|
15 |
-
"pip>=24.2",
|
16 |
-
"uv>=0.4.20",
|
17 |
"weave @ git+https://github.com/wandb/weave@feat/eval-progressbar",
|
18 |
"streamlit>=1.40.1",
|
19 |
"python-dotenv>=1.0.1",
|
20 |
"watchdog>=6.0.0",
|
21 |
-
"firerequests>=0.1.1",
|
22 |
-
"pymupdf4llm>=0.0.17",
|
23 |
"transformers>=4.46.3",
|
24 |
"torch>=2.5.1",
|
25 |
-
"presidio-analyzer>=2.2.355",
|
26 |
-
"presidio-anonymizer>=2.2.355",
|
27 |
"instructor>=1.7.0",
|
28 |
]
|
29 |
|
30 |
[project.optional-dependencies]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
docs = [
|
32 |
"mkdocs>=1.6.1",
|
33 |
"mkdocstrings>=0.26.1",
|
|
|
9 |
"evaluate>=0.4.3",
|
10 |
"google-generativeai>=0.8.3",
|
11 |
"openai>=1.52.2",
|
|
|
|
|
|
|
|
|
|
|
12 |
"weave @ git+https://github.com/wandb/weave@feat/eval-progressbar",
|
13 |
"streamlit>=1.40.1",
|
14 |
"python-dotenv>=1.0.1",
|
15 |
"watchdog>=6.0.0",
|
|
|
|
|
16 |
"transformers>=4.46.3",
|
17 |
"torch>=2.5.1",
|
|
|
|
|
18 |
"instructor>=1.7.0",
|
19 |
]
|
20 |
|
21 |
[project.optional-dependencies]
|
22 |
+
presidio = [
|
23 |
+
"presidio-analyzer>=2.2.355",
|
24 |
+
"presidio-anonymizer>=2.2.355",
|
25 |
+
]
|
26 |
+
dev = [
|
27 |
+
"isort>=5.13.2",
|
28 |
+
"black>=24.10.0",
|
29 |
+
"ruff>=0.6.9",
|
30 |
+
"pip>=24.2",
|
31 |
+
"uv>=0.4.20",
|
32 |
+
]
|
33 |
docs = [
|
34 |
"mkdocs>=1.6.1",
|
35 |
"mkdocstrings>=0.26.1",
|