trialmark-forge 0.1.0__py3-none-any.whl
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.
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"""A Trialmark runner that tests Forge's own AI steps through Forge's evaluation API.
|
|
2
|
+
|
|
3
|
+
Each case is sent to ``POST /api/eval/run`` on a Forge deployment, which runs it
|
|
4
|
+
through the same code a Forge user reaches (the Project's masking, grounding and
|
|
5
|
+
instructions, or the app's fields, rules and guidance) on the model the
|
|
6
|
+
configuration names, as a dry run that changes nothing. Forge returns the output
|
|
7
|
+
with its cost, tokens and time, the Forge version and a fingerprint of the
|
|
8
|
+
settings it ran under, and this runner hands them to Trialmark.
|
|
9
|
+
|
|
10
|
+
Configuration::
|
|
11
|
+
|
|
12
|
+
"runners": { "forge": { "base_url": "https://www.forgeprivate.com" } },
|
|
13
|
+
"models": [
|
|
14
|
+
{ "id": "claude-sonnet-5-5", "runner": "forge",
|
|
15
|
+
"settings": { "target": { "kind": "answer", "project_id": "…" } } }
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
Runner options:
|
|
19
|
+
base_url: the Forge deployment (default https://www.forgeprivate.com).
|
|
20
|
+
token_env: an environment variable holding the evaluation token
|
|
21
|
+
(default FORGE_EVAL_TOKEN); used when it is set.
|
|
22
|
+
token_file: a file holding the token, used otherwise (default ~/.forge-eval-token).
|
|
23
|
+
timeout: seconds to wait for one case (default 300).
|
|
24
|
+
|
|
25
|
+
Model settings:
|
|
26
|
+
target: what to run: ``kind`` (answer, summarise, draft, extract, classify,
|
|
27
|
+
check) and ``project_id`` or ``tracker_id``. Required.
|
|
28
|
+
options: passed to Forge with every case, such as ``{"today": "2026-11-06"}``
|
|
29
|
+
for extraction, so a relative date means the same on every run.
|
|
30
|
+
model: the model Forge should run, when it differs from the entry's id.
|
|
31
|
+
``"default"`` runs the step on the model Forge would choose.
|
|
32
|
+
expected_input_tokens, expected_output_tokens: for the cost estimate only.
|
|
33
|
+
|
|
34
|
+
A case's input is a string or an object. A string becomes ``{"prompt": …}`` for
|
|
35
|
+
answer, summarise and draft, and ``{"text": …}`` for extract; an object is sent as
|
|
36
|
+
it is. For answer, summarise and draft the output Trialmark scores is the answer's
|
|
37
|
+
text, so text scorers such as ``judge`` and ``checklist`` work unchanged; for the
|
|
38
|
+
other kinds it is Forge's JSON output.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
from __future__ import annotations
|
|
42
|
+
|
|
43
|
+
import json
|
|
44
|
+
import os
|
|
45
|
+
import ssl
|
|
46
|
+
import threading
|
|
47
|
+
import urllib.error
|
|
48
|
+
import urllib.request
|
|
49
|
+
from pathlib import Path
|
|
50
|
+
from typing import Any
|
|
51
|
+
|
|
52
|
+
from trialmark import RunOutput
|
|
53
|
+
|
|
54
|
+
__version__ = "0.1.0"
|
|
55
|
+
|
|
56
|
+
DEFAULT_BASE_URL = "https://www.forgeprivate.com"
|
|
57
|
+
TEXT_KINDS = ("answer", "summarise", "draft")
|
|
58
|
+
KINDS = (*TEXT_KINDS, "extract", "classify", "check")
|
|
59
|
+
|
|
60
|
+
# Rough sizes for the estimate, from Forge's own runs: an answer reads about ten
|
|
61
|
+
# thousand tokens of retrieved passages; the other steps read mostly their input.
|
|
62
|
+
_EXPECTED_INPUT = {"answer": 11000, "summarise": 20000, "draft": 20000, "extract": 2000, "classify": 1500, "check": 0}
|
|
63
|
+
_EXPECTED_OUTPUT = {"answer": 400, "summarise": 800, "draft": 1200, "extract": 600, "classify": 300, "check": 0}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _tls_context() -> ssl.SSLContext:
|
|
67
|
+
"""Certificates from certifi, so HTTPS works on Pythons that ship without a
|
|
68
|
+
certificate list (python.org's macOS builds), and the system's otherwise."""
|
|
69
|
+
try:
|
|
70
|
+
import certifi
|
|
71
|
+
|
|
72
|
+
return ssl.create_default_context(cafile=certifi.where())
|
|
73
|
+
except ImportError:
|
|
74
|
+
return ssl.create_default_context()
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class ForgeError(Exception):
|
|
78
|
+
"""A refusal from Forge that should stop a run before it spends anything."""
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class ForgeRunner:
|
|
82
|
+
"""Runs each case through one of Forge's capabilities on the configured model."""
|
|
83
|
+
|
|
84
|
+
costs_money = True
|
|
85
|
+
|
|
86
|
+
def __init__(
|
|
87
|
+
self,
|
|
88
|
+
base_url: str = DEFAULT_BASE_URL,
|
|
89
|
+
token_env: str = "FORGE_EVAL_TOKEN",
|
|
90
|
+
token_file: str | None = None,
|
|
91
|
+
timeout: float = 300,
|
|
92
|
+
base_dir: Path | None = None,
|
|
93
|
+
opener: Any = None,
|
|
94
|
+
) -> None:
|
|
95
|
+
self.base_url = base_url.rstrip("/")
|
|
96
|
+
self.token_env = token_env
|
|
97
|
+
self.token_file = Path(token_file).expanduser() if token_file else Path.home() / ".forge-eval-token"
|
|
98
|
+
self.timeout = float(timeout)
|
|
99
|
+
# For tests: anything with urllib's open(request, timeout=) interface.
|
|
100
|
+
self._opener = opener or urllib.request.build_opener(urllib.request.HTTPSHandler(context=_tls_context()))
|
|
101
|
+
self._targets: dict[str, Any] | None = None
|
|
102
|
+
self._lock = threading.Lock()
|
|
103
|
+
|
|
104
|
+
# --- talking to Forge -------------------------------------------------------
|
|
105
|
+
|
|
106
|
+
def _token(self) -> str:
|
|
107
|
+
token = os.environ.get(self.token_env, "").strip()
|
|
108
|
+
if token:
|
|
109
|
+
return token
|
|
110
|
+
if self.token_file.is_file():
|
|
111
|
+
token = self.token_file.read_text(encoding="utf-8").strip()
|
|
112
|
+
if token:
|
|
113
|
+
return token
|
|
114
|
+
raise ForgeError(
|
|
115
|
+
f"No evaluation token: set {self.token_env}, or save the token in {self.token_file}."
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
def _call(self, method: str, path: str, body: Any = None) -> tuple[int, dict[str, Any]]:
|
|
119
|
+
data = json.dumps(body).encode("utf-8") if body is not None else None
|
|
120
|
+
req = urllib.request.Request(
|
|
121
|
+
self.base_url + path,
|
|
122
|
+
data=data,
|
|
123
|
+
method=method,
|
|
124
|
+
headers={
|
|
125
|
+
"Authorization": f"Bearer {self._token()}",
|
|
126
|
+
"Content-Type": "application/json",
|
|
127
|
+
"User-Agent": f"trialmark-forge/{__version__}",
|
|
128
|
+
},
|
|
129
|
+
)
|
|
130
|
+
try:
|
|
131
|
+
with self._opener.open(req, timeout=self.timeout) as res:
|
|
132
|
+
return res.status, json.loads(res.read().decode("utf-8") or "{}")
|
|
133
|
+
except urllib.error.HTTPError as e:
|
|
134
|
+
try:
|
|
135
|
+
payload = json.loads(e.read().decode("utf-8") or "{}")
|
|
136
|
+
except ValueError:
|
|
137
|
+
payload = {}
|
|
138
|
+
return e.code, payload
|
|
139
|
+
|
|
140
|
+
def targets(self) -> dict[str, Any]:
|
|
141
|
+
"""Forge's list of what this token may evaluate, fetched once per run."""
|
|
142
|
+
with self._lock:
|
|
143
|
+
if self._targets is None:
|
|
144
|
+
status, body = self._call("GET", "/api/eval/targets")
|
|
145
|
+
if status == 401:
|
|
146
|
+
raise ForgeError("Forge refused the evaluation token. Check it, and save it again if it has changed.")
|
|
147
|
+
if status == 404:
|
|
148
|
+
raise ForgeError(f"The evaluation API is not switched on at {self.base_url}.")
|
|
149
|
+
if status != 200:
|
|
150
|
+
raise ForgeError(f"Forge answered {status} when listing targets: {body.get('error', body)}")
|
|
151
|
+
self._targets = body
|
|
152
|
+
return self._targets
|
|
153
|
+
|
|
154
|
+
# --- the runner interface ---------------------------------------------------
|
|
155
|
+
|
|
156
|
+
def prepare(self) -> None:
|
|
157
|
+
# Reaches Forge and checks the token once, before any case is run.
|
|
158
|
+
self.targets()
|
|
159
|
+
|
|
160
|
+
def _target(self, model: Any) -> dict[str, Any]:
|
|
161
|
+
t = model.settings.get("target")
|
|
162
|
+
if not isinstance(t, dict) or t.get("kind") not in KINDS:
|
|
163
|
+
raise ForgeError(
|
|
164
|
+
f"Model '{model.id}' needs settings.target with a kind from {', '.join(KINDS)} "
|
|
165
|
+
"and a project_id or tracker_id."
|
|
166
|
+
)
|
|
167
|
+
target_id = t.get("project_id") if t["kind"] in TEXT_KINDS else t.get("tracker_id")
|
|
168
|
+
if not target_id:
|
|
169
|
+
raise ForgeError(f"Model '{model.id}': a {t['kind']} target needs {'project_id' if t['kind'] in TEXT_KINDS else 'tracker_id'}.")
|
|
170
|
+
listed = next((x for x in self.targets().get("targets", []) if x.get("id") == target_id), None)
|
|
171
|
+
if listed is None:
|
|
172
|
+
raise ForgeError(f"Model '{model.id}': {target_id} is not among the targets this token may evaluate.")
|
|
173
|
+
if t["kind"] not in [c.get("kind") for c in listed.get("capabilities", [])]:
|
|
174
|
+
offered = ", ".join(c.get("kind", "?") for c in listed.get("capabilities", []))
|
|
175
|
+
raise ForgeError(f"Model '{model.id}': {listed.get('name')} does not support {t['kind']} (it offers {offered}).")
|
|
176
|
+
return t
|
|
177
|
+
|
|
178
|
+
def _forge_model(self, model: Any) -> str | None:
|
|
179
|
+
chosen = model.settings.get("model", model.id)
|
|
180
|
+
return None if chosen == "default" else chosen
|
|
181
|
+
|
|
182
|
+
def _input(self, kind: str, value: Any) -> dict[str, Any]:
|
|
183
|
+
if isinstance(value, dict):
|
|
184
|
+
return value
|
|
185
|
+
if isinstance(value, str):
|
|
186
|
+
return {"prompt": value} if kind in TEXT_KINDS else {"text": value}
|
|
187
|
+
raise ForgeError(f"A {kind} case's input must be a string or an object.")
|
|
188
|
+
|
|
189
|
+
def estimate_cost(self, model: Any, case: Any) -> float | None:
|
|
190
|
+
kind = self._target(model)["kind"]
|
|
191
|
+
if kind == "check":
|
|
192
|
+
return 0.0
|
|
193
|
+
chosen = self._forge_model(model)
|
|
194
|
+
price = next((m for m in self.targets().get("models", []) if m.get("id") == chosen), None)
|
|
195
|
+
if price is None:
|
|
196
|
+
if chosen is None:
|
|
197
|
+
return None # the model Forge would choose; its price is not listed per target
|
|
198
|
+
raise ForgeError(f"Model '{model.id}': Forge cannot price {chosen}, so it will not run it.")
|
|
199
|
+
s = model.settings
|
|
200
|
+
size = len(json.dumps(case.input)) // 4
|
|
201
|
+
tokens_in = float(s.get("expected_input_tokens", _EXPECTED_INPUT[kind])) + size
|
|
202
|
+
tokens_out = float(s.get("expected_output_tokens", _EXPECTED_OUTPUT[kind]))
|
|
203
|
+
return (tokens_in * price["input_usd_per_mtok"] + tokens_out * price["output_usd_per_mtok"]) / 1_000_000
|
|
204
|
+
|
|
205
|
+
def run(self, model: Any, case: Any) -> RunOutput:
|
|
206
|
+
target = self._target(model)
|
|
207
|
+
kind = target["kind"]
|
|
208
|
+
body: dict[str, Any] = {"target": target, "input": self._input(kind, case.input)}
|
|
209
|
+
if model.settings.get("options"):
|
|
210
|
+
body["options"] = model.settings["options"]
|
|
211
|
+
chosen = self._forge_model(model)
|
|
212
|
+
if chosen and kind != "check":
|
|
213
|
+
body["model"] = chosen
|
|
214
|
+
status, r = self._call("POST", "/api/eval/run", body)
|
|
215
|
+
if status != 200:
|
|
216
|
+
return RunOutput(output=None, error=f"Forge {status}: {r.get('error', 'no message')}"[:500])
|
|
217
|
+
|
|
218
|
+
out = r.get("output")
|
|
219
|
+
if kind in TEXT_KINDS and isinstance(out, dict):
|
|
220
|
+
out = out.get("text", "")
|
|
221
|
+
error = None
|
|
222
|
+
if r.get("finish") == "length":
|
|
223
|
+
error = "The answer was cut off at Forge's output limit."
|
|
224
|
+
# The version and the fingerprint go on every result, so the record shows
|
|
225
|
+
# which Forge and which configuration each answer came from.
|
|
226
|
+
note = " ".join(
|
|
227
|
+
[f"forge {str(r.get('forge_version', '?'))[:12]}", f"settings {r.get('settings_fingerprint', '?')}"]
|
|
228
|
+
+ [str(n) for n in r.get("notes", []) if n]
|
|
229
|
+
)
|
|
230
|
+
return RunOutput(
|
|
231
|
+
output=out,
|
|
232
|
+
cost_usd=float(r.get("cost_usd") or 0.0),
|
|
233
|
+
# Forge's own time for the step, without the network between here and Forge.
|
|
234
|
+
latency_ms=int(r["latency_ms"]) if isinstance(r.get("latency_ms"), (int, float)) else None,
|
|
235
|
+
input_tokens=int(r.get("input_tokens") or 0),
|
|
236
|
+
output_tokens=int(r.get("output_tokens") or 0),
|
|
237
|
+
error=error,
|
|
238
|
+
note=note,
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
__all__ = ["ForgeRunner", "ForgeError", "__version__"]
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: trialmark-forge
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Trialmark runner that acceptance-tests Forge's AI steps (answering, summarising, drafting, extracting, classifying and checking) through Forge's evaluation API, on the models you choose.
|
|
5
|
+
Project-URL: Homepage, https://github.com/peshwar9/trialmark-forge
|
|
6
|
+
Project-URL: Trialmark, https://github.com/peshwar9/trialmark
|
|
7
|
+
Author: PE (peshwar9)
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: acceptance testing,evaluation,forge,llm,trialmark
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Classifier: Topic :: Software Development :: Testing
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Requires-Dist: certifi
|
|
18
|
+
Requires-Dist: trialmark>=0.5.1
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# trialmark-forge
|
|
24
|
+
|
|
25
|
+
A [Trialmark](https://github.com/peshwar9/trialmark) runner that acceptance-tests the AI steps of
|
|
26
|
+
[Forge](https://www.forgeprivate.com) on the models you choose.
|
|
27
|
+
|
|
28
|
+
Trialmark decides which model is good enough for a task, with a pass mark fixed before the results
|
|
29
|
+
and a record anyone can check. This package lets it test Forge's own work rather than a bare model:
|
|
30
|
+
each case runs through Forge's evaluation API, so the answer is the one a Forge user would get,
|
|
31
|
+
with the Project's instructions, masking and grounding, or the app's fields, rules and guidance,
|
|
32
|
+
applied. Nothing in Forge changes: every call is a dry run.
|
|
33
|
+
|
|
34
|
+
## What it can test
|
|
35
|
+
|
|
36
|
+
| Kind | Runs against | A case's input | The output Trialmark scores |
|
|
37
|
+
|---|---|---|---|
|
|
38
|
+
| `answer`, `summarise`, `draft` | A Project | The question or instruction, as a string | The answer's text, with its citations |
|
|
39
|
+
| `extract` | An app that reads documents | The document's text, as a string, or `{"files": [...]}` | The fields or rows, as JSON |
|
|
40
|
+
| `classify` | An app with a chart of accounts | `{"rows": [{"description": "...", "direction": "Debit"}]}` | Each row's account, as JSON |
|
|
41
|
+
| `check` | An app with checks, such as vendor onboarding | `{"kind": "vendor", "fields": {...}, "detected": [...]}` | Each check's result, as JSON; no model is called |
|
|
42
|
+
|
|
43
|
+
Options for each kind, such as `{"today": "2026-11-06"}` for extraction, go in the model's
|
|
44
|
+
settings (below).
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
pip install trialmark-forge
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Trialmark finds the runner once the package is installed; `trialmark plugins` lists it as `forge`.
|
|
53
|
+
|
|
54
|
+
## The token
|
|
55
|
+
|
|
56
|
+
The evaluation API takes a bearer token issued by the Forge deployment. The runner reads it from
|
|
57
|
+
the `FORGE_EVAL_TOKEN` environment variable when that is set, and otherwise from
|
|
58
|
+
`~/.forge-eval-token`. Keep it out of configuration files and repositories.
|
|
59
|
+
|
|
60
|
+
## A configuration
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"test_set": "testset.json",
|
|
65
|
+
"pass_mark": { "metric": "correct", "tolerance_points": 3, "floors": { "grounded": 0.95 }, "choose": "cheapest" },
|
|
66
|
+
"repeats": 3,
|
|
67
|
+
"concurrency": 4,
|
|
68
|
+
"runners": { "forge": { "base_url": "https://www.forgeprivate.com" } },
|
|
69
|
+
"models": [
|
|
70
|
+
{ "id": "claude-haiku-4-5-20251001", "runner": "forge",
|
|
71
|
+
"settings": { "target": { "kind": "answer", "project_id": "<the Project's id>" } } },
|
|
72
|
+
{ "id": "claude-sonnet-5-5", "runner": "forge",
|
|
73
|
+
"settings": { "target": { "kind": "answer", "project_id": "<the Project's id>" } } }
|
|
74
|
+
],
|
|
75
|
+
"scorers": [{ "name": "judge", "options": { "model": "claude-opus-5-5", "documents": ["docs/contract.md"] } }],
|
|
76
|
+
"output": "runs/answers.json"
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`trialmark run config.json` prints the plan and an estimate from Forge's own prices, and checks
|
|
81
|
+
that the token may evaluate each target and that Forge can price each model, before anything is
|
|
82
|
+
spent. Add `--yes` to run it.
|
|
83
|
+
|
|
84
|
+
**Runner options:** `base_url` (default `https://www.forgeprivate.com`), `token_env` (default
|
|
85
|
+
`FORGE_EVAL_TOKEN`), `token_file` (default `~/.forge-eval-token`), `timeout` in seconds (default
|
|
86
|
+
300).
|
|
87
|
+
|
|
88
|
+
**Model settings:** `target` (required: `kind`, and `project_id` or `tracker_id`); `options`,
|
|
89
|
+
sent with every case, such as `{"today": "2026-11-06"}` so that an extraction reads relative dates
|
|
90
|
+
the same way on every run; `model`, when Forge should run a different model from the entry's id,
|
|
91
|
+
or `"default"` for the model Forge would choose; `expected_input_tokens` and
|
|
92
|
+
`expected_output_tokens`, to sharpen the estimate.
|
|
93
|
+
|
|
94
|
+
## What the record holds
|
|
95
|
+
|
|
96
|
+
Each result carries Forge's cost, tokens and time for the step (measured inside Forge, without the
|
|
97
|
+
network), and a note with the Forge version and the fingerprint of the settings the step ran under
|
|
98
|
+
(an RFC 8785 hash). Two runs with the same fingerprint tested the same configuration; a changed
|
|
99
|
+
fingerprint means someone changed the Project's instructions or the app's setup in between.
|
|
100
|
+
|
|
101
|
+
A refusal from Forge, such as the daily spend cap, is recorded as that case's error, and the run
|
|
102
|
+
carries on. An answer cut off at Forge's output limit is recorded as an error too.
|
|
103
|
+
|
|
104
|
+
## Licence
|
|
105
|
+
|
|
106
|
+
Apache-2.0.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
trialmark_forge/__init__.py,sha256=ATQFxb4ZNibgI3OLXTOUeE1hruojdxc-Fk_uIu19HUk,11008
|
|
2
|
+
trialmark_forge-0.1.0.dist-info/METADATA,sha256=Z4FI0GPky0Ua2KyGaCLc5uu8MQ6TOYTGHWYjxbTDhj4,5020
|
|
3
|
+
trialmark_forge-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
4
|
+
trialmark_forge-0.1.0.dist-info/entry_points.txt,sha256=nD-ZgiOhBniGjTkRQmOGdpJqg5568OoINmIlSAorDGQ,56
|
|
5
|
+
trialmark_forge-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
6
|
+
trialmark_forge-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|