|
31 | 31 | ## Model Configuration |
32 | 32 |
|
33 | 33 | - Model `id` is **auto-injected** from filename (minus `.toml`) — never put `id` in TOML files |
34 | | -- Same model is duplicated across provider directories with no cross-referencing |
| 34 | +- Models may reuse another model's definition via `extends` (see below); otherwise the full definition must be present in the file |
35 | 35 | - Schema uses `.strict()` — extra fields cause validation errors |
36 | 36 |
|
| 37 | +### `[extends]` (inheritance between models) |
| 38 | +- Syntax — a table at the top of the TOML: |
| 39 | + ```toml |
| 40 | + [extends] |
| 41 | + from = "<provider-id>/<model-id>" # required |
| 42 | + omit = ["experimental.modes.fast"] # optional, dot-path strings |
| 43 | + ``` |
| 44 | + Example: `from = "anthropic/claude-opus-4-6"` |
| 45 | +- Resolved at parse time in `generate()`; the final JSON output contains **no** `extends` field — it exists only to cut duplication in the TOMLs |
| 46 | +- Merge semantics: |
| 47 | + - Plain objects (`[cost]`, `[limit]`, `[modalities]`, `[provider]`, `[experimental]`, …) are **deep-merged** |
| 48 | + - Arrays (e.g. `modalities.input`) and primitives are **replaced** wholesale by the child |
| 49 | + - Any field the child omits is inherited verbatim from the base |
| 50 | +- `omit` runs **after** the merge and deletes each dot-path from the result (used when the child needs to *remove* something the base defines, e.g. a provider-specific experimental mode). Every listed path must exist in the merged model, else an error is thrown. Ancestor tables that become empty as a result are also pruned, so `omit = ["experimental.modes.fast"]` yields no `experimental` key in the final JSON when `fast` was the only mode. |
| 51 | +- Chains are allowed (A extends B extends C); cycles throw |
| 52 | +- The base model must exist; `[extends.from]` pointing at a missing provider/model is an error |
| 53 | +- The `extends` table is stripped before schema validation, so the merged result must still satisfy the strict `Model` schema |
| 54 | + |
37 | 55 | ### Bedrock Naming Patterns |
38 | 56 | - Dated models: `-v1:0` suffix (`anthropic.claude-3-5-sonnet-20241022-v1:0.toml`) |
39 | 57 | - Latest/undated models: bare `-v1` (`anthropic.claude-opus-4-6-v1.toml`) |
|
0 commit comments