promptpolygraph 0.6.6__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.
Files changed (208) hide show
  1. promptpolygraph-0.6.6/.dockerignore +44 -0
  2. promptpolygraph-0.6.6/.env.example +30 -0
  3. promptpolygraph-0.6.6/.github/workflows/ci.yml +61 -0
  4. promptpolygraph-0.6.6/.github/workflows/publish.yml +23 -0
  5. promptpolygraph-0.6.6/.gitignore +32 -0
  6. promptpolygraph-0.6.6/CHANGELOG.md +192 -0
  7. promptpolygraph-0.6.6/Dockerfile +74 -0
  8. promptpolygraph-0.6.6/LICENSE +190 -0
  9. promptpolygraph-0.6.6/PKG-INFO +380 -0
  10. promptpolygraph-0.6.6/README.md +341 -0
  11. promptpolygraph-0.6.6/configs/schedules.yaml +23 -0
  12. promptpolygraph-0.6.6/configs/support_bot.yaml +58 -0
  13. promptpolygraph-0.6.6/deploy/README.md +129 -0
  14. promptpolygraph-0.6.6/deploy/aws/ecs-task-def.json +80 -0
  15. promptpolygraph-0.6.6/deploy/gcp/cloudrun-api.yaml +76 -0
  16. promptpolygraph-0.6.6/docker-compose.yml +79 -0
  17. promptpolygraph-0.6.6/docs/ARCHITECTURE.md +177 -0
  18. promptpolygraph-0.6.6/docs/REDTEAM_LOCAL.md +167 -0
  19. promptpolygraph-0.6.6/docs/SERVICE.md +172 -0
  20. promptpolygraph-0.6.6/examples/clinical_trials/README.md +68 -0
  21. promptpolygraph-0.6.6/examples/clinical_trials/config.yaml +65 -0
  22. promptpolygraph-0.6.6/examples/clinical_trials/corpus/data_management.json +89 -0
  23. promptpolygraph-0.6.6/examples/clinical_trials/corpus/edge_input.json +80 -0
  24. promptpolygraph-0.6.6/examples/clinical_trials/corpus/eligibility_criteria.json +101 -0
  25. promptpolygraph-0.6.6/examples/clinical_trials/corpus/endpoints_estimands.json +89 -0
  26. promptpolygraph-0.6.6/examples/clinical_trials/corpus/protocol_authoring.json +102 -0
  27. promptpolygraph-0.6.6/examples/clinical_trials/corpus/refusal_safety.json +100 -0
  28. promptpolygraph-0.6.6/examples/clinical_trials/corpus/regulatory_compliance.json +85 -0
  29. promptpolygraph-0.6.6/examples/clinical_trials/corpus/safety_reporting.json +89 -0
  30. promptpolygraph-0.6.6/examples/clinical_trials/corpus/schedule_of_assessments.json +88 -0
  31. promptpolygraph-0.6.6/examples/clinical_trials/corpus/statistical_considerations.json +88 -0
  32. promptpolygraph-0.6.6/examples/clinical_trials/personas.yaml +85 -0
  33. promptpolygraph-0.6.6/examples/clinical_trials/rubric.yaml +100 -0
  34. promptpolygraph-0.6.6/examples/everyday_assistant/README.md +75 -0
  35. promptpolygraph-0.6.6/examples/everyday_assistant/config.yaml +71 -0
  36. promptpolygraph-0.6.6/examples/everyday_assistant/corpus/edge_input.json +93 -0
  37. promptpolygraph-0.6.6/examples/everyday_assistant/corpus/factual_qa.json +93 -0
  38. promptpolygraph-0.6.6/examples/everyday_assistant/corpus/how_to.json +99 -0
  39. promptpolygraph-0.6.6/examples/everyday_assistant/corpus/reasoning.json +93 -0
  40. promptpolygraph-0.6.6/examples/everyday_assistant/corpus/recommendations.json +86 -0
  41. promptpolygraph-0.6.6/examples/everyday_assistant/corpus/refusal.json +93 -0
  42. promptpolygraph-0.6.6/examples/everyday_assistant/corpus/safety.json +83 -0
  43. promptpolygraph-0.6.6/examples/everyday_assistant/personas.yaml +57 -0
  44. promptpolygraph-0.6.6/examples/everyday_assistant/rubric.yaml +78 -0
  45. promptpolygraph-0.6.6/examples/everyday_assistant/seed_bank.json +14 -0
  46. promptpolygraph-0.6.6/examples/support_bot/config.yaml +63 -0
  47. promptpolygraph-0.6.6/examples/support_bot/corpus/accuracy.json +92 -0
  48. promptpolygraph-0.6.6/examples/support_bot/corpus/edge_input.json +94 -0
  49. promptpolygraph-0.6.6/examples/support_bot/corpus/refusal.json +89 -0
  50. promptpolygraph-0.6.6/examples/support_bot/corpus/safety.json +76 -0
  51. promptpolygraph-0.6.6/examples/support_bot/corpus/tone.json +76 -0
  52. promptpolygraph-0.6.6/examples/support_bot/personas.yaml +47 -0
  53. promptpolygraph-0.6.6/examples/support_bot/rubric.yaml +66 -0
  54. promptpolygraph-0.6.6/examples/support_bot/seed_bank.json +14 -0
  55. promptpolygraph-0.6.6/pyproject.toml +58 -0
  56. promptpolygraph-0.6.6/redteam-models.yaml +141 -0
  57. promptpolygraph-0.6.6/scripts/redteam_pull_hf.py +172 -0
  58. promptpolygraph-0.6.6/scripts/redteam_pull_ollama.sh +100 -0
  59. promptpolygraph-0.6.6/src/promptpolygraph/__init__.py +37 -0
  60. promptpolygraph-0.6.6/src/promptpolygraph/__main__.py +10 -0
  61. promptpolygraph-0.6.6/src/promptpolygraph/adapters/__init__.py +60 -0
  62. promptpolygraph-0.6.6/src/promptpolygraph/adapters/base.py +40 -0
  63. promptpolygraph-0.6.6/src/promptpolygraph/adapters/callable.py +64 -0
  64. promptpolygraph-0.6.6/src/promptpolygraph/adapters/demo.py +121 -0
  65. promptpolygraph-0.6.6/src/promptpolygraph/adapters/http.py +143 -0
  66. promptpolygraph-0.6.6/src/promptpolygraph/adapters/llm.py +198 -0
  67. promptpolygraph-0.6.6/src/promptpolygraph/analyze/__init__.py +33 -0
  68. promptpolygraph-0.6.6/src/promptpolygraph/analyze/analyzer.py +396 -0
  69. promptpolygraph-0.6.6/src/promptpolygraph/analyze/assertions.py +488 -0
  70. promptpolygraph-0.6.6/src/promptpolygraph/analyze/baseline.py +108 -0
  71. promptpolygraph-0.6.6/src/promptpolygraph/analyze/embedders.py +121 -0
  72. promptpolygraph-0.6.6/src/promptpolygraph/analyze/gate.py +289 -0
  73. promptpolygraph-0.6.6/src/promptpolygraph/analyze/rubric.py +177 -0
  74. promptpolygraph-0.6.6/src/promptpolygraph/audit/__init__.py +24 -0
  75. promptpolygraph-0.6.6/src/promptpolygraph/audit/code_context.py +296 -0
  76. promptpolygraph-0.6.6/src/promptpolygraph/audit/engine.py +109 -0
  77. promptpolygraph-0.6.6/src/promptpolygraph/audit/forensic.py +404 -0
  78. promptpolygraph-0.6.6/src/promptpolygraph/audit/persona.py +406 -0
  79. promptpolygraph-0.6.6/src/promptpolygraph/cli.py +974 -0
  80. promptpolygraph-0.6.6/src/promptpolygraph/compare/__init__.py +15 -0
  81. promptpolygraph-0.6.6/src/promptpolygraph/compare/matrix.py +401 -0
  82. promptpolygraph-0.6.6/src/promptpolygraph/compare/pairwise.py +103 -0
  83. promptpolygraph-0.6.6/src/promptpolygraph/compare/trend.py +81 -0
  84. promptpolygraph-0.6.6/src/promptpolygraph/config.py +182 -0
  85. promptpolygraph-0.6.6/src/promptpolygraph/configdesign.py +120 -0
  86. promptpolygraph-0.6.6/src/promptpolygraph/corpus/__init__.py +15 -0
  87. promptpolygraph-0.6.6/src/promptpolygraph/corpus/generator.py +467 -0
  88. promptpolygraph-0.6.6/src/promptpolygraph/corpus/loader.py +90 -0
  89. promptpolygraph-0.6.6/src/promptpolygraph/data/__init__.py +0 -0
  90. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/__init__.py +0 -0
  91. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/accessibility_user.yaml +9 -0
  92. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/budget_conscious.yaml +10 -0
  93. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/enthusiast.yaml +10 -0
  94. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/first_timer.yaml +9 -0
  95. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/frustrated_returning_customer.yaml +10 -0
  96. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/non_native_speaker.yaml +9 -0
  97. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/plain_language_needer.yaml +10 -0
  98. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/power_user.yaml +9 -0
  99. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/privacy_skeptic.yaml +10 -0
  100. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/the_journalist.yaml +10 -0
  101. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/the_skeptic.yaml +9 -0
  102. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/the_troll.yaml +10 -0
  103. promptpolygraph-0.6.6/src/promptpolygraph/data/personas/time_pressed_exec.yaml +8 -0
  104. promptpolygraph-0.6.6/src/promptpolygraph/discovery.py +83 -0
  105. promptpolygraph-0.6.6/src/promptpolygraph/elicit.py +338 -0
  106. promptpolygraph-0.6.6/src/promptpolygraph/llm.py +215 -0
  107. promptpolygraph-0.6.6/src/promptpolygraph/models.py +228 -0
  108. promptpolygraph-0.6.6/src/promptpolygraph/persona/__init__.py +20 -0
  109. promptpolygraph-0.6.6/src/promptpolygraph/persona/library.py +79 -0
  110. promptpolygraph-0.6.6/src/promptpolygraph/persona/new.py +160 -0
  111. promptpolygraph-0.6.6/src/promptpolygraph/pipeline.py +210 -0
  112. promptpolygraph-0.6.6/src/promptpolygraph/redteam/__init__.py +38 -0
  113. promptpolygraph-0.6.6/src/promptpolygraph/redteam/catalog.py +84 -0
  114. promptpolygraph-0.6.6/src/promptpolygraph/redteam/codetrace.py +180 -0
  115. promptpolygraph-0.6.6/src/promptpolygraph/redteam/converters.py +216 -0
  116. promptpolygraph-0.6.6/src/promptpolygraph/redteam/design.py +148 -0
  117. promptpolygraph-0.6.6/src/promptpolygraph/redteam/guard.py +239 -0
  118. promptpolygraph-0.6.6/src/promptpolygraph/redteam/judge.py +73 -0
  119. promptpolygraph-0.6.6/src/promptpolygraph/redteam/models.py +120 -0
  120. promptpolygraph-0.6.6/src/promptpolygraph/redteam/multiturn.py +435 -0
  121. promptpolygraph-0.6.6/src/promptpolygraph/redteam/orchestrator.py +235 -0
  122. promptpolygraph-0.6.6/src/promptpolygraph/redteam/profiles.py +143 -0
  123. promptpolygraph-0.6.6/src/promptpolygraph/redteam/report.py +394 -0
  124. promptpolygraph-0.6.6/src/promptpolygraph/redteam/rootcause.py +148 -0
  125. promptpolygraph-0.6.6/src/promptpolygraph/redteam/roster.py +231 -0
  126. promptpolygraph-0.6.6/src/promptpolygraph/redteam/scrub.py +56 -0
  127. promptpolygraph-0.6.6/src/promptpolygraph/redteam/sources/__init__.py +49 -0
  128. promptpolygraph-0.6.6/src/promptpolygraph/redteam/sources/base.py +64 -0
  129. promptpolygraph-0.6.6/src/promptpolygraph/redteam/sources/catalog_source.py +31 -0
  130. promptpolygraph-0.6.6/src/promptpolygraph/redteam/sources/dataset_source.py +343 -0
  131. promptpolygraph-0.6.6/src/promptpolygraph/redteam/sources/deepteam_source.py +428 -0
  132. promptpolygraph-0.6.6/src/promptpolygraph/redteam/sources/garak_source.py +331 -0
  133. promptpolygraph-0.6.6/src/promptpolygraph/redteam/sources/pyrit_source.py +382 -0
  134. promptpolygraph-0.6.6/src/promptpolygraph/redteam/strategies.py +143 -0
  135. promptpolygraph-0.6.6/src/promptpolygraph/report/__init__.py +104 -0
  136. promptpolygraph-0.6.6/src/promptpolygraph/report/_env.py +51 -0
  137. promptpolygraph-0.6.6/src/promptpolygraph/report/charts.py +415 -0
  138. promptpolygraph-0.6.6/src/promptpolygraph/report/context.py +580 -0
  139. promptpolygraph-0.6.6/src/promptpolygraph/report/docx.py +298 -0
  140. promptpolygraph-0.6.6/src/promptpolygraph/report/html.py +414 -0
  141. promptpolygraph-0.6.6/src/promptpolygraph/report/markdown.py +360 -0
  142. promptpolygraph-0.6.6/src/promptpolygraph/report/pdf.py +101 -0
  143. promptpolygraph-0.6.6/src/promptpolygraph/report/templates/default/report.html.j2 +349 -0
  144. promptpolygraph-0.6.6/src/promptpolygraph/report/templates/default/report.md.j2 +121 -0
  145. promptpolygraph-0.6.6/src/promptpolygraph/report/templates/minimal/report.html.j2 +34 -0
  146. promptpolygraph-0.6.6/src/promptpolygraph/report/templates/minimal/report.md.j2 +13 -0
  147. promptpolygraph-0.6.6/src/promptpolygraph/runner/__init__.py +16 -0
  148. promptpolygraph-0.6.6/src/promptpolygraph/runner/runner.py +144 -0
  149. promptpolygraph-0.6.6/src/promptpolygraph/runner/store.py +188 -0
  150. promptpolygraph-0.6.6/src/promptpolygraph/service/__init__.py +22 -0
  151. promptpolygraph-0.6.6/src/promptpolygraph/service/app.py +465 -0
  152. promptpolygraph-0.6.6/src/promptpolygraph/service/auth.py +27 -0
  153. promptpolygraph-0.6.6/src/promptpolygraph/service/dashboard.py +720 -0
  154. promptpolygraph-0.6.6/src/promptpolygraph/service/db.py +284 -0
  155. promptpolygraph-0.6.6/src/promptpolygraph/service/jobspec.py +62 -0
  156. promptpolygraph-0.6.6/src/promptpolygraph/service/scheduler.py +67 -0
  157. promptpolygraph-0.6.6/src/promptpolygraph/service/schemas.py +81 -0
  158. promptpolygraph-0.6.6/src/promptpolygraph/service/server.py +25 -0
  159. promptpolygraph-0.6.6/src/promptpolygraph/service/settings.py +60 -0
  160. promptpolygraph-0.6.6/src/promptpolygraph/service/webhooks.py +24 -0
  161. promptpolygraph-0.6.6/src/promptpolygraph/service/worker.py +108 -0
  162. promptpolygraph-0.6.6/src/promptpolygraph/tune.py +124 -0
  163. promptpolygraph-0.6.6/src/promptpolygraph/ui/__init__.py +12 -0
  164. promptpolygraph-0.6.6/src/promptpolygraph/ui/arena.py +1369 -0
  165. promptpolygraph-0.6.6/src/promptpolygraph/ui/chrome.py +634 -0
  166. promptpolygraph-0.6.6/src/promptpolygraph/ui/page.py +2635 -0
  167. promptpolygraph-0.6.6/src/promptpolygraph/ui/server.py +1738 -0
  168. promptpolygraph-0.6.6/tests/conftest.py +41 -0
  169. promptpolygraph-0.6.6/tests/test_adapters.py +63 -0
  170. promptpolygraph-0.6.6/tests/test_analyze.py +64 -0
  171. promptpolygraph-0.6.6/tests/test_arena.py +151 -0
  172. promptpolygraph-0.6.6/tests/test_audit_report.py +70 -0
  173. promptpolygraph-0.6.6/tests/test_code_context.py +36 -0
  174. promptpolygraph-0.6.6/tests/test_codetrace.py +71 -0
  175. promptpolygraph-0.6.6/tests/test_compare.py +285 -0
  176. promptpolygraph-0.6.6/tests/test_controlplane.py +188 -0
  177. promptpolygraph-0.6.6/tests/test_converters.py +223 -0
  178. promptpolygraph-0.6.6/tests/test_corpus.py +39 -0
  179. promptpolygraph-0.6.6/tests/test_dashboard.py +44 -0
  180. promptpolygraph-0.6.6/tests/test_designers.py +112 -0
  181. promptpolygraph-0.6.6/tests/test_elicit.py +77 -0
  182. promptpolygraph-0.6.6/tests/test_export.py +32 -0
  183. promptpolygraph-0.6.6/tests/test_forensic_fixes.py +133 -0
  184. promptpolygraph-0.6.6/tests/test_guard.py +219 -0
  185. promptpolygraph-0.6.6/tests/test_llm_backends.py +59 -0
  186. promptpolygraph-0.6.6/tests/test_multiturn.py +201 -0
  187. promptpolygraph-0.6.6/tests/test_packs.py +60 -0
  188. promptpolygraph-0.6.6/tests/test_providers.py +85 -0
  189. promptpolygraph-0.6.6/tests/test_redteam.py +226 -0
  190. promptpolygraph-0.6.6/tests/test_redteam_replay.py +133 -0
  191. promptpolygraph-0.6.6/tests/test_report_coverage.py +278 -0
  192. promptpolygraph-0.6.6/tests/test_report_personas.py +163 -0
  193. promptpolygraph-0.6.6/tests/test_report_templates.py +53 -0
  194. promptpolygraph-0.6.6/tests/test_rootcause.py +77 -0
  195. promptpolygraph-0.6.6/tests/test_roster.py +93 -0
  196. promptpolygraph-0.6.6/tests/test_runner.py +95 -0
  197. promptpolygraph-0.6.6/tests/test_scoring.py +365 -0
  198. promptpolygraph-0.6.6/tests/test_scrub.py +40 -0
  199. promptpolygraph-0.6.6/tests/test_service.py +171 -0
  200. promptpolygraph-0.6.6/tests/test_service_redteam.py +70 -0
  201. promptpolygraph-0.6.6/tests/test_source_dataset.py +378 -0
  202. promptpolygraph-0.6.6/tests/test_source_deepteam.py +297 -0
  203. promptpolygraph-0.6.6/tests/test_source_garak.py +214 -0
  204. promptpolygraph-0.6.6/tests/test_source_pyrit.py +224 -0
  205. promptpolygraph-0.6.6/tests/test_sqlstore.py +234 -0
  206. promptpolygraph-0.6.6/tests/test_tune.py +45 -0
  207. promptpolygraph-0.6.6/tests/test_ui_exports.py +142 -0
  208. promptpolygraph-0.6.6/tests/test_visuals.py +193 -0
