tierwise 0.8.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.
- tierwise-0.8.0/.dockerignore +13 -0
- tierwise-0.8.0/.env.example +31 -0
- tierwise-0.8.0/.github/workflows/ci.yml +54 -0
- tierwise-0.8.0/.github/workflows/claude-code-review.yml +45 -0
- tierwise-0.8.0/.github/workflows/claude.yml +50 -0
- tierwise-0.8.0/.github/workflows/release.yml +44 -0
- tierwise-0.8.0/.gitignore +14 -0
- tierwise-0.8.0/BENCHMARK.md +87 -0
- tierwise-0.8.0/CHANGELOG.md +20 -0
- tierwise-0.8.0/Dockerfile +24 -0
- tierwise-0.8.0/LICENSE +202 -0
- tierwise-0.8.0/PKG-INFO +408 -0
- tierwise-0.8.0/README.md +371 -0
- tierwise-0.8.0/config/registry.yaml +172 -0
- tierwise-0.8.0/deploy/docker-compose.yml +81 -0
- tierwise-0.8.0/deploy/grafana/dashboards/tierwise.json +347 -0
- tierwise-0.8.0/deploy/grafana/provisioning/dashboards/tierwise.yml +8 -0
- tierwise-0.8.0/deploy/grafana/provisioning/datasources/prometheus.yml +9 -0
- tierwise-0.8.0/deploy/prometheus.yml +7 -0
- tierwise-0.8.0/deploy/registry.compose.yaml +36 -0
- tierwise-0.8.0/docs/HANDOFF.md +148 -0
- tierwise-0.8.0/docs/benchmark/dashboard.jpg +0 -0
- tierwise-0.8.0/docs/benchmark/heldout.json +3288 -0
- tierwise-0.8.0/docs/benchmark/heldout_pareto.png +0 -0
- tierwise-0.8.0/docs/benchmark/sprout.json +3288 -0
- tierwise-0.8.0/docs/benchmark/sprout_pareto.png +0 -0
- tierwise-0.8.0/docs/superpowers/plans/2026-11-01-tierwise-m0-m1.md +256 -0
- tierwise-0.8.0/docs/superpowers/plans/2026-11-01-tierwise-m2.md +339 -0
- tierwise-0.8.0/docs/superpowers/plans/2026-11-01-tierwise-m3-5.md +269 -0
- tierwise-0.8.0/docs/superpowers/plans/2026-11-01-tierwise-m3.md +290 -0
- tierwise-0.8.0/docs/superpowers/plans/2026-11-01-tierwise-m4.md +283 -0
- tierwise-0.8.0/docs/superpowers/plans/2026-11-01-tierwise-m5.md +216 -0
- tierwise-0.8.0/docs/superpowers/plans/2026-11-01-tierwise-m6.md +250 -0
- tierwise-0.8.0/docs/superpowers/plans/2026-11-01-tierwise-m7a.md +236 -0
- tierwise-0.8.0/docs/superpowers/plans/2026-11-01-tierwise-m7b.md +205 -0
- tierwise-0.8.0/docs/superpowers/plans/2026-11-01-tierwise-m8.md +145 -0
- tierwise-0.8.0/docs/superpowers/specs/2026-11-01-tierwise-design.md +276 -0
- tierwise-0.8.0/evaluation/__init__.py +0 -0
- tierwise-0.8.0/evaluation/datasets.py +112 -0
- tierwise-0.8.0/evaluation/metrics.py +111 -0
- tierwise-0.8.0/evaluation/run_eval.py +181 -0
- tierwise-0.8.0/evaluation/scorers.py +51 -0
- tierwise-0.8.0/models/router/NOTICE +2 -0
- tierwise-0.8.0/models/router/classifier.npz +0 -0
- tierwise-0.8.0/models/router/metrics.json +22 -0
- tierwise-0.8.0/models/router/router.json +6 -0
- tierwise-0.8.0/models/router/tokenizer.json +1 -0
- tierwise-0.8.0/pyproject.toml +100 -0
- tierwise-0.8.0/scripts/bench_router.py +48 -0
- tierwise-0.8.0/scripts/compose_smoke.py +120 -0
- tierwise-0.8.0/scripts/costs.py +59 -0
- tierwise-0.8.0/scripts/demo.py +45 -0
- tierwise-0.8.0/scripts/fake_upstream.py +64 -0
- tierwise-0.8.0/scripts/smoke.py +112 -0
- tierwise-0.8.0/scripts/wheel_smoke.py +33 -0
- tierwise-0.8.0/src/tierwise/__init__.py +3 -0
- tierwise-0.8.0/src/tierwise/__main__.py +101 -0
- tierwise-0.8.0/src/tierwise/affinity.py +137 -0
- tierwise-0.8.0/src/tierwise/api/__init__.py +0 -0
- tierwise-0.8.0/src/tierwise/api/app.py +127 -0
- tierwise-0.8.0/src/tierwise/api/auth.py +22 -0
- tierwise-0.8.0/src/tierwise/api/errors.py +84 -0
- tierwise-0.8.0/src/tierwise/api/routes.py +481 -0
- tierwise-0.8.0/src/tierwise/api/streaming.py +205 -0
- tierwise-0.8.0/src/tierwise/budgets.py +130 -0
- tierwise-0.8.0/src/tierwise/cache.py +135 -0
- tierwise-0.8.0/src/tierwise/config.py +85 -0
- tierwise-0.8.0/src/tierwise/costs.py +28 -0
- tierwise-0.8.0/src/tierwise/fetch.py +69 -0
- tierwise-0.8.0/src/tierwise/keys.py +51 -0
- tierwise-0.8.0/src/tierwise/metrics.py +88 -0
- tierwise-0.8.0/src/tierwise/options.py +69 -0
- tierwise-0.8.0/src/tierwise/providers/__init__.py +0 -0
- tierwise-0.8.0/src/tierwise/providers/anthropic.py +297 -0
- tierwise-0.8.0/src/tierwise/providers/base.py +126 -0
- tierwise-0.8.0/src/tierwise/providers/gemini.py +263 -0
- tierwise-0.8.0/src/tierwise/providers/ollama.py +16 -0
- tierwise-0.8.0/src/tierwise/providers/openai.py +143 -0
- tierwise-0.8.0/src/tierwise/registry.py +104 -0
- tierwise-0.8.0/src/tierwise/reliability/__init__.py +0 -0
- tierwise-0.8.0/src/tierwise/reliability/breaker.py +151 -0
- tierwise-0.8.0/src/tierwise/reliability/failover.py +100 -0
- tierwise-0.8.0/src/tierwise/reliability/retry.py +34 -0
- tierwise-0.8.0/src/tierwise/router/__init__.py +16 -0
- tierwise-0.8.0/src/tierwise/router/classifier.py +67 -0
- tierwise-0.8.0/src/tierwise/router/encoder.py +126 -0
- tierwise-0.8.0/src/tierwise/router/features.py +80 -0
- tierwise-0.8.0/src/tierwise/router/learned.py +152 -0
- tierwise-0.8.0/src/tierwise/router/modes.py +96 -0
- tierwise-0.8.0/src/tierwise/router/router.py +73 -0
- tierwise-0.8.0/src/tierwise/router/rules.py +66 -0
- tierwise-0.8.0/src/tierwise/schema.py +178 -0
- tierwise-0.8.0/src/tierwise/selector.py +161 -0
- tierwise-0.8.0/src/tierwise/store.py +353 -0
- tierwise-0.8.0/src/tierwise/telemetry.py +48 -0
- tierwise-0.8.0/src/tierwise/tokens.py +33 -0
- tierwise-0.8.0/tests/__init__.py +0 -0
- tierwise-0.8.0/tests/api/__init__.py +0 -0
- tierwise-0.8.0/tests/api/helpers.py +144 -0
- tierwise-0.8.0/tests/api/test_auth_route.py +70 -0
- tierwise-0.8.0/tests/api/test_cache_route.py +100 -0
- tierwise-0.8.0/tests/api/test_chat_route.py +161 -0
- tierwise-0.8.0/tests/api/test_failover_route.py +60 -0
- tierwise-0.8.0/tests/api/test_fault_injection.py +130 -0
- tierwise-0.8.0/tests/api/test_limits_route.py +187 -0
- tierwise-0.8.0/tests/api/test_load.py +37 -0
- tierwise-0.8.0/tests/api/test_metrics_route.py +76 -0
- tierwise-0.8.0/tests/api/test_models_route.py +15 -0
- tierwise-0.8.0/tests/api/test_routing_route.py +376 -0
- tierwise-0.8.0/tests/api/test_stream_hold.py +154 -0
- tierwise-0.8.0/tests/api/test_streaming_route.py +210 -0
- tierwise-0.8.0/tests/evaluation/__init__.py +0 -0
- tierwise-0.8.0/tests/evaluation/test_critical_gate.py +53 -0
- tierwise-0.8.0/tests/evaluation/test_datasets.py +81 -0
- tierwise-0.8.0/tests/evaluation/test_metrics.py +93 -0
- tierwise-0.8.0/tests/evaluation/test_run_eval.py +57 -0
- tierwise-0.8.0/tests/evaluation/test_scorers.py +31 -0
- tierwise-0.8.0/tests/providers/__init__.py +0 -0
- tierwise-0.8.0/tests/providers/test_anthropic.py +340 -0
- tierwise-0.8.0/tests/providers/test_base.py +181 -0
- tierwise-0.8.0/tests/providers/test_gemini.py +240 -0
- tierwise-0.8.0/tests/providers/test_ollama.py +53 -0
- tierwise-0.8.0/tests/providers/test_openai.py +214 -0
- tierwise-0.8.0/tests/reliability/__init__.py +0 -0
- tierwise-0.8.0/tests/reliability/test_breaker.py +138 -0
- tierwise-0.8.0/tests/reliability/test_failover.py +135 -0
- tierwise-0.8.0/tests/reliability/test_retry.py +59 -0
- tierwise-0.8.0/tests/router/__init__.py +0 -0
- tierwise-0.8.0/tests/router/labeled_prompts.jsonl +30 -0
- tierwise-0.8.0/tests/router/test_classifier.py +61 -0
- tierwise-0.8.0/tests/router/test_encoder_inputs.py +103 -0
- tierwise-0.8.0/tests/router/test_encoder_onnx.py +91 -0
- tierwise-0.8.0/tests/router/test_learned.py +132 -0
- tierwise-0.8.0/tests/router/test_modes.py +116 -0
- tierwise-0.8.0/tests/router/test_router.py +209 -0
- tierwise-0.8.0/tests/router/test_rules.py +121 -0
- tierwise-0.8.0/tests/test_affinity.py +133 -0
- tierwise-0.8.0/tests/test_budgets.py +149 -0
- tierwise-0.8.0/tests/test_cache.py +161 -0
- tierwise-0.8.0/tests/test_cli.py +80 -0
- tierwise-0.8.0/tests/test_config.py +42 -0
- tierwise-0.8.0/tests/test_costs.py +44 -0
- tierwise-0.8.0/tests/test_deploy_files.py +138 -0
- tierwise-0.8.0/tests/test_fetch.py +63 -0
- tierwise-0.8.0/tests/test_keys.py +43 -0
- tierwise-0.8.0/tests/test_metrics.py +96 -0
- tierwise-0.8.0/tests/test_options.py +75 -0
- tierwise-0.8.0/tests/test_registry.py +131 -0
- tierwise-0.8.0/tests/test_schema.py +139 -0
- tierwise-0.8.0/tests/test_selector.py +418 -0
- tierwise-0.8.0/tests/test_smoke.py +5 -0
- tierwise-0.8.0/tests/test_store.py +304 -0
- tierwise-0.8.0/tests/test_telemetry.py +100 -0
- tierwise-0.8.0/tests/training/__init__.py +0 -0
- tierwise-0.8.0/tests/training/test_prepare.py +75 -0
- tierwise-0.8.0/training/__init__.py +0 -0
- tierwise-0.8.0/training/export_onnx.py +55 -0
- tierwise-0.8.0/training/prepare_data.py +94 -0
- tierwise-0.8.0/training/train.py +118 -0
- tierwise-0.8.0/uv.lock +3411 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Copy to .env and fill in the providers you want to use. Leave a key empty to disable that provider.
|
|
2
|
+
ANTHROPIC_API_KEY=
|
|
3
|
+
OPENAI_API_KEY=
|
|
4
|
+
GEMINI_API_KEY=
|
|
5
|
+
# Any OpenAI-compatible host works here (Groq, Together, DeepSeek, ...)
|
|
6
|
+
OPENAI_BASE_URL=https://api.openai.com/v1
|
|
7
|
+
# Local models: run `ollama serve`, then set this (leave unset to disable Ollama)
|
|
8
|
+
# OLLAMA_BASE_URL=http://localhost:11434/v1
|
|
9
|
+
|
|
10
|
+
# Model list with prices and capabilities, and where requests are logged
|
|
11
|
+
TIERWISE_REGISTRY=config/registry.yaml
|
|
12
|
+
TIERWISE_DB_URL=sqlite+aiosqlite:///tierwise.db
|
|
13
|
+
|
|
14
|
+
# Reliability (defaults shown)
|
|
15
|
+
# RETRIES=2
|
|
16
|
+
# BREAKER_FAILURES=5
|
|
17
|
+
# BREAKER_WINDOW_S=60
|
|
18
|
+
# BREAKER_COOLDOWN_S=30
|
|
19
|
+
# STREAM_HOLD_S=3.0
|
|
20
|
+
# STREAM_HOLD_BYTES=4096
|
|
21
|
+
|
|
22
|
+
# Semantic cache (needs models/router/model.onnx)
|
|
23
|
+
# TIERWISE_CACHE=false (opt-in: see the README's limits)
|
|
24
|
+
# CACHE_SIMILARITY=0.95
|
|
25
|
+
# CACHE_TTL_S=3600
|
|
26
|
+
# CACHE_MAX_ENTRIES=10000
|
|
27
|
+
# CACHE_MAX_TEMPERATURE=0.3
|
|
28
|
+
|
|
29
|
+
# Gateway API keys (create with `tierwise keys create`)
|
|
30
|
+
# TIERWISE_REQUIRE_KEY=false
|
|
31
|
+
# KEYS_REFRESH_S=30
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
check:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
services:
|
|
11
|
+
postgres: # the store tests also run against Postgres (TIERWISE_TEST_PG_URL)
|
|
12
|
+
image: postgres:16
|
|
13
|
+
env:
|
|
14
|
+
POSTGRES_USER: tierwise
|
|
15
|
+
POSTGRES_PASSWORD: tierwise
|
|
16
|
+
POSTGRES_DB: tierwise
|
|
17
|
+
ports:
|
|
18
|
+
- 5432:5432
|
|
19
|
+
options: >-
|
|
20
|
+
--health-cmd "pg_isready -h 127.0.0.1 -U tierwise -d tierwise"
|
|
21
|
+
--health-interval 5s
|
|
22
|
+
--health-timeout 5s
|
|
23
|
+
--health-retries 10
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: astral-sh/setup-uv@v6
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.12"
|
|
29
|
+
- run: uv sync
|
|
30
|
+
- run: uv run ruff check .
|
|
31
|
+
- run: uv run mypy src
|
|
32
|
+
- run: uv run pytest -q
|
|
33
|
+
env:
|
|
34
|
+
TIERWISE_TEST_PG_URL: postgresql+asyncpg://tierwise:tierwise@localhost:5432/tierwise
|
|
35
|
+
- name: wheel installs and serves without the repo # the M8 exit check
|
|
36
|
+
run: |
|
|
37
|
+
uv build
|
|
38
|
+
uv venv "$RUNNER_TEMP/wheel"
|
|
39
|
+
uv pip install --python "$RUNNER_TEMP/wheel" dist/*.whl
|
|
40
|
+
mkdir "$RUNNER_TEMP/empty" && cd "$RUNNER_TEMP/empty"
|
|
41
|
+
"$RUNNER_TEMP/wheel/bin/tierwise" --help
|
|
42
|
+
"$RUNNER_TEMP/wheel/bin/python" "$GITHUB_WORKSPACE/scripts/wheel_smoke.py"
|
|
43
|
+
|
|
44
|
+
compose-smoke: # the M7 exit check: the whole stack up, traffic through it, dashboard live
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v4
|
|
48
|
+
- uses: astral-sh/setup-uv@v6
|
|
49
|
+
with:
|
|
50
|
+
python-version: "3.12"
|
|
51
|
+
- run: docker compose -f deploy/docker-compose.yml up -d --build
|
|
52
|
+
- run: uv run python scripts/compose_smoke.py
|
|
53
|
+
- if: always()
|
|
54
|
+
run: docker compose -f deploy/docker-compose.yml down -v
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Claude Code Review
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, ready_for_review, reopened]
|
|
6
|
+
# Optional: Only run on specific file changes
|
|
7
|
+
# paths:
|
|
8
|
+
# - "src/**/*.ts"
|
|
9
|
+
# - "src/**/*.tsx"
|
|
10
|
+
# - "src/**/*.js"
|
|
11
|
+
# - "src/**/*.jsx"
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
claude-review:
|
|
15
|
+
# Optional: Filter by PR author
|
|
16
|
+
# if: |
|
|
17
|
+
# github.event.pull_request.user.login == 'external-contributor' ||
|
|
18
|
+
# github.event.pull_request.user.login == 'new-developer' ||
|
|
19
|
+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
|
|
20
|
+
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
permissions:
|
|
23
|
+
contents: read
|
|
24
|
+
pull-requests: read
|
|
25
|
+
issues: read
|
|
26
|
+
id-token: write
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- name: Checkout repository
|
|
30
|
+
uses: actions/checkout@v4
|
|
31
|
+
with:
|
|
32
|
+
fetch-depth: 1
|
|
33
|
+
|
|
34
|
+
- name: Run Claude Code Review
|
|
35
|
+
id: claude-review
|
|
36
|
+
uses: anthropics/claude-code-action@v1
|
|
37
|
+
with:
|
|
38
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
39
|
+
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
|
|
40
|
+
plugins: 'code-review@claude-code-plugins'
|
|
41
|
+
prompt: '/code-review:code-review --comment ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
|
|
42
|
+
claude_args: '--allowedTools "mcp__github_inline_comment__create_inline_comment"'
|
|
43
|
+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
|
44
|
+
# or https://code.claude.com/docs/en/cli-reference for available options
|
|
45
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Claude Code
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created]
|
|
6
|
+
pull_request_review_comment:
|
|
7
|
+
types: [created]
|
|
8
|
+
issues:
|
|
9
|
+
types: [opened, assigned]
|
|
10
|
+
pull_request_review:
|
|
11
|
+
types: [submitted]
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
claude:
|
|
15
|
+
if: |
|
|
16
|
+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
17
|
+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
|
18
|
+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
|
19
|
+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
pull-requests: read
|
|
24
|
+
issues: read
|
|
25
|
+
id-token: write
|
|
26
|
+
actions: read # Required for Claude to read CI results on PRs
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout repository
|
|
29
|
+
uses: actions/checkout@v4
|
|
30
|
+
with:
|
|
31
|
+
fetch-depth: 1
|
|
32
|
+
|
|
33
|
+
- name: Run Claude Code
|
|
34
|
+
id: claude
|
|
35
|
+
uses: anthropics/claude-code-action@v1
|
|
36
|
+
with:
|
|
37
|
+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
|
38
|
+
|
|
39
|
+
# This is an optional setting that allows Claude to read CI results on PRs
|
|
40
|
+
additional_permissions: |
|
|
41
|
+
actions: read
|
|
42
|
+
|
|
43
|
+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
|
|
44
|
+
# prompt: 'Update the pull request description to include a summary of changes.'
|
|
45
|
+
|
|
46
|
+
# Optional: Add claude_args to customize behavior and configuration
|
|
47
|
+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
|
48
|
+
# or https://code.claude.com/docs/en/cli-reference for available options
|
|
49
|
+
# claude_args: '--allowed-tools Bash(gh pr *)'
|
|
50
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: astral-sh/setup-uv@v6
|
|
13
|
+
with:
|
|
14
|
+
python-version: "3.12"
|
|
15
|
+
- name: tag matches the package version
|
|
16
|
+
run: |
|
|
17
|
+
version=$(uv version --short)
|
|
18
|
+
test "$GITHUB_REF_NAME" = "v$version" || { echo "tag $GITHUB_REF_NAME != v$version"; exit 1; }
|
|
19
|
+
- run: uv sync
|
|
20
|
+
- run: uv run pytest -q # a PyPI version can't be re-uploaded: never publish untested
|
|
21
|
+
- run: uv build
|
|
22
|
+
- name: wheel installs and serves without the repo
|
|
23
|
+
run: |
|
|
24
|
+
uv venv "$RUNNER_TEMP/wheel"
|
|
25
|
+
uv pip install --python "$RUNNER_TEMP/wheel" dist/*.whl
|
|
26
|
+
mkdir "$RUNNER_TEMP/empty" && cd "$RUNNER_TEMP/empty"
|
|
27
|
+
"$RUNNER_TEMP/wheel/bin/python" "$GITHUB_WORKSPACE/scripts/wheel_smoke.py"
|
|
28
|
+
- uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: dist
|
|
31
|
+
path: dist/
|
|
32
|
+
|
|
33
|
+
publish: # PyPI Trusted Publishing: no token is stored anywhere
|
|
34
|
+
needs: build
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
environment: pypi
|
|
37
|
+
permissions:
|
|
38
|
+
id-token: write
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/download-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
name: dist
|
|
43
|
+
path: dist/
|
|
44
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# tierwise routing benchmark
|
|
2
|
+
|
|
3
|
+
**Headline:** on 3,943 held-out prompts, tierwise's deployed router keeps **95% of GPT-4's quality at 44% of its cost (56.0% saved)**. Random routing saves 36.6% at the same quality. The learned classifier on its own saves 60.0%; the deployed router gives up 4 points of that so that rules can still push hard prompts upward.
|
|
4
|
+
|
|
5
|
+
Every number here comes from precomputed answers, so reproducing it costs nothing in API calls.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
Each prompt has an answer from a **cheap** and a **strong** model, with a known quality and cost for each. Every router gives each prompt a score, and a prompt goes to the strong model when its score is at or above a threshold *t*. Sweeping *t* from "everything cheap" to "everything strong" traces the router's cost/quality curve.
|
|
10
|
+
|
|
11
|
+
| | Held-out (headline) | SPROUT (out-of-distribution) |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| **Data** | Test split of [`routellm/gpt4_dataset`](https://huggingface.co/datasets/routellm/gpt4_dataset) (Apache-2.0). Split by prompt hash, never trained on. | Test split of [`CARROT-LLM-Routing/SPROUT`](https://huggingface.co/datasets/CARROT-LLM-Routing/SPROUT). **No license is stated**; it is downloaded at eval time, nothing from it is committed, and only aggregates are reported. |
|
|
14
|
+
| **Prompts** | 3,943 | 6,637 (0 dropped) |
|
|
15
|
+
| **Cheap / strong** | Mixtral-8x7B / GPT-4 (`gpt-4-1106-preview`) | gpt-4o-mini / gpt-4o (`2024-08-06`) |
|
|
16
|
+
| **Quality** | Cheap: GPT-4 judge's grade of Mixtral's answer, (score − 1) / 4. Strong: 1.0. **Assumption:** the judge graded only Mixtral, so GPT-4's own answer is the reference. | The dataset's per-model `score` in [0, 1], from an LLM judge, for both models. |
|
|
17
|
+
| **Cost** | Prompt and answer length ÷ 4 chars per token × list price | The dataset's token counts × list price |
|
|
18
|
+
| **Prices** (USD / 1M tokens, in / out) | GPT-4 10 / 30 (OpenAI); Mixtral 0.60 / 0.60 (Together AI) | gpt-4o 2.50 / 10; gpt-4o-mini 0.15 / 0.60 (OpenAI) |
|
|
19
|
+
|
|
20
|
+
**The routers:**
|
|
21
|
+
- **random:** a uniform random score, seed 0.
|
|
22
|
+
- **rules:** the M3 rules scorer.
|
|
23
|
+
- **learned:** the M4 classifier's raw P(strong model needed).
|
|
24
|
+
- **hybrid:** what the gateway actually runs: `route()` with rules first, the learned router when rules are unsure, and difficulty = max(rules, learned).
|
|
25
|
+
|
|
26
|
+
**Metrics:**
|
|
27
|
+
- **Cost saved at X%:** the share of the all-strong cost saved at the cheapest point that reaches X% of all-strong quality. It is interpolated between neighbouring thresholds, which in practice means randomly mixing two thresholds. *Single threshold* is the conservative version: one fixed threshold.
|
|
28
|
+
- **Misroutes:** prompts the cheap model failed (quality < 0.5) while the strong one didn't, that were still routed cheap at the single-threshold 95% point.
|
|
29
|
+
- **AUC:** the area under quality-fraction over cost-fraction.
|
|
30
|
+
|
|
31
|
+
## Results
|
|
32
|
+
|
|
33
|
+
### Held-out: Mixtral-8x7B vs GPT-4
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
| Router | Saved @ 95% | @ 98% | @ 99% | Single threshold @ 95% | Misroutes @ 95% | AUC |
|
|
38
|
+
|---|---|---|---|---|---|---|
|
|
39
|
+
| random | 36.6% | 14.9% | 7.0% | 36.6% | 110 | 0.905 |
|
|
40
|
+
| rules | 38.9% | 10.1% | 5.1% | 38.3% | 98 | 0.905 |
|
|
41
|
+
| learned | **60.0%** | **28.3%** | **18.0%** | 60.0% | 68 | 0.930 |
|
|
42
|
+
| **hybrid (deployed)** | **56.0%** | 20.2% | 9.4% | 55.9% | 73 | 0.920 |
|
|
43
|
+
|
|
44
|
+
All-Mixtral already reaches 85.6% of GPT-4's quality at 2.7% of its cost.
|
|
45
|
+
|
|
46
|
+
### SPROUT: gpt-4o-mini vs gpt-4o
|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
| Router | Saved @ 95% | @ 98% | @ 99% | AUC |
|
|
51
|
+
|---|---|---|---|---|
|
|
52
|
+
| random | 93.2% | 35.2% | 21.0% | 0.909 |
|
|
53
|
+
| rules | 93.2% | **58.5%** | **53.4%** | 0.915 |
|
|
54
|
+
| learned | 93.2% | 51.7% | 40.9% | 0.914 |
|
|
55
|
+
| hybrid (deployed) | 93.2% | 52.0% | 48.8% | 0.915 |
|
|
56
|
+
|
|
57
|
+
**gpt-4o-mini alone reaches 95.2% of gpt-4o's quality** (mean judged score 0.807 vs 0.848) at 6.8% of its cost, so every router "saves" 93.2% at the 95% target just by sending everything cheap. The stricter targets are where the routers differ:
|
|
58
|
+
- **All routers beat random.**
|
|
59
|
+
- **Rules beat the learned classifier out of distribution.** The classifier learned which prompts *Mixtral* struggles with, in 2024-era data; gpt-4o-mini fails on different prompts.
|
|
60
|
+
- **The hybrid's recovery depends on the target.** Because rules can raise its difficulty, at 99% it recovers most of the gap between learned and rules (48.8% vs 40.9% and 53.4%). At 98% it recovers almost none of it (52.0% vs 51.7% and 58.5%).
|
|
61
|
+
|
|
62
|
+
## The deployed hybrid
|
|
63
|
+
|
|
64
|
+
- **Who decides:** the rules router decides alone only when it is confident (confidence ≥ 0.8). On every other prompt the learned classifier decides, and rules can only raise its difficulty.
|
|
65
|
+
- **The max rule:** this was added in M5 after the critical-set gate caught the classifier sending 4 of 10 labeled hard prompts (a proof, a derivation, an architecture design and a legal review) to basic-tier models. The rule costs 4 points on the held-out headline (60.0% → 56.0%), and it brings the out-of-distribution result closer to the rules router.
|
|
66
|
+
- **Low confidence:** 42.0% of held-out prompts (61.6% on SPROUT) get a decision with confidence below 0.3, so the gateway raises their quality bar one step. That comes from `to_decision` measuring distance from a low threshold (0.15) in probability space. It is a deliberate upward bias, and the next thing to tune when real traffic exists.
|
|
67
|
+
|
|
68
|
+
## Limitations
|
|
69
|
+
|
|
70
|
+
- **Older model pairs.** Neither dataset contains tierwise's registry models (Claude 5.5, GPT-5.x, Gemini 3). The benchmark measures how well the router *ranks* prompts by how much they need a strong model, and that ranking is what carries over. The registry's `quality` values stay uncalibrated placeholders until M9's shadow labels exist for current models.
|
|
71
|
+
- **Two models, single-turn.** The gateway chooses among many models and caches multi-turn prefixes, and neither shows up here. Cache-aware selection is covered by the M3 tests instead.
|
|
72
|
+
- **Judge-based quality.** Both datasets grade answers with an LLM judge, and the held-out set assumes GPT-4's answer is always right.
|
|
73
|
+
- **SPROUT's license is unstated.** It is used for aggregate numbers only.
|
|
74
|
+
|
|
75
|
+
## Reproduce
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
uv sync --group train
|
|
79
|
+
uv run python -m training.export_onnx
|
|
80
|
+
uv run python -m training.prepare_data --limit 40000
|
|
81
|
+
uv run python -m evaluation.run_eval --dataset heldout # docs/benchmark/heldout.{json,png}
|
|
82
|
+
uv run python -m evaluation.run_eval --dataset sprout # downloads ~580 MB into the HF cache
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The critical-set gate (`tests/evaluation/test_critical_gate.py`) checks that the 10 labeled hard prompts never route to a basic-tier model. Coverage differs by environment:
|
|
86
|
+
- **CI** runs the rules path only, because the 90 MB ONNX encoder isn't there. The max(rules, learned) logic is covered separately by unit tests with fake routers.
|
|
87
|
+
- **The learned path**, with the trained classifier, runs wherever the model files exist. Run it after every retrain.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.8.0 — 2026-11-02
|
|
4
|
+
|
|
5
|
+
First public release. Versions track milestones: 0.8.0 is M8.
|
|
6
|
+
|
|
7
|
+
- **M0–M1:** packaging, CI, OpenAI-compatible schema, Anthropic and OpenAI adapters, passthrough.
|
|
8
|
+
- **M2:** Gemini and Ollama, streaming, model registry, cost accounting, SQLite request log.
|
|
9
|
+
- **M3:** rules router, cache-aware selector, prefix affinity, `auto*` / `tier:*` models.
|
|
10
|
+
- **M3.5:** reasoning effort chosen together with the model.
|
|
11
|
+
- **M4:** learned router (MiniLM on ONNX + numpy classifier).
|
|
12
|
+
- **M5:** eval harness, Pareto curves, `BENCHMARK.md`, critical-set CI gate.
|
|
13
|
+
- **M6:** retry, failover, two-level circuit breakers, stream hold, opt-in semantic cache.
|
|
14
|
+
- **M7:** API keys, rate limits, monthly budgets; Prometheus, OpenTelemetry, Grafana, docker-compose with Postgres.
|
|
15
|
+
- **M8:**
|
|
16
|
+
- `pip install tierwise` works without a checkout: the registry and router artifacts ship in the wheel.
|
|
17
|
+
- `tierwise fetch-model` downloads the encoder at a pinned commit and checks its sha256.
|
|
18
|
+
- A cancelled request now releases its budget reservation.
|
|
19
|
+
- Releases publish to PyPI from a tag, and the Docker base image is pinned by digest.
|
|
20
|
+
- `scripts/demo.py`.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
FROM python:3.12-slim@sha256:aa943ce411423c7582288f18707ff66eddcbaeb510502d747a72aeb34f30d159
|
|
2
|
+
|
|
3
|
+
COPY --from=ghcr.io/astral-sh/uv:0.5.11 /uv /usr/local/bin/uv
|
|
4
|
+
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PROJECT_ENVIRONMENT=/opt/venv \
|
|
5
|
+
PATH="/opt/venv/bin:$PATH" PYTHONUNBUFFERED=1
|
|
6
|
+
|
|
7
|
+
WORKDIR /app
|
|
8
|
+
# dependencies first, so source edits don't reinstall them
|
|
9
|
+
COPY pyproject.toml uv.lock README.md ./
|
|
10
|
+
RUN uv sync --frozen --no-dev --no-install-project
|
|
11
|
+
|
|
12
|
+
COPY src ./src
|
|
13
|
+
COPY config ./config
|
|
14
|
+
COPY deploy/registry.compose.yaml ./deploy/registry.compose.yaml
|
|
15
|
+
COPY models/router ./models/router
|
|
16
|
+
COPY scripts/fake_upstream.py ./scripts/fake_upstream.py
|
|
17
|
+
RUN uv sync --frozen --no-dev
|
|
18
|
+
|
|
19
|
+
RUN useradd --system --no-create-home tierwise
|
|
20
|
+
USER tierwise
|
|
21
|
+
|
|
22
|
+
ENV TIERWISE_HOST=0.0.0.0 TIERWISE_PORT=8000
|
|
23
|
+
EXPOSE 8000
|
|
24
|
+
CMD ["tierwise"]
|
tierwise-0.8.0/LICENSE
ADDED
|
@@ -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.
|