@dbx-tools/model 0.9.40 → 0.9.46
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.
- package/README.md +19 -2
- package/index.ts +2 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -2
- package/lib/package.json +137 -0
- package/lib/src/_metadata-generator.js +11 -8
- package/lib/src/_ranking.js +31 -6
- package/lib/src/_retirement.d.ts +10 -0
- package/lib/src/_retirement.js +59 -0
- package/lib/src/bindings.d.ts +10 -0
- package/lib/src/bindings.js +11 -0
- package/lib/src/classify.d.ts +5 -0
- package/lib/src/classify.js +13 -5
- package/lib/src/metadata-cache.js +7 -10
- package/lib/src/metadata.d.ts +2 -7
- package/lib/src/metadata.js +16 -53
- package/lib/src/model-client.d.ts +2 -0
- package/lib/src/model-client.js +13 -7
- package/lib/src/policy.d.ts +14 -0
- package/lib/src/policy.js +47 -2
- package/lib/src/reasoning-translation.js +8 -3
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -6
- package/src/_metadata-generator.ts +11 -11
- package/src/_ranking.ts +29 -5
- package/src/_retirement.ts +70 -0
- package/src/bindings.ts +11 -0
- package/src/classify.ts +13 -4
- package/src/metadata-cache.ts +6 -11
- package/src/metadata.ts +43 -77
- package/src/model-client.ts +13 -8
- package/src/policy.ts +45 -1
- package/src/reasoning-translation.ts +7 -4
package/src/policy.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type ServingEndpointSummary,
|
|
7
7
|
} from "@dbx-tools/shared-model/contracts";
|
|
8
8
|
|
|
9
|
-
import { supportsToolsByFamily } from "./classify.ts";
|
|
9
|
+
import { compareVersionTuples, supportsToolsByFamily, versionTuple } from "./classify.ts";
|
|
10
10
|
|
|
11
11
|
const FAMILIES = [
|
|
12
12
|
"claude",
|
|
@@ -54,6 +54,50 @@ export function modelSearchQuery(name: string): string | undefined {
|
|
|
54
54
|
return [parsed.family, ...parsed.version.map(String), ...parsed.model].join(" ");
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Return whether `name` has native web search: an exact documented identity, or
|
|
59
|
+
* a later {@link versionTuple} in the same family as a documented native
|
|
60
|
+
* web-search model. Intra-family floors use the name digit parser so identities
|
|
61
|
+
* like `databricks-claude-opus-4-8` and `system.ai.gpt-6-1-sol` compare.
|
|
62
|
+
* Hosted GPT-OSS weights never inherit.
|
|
63
|
+
*/
|
|
64
|
+
export function inheritsNativeWebSearch(name: string, documented: Iterable<string>): boolean {
|
|
65
|
+
const documentedKeys = documented instanceof Set ? documented : new Set(documented);
|
|
66
|
+
const key = modelSearchQuery(name)?.replaceAll(" ", "-");
|
|
67
|
+
if (key && documentedKeys.has(key)) return true;
|
|
68
|
+
const family = modelFamily(name);
|
|
69
|
+
if (!family || isOpenWeightsGpt(name)) return false;
|
|
70
|
+
const version = versionTuple(name);
|
|
71
|
+
if (isZeroVersion(version)) return false;
|
|
72
|
+
let floor: readonly number[] | undefined;
|
|
73
|
+
for (const entry of documentedKeys) {
|
|
74
|
+
if (modelFamily(entry) !== family || isOpenWeightsGpt(entry)) continue;
|
|
75
|
+
const documentedVersion = versionTuple(entry);
|
|
76
|
+
if (isZeroVersion(documentedVersion)) continue;
|
|
77
|
+
if (!floor || compareVersionTuples(documentedVersion, floor) < 0) {
|
|
78
|
+
floor = documentedVersion;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return floor !== undefined && compareVersionTuples(version, floor) >= 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Return whether an identity names a Databricks-hosted foundation model
|
|
86
|
+
* (`databricks-*` endpoint or `system.ai.*` model service). Custom and
|
|
87
|
+
* external endpoints use arbitrary names, so their digits are not versions.
|
|
88
|
+
*/
|
|
89
|
+
export function isFoundationModelIdentity(name: string): boolean {
|
|
90
|
+
return /^(?:databricks-|system\.ai\.)/i.test(name.trim());
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function isOpenWeightsGpt(name: string): boolean {
|
|
94
|
+
return modelFamily(name) === "gpt" && /(?:^|[-_.])oss(?:[-_.]|$)/i.test(name);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function isZeroVersion(version: readonly number[]): boolean {
|
|
98
|
+
return version.every((part) => (part ?? 0) === 0);
|
|
99
|
+
}
|
|
100
|
+
|
|
57
101
|
/** Return the reasoning efforts accepted by a model family. */
|
|
58
102
|
export function modelReasoningEfforts(name: string): ReasoningEffort[] {
|
|
59
103
|
const normalized = name.toLowerCase();
|
|
@@ -129,9 +129,10 @@ interface AliasDocument {
|
|
|
129
129
|
readonly level: ReasoningLevel;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
const aliasDocuments: readonly AliasDocument[] = Object.entries(ALIASES).map(
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
const aliasDocuments: readonly AliasDocument[] = Object.entries(ALIASES).map(([token, level]) => ({
|
|
133
|
+
token,
|
|
134
|
+
level,
|
|
135
|
+
}));
|
|
135
136
|
|
|
136
137
|
const aliasFuse = new Fuse(aliasDocuments, {
|
|
137
138
|
keys: ["token"],
|
|
@@ -384,7 +385,9 @@ export function adaptRequestReasoning(
|
|
|
384
385
|
}
|
|
385
386
|
}
|
|
386
387
|
|
|
387
|
-
return changed
|
|
388
|
+
return changed
|
|
389
|
+
? { body: next, changed: true, wireEffort: wire }
|
|
390
|
+
: { body, changed: false, wireEffort: wire };
|
|
388
391
|
}
|
|
389
392
|
|
|
390
393
|
/** Normalize labels for alias lookup (`Extra High` → `extra-high`). */
|