@@ -0,0 +1,44 @@
1
+ # Version control
2
+ .git
3
+ .gitignore
4
+
5
+ # Virtualenvs
6
+ .venv
7
+ venv
8
+ env
9
+
10
+ # Python caches / build artifacts
11
+ __pycache__
12
+ *.py[cod]
13
+ *.egg-info
14
+ .eggs
15
+ build
16
+ dist
17
+
18
+ # Tooling caches
19
+ .pytest_cache
20
+ .mypy_cache
21
+ .ruff_cache
22
+ .coverage
23
+ htmlcov
24
+
25
+ # Runtime output / local DBs
26
+ polygraph_out
27
+ *.sqlite
28
+ *.sqlite3
29
+ *.db
30
+
31
+ # Tests (not needed in the image)
32
+ tests
33
+
34
+ # Local secrets / env
35
+ .env
36
+ *.local
37
+
38
+ # OS / editor cruft
39
+ .DS_Store
40
+ .idea
41
+ .vscode
42
+
43
+ # Deploy docs / manifests (not part of the build context payload)
44
+ deploy
@@ -0,0 +1,30 @@
1
+ # Copy to .env (gitignored) for the service. All vars are optional; these are
2
+ # the defaults / common settings. See docs/SERVICE.md for the full list.
3
+
4
+ # Storage: sqlite for local/dev, postgres in production.
5
+ # POLYGRAPH_DATABASE_URL=sqlite:///polygraph_service.sqlite
6
+ # POLYGRAPH_DATABASE_URL=postgresql+psycopg://user:password@localhost:5432/polygraph
7
+
8
+ # Comma-separated API keys. Empty = auth disabled (dev only).
9
+ # POLYGRAPH_API_KEYS=change-me-key-1,change-me-key-2
10
+
11
+ # Where report artifacts (docx/pdf) are written; share this volume across
12
+ # api + worker containers in multi-container deployments.
13
+ # POLYGRAPH_OUT_DIR=polygraph_out
14
+
15
+ # Directory of named configs the API can launch by name (config_name).
16
+ # POLYGRAPH_CONFIG_DIR=configs
17
+
18
+ # Run the worker inside the API process (true for single-container/local;
19
+ # set false in production and run dedicated `polygraph-worker` containers).
20
+ # POLYGRAPH_INPROCESS_WORKER=true
21
+
22
+ # Optional cron schedules file and a global completion webhook.
23
+ # POLYGRAPH_SCHEDULES_PATH=configs/schedules.yaml
24
+ # POLYGRAPH_WEBHOOK_URL=https://example.com/hooks/polygraph
25
+
26
+ # Force offline deterministic runs (no LLM calls) even without a key.
27
+ # POLYGRAPH_DEFAULT_MOCK=false
28
+
29
+ # Required for real (non-mock) runs that use the LLM analyzer/audit/generation.
30
+ # ANTHROPIC_API_KEY=sk-ant-...
@@ -0,0 +1,61 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["**"]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ python-version: ["3.11", "3.12"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python ${{ matrix.python-version }}
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+
23
+ - name: Install (core + service + dev)
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install -e ".[dev,service]"
27
+
28
+ - name: Run tests
29
+ run: pytest -q
30
+
31
+ - name: Offline smoke (default example, no API key)
32
+ run: |
33
+ polygraph all --config examples/everyday_assistant/config.yaml \
34
+ --out-dir /tmp/ci_out --mock --format md,html || true
35
+ test -f /tmp/ci_out/*/report.md
36
+
37
+ build:
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+ - uses: actions/setup-python@v5
42
+ with:
43
+ python-version: "3.12"
44
+ - name: Build wheel + sdist
45
+ run: |
46
+ python -m pip install --upgrade pip build
47
+ python -m build
48
+ - name: Verify persona data is packaged
49
+ run: |
50
+ python - <<'PY'
51
+ import glob, zipfile, sys
52
+ whl = sorted(glob.glob("dist/*.whl"))[-1]
53
+ names = zipfile.ZipFile(whl).namelist()
54
+ personas = [n for n in names if n.startswith("promptpolygraph/data/personas/") and n.endswith(".yaml")]
55
+ assert len(personas) >= 12, f"persona data missing from wheel: {personas}"
56
+ print(f"ok: {len(personas)} persona files packaged in {whl}")
57
+ PY
58
+ - uses: actions/upload-artifact@v4
59
+ with:
60
+ name: dist
61
+ path: dist/*
@@ -0,0 +1,23 @@
1
+ name: publish
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ pypi:
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ id-token: write
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.12"
21
+ - run: python -m pip install --upgrade build
22
+ - run: python -m build
23
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,32 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+ env/
11
+
12
+ # Tooling
13
+ .pytest_cache/
14
+ .mypy_cache/
15
+ .ruff_cache/
16
+ .coverage
17
+ htmlcov/
18
+
19
+ # Runtime output
20
+ polygraph_out/
21
+ *.sqlite
22
+ *.sqlite3
23
+ *.db
24
+
25
+ # OS / editor
26
+ .DS_Store
27
+ .idea/
28
+ .vscode/
29
+
30
+ # Local secrets / env
31
+ .env
32
+ *.local
@@ -0,0 +1,192 @@
1
+ # Changelog
2
+
3
+ All notable changes to PromptPolygraph are documented here. The format is based
4
+ on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.6.6] - 2026-06-13
10
+
11
+ ### Fixed
12
+ - Package version metadata: `pyproject.toml` now reports the project's actual
13
+ version (was stale at `0.1.0`). First release published to PyPI.
14
+
15
+ ## [0.6.5] - 2026-06-11
16
+
17
+ ### Added
18
+ - Generation progress: corpus generation streams steps (plan/batch/prompt) — a
19
+ live progress bar + prompt list in the Studio, a live counter in the CLI.
20
+ - Provider discovery + `polygraph init`: detects usable backends (API key present
21
+ / Ollama reachable) and their models; `GET /api/providers` + `GET /api/status`
22
+ drive provider/model dropdowns and a header status pill (Live vs Mock-only).
23
+ - Config builder (New run): compose a config (identity, a type-aware target
24
+ adapter, corpus + custom-category editor, analysis/audit/report, red-team,
25
+ backend), save (`POST /api/configs`) / load (`GET /api/config`) / launch.
26
+ - AI Designer: a collapsible dock that designs a run config (`POST /api/config/design`)
27
+ or a red-team config (`POST /api/redteam/design`, grounded in the technique
28
+ catalog + installed sources + profiles) and injects it; a designed red-team
29
+ roster runs as a custom profile (`POST /api/redteam/profile` → `?profile_ref=`).
30
+ - Target connection: a "Test connection" button + `POST /api/adapter/test`; a
31
+ callable adapter is configurable by `module:function` import string.
32
+ - Tooltips across the config/Studio/Arena controls.
33
+
34
+ ### Changed
35
+ - Unified the Arena and dashboard chrome (shared header/theme via `ui/chrome.py`).
36
+ - Corpus generation defaults to 8 prompts/category when count + per-category are
37
+ blank (was zero); the UI states the amount.
38
+ - The rendered-page term check reads its list from the environment rather than
39
+ hardcoding any terms in the source.
40
+
41
+ ## [0.6.0] - 2026-06-11
42
+
43
+ ### Added
44
+ - Arena drill-down: click an attacker for the per-turn timeline (probe/response/
45
+ verdict per turn) and the root cause.
46
+ - Code-grounded root-cause ladder (opt-in via `redteam.code_path`): a model pass
47
+ over a local checkout cites `file:line` rungs of the target source, colored by
48
+ stage state (broken/weak/held), with a suggested-fix diff; source windows are
49
+ re-read from disk. With no `code_path` it returns a finding summary (control,
50
+ OWASP/ATLAS, mitigation) instead of a ladder.
51
+ - Code-dive egress controls: defaults to a local model; a non-local provider is
52
+ refused when `POLYGRAPH_AIR_GAP=1` and otherwise requires `consent` in the
53
+ request. Excerpts are secret-scrubbed before send; indexing honors
54
+ `.gitignore` / `.polygraphignore` in addition to the vendor-dir skip.
55
+ - Replay: Arena runs are persisted to `out_dir/redteam/<id>/`; Live/Replay
56
+ toggle. Endpoints: `GET /api/redteam/runs`, `/api/redteam/runs/{id}`,
57
+ `/api/redteam/runs/{id}/events`; `POST /api/redteam/trace`.
58
+ - Arena lanes show technique/source, provider, and mode; scoreboard shows ASR +
59
+ an OWASP coverage grid; a findings table. OSS source quick-add chips and a
60
+ Trace-in-code `code_path` field.
61
+ - Studio (renamed from Personas, with Prompts | Personas sub-tabs): prompt-corpus
62
+ generator — `POST /api/corpus/generate` (mode/domain/difficulty/count/
63
+ per_category/categories/seed; pluggable provider+model; mock), preview, export
64
+ via `GET /api/corpus/export` (json/jsonl/csv, path-guarded), and "use in new
65
+ run" (corpus path override on `/api/run`).
66
+
67
+ ## [0.5.1] - 2026-06-11
68
+
69
+ ### Added
70
+ - **Corpus export in the dashboard** — a run's prompt corpus downloads as JSON,
71
+ JSONL, or CSV from the run detail view (the UI face of `polygraph export`),
72
+ with a `prompts_only` option. New `GET /api/runs/{id}/corpus` endpoint.
73
+ - **Persona-panel export in the studio** — saved persona panels download as YAML
74
+ from the Persona studio. New `GET /api/personas/files/download` endpoint,
75
+ bounded to the studio's saved files + bundled example panels (no arbitrary
76
+ file reads).
77
+
78
+ ## [0.5.0] - 2026-06-11
79
+
80
+ ### Added
81
+ - **Red-team engine + live Arena** — a new `polygraph redteam` command and a
82
+ realtime multi-agent Arena (attacker agents on the rails, the target in the
83
+ centre, green/red breach accretion, drill-down to the mitigation). Streams
84
+ over **SSE** in the local dashboard and **WebSocket** in the service. Runs
85
+ fully offline in mock mode (deterministic probes + verdicts + simulated
86
+ thinking stream) so the Arena demos with zero tokens.
87
+ - **Preconfigured attacker teams (profiles)** — `all_frontier` (the
88
+ out-of-the-box default; every strategy on a frontier model, each agent a
89
+ distinct persona + temperature), `multi_frontier` (mixed frontier vendors),
90
+ `mixed` (local open models + frontier), `local_swarm` (100% offline),
91
+ `pressure`, `quick`, and **`deep`** (adaptive smart multi-turn).
92
+ - **Technique catalog** — attackers seed + mutate from a catalog of known,
93
+ standards-mapped techniques (OWASP Top-10 for LLM Apps + MITRE ATLAS) rather
94
+ than improvising from a blank slate.
95
+ - **OSS-grounded attack sources** — pluggable probe sources that flow through
96
+ the same target → breach-judge loop and into the report + Arena, attributed
97
+ to their source: a built-in `catalog` source (no deps), plus optional
98
+ `garak`, `pyrit`, and `deepteam` integrations and on-demand dataset loaders
99
+ (`dataset:advbench`, `dataset:harmbench`, `dataset:jailbreakbench`). Install
100
+ with the `[redteam]` extra; each source registers only when its dependency
101
+ imports. Select with `--sources` or `redteam.sources` in config.
102
+ - **Smart multi-turn strategies** — PAIR (iterative refinement against the
103
+ target's refusal), Crescendo (gradual escalation), and TAP (tree-of-attacks
104
+ candidates) replace naive escalation when an attacker's `mode` is set.
105
+ - **Converter layer** — probe transforms (base64, rot13, leetspeak, reverse,
106
+ unicode-confusable, payload-split, roleplay-wrap, whitespace-pad) and
107
+ **many-shot** prefixing, selectable per attacker via `converter`.
108
+ - **Llama-Guard breach judge** — `--guard` scores breaches with a
109
+ Llama-Guard-style safety classifier (MLCommons S1–S14 hazard taxonomy) on a
110
+ local model, as an alternative to the LLM-reviewer judge.
111
+ - **ASR + OWASP coverage in the report** — attack-success-rate headline, an
112
+ OWASP LLM Top-10 coverage table (tested vs breached), and per-vulnerability
113
+ OWASP + MITRE ATLAS tags, across the Markdown, HTML, and JSON renderers.
114
+ - **Provenance-labelled local model roster** + Ollama/HuggingFace pull scripts
115
+ and hardware guidance (Mac Studio / NVIDIA DGX Spark / cloud / Docker) for
116
+ running attacker/judge models locally.
117
+
118
+ ## [0.4.1] - 2026-06-11
119
+
120
+ ### Added
121
+ - **Pluggable judge/audit/generation backend** — the grader, audit agents, and
122
+ corpus generation can now run against any OpenAI-compatible endpoint
123
+ (**Ollama**, vLLM, LM Studio, OpenAI), not just Anthropic. Configure via
124
+ `llm: {provider: ollama, base_url: ...}` + `model: <name>`. Local providers
125
+ need no API key, so the **whole eval can run 100% locally on open models**.
126
+ Uses httpx (a core dep) — no extra packages required for the local path.
127
+ - The `llm` *target* adapter accepts `provider: ollama` (defaults to the local
128
+ Ollama endpoint) for testing a local model as the system under test.
129
+
130
+ ### Changed
131
+ - Mock-vs-live detection is now provider-aware: a local provider (Ollama) runs
132
+ live with no key; key-providers (Anthropic/OpenAI) fall back to mock only when
133
+ the key is absent. Default behavior (Anthropic) is unchanged.
134
+
135
+ ## [0.4.0] - 2026-06-11
136
+
137
+ ### Added
138
+ - **Control-plane dashboard** — launch runs from the UI (pick a config + dials +
139
+ persona panel, watch live progress), not just browse them.
140
+ - **Persona studio** — create, generate, edit, and select persona panels in the dashboard.
141
+ - **Persona summary in reports** — the persona panel (summaries, verdicts, radar,
142
+ rubric-vs-persona divergences) now appears in the HTML, Markdown, and docx reports.
143
+ - **Case-level A/B diff + case explorer** — same-prompt responses side by side across
144
+ two runs with score deltas, and a searchable/sortable/filterable case table.
145
+
146
+ ## [0.3.0] - 2026-06-11
147
+
148
+ ### Added
149
+ - **Scoring depth** — weighted assertions, per-test thresholds, `negate`, and metric
150
+ tagging; new assertion kinds (`icontains`, `contains_any`/`contains_all`,
151
+ `starts_with`, `is_refusal`, `levenshtein`, `cost_under`, `similar` [semantic
152
+ similarity with a pluggable embedder + offline mock], `python`/`callable`
153
+ [AST-sandboxed custom code, disabled by default]); **named + derived (F1-style)
154
+ metrics**; a weighted gate mode; `cost_usd` now populated by the llm/http/demo adapters.
155
+ - **History, comparison & trend** — run lineage (corpus/rubric/config fingerprints,
156
+ SUT git sha/ref, project); comparability-gated **N-run comparison**, per-dimension
157
+ **trends with slope**, **regression detection**, and a rolling-window baseline; new
158
+ `compare --runs`, `trend`, and `regressions` CLI commands.
159
+ - **Forensic v2** — every leverage change carries a concrete **`suggested_fix`**
160
+ (file / locus / rationale / diff), grounded in real source when a checkout is provided.
161
+ - **Visuals** — dashboard score heatmap, compare matrix, per-dimension trend lines,
162
+ persona radar, and a root-cause → suggested-fix view (all inline SVG, offline);
163
+ presentation-grade HTML reports with inline-SVG charts.
164
+ - **Local dashboard** (`polygraph dashboard`), **Jinja2 report templates + branding**,
165
+ and **prompt-corpus export** (`polygraph export` → json/jsonl/csv).
166
+
167
+ ### Changed
168
+ - All additions are backward compatible; the strict gate reproduces prior verdicts exactly.
169
+
170
+ ## [0.1.1] - 2026-06-09
171
+
172
+ Initial public release.
173
+
174
+ ### Added
175
+ - Synthetic corpora (fixed / varied / adversarial / hybrid) with an LLM generator.
176
+ - Adapters: HTTP/REST, LLM chat (OpenAI-compatible / Anthropic), in-process callable, demo.
177
+ - Async runner: concurrency, retry, resume, response cache.
178
+ - Deterministic assertions + an LLM rubric scorer with a multi-judge ensemble; a
179
+ cumulative pass/fail gate and baseline diff.
180
+ - **Persona reaction panel** reconciled against the rubric, and a **forensic audit**
181
+ that reads a local source tree to cite `file:line` root causes.
182
+ - **SME golden-probe elicitation** (`polygraph elicit`) and **domain scaffolding**
183
+ (`polygraph tune`).
184
+ - Reports in markdown / docx / pdf / html; A/B compare + baselines.
185
+ - Example packs: everyday-assistant (default), support-bot, clinical-trials.
186
+ - Deployable service: FastAPI API + worker + Postgres job queue + scheduler + webhooks
187
+ + dashboard; one Docker image, AWS/GCP deploy guides; CI workflow.
188
+
189
+ [Unreleased]: https://github.com/justinkastil/promptpolygraph/compare/v0.4.0...HEAD
190
+ [0.4.0]: https://github.com/justinkastil/promptpolygraph/releases/tag/v0.4.0
191
+ [0.3.0]: https://github.com/justinkastil/promptpolygraph/releases/tag/v0.3.0
192
+ [0.1.1]: https://github.com/justinkastil/promptpolygraph/releases/tag/v0.1.1
@@ -0,0 +1,74 @@
1
+ # syntax=docker/dockerfile:1
2
+
3
+ # ---------------------------------------------------------------------------
4
+ # Build stage — install the package (with the [service] extra) into a venv.
5
+ # ---------------------------------------------------------------------------
6
+ FROM python:3.12-slim AS build
7
+
8
+ ENV PIP_NO_CACHE_DIR=1 \
9
+ PIP_DISABLE_PIP_VERSION_CHECK=1
10
+
11
+ WORKDIR /app
12
+
13
+ # Create an isolated virtualenv we can copy wholesale into the runtime stage.
14
+ RUN python -m venv /opt/venv
15
+ ENV PATH="/opt/venv/bin:$PATH"
16
+
17
+ # Copy only what the build backend needs first, to keep the layer cache warm.
18
+ COPY pyproject.toml README.md LICENSE ./
19
+ COPY src ./src
20
+
21
+ # Install the package plus the service extra (fastapi, uvicorn, sqlalchemy,
22
+ # apscheduler, pydantic-settings, psycopg[binary]).
23
+ RUN pip install ".[service]"
24
+
25
+ # ---------------------------------------------------------------------------
26
+ # Runtime stage — venv + app code, with PDF support on by default.
27
+ # ---------------------------------------------------------------------------
28
+ FROM python:3.12-slim AS runtime
29
+
30
+ # PDF export (docx -> pdf) needs LibreOffice's `soffice` on PATH. It is
31
+ # included by default so reports render out of the box. Build a slim image
32
+ # without it via: docker build --build-arg INCLUDE_PDF=false .
33
+ # (html / md / docx all work regardless.)
34
+ ARG INCLUDE_PDF=true
35
+
36
+ ENV PATH="/opt/venv/bin:$PATH" \
37
+ HOME=/home/appuser \
38
+ PYTHONUNBUFFERED=1 \
39
+ PYTHONDONTWRITEBYTECODE=1 \
40
+ POLYGRAPH_HOST=0.0.0.0 \
41
+ POLYGRAPH_PORT=8080 \
42
+ POLYGRAPH_OUT_DIR=/data/out \
43
+ POLYGRAPH_CONFIG_DIR=/app/configs
44
+
45
+ # curl powers the HEALTHCHECK; libreoffice-writer (+ a base font) powers PDF.
46
+ RUN apt-get update \
47
+ && apt-get install -y --no-install-recommends curl \
48
+ && if [ "$INCLUDE_PDF" = "true" ]; then \
49
+ apt-get install -y --no-install-recommends libreoffice-writer fonts-dejavu-core; \
50
+ fi \
51
+ && rm -rf /var/lib/apt/lists/*
52
+
53
+ # Non-root runtime user.
54
+ RUN useradd --create-home --uid 10001 appuser
55
+
56
+ WORKDIR /app
57
+
58
+ # Bring over the prebuilt virtualenv and the application files.
59
+ COPY --from=build /opt/venv /opt/venv
60
+ COPY examples ./examples
61
+ COPY configs ./configs
62
+
63
+ # Shared artifact directory (mounted as a volume in compose / cloud).
64
+ RUN mkdir -p /data/out && chown -R appuser:appuser /app /data /home/appuser
65
+
66
+ USER appuser
67
+
68
+ EXPOSE 8080
69
+
70
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
71
+ CMD curl -fsS "http://localhost:${POLYGRAPH_PORT}/healthz" || exit 1
72
+
73
+ # Default role is the API server. Override with `polygraph-worker` for workers.
74
+ CMD ["polygraph-server"]
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works.
111
+
112
+ You may add Your own copyright statement to Your modifications and
113
+ may provide additional or different license terms and conditions
114
+ for use, reproduction, or distribution of Your modifications, or
115
+ for any such Derivative Works as a whole, provided Your use,
116
+ reproduction, and distribution of the Work otherwise complies with
117
+ the conditions stated in this License.
118
+
119
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
120
+ any Contribution intentionally submitted for inclusion in the Work
121
+ by You to the Licensor shall be under the terms and conditions of
122
+ this License, without any additional terms or conditions.
123
+ Notwithstanding the above, nothing herein shall supersede or modify
124
+ the terms of any separate license agreement you may have executed
125
+ with Licensor regarding such Contributions.
126
+
127
+ 6. Trademarks. This License does not grant permission to use the trade
128
+ names, trademarks, service marks, or product names of the Licensor,
129
+ except as required for reasonable and customary use in describing the
130
+ origin of the Work and reproducing the content of the NOTICE file.
131
+
132
+ 7. Disclaimer of Warranty. Unless required by applicable law or
133
+ agreed to in writing, Licensor provides the Work (and each
134
+ Contributor provides its Contributions) on an "AS IS" BASIS,
135
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
136
+ implied, including, without limitation, any warranties or conditions
137
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
138
+ PARTICULAR PURPOSE. You are solely responsible for determining the
139
+ appropriateness of using or redistributing the Work and assume any
140
+ risks associated with Your exercise of permissions under this License.
141
+
142
+ 8. Limitation of Liability. In no event and under no legal theory,
143
+ whether in tort (including negligence), contract, or otherwise,
144
+ unless required by applicable law (such as deliberate and grossly
145
+ negligent acts) or agreed to in writing, shall any Contributor be
146
+ liable to You for damages, including any direct, indirect, special,
147
+ incidental, or consequential damages of any character arising as a
148
+ result of this License or out of the use or inability to use the
149
+ Work (including but not limited to damages for loss of goodwill,
150
+ work stoppage, computer failure or malfunction, or any and all
151
+ other commercial damages or losses), even if such Contributor
152
+ has been advised of the possibility of such damages.
153
+
154
+ 9. Accepting Warranty or Additional Liability. While redistributing
155
+ the Work or Derivative Works thereof, You may choose to offer,
156
+ and charge a fee for, acceptance of support, warranty, indemnity,
157
+ or other liability obligations and/or rights consistent with this
158
+ License. However, in accepting such obligations, You may act only
159
+ on Your own behalf and on Your sole responsibility, not on behalf
160
+ of any other Contributor, and only if You agree to indemnify,
161
+ defend, and hold each Contributor harmless for any liability
162
+ incurred by, or claims asserted against, such Contributor by reason
163
+ of your accepting any such warranty or additional liability.
164
+
165
+ END OF TERMS AND CONDITIONS
166
+
167
+ APPENDIX: How to apply the Apache License to your work.
168
+
169
+ To apply the Apache License to your work, attach the following
170
+ boilerplate notice, with the fields enclosed by brackets "[]"
171
+ replaced with your own identifying information. (Don't include
172
+ the brackets!) The text should be enclosed in the appropriate
173
+ comment syntax for the file format. We also recommend that a
174
+ file or class name and description of purpose be included on the
175
+ same "printed page" as the copyright notice for easier
176
+ identification within third-party archives.
177
+
178
+ Copyright [yyyy] [name of copyright owner]
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.