vijil-dome 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vijil-dome might be problematic. Click here for more details.
- vijil_dome-1.0.0/PKG-INFO +504 -0
- vijil_dome-1.0.0/README.md +287 -0
- vijil_dome-1.0.0/pyproject.toml +224 -0
- vijil_dome-1.0.0/vijil_dome/Dome.py +157 -0
- vijil_dome-1.0.0/vijil_dome/__init__.py +4 -0
- vijil_dome-1.0.0/vijil_dome/defaults.py +35 -0
- vijil_dome-1.0.0/vijil_dome/detectors/__init__.py +186 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/__init__.py +16 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/configs/banlists/default_banlist.txt +403 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/configs/embedding_files/jailbreak/garak_inthewild_jailbreak.raw.txt +666 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/configs/presidio/default_config.yaml +36 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/embedding_models.py +32 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/factcheck_roberta.py +49 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/flashtext_kw_banlist.py +47 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/hhem_hallucination.py +54 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/jb_perplexity_heuristics.py +147 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/llm_models.py +214 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/openai_models.py +66 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/perspective.py +63 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/pi_hf_deberta.py +203 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/pi_hf_mbert.py +54 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/pii_presidio.py +107 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/secret_detector.py +81 -0
- vijil_dome-1.0.0/vijil_dome/detectors/methods/toxicity_deberta.py +62 -0
- vijil_dome-1.0.0/vijil_dome/detectors/utils/__init__.py +0 -0
- vijil_dome-1.0.0/vijil_dome/detectors/utils/embeddings_base.py +66 -0
- vijil_dome-1.0.0/vijil_dome/detectors/utils/hf_model.py +81 -0
- vijil_dome-1.0.0/vijil_dome/detectors/utils/llm_api_base.py +100 -0
- vijil_dome-1.0.0/vijil_dome/detectors/utils/prompt_templates/modifiable_prompts.py +151 -0
- vijil_dome-1.0.0/vijil_dome/embeds/__init__.py +17 -0
- vijil_dome-1.0.0/vijil_dome/embeds/embedder.py +44 -0
- vijil_dome-1.0.0/vijil_dome/embeds/examples.py +79 -0
- vijil_dome-1.0.0/vijil_dome/embeds/index/__init__.py +42 -0
- vijil_dome-1.0.0/vijil_dome/embeds/index/basic.py +183 -0
- vijil_dome-1.0.0/vijil_dome/embeds/models/__init__.py +67 -0
- vijil_dome-1.0.0/vijil_dome/embeds/models/fastembed.py +56 -0
- vijil_dome-1.0.0/vijil_dome/embeds/models/sentence_transformers.py +46 -0
- vijil_dome-1.0.0/vijil_dome/guardrails/__init__.py +346 -0
- vijil_dome-1.0.0/vijil_dome/guardrails/config_parser.py +174 -0
- vijil_dome-1.0.0/vijil_dome/guardrails/defaults.py +37 -0
- vijil_dome-1.0.0/vijil_dome/guardrails/examples/ex_guarded_chat_completions.py +71 -0
- vijil_dome-1.0.0/vijil_dome/guardrails/instrumentation/instrumentation.py +135 -0
- vijil_dome-1.0.0/vijil_dome/guardrails/instrumentation/metrics.py +152 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/examples/ex_guardrail.py +132 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/examples/ex_logging.ipynb +268 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/examples/ex_tracing.py +57 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/examples/multiple_handler_logging_config/config.toml +27 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/examples/multiple_handler_logging_config/ex_logging.ipynb +633 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/examples/multiple_processor_exporter_config/config.toml +59 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/examples/multiple_processor_exporter_config/ex_logging.py +77 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/examples/utils/create_gcp_instruments.py +58 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/examples/utils/create_instruments.py +130 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/logging/__init__.py +152 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/logging/default_logging_config.toml +22 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/logging/readme.md +30 -0
- vijil_dome-1.0.0/vijil_dome/instrumentation/tracing.py +51 -0
- vijil_dome-1.0.0/vijil_dome/integrations/adk/__init__.py +1 -0
- vijil_dome-1.0.0/vijil_dome/integrations/adk/callbacks.py +105 -0
- vijil_dome-1.0.0/vijil_dome/integrations/examples/agentops_integration.py +116 -0
- vijil_dome-1.0.0/vijil_dome/integrations/examples/langchain_integration.ipynb +294 -0
- vijil_dome-1.0.0/vijil_dome/integrations/examples/otel/domed_client.py +83 -0
- vijil_dome-1.0.0/vijil_dome/integrations/examples/otel/example_config.toml +27 -0
- vijil_dome-1.0.0/vijil_dome/integrations/examples/otel/setup_otel.py +106 -0
- vijil_dome-1.0.0/vijil_dome/integrations/examples/weave_integration.py +106 -0
- vijil_dome-1.0.0/vijil_dome/integrations/instrumentation/otel_instrumentation.py +73 -0
- vijil_dome-1.0.0/vijil_dome/integrations/langchain/runnable.py +37 -0
- vijil_dome-1.0.0/vijil_dome/tests/detectors/test_generic_detectors.py +35 -0
- vijil_dome-1.0.0/vijil_dome/tests/detectors/test_integrity_detectors.py +91 -0
- vijil_dome-1.0.0/vijil_dome/tests/detectors/test_moderations_detectors.py +80 -0
- vijil_dome-1.0.0/vijil_dome/tests/detectors/test_privacy_detectors.py +63 -0
- vijil_dome-1.0.0/vijil_dome/tests/detectors/test_security_detectors.py +131 -0
- vijil_dome-1.0.0/vijil_dome/tests/test_dome_obj.py +116 -0
- vijil_dome-1.0.0/vijil_dome/types.py +5 -0
- vijil_dome-1.0.0/vijil_dome/utils/__init__.py +0 -0
- vijil_dome-1.0.0/vijil_dome/utils/readers.py +39 -0
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: vijil-dome
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary:
|
|
5
|
+
Author: Pradeep Das
|
|
6
|
+
Author-email: das.pradeep@gmail.com
|
|
7
|
+
Requires-Python: >=3.11,<3.13
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Provides-Extra: embeddings
|
|
12
|
+
Provides-Extra: google
|
|
13
|
+
Provides-Extra: langchain
|
|
14
|
+
Provides-Extra: opentelemetry
|
|
15
|
+
Requires-Dist: Deprecated (==1.2.15)
|
|
16
|
+
Requires-Dist: Jinja2 (==3.1.4)
|
|
17
|
+
Requires-Dist: MarkupSafe (==3.0.2)
|
|
18
|
+
Requires-Dist: PyJWT (==2.10.1)
|
|
19
|
+
Requires-Dist: PyYAML (==6.0.2)
|
|
20
|
+
Requires-Dist: Pygments (==2.18.0)
|
|
21
|
+
Requires-Dist: SQLAlchemy (==2.0.32)
|
|
22
|
+
Requires-Dist: aiobotocore (==2.15.2)
|
|
23
|
+
Requires-Dist: aiohappyeyeballs (==2.3.4)
|
|
24
|
+
Requires-Dist: aiohttp (==3.10.1)
|
|
25
|
+
Requires-Dist: aioitertools (==0.12.0)
|
|
26
|
+
Requires-Dist: aiosignal (==1.3.1)
|
|
27
|
+
Requires-Dist: annotated-types (==0.7.0)
|
|
28
|
+
Requires-Dist: annoy (==1.17.3) ; extra == "embeddings"
|
|
29
|
+
Requires-Dist: anyio (==4.8.0)
|
|
30
|
+
Requires-Dist: attrs (==24.1.0)
|
|
31
|
+
Requires-Dist: azure-core (==1.32.0)
|
|
32
|
+
Requires-Dist: bcrypt (==4.2.1)
|
|
33
|
+
Requires-Dist: blis (==0.7.11)
|
|
34
|
+
Requires-Dist: boto3 (==1.35.36)
|
|
35
|
+
Requires-Dist: botocore (==1.35.36)
|
|
36
|
+
Requires-Dist: cachetools (==5.5.0)
|
|
37
|
+
Requires-Dist: catalogue (==2.0.10)
|
|
38
|
+
Requires-Dist: cattrs (==24.1.2)
|
|
39
|
+
Requires-Dist: certifi (==2024.7.4)
|
|
40
|
+
Requires-Dist: charset-normalizer (==3.3.2)
|
|
41
|
+
Requires-Dist: click (==8.1.8)
|
|
42
|
+
Requires-Dist: cloudpathlib (==0.20.0)
|
|
43
|
+
Requires-Dist: colorama (==0.4.6)
|
|
44
|
+
Requires-Dist: confection (==0.1.5)
|
|
45
|
+
Requires-Dist: constructs (==10.4.2)
|
|
46
|
+
Requires-Dist: contourpy (==1.3.1)
|
|
47
|
+
Requires-Dist: cramjam (==2.9.1)
|
|
48
|
+
Requires-Dist: cycler (==0.12.1)
|
|
49
|
+
Requires-Dist: cymem (==2.0.10)
|
|
50
|
+
Requires-Dist: dataclasses-json (==0.6.7)
|
|
51
|
+
Requires-Dist: datasets (==2.21.0)
|
|
52
|
+
Requires-Dist: defusedxml (==0.7.1)
|
|
53
|
+
Requires-Dist: detect-secrets (==1.5.0)
|
|
54
|
+
Requires-Dist: dill (==0.3.8)
|
|
55
|
+
Requires-Dist: distro (==1.9.0)
|
|
56
|
+
Requires-Dist: faiss-cpu (==1.8.0.post1)
|
|
57
|
+
Requires-Dist: fastapi (==0.115.6)
|
|
58
|
+
Requires-Dist: fastparquet (==2024.11.0)
|
|
59
|
+
Requires-Dist: filelock (==3.16.1)
|
|
60
|
+
Requires-Dist: flashtext (==2.7)
|
|
61
|
+
Requires-Dist: fonttools (==4.55.2)
|
|
62
|
+
Requires-Dist: fpdf2 (==2.8.1)
|
|
63
|
+
Requires-Dist: frozenlist (==1.4.1)
|
|
64
|
+
Requires-Dist: fsspec (==2024.6.1)
|
|
65
|
+
Requires-Dist: google-api-core (==2.23.0) ; extra == "google"
|
|
66
|
+
Requires-Dist: google-api-python-client (==2.157.0) ; extra == "google"
|
|
67
|
+
Requires-Dist: google-auth (==2.36.0) ; extra == "google"
|
|
68
|
+
Requires-Dist: google-auth-httplib2 (==0.2.0) ; extra == "google"
|
|
69
|
+
Requires-Dist: google-cloud-appengine-logging (==1.5.0) ; extra == "google"
|
|
70
|
+
Requires-Dist: google-cloud-audit-log (==0.3.0) ; extra == "google"
|
|
71
|
+
Requires-Dist: google-cloud-core (==2.4.1) ; extra == "google"
|
|
72
|
+
Requires-Dist: google-cloud-logging (==3.11.3) ; extra == "google"
|
|
73
|
+
Requires-Dist: google-cloud-monitoring (==2.23.1) ; extra == "google"
|
|
74
|
+
Requires-Dist: google-cloud-trace (==1.14.1) ; extra == "google"
|
|
75
|
+
Requires-Dist: googleapis-common-protos (==1.66.0) ; extra == "google"
|
|
76
|
+
Requires-Dist: greenlet (==3.0.3)
|
|
77
|
+
Requires-Dist: grpc-google-iam-v1 (==0.14.0)
|
|
78
|
+
Requires-Dist: grpcio (==1.68.1)
|
|
79
|
+
Requires-Dist: grpcio-status (==1.68.1)
|
|
80
|
+
Requires-Dist: h11 (==0.14.0)
|
|
81
|
+
Requires-Dist: httpcore (==1.0.5)
|
|
82
|
+
Requires-Dist: httplib2 (==0.22.0)
|
|
83
|
+
Requires-Dist: httpx (==0.28.1)
|
|
84
|
+
Requires-Dist: huggingface-hub (==0.26.3)
|
|
85
|
+
Requires-Dist: idna (==3.7)
|
|
86
|
+
Requires-Dist: importlib_metadata (==8.5.0)
|
|
87
|
+
Requires-Dist: importlib_resources (==6.5.2)
|
|
88
|
+
Requires-Dist: iniconfig (==2.0.0)
|
|
89
|
+
Requires-Dist: jiter (==0.8.2)
|
|
90
|
+
Requires-Dist: jmespath (==1.0.1)
|
|
91
|
+
Requires-Dist: joblib (==1.4.2)
|
|
92
|
+
Requires-Dist: jsii (==1.106.0)
|
|
93
|
+
Requires-Dist: jsonpatch (==1.33)
|
|
94
|
+
Requires-Dist: jsonpointer (==3.0.0)
|
|
95
|
+
Requires-Dist: jsonschema (==4.23.0)
|
|
96
|
+
Requires-Dist: jsonschema-specifications (==2025.4.1)
|
|
97
|
+
Requires-Dist: kiwisolver (==1.4.7)
|
|
98
|
+
Requires-Dist: langchain (==0.2.12) ; extra == "langchain"
|
|
99
|
+
Requires-Dist: langchain-community (==0.2.11) ; extra == "langchain"
|
|
100
|
+
Requires-Dist: langchain-core (==0.2.43) ; extra == "langchain"
|
|
101
|
+
Requires-Dist: langchain-openai (==0.1.20) ; extra == "langchain"
|
|
102
|
+
Requires-Dist: langchain-text-splitters (==0.2.2) ; extra == "langchain"
|
|
103
|
+
Requires-Dist: langcodes (==3.5.0)
|
|
104
|
+
Requires-Dist: langsmith (==0.1.112) ; extra == "langchain"
|
|
105
|
+
Requires-Dist: language_data (==1.3.0)
|
|
106
|
+
Requires-Dist: litellm (==1.70.2)
|
|
107
|
+
Requires-Dist: marisa-trie (==1.2.1)
|
|
108
|
+
Requires-Dist: markdown-it-py (==3.0.0)
|
|
109
|
+
Requires-Dist: marshmallow (==3.21.3)
|
|
110
|
+
Requires-Dist: matplotlib (==3.9.3)
|
|
111
|
+
Requires-Dist: mdurl (==0.1.2)
|
|
112
|
+
Requires-Dist: mpmath (==1.3.0)
|
|
113
|
+
Requires-Dist: multidict (==6.0.5)
|
|
114
|
+
Requires-Dist: multiprocess (==0.70.16)
|
|
115
|
+
Requires-Dist: murmurhash (==1.0.11)
|
|
116
|
+
Requires-Dist: mypy (==1.13.0)
|
|
117
|
+
Requires-Dist: mypy-extensions (==1.0.0)
|
|
118
|
+
Requires-Dist: nest-asyncio (==1.6.0)
|
|
119
|
+
Requires-Dist: networkx (==3.4.2)
|
|
120
|
+
Requires-Dist: numpy (==1.26.0)
|
|
121
|
+
Requires-Dist: openai (==1.75.0)
|
|
122
|
+
Requires-Dist: opentelemetry-api (==1.28.1) ; extra == "opentelemetry"
|
|
123
|
+
Requires-Dist: opentelemetry-exporter-gcp-monitoring (==1.7.0a0) ; extra == "opentelemetry"
|
|
124
|
+
Requires-Dist: opentelemetry-exporter-gcp-trace (==1.9.0) ; extra == "opentelemetry"
|
|
125
|
+
Requires-Dist: opentelemetry-exporter-otlp (==1.28.1) ; extra == "opentelemetry"
|
|
126
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-common (==1.28.1) ; extra == "opentelemetry"
|
|
127
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc (==1.28.1) ; extra == "opentelemetry"
|
|
128
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http (==1.28.1) ; extra == "opentelemetry"
|
|
129
|
+
Requires-Dist: opentelemetry-instrumentation (==0.49b1) ; extra == "opentelemetry"
|
|
130
|
+
Requires-Dist: opentelemetry-instrumentation-asyncio (==0.49b1) ; extra == "opentelemetry"
|
|
131
|
+
Requires-Dist: opentelemetry-instrumentation-logging (==0.49b1) ; extra == "opentelemetry"
|
|
132
|
+
Requires-Dist: opentelemetry-instrumentation-threading (==0.49b1) ; extra == "opentelemetry"
|
|
133
|
+
Requires-Dist: opentelemetry-propagator-gcp (==1.7.0) ; extra == "opentelemetry"
|
|
134
|
+
Requires-Dist: opentelemetry-proto (>=1.28.1) ; extra == "opentelemetry"
|
|
135
|
+
Requires-Dist: opentelemetry-resourcedetector-gcp (==1.7.0a0) ; extra == "opentelemetry"
|
|
136
|
+
Requires-Dist: opentelemetry-sdk (==1.28.1) ; extra == "opentelemetry"
|
|
137
|
+
Requires-Dist: opentelemetry-semantic-conventions (==0.49b1) ; extra == "opentelemetry"
|
|
138
|
+
Requires-Dist: orjson (==3.10.6)
|
|
139
|
+
Requires-Dist: packaging (==24.2.0)
|
|
140
|
+
Requires-Dist: pandas (==2.2.3)
|
|
141
|
+
Requires-Dist: phonenumbers (==8.13.51)
|
|
142
|
+
Requires-Dist: pillow (==11.0.0)
|
|
143
|
+
Requires-Dist: pluggy (==1.5.0)
|
|
144
|
+
Requires-Dist: preshed (==3.0.9)
|
|
145
|
+
Requires-Dist: presidio_analyzer (==2.2.355)
|
|
146
|
+
Requires-Dist: presidio_anonymizer (==2.2.355)
|
|
147
|
+
Requires-Dist: propcache (==0.2.1)
|
|
148
|
+
Requires-Dist: proto-plus (==1.25.0)
|
|
149
|
+
Requires-Dist: protobuf (==5.29.1)
|
|
150
|
+
Requires-Dist: publication (==0.0.3)
|
|
151
|
+
Requires-Dist: pyarrow (==18.1.0)
|
|
152
|
+
Requires-Dist: pyasn1 (==0.6.1)
|
|
153
|
+
Requires-Dist: pyasn1_modules (==0.4.1)
|
|
154
|
+
Requires-Dist: pycryptodome (==3.21.0)
|
|
155
|
+
Requires-Dist: pydantic (==2.8.2)
|
|
156
|
+
Requires-Dist: pydantic_core (==2.20.1)
|
|
157
|
+
Requires-Dist: pyparsing (==3.2.0)
|
|
158
|
+
Requires-Dist: pytest (==8.3.4)
|
|
159
|
+
Requires-Dist: pytest-asyncio (==0.24.0)
|
|
160
|
+
Requires-Dist: python-dateutil (==2.9.0.post0)
|
|
161
|
+
Requires-Dist: python-dotenv (==1.0.1)
|
|
162
|
+
Requires-Dist: pytz (==2024.2)
|
|
163
|
+
Requires-Dist: referencing (==0.36.2)
|
|
164
|
+
Requires-Dist: regex (==2024.7.24)
|
|
165
|
+
Requires-Dist: requests (==2.32.3)
|
|
166
|
+
Requires-Dist: requests-aws4auth (==1.3.1)
|
|
167
|
+
Requires-Dist: requests-file (==2.1.0)
|
|
168
|
+
Requires-Dist: rich (==13.9.4)
|
|
169
|
+
Requires-Dist: rpds-py (==0.25.1)
|
|
170
|
+
Requires-Dist: rsa (==4.9)
|
|
171
|
+
Requires-Dist: ruff (==0.4.10)
|
|
172
|
+
Requires-Dist: s3transfer (==0.10.4)
|
|
173
|
+
Requires-Dist: safetensors (==0.4.5)
|
|
174
|
+
Requires-Dist: scikit-learn (==1.5.2)
|
|
175
|
+
Requires-Dist: scipy (==1.14.1)
|
|
176
|
+
Requires-Dist: seaborn (==0.13.2)
|
|
177
|
+
Requires-Dist: sentence-transformers (==3.3.1)
|
|
178
|
+
Requires-Dist: setuptools (==75.6.0)
|
|
179
|
+
Requires-Dist: shellingham (==1.5.4)
|
|
180
|
+
Requires-Dist: six (==1.17.0)
|
|
181
|
+
Requires-Dist: smart-open (==7.0.5)
|
|
182
|
+
Requires-Dist: sniffio (==1.3.1)
|
|
183
|
+
Requires-Dist: spacy (==3.7.5)
|
|
184
|
+
Requires-Dist: spacy-legacy (==3.0.12)
|
|
185
|
+
Requires-Dist: spacy-loggers (==1.0.5)
|
|
186
|
+
Requires-Dist: srsly (==2.4.8)
|
|
187
|
+
Requires-Dist: starlette (==0.41.3)
|
|
188
|
+
Requires-Dist: sympy (==1.13.1)
|
|
189
|
+
Requires-Dist: tenacity (==8.5.0)
|
|
190
|
+
Requires-Dist: thinc (==8.2.5)
|
|
191
|
+
Requires-Dist: threadpoolctl (==3.5.0)
|
|
192
|
+
Requires-Dist: tiktoken (==0.7.0)
|
|
193
|
+
Requires-Dist: tldextract (==5.1.3)
|
|
194
|
+
Requires-Dist: tokenizers (==0.21.1)
|
|
195
|
+
Requires-Dist: toml (==0.10.2)
|
|
196
|
+
Requires-Dist: torch (==2.6.0)
|
|
197
|
+
Requires-Dist: tqdm (==4.66.5)
|
|
198
|
+
Requires-Dist: transformers (==4.48.0)
|
|
199
|
+
Requires-Dist: typeguard (==2.13.3)
|
|
200
|
+
Requires-Dist: typer (==0.15.1)
|
|
201
|
+
Requires-Dist: types-requests (==2.32.0.20241016)
|
|
202
|
+
Requires-Dist: types-toml (==0.10.8.20240310)
|
|
203
|
+
Requires-Dist: typing-inspect (==0.9.0)
|
|
204
|
+
Requires-Dist: typing_extensions (==4.12.2)
|
|
205
|
+
Requires-Dist: tzdata (==2024.2)
|
|
206
|
+
Requires-Dist: uritemplate (==4.1.1)
|
|
207
|
+
Requires-Dist: urllib3 (==2.2.2)
|
|
208
|
+
Requires-Dist: uvicorn (==0.34.0)
|
|
209
|
+
Requires-Dist: wasabi (==1.1.3)
|
|
210
|
+
Requires-Dist: weasel (==0.4.1)
|
|
211
|
+
Requires-Dist: wrapt (==1.17.0)
|
|
212
|
+
Requires-Dist: xxhash (==3.5.0)
|
|
213
|
+
Requires-Dist: yarl (==1.9.4)
|
|
214
|
+
Requires-Dist: zipp (==3.21.0)
|
|
215
|
+
Description-Content-Type: text/markdown
|
|
216
|
+
|
|
217
|
+
# Vijil Dome
|
|
218
|
+
|
|
219
|
+
## Installing the library
|
|
220
|
+
|
|
221
|
+
You can install ```vijil-dome``` as a library by running the command
|
|
222
|
+
|
|
223
|
+
```pip install git+https://github.com/vijilAI/vijil-dome.git@domelibrary```
|
|
224
|
+
|
|
225
|
+
See the examples folder for usage examples
|
|
226
|
+
|
|
227
|
+
## Cloning/Syncing the repo
|
|
228
|
+
|
|
229
|
+
### Clone
|
|
230
|
+
|
|
231
|
+
`git clone --recurse-submodules git@github.com:vijilAI/vijil-dome.git`
|
|
232
|
+
|
|
233
|
+
### Sync
|
|
234
|
+
|
|
235
|
+
`git pull --recurse-submodules`
|
|
236
|
+
|
|
237
|
+
### Submodule init
|
|
238
|
+
|
|
239
|
+
`git submodule update --init --recursive`
|
|
240
|
+
|
|
241
|
+
### Submodule update
|
|
242
|
+
|
|
243
|
+
`git submodule update --recursive --remote`: --remote: Fetches the latest changes from the remote repository for each submodule.
|
|
244
|
+
|
|
245
|
+
## Configuration Overview
|
|
246
|
+
|
|
247
|
+
This README provides detailed information about the configuration file used for setting up a Dome.
|
|
248
|
+
|
|
249
|
+
## Running locally:
|
|
250
|
+
|
|
251
|
+
### Build and run
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
# Set a local API_KEY
|
|
255
|
+
$ export API_KEY=test-123
|
|
256
|
+
$ make build
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Test locally
|
|
260
|
+
|
|
261
|
+
#### Status check
|
|
262
|
+
```
|
|
263
|
+
$ curl localhost:80/status
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
#### Add/Update dome config
|
|
267
|
+
```
|
|
268
|
+
$ curl -XPATCH "localhost:80/config" \
|
|
269
|
+
-H "Content-Type: application/json" \
|
|
270
|
+
-d '{
|
|
271
|
+
"input-guards": ["prompt-injection", "input-toxicity"],
|
|
272
|
+
"output-guards": ["output-toxicity"],
|
|
273
|
+
"input-early-exit": false,
|
|
274
|
+
"prompt-injection": {
|
|
275
|
+
"type": "security",
|
|
276
|
+
"early-exit": false,
|
|
277
|
+
"methods": ["prompt-injection-deberta-v3-base", "security-llm"],
|
|
278
|
+
"security-llm": {
|
|
279
|
+
"model_name": "gpt-4o"
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
"input-toxicity": {
|
|
283
|
+
"type": "moderation",
|
|
284
|
+
"methods": ["moderations-oai-api"]
|
|
285
|
+
},
|
|
286
|
+
"output-toxicity": {
|
|
287
|
+
"type": "moderation",
|
|
288
|
+
"methods": ["moderation-prompt-engineering"]
|
|
289
|
+
}
|
|
290
|
+
}'
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
#### Input detections
|
|
294
|
+
```
|
|
295
|
+
$ curl -XGET "localhost:80/input_detection?api_key=test-123&input_str=hello"
|
|
296
|
+
$ curl -XGET "localhost:80/async_input_detection?api_key=test-123&input_str=hello"
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
#### Output detections
|
|
300
|
+
```
|
|
301
|
+
$ curl -XGET "localhost:80/output_detection?api_key=test-123&output_str=goodbye"
|
|
302
|
+
$ curl -XGET "localhost:80/async_output_detection?api_key=test-123&output_str=goodbye"
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Table of Contents
|
|
306
|
+
1. [General Structure](#general-structure)
|
|
307
|
+
2. [Method-Specific Settings](#method-specific-settings)
|
|
308
|
+
- [Security Methods](#1-security-methods)
|
|
309
|
+
- [DeBERTa Prompt-Injection Model](#i-deberta-prompt-injection-model-prompt-injection-deberta-v3-base)
|
|
310
|
+
- [Security Prompt Engineering](#ii-security-prompt-engineering-security-llm)
|
|
311
|
+
- [Length-Per-Perplexity Heuristic](#iii--length-per-perplexity-heuristic-jb-length-per-perplexity)
|
|
312
|
+
- [Prefix-Suffix Perplexity Heuristic](#iv-prefix-suffix-perplexity-heuristic-jb-prefix-suffix-perplexity)
|
|
313
|
+
- [Security Embeddings](#v-security-embeddings-security-embeddings)
|
|
314
|
+
- [Moderation Methods](#2-moderation-methods)
|
|
315
|
+
- [Flashtext Banlist](#i-flashtext-banlist-moderation-flashtext)
|
|
316
|
+
- [Moderation Prompt Engineeering](#iii-moderation-prompt-engineering-moderation-prompt-engineering)
|
|
317
|
+
- [OpenAI Moderation API](#iv-openai-moderations-api-moderations-oai-api)
|
|
318
|
+
- [Perspective API](#v-perspective-api-moderation-perspective-api)
|
|
319
|
+
- [DeBERTa Toxicity Model](#vi-deberta-toxicity-model-moderation-deberta)
|
|
320
|
+
- [Privacy Methods](#3-privacy-methods)
|
|
321
|
+
- [Presidio](#i-presidio-privacy-presidio)
|
|
322
|
+
- [Integrity Methods](#4-integrity-methods)
|
|
323
|
+
- [HHEM](#i-hhem-hhem-hallucination)
|
|
324
|
+
- [Hallucination Prompt Engineering](#ii-hallucination-prompt-engineering-hallucination-llm)
|
|
325
|
+
- [RoBERTa Fact-Check](#iii-roberta-fact-check-model-fact-check-roberta)
|
|
326
|
+
- [Fact-Check Prompt Engineering](#iv-fact-check-prompt-engineering-fact-check-llm)
|
|
327
|
+
|
|
328
|
+
## General Structure
|
|
329
|
+
|
|
330
|
+
Dome configurations can be specified via either a dictionary or a TOML file. An example of a TOML configuration is shown below
|
|
331
|
+
|
|
332
|
+
```toml
|
|
333
|
+
[guardrail]
|
|
334
|
+
input-guards = ["prompt-injection", "input-toxicity"]
|
|
335
|
+
output-guards = ["output-toxicity"]
|
|
336
|
+
input-early-exit = false
|
|
337
|
+
|
|
338
|
+
[prompt-injection]
|
|
339
|
+
type="security"
|
|
340
|
+
early-exit = false
|
|
341
|
+
methods = ["prompt-injection-deberta-v3-base", "security-llm"]
|
|
342
|
+
|
|
343
|
+
[prompt-injection.security-llm]
|
|
344
|
+
model_name = "gpt-4o"
|
|
345
|
+
|
|
346
|
+
[input-toxicity]
|
|
347
|
+
type="moderation"
|
|
348
|
+
methods = ["moderations-oai-api"]
|
|
349
|
+
|
|
350
|
+
[output-toxicity]
|
|
351
|
+
type="moderation"
|
|
352
|
+
methods = ["moderation-prompt-engineering"]
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Configurations can also be provided via dictionaries. The same configuration as a dictionary is shown below
|
|
356
|
+
```python
|
|
357
|
+
example_config = {
|
|
358
|
+
"input-guards": ["prompt-injection", "input-toxicity"],
|
|
359
|
+
"output-guards": ["output-toxicity"],
|
|
360
|
+
"input-early-exit": False,
|
|
361
|
+
"prompt-injection": {
|
|
362
|
+
"type": "security",
|
|
363
|
+
"early-exit":False,
|
|
364
|
+
"methods" : ["prompt-injection-deberta-v3-base", "security-llm"],
|
|
365
|
+
"security-llm": {
|
|
366
|
+
"model_name": "gpt-4o"
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
"input_toxicity":{
|
|
370
|
+
"type":"moderation",
|
|
371
|
+
"methods":["moderations-oai-api"]
|
|
372
|
+
},
|
|
373
|
+
"output_toxicity":{
|
|
374
|
+
"type":"moderation",
|
|
375
|
+
"methods":["moderation-prompt-engineering"]
|
|
376
|
+
},
|
|
377
|
+
}
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
The ```guardrail``` field describes the high level structure of the Dome object. ```guardrail``` has four attributes that must be specified
|
|
381
|
+
- ```input-guards``` - A list of user-defined guard-group names that will be used to scan the input to the LLM
|
|
382
|
+
- ```output-guards``` - A list of user-defined guard-group names that will be used to scan the output from the LLM
|
|
383
|
+
- ```input-early-exit``` - A boolean value to determine if the input-guards will run in "early-exit" mode, i.e, stop execution as soon as one of the groups has flagged the input. (Default value : true)
|
|
384
|
+
- ```output-early-exit``` - A boolean value to determine if the output-guards will run in "early-exit" mode, i.e, stop execution as soon as one of the groups has flagged the output. (Default value : true)
|
|
385
|
+
- ```input-run-parallel``` - A boolean value to determine if the input guard-groups will be executed in parallel or not. (Default value : false)
|
|
386
|
+
- ```output-run-parallel``` - A boolean value to determine if the output guard-groups will be executed in parallel or not. (Default value : false)
|
|
387
|
+
|
|
388
|
+
Once the guardrail structure has been specified, the configuration of each guard-group can be specified by creating a new field with the guard-group's name. In the example above, we have three guard-groups ```prompt-injection```, ```input-toxicity``` and ```output-toxicity```. ```prompt-injection``` and ```input-toxicity``` apply to the input, and ```output-toxicity``` is applied only to the output.
|
|
389
|
+
|
|
390
|
+
Each guard-group has three attributes:
|
|
391
|
+
- ```type``` - this must be specified, and controls the type of the guard-group. A guard-group's type is the category of guards that it holds. Every guard-group can only be exactly one type. We currently support four types = ```security```, ```moderation```, ```privacy``` and ```integrity``` (Note: Integrity is a WIP and has not yet been tested)
|
|
392
|
+
- ```methods``` - a list that describes which methods are to be used in the guard-group. The methods that can be used depend on the type selected (See model-specific settings for a list of all the methods available for each type of guardgroup). Note that the name in this list **must** match a name of a method exactly.
|
|
393
|
+
- ```early-exit``` - a boolean flag that determines if the methods run in "early-exit" mode, i.e, stop execution as soon as one of the methods has flagged the output. (Default value : true)
|
|
394
|
+
- ```run-parallel``` - a boolean flag that determins if the methods run in parallel or sequentially. (Note: if this is enabled, then the value of early-exit is ignored and execution stops as soon as one method flags the query). (Default value: false)
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
Finally, to customize settings at the method-level, create a new field with the name ```<GROUP-NAME>.<METHOD-NAME>```. In the example above, ```prompt-injection.security-llm``` describes the configuration settings for the ```security-llm``` method of the ```prompt-injection``` guard-group. This configuration scheme lets users create custom settings for different groups and use the same method with different settings in a guardrail. See the next section for detailed instructions on the options available for each method.
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
## Method-Specific Settings
|
|
401
|
+
|
|
402
|
+
This section outlines all the methods currently supported for the various types of guard-groups that can be created.
|
|
403
|
+
|
|
404
|
+
### 1. Security Methods
|
|
405
|
+
Security guards are guards meant to block against malicious prompts that attempt to cause the LLM to break its intended behaviour and guidelines. We currently support methods that aim to detect prompt injections, and jailbreak attacks. Security methods should typically be used in input guardrails.
|
|
406
|
+
|
|
407
|
+
#### i. DeBERTa Prompt-Injection Model (```prompt-injection-deberta-v3-base```)
|
|
408
|
+
This is a [fine-tuned deberta-v3-base model](https://huggingface.co/protectai/deberta-v3-base-prompt-injection), intended to be a classifier for detecting jailbreaks and prompt injection attacks. It has the following parameters
|
|
409
|
+
- ```truncation``` : optional boolean. Determines if the model input should be truncated or not. (Default: true)
|
|
410
|
+
- ```max_length``` : optional int. Maximum length of input string. (Default: 512)
|
|
411
|
+
|
|
412
|
+
#### ii. Security Prompt Engineering (```security-llm```)
|
|
413
|
+
A detector that uses custom prompt-engineering to determine if the query string is a prompt-injection or jailbreak attempt. It has the following parameters
|
|
414
|
+
- ```hub_name``` : optional str. The hub that hosts the model you want to use. Currently supports OpenAI (```"openai"```), Together (```"together"```) and Octo (```"octo"```). Default value : ```"openai"```
|
|
415
|
+
- ```model_name``` : optional str. The model that you want to use. Default: ```"gpt-4-turbo"```. Please ensure that the model you wish to use is compatible with the hub you selected.
|
|
416
|
+
- ```api_key```: optional str. Specify the API key you want to use. By default, this is None, and the API key is pulled directly from the environment variables. The environment variables used are ```OPENAI_API_KEY```, ```OCTO_API_KEY```, and ```TOGETHER_API_KEY```
|
|
417
|
+
|
|
418
|
+
#### iii. Length-Per-Perplexity Heuristic (```jb-length-per-perplexity```)
|
|
419
|
+
This method uses a hueristic based on perplexity outputs of GPT-2 and the length of a query string to determine if a prompt is a possible jailbreak attack. See [NeMo Guardrails](https://docs.nvidia.com/nemo/guardrails/user_guides/guardrails-library.html#jailbreak-detection-heuristics) for additional details. It has the following parameters
|
|
420
|
+
- ```stride_length```: optional int. Stride of the LLM. Default value: 512
|
|
421
|
+
- ```threshold```: optional float. the threshold of the heuristic. A string with a score higher than the threshold is classified as a jailbreak. Default: 89.79
|
|
422
|
+
|
|
423
|
+
#### iv. Prefix-Suffix-Perplexity Heuristic (```jb-prefix-suffix-perplexity```)
|
|
424
|
+
Similar to the previous method, this method uses a hueristic based on the perplexity of the first and last 20 words of a query. See [NeMo Guardrails](https://docs.nvidia.com/nemo/guardrails/user_guides/guardrails-library.html#jailbreak-detection-heuristics) for additional details. It has the following parameters
|
|
425
|
+
- ```stride_length```: optional int. Stride of the LLM. Default value: 512
|
|
426
|
+
- ```prefix_threshold```: optional float. The threshold for prefix perplexity. Any query string with a prefix threshold higher than this is flagged as a jailbreak attempt. Default: 1845.65
|
|
427
|
+
- ```suffix_threshold```: optional float. The threshold for suffix perplexity. Any query string with a suffix threshold higher than this is flagged as a jailbreak attempt. Default: 1845.65
|
|
428
|
+
- ```prefix_length```: optional int. The number of words to consider in the prefix. If this is larger than the number of words in the query string, the max length of the query string is used. Default: 20
|
|
429
|
+
- ```suffix_length```: optional int. The number of words to consider in the suffix. If this is larger than the number of words in the query string, the max length of the query string is used. Default: 20
|
|
430
|
+
|
|
431
|
+
#### v. Security Embeddings (```security-embeddings```)
|
|
432
|
+
Creates an embeddings index using the garak-in-the-wild-jailbreaks dataset. It has the following parameters:
|
|
433
|
+
- ```engine```: optional str. The engine to perform the embeddings. We currently support ```SentenceTransformer``` and ```FastEmbed```. Default: ```SentenceTransformer```
|
|
434
|
+
- ```model```: optional str. The embedding model to use. Default: ```all-MiniLM-L6-v2```
|
|
435
|
+
- ```threshold```: optional float. The default similarity threshold. If the similarity between a query and its nearest neighbour is greater than or equal to this value, the query is flagged. Default: 0.8
|
|
436
|
+
- ```in_mem```: optional bool. Keep the index in memory via a Pandas dataframe (if true) or via Annoy (if False). (Note: Annoy appears to have some instability on Windows environments). Default: true
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
### 2. Moderation Methods
|
|
440
|
+
Moderation methods are aimed to catch content that can be deemed offensive, hurtful, toxic or inappropriate. They also provide support for catching content that might violate other policies such as containing words of phrases that should be banned. Moderation methods can be used at both the input and output level.
|
|
441
|
+
|
|
442
|
+
#### i. Flashtext Banlist (```moderation-flashtext```)
|
|
443
|
+
Uses the [Flashtext](https://github.com/vi3k6i5/flashtext) algorithm for fast keyword matching to block any string that contains a phrase or word that is present in a banlist. It has the following parameters
|
|
444
|
+
- ```banlist_filepaths```: optional list[str]. A list of paths to text files that contain banned phrases. If not provided, the default banlist (```vijil_core/detectors/configs/banlists/default_banlist.txt```) is used.
|
|
445
|
+
|
|
446
|
+
#### ii. Moderation Prompt Engineering (```moderation-prompt-engineering```)
|
|
447
|
+
A detector that uses custom prompt-engineering to determine if the query string contains toxicity. It has the following parameters
|
|
448
|
+
- ```hub_name``` : optional str. The hub that hosts the model you want to use. Currently supports OpenAI (```"openai"```), Together (```"together"```) and Octo (```"octo"```). Default value : ```"openai"```
|
|
449
|
+
- ```model_name``` : optional str. The model that you want to use. Default: ```"gpt-4-turbo"```. Please ensure that the model you wish to use is compatible with the hub you selected.
|
|
450
|
+
- ```api_key```: optional str. Specify the API key you want to use. By default this is not specified and the API key is pulled directly from the environment variables. The environment variables used are ```OPENAI_API_KEY```, ```OCTO_API_KEY```, and ```TOGETHER_API_KEY``` for the corresponding hubs.
|
|
451
|
+
|
|
452
|
+
#### iii. OpenAI Moderations API (```moderations-oai-api```)
|
|
453
|
+
Uses the latest text-moderation model from OpenAI to classify content for hate, harassment, self-harm, sexual content and violence. It supports the following parameters
|
|
454
|
+
- ```score_threshold_dict```: optional dict[str : float]. This dictionary sets the per-category score threshold for each of the different toxicity dimensions. Scores above the threshold will be flagged as toxic. If this is not set, a default value of 0.5 is used for each category. If the dictionary is provided, only the categories in the dictionary are considered. For example, setting this to ```{"violence" : 0.8, "self-harm" : 0.3}``` will cause the method to ignore every category except violence and self-harm, setting their thresholds to 0.8 and 0.3 respectively. For a full list of the categories available, see [here](https://platform.openai.com/docs/guides/moderation/overview).
|
|
455
|
+
|
|
456
|
+
#### iv. Perspective API (```moderation-perspective-api```)
|
|
457
|
+
Uses Google Jigsaw's [Perspective API](https://www.perspectiveapi.com/) to detect toxicity in text. It supports the following parameters
|
|
458
|
+
- ```attributes```: optional dict. We do not recommend changing this since it is required by the API. By default, the value is ```{'TOXICITY':{}}```
|
|
459
|
+
- ```score_threshold_dict```: optional dict[str: float]. Provide a score threshold for the API. Values that cross the threshold are flagged by the detector. Default: ```{"TOXICITY": 0.5}```. If you wish to change the threshold then change the dictionary accordingly (eg. ```{"TOXICITY": 0.75}``` would set the threshold to 0.75.)
|
|
460
|
+
|
|
461
|
+
#### v. DeBERTa Toxicity Model (```moderation-deberta```)
|
|
462
|
+
Uses a [fine-tuned deberta v3 model](https://huggingface.co/cooperleong00/deberta-v3-large_toxicity-scorer) to detect the presence of toxicity in text. It has the following parameters
|
|
463
|
+
- ```truncation``` : optional boolean. The truncation strategy used by the model. Default:true,
|
|
464
|
+
- ```max_length``` : optional int. Maximum sequence length that can be processed. Default:208
|
|
465
|
+
- ```device``` : Optional str. The device to run on ("cuda" or "cpu"). By default uses CUDA if available, else the CPU.
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
### 3. Privacy Methods
|
|
469
|
+
Privacy methods are aimed to detect and obfuscate the presence of private information and personally identifiable information (PII) in a string. They can be used at both the input and output levels.
|
|
470
|
+
|
|
471
|
+
#### i. Presidio (```privacy-presidio```)
|
|
472
|
+
Uses [Microsoft's Presidio Data Protection and De-Identification SDK](https://microsoft.github.io/presidio/) to detect the presence of PII in a query string. Depending on the configuration it can be used to just detect PII, or obfuscate it instead. It has the following parameters
|
|
473
|
+
- ```score_threshold```: optional float. The threshold for a string to be classified as PII. Default value : 0.5
|
|
474
|
+
- ```anonymize```: optional boolean. Determine whether or not anonymization should be enabled. **Important**: if anonymization is enabled, this method will never flag any text. Instead, it will return an anonymized version of the query string with all the PII redacted. Default value: true
|
|
475
|
+
- ```allow_list_files```: Optional List[str]. A list of filepaths that contain PII whitelists. Each file should be a text file where every line corresponds to one PII entry that should be ignored. By default, no files are specified in the allow list.
|
|
476
|
+
|
|
477
|
+
### 4. Integrity Methods
|
|
478
|
+
(Note: integrity methods are still currently a WIP and have not yet been thoroughly tested! We still need to think about how to best integrate it into Dome's workflow in a RAG setting. For thoroughnesses; sake, we still document our methods here.)
|
|
479
|
+
|
|
480
|
+
Integrity methods evaluate query strings based on some available context to check for possible hallucinations and ungrounded or incorrect conclusions. Integrity methods will typically only apply to output guards in RAG-based applications. All integrity models support ```context``` as a parameter where the context for the detector can be initialized.
|
|
481
|
+
|
|
482
|
+
#### i. HHEM (```hhem-hallucination```)
|
|
483
|
+
Uses the [HHEM Model by Vectara](https://huggingface.co/vectara/hallucination_evaluation_model) to determine if there might be possible model hallucinations. It supports the following parameters
|
|
484
|
+
- ```context```: optional str. Set the initial context
|
|
485
|
+
- ```factual_consistency_score_threshold``` : optional float. The factual consistency score threshold. **Important** - any input where the factual consistency score is **lower** than the threshold is classified as a possible hallucination. Default value: 0.5
|
|
486
|
+
|
|
487
|
+
#### ii. Hallucination Prompt Engineering (```hallucination-llm```)
|
|
488
|
+
Uses a prompt template outlined in [NeMo Guardrails](https://docs.nvidia.com/nemo/guardrails/user_guides/guardrails-library.html#hallucination-detection) to detect hallucinations given a context and hypothesis
|
|
489
|
+
- ```context```: optional str. Set the initial context
|
|
490
|
+
- ```hub_name``` : optional str. The hub that hosts the model you want to use. Currently supports OpenAI (```"openai"```), Together (```"together"```) and Octo (```"octo"```). Default value : ```"openai"```
|
|
491
|
+
- ```model_name``` : optional str. The model that you want to use. Default: ```"gpt-4-turbo"```. Please ensure that the model you wish to use is compatible with the hub you selected.
|
|
492
|
+
- ```api_key```: optional str. Specify the API key you want to use. By default this is not specified and the API key is pulled directly from the environment variables. The environment variables used are ```OPENAI_API_KEY```, ```OCTO_API_KEY```, and ```TOGETHER_API_KEY``` for the corresponding hubs.
|
|
493
|
+
|
|
494
|
+
#### iii. RoBERTa fact-Check model (```fact-check-roberta```)
|
|
495
|
+
Uses a [fine-tuned Roberta model](https://huggingface.co/Dzeniks/roberta-fact-check) to detect possible factual inconsistencies by examining the joint encoding of a context string and a query string and classifying if the context supports or refutes the claim. It supports the following parameters
|
|
496
|
+
- ```context```: optional str. Set the initial context
|
|
497
|
+
|
|
498
|
+
#### iv. Fact-Check Prompt Engineering (```fact-check-llm```)
|
|
499
|
+
Uses a prompt template outlined in [NeMo Guardrails](https://docs.nvidia.com/nemo/guardrails/user_guides/guardrails-library.html#fact-checking) to detect if a claim is grounded in some context. It supports the following parameters:
|
|
500
|
+
- ```context```: optional str. Set the initial context
|
|
501
|
+
- ```hub_name``` : optional str. The hub that hosts the model you want to use. Currently supports OpenAI (```"openai"```), Together (```"together"```) and Octo (```"octo"```). Default value : ```"openai"```
|
|
502
|
+
- ```model_name``` : optional str. The model that you want to use. Default: ```"gpt-4-turbo"```. Please ensure that the model you wish to use is compatible with the hub you selected.
|
|
503
|
+
- ```api_key```: optional str. Specify the API key you want to use. By default this is not specified and the API key is pulled directly from the environment variables. The environment variables used are ```OPENAI_API_KEY```, ```OCTO_API_KEY```, and ```TOGETHER_API_KEY``` for the corresponding hubs.
|
|
504
|
+
|