@dbx-tools/dbx-model-catalog 0.2.0 → 0.3.0
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 +294 -57
- package/dist/_generated/channels.d.ts +4 -3
- package/dist/_generated/json-schema.d.ts +6527 -175
- package/dist/_generated/schemas.d.ts +154 -0
- package/dist/_generated/workspace-rules.d.ts +133 -0
- package/dist/browser.d.ts +34 -17
- package/dist/browser.js +1192 -149
- package/dist/catalog-index.d.ts +15 -2
- package/dist/chunk-engbh7tj.js +39 -0
- package/dist/chunk-gzjer0mc.js +1797 -0
- package/dist/chunk-pp7fw379.js +51 -0
- package/dist/chunk-pwssxaq0.js +39 -0
- package/dist/cli.js +9 -654
- package/dist/effective.d.ts +31 -0
- package/dist/index.d.ts +33 -16
- package/dist/index.js +60 -660
- package/dist/local-client.d.ts +16 -3
- package/dist/pynect.d.ts +6 -3
- package/dist/search.d.ts +7 -1
- package/dist/serving-endpoints.d.ts +15 -0
- package/dist/sources.d.ts +30 -0
- package/dist/types.d.ts +31 -3
- package/dist/validation.d.ts +15 -1
- package/dist/workspace-cache.d.ts +68 -0
- package/dist/workspace-client.d.ts +49 -0
- package/dist/workspace-connection.d.ts +67 -0
- package/dist/workspace-file-cache.d.ts +11 -0
- package/dist/workspace-identity.d.ts +27 -0
- package/dist/workspace-overlay.d.ts +71 -0
- package/package.json +5 -6
- package/src/_generated/channels.ts +5 -2
- package/src/_generated/json-schema.ts +4 -2
- package/src/_generated/schemas.ts +177 -0
- package/src/_generated/workspace-rules.ts +285 -0
- package/src/browser.ts +105 -54
- package/src/catalog-index.ts +46 -19
- package/src/cli.ts +8 -11
- package/src/effective.ts +200 -0
- package/src/identity.ts +3 -26
- package/src/index.ts +155 -82
- package/src/local-client.ts +94 -18
- package/src/pynect.ts +28 -65
- package/src/search.ts +48 -0
- package/src/serving-endpoints.ts +157 -0
- package/src/sources.ts +107 -0
- package/src/types.ts +32 -2
- package/src/validation.ts +33 -0
- package/src/workspace-cache.ts +234 -0
- package/src/workspace-client.ts +134 -0
- package/src/workspace-connection.ts +160 -0
- package/src/workspace-file-cache.ts +45 -0
- package/src/workspace-identity.ts +77 -0
- package/src/workspace-overlay.ts +200 -0
- package/dist/pynect.js +0 -557
package/dist/index.js
CHANGED
|
@@ -1,662 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return identities.map((value, index) => {
|
|
33
|
-
if (index === 0 || value.startsWith("databricks-"))
|
|
34
|
-
return { kind: "endpoint", value };
|
|
35
|
-
if (value.startsWith("system.ai."))
|
|
36
|
-
return { kind: "model-service", value };
|
|
37
|
-
const separator = value.indexOf("/");
|
|
38
|
-
if (separator > 0 && providerPrefixes.has(value.slice(0, separator).toLowerCase())) {
|
|
39
|
-
return {
|
|
40
|
-
kind: "provider",
|
|
41
|
-
provider: value.slice(0, separator).toLowerCase(),
|
|
42
|
-
value
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
return { kind: "alias", value };
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// src/search.ts
|
|
50
|
-
var neutralScore = 50;
|
|
51
|
-
var statusPriority = new Map([
|
|
52
|
-
"active",
|
|
53
|
-
"preview",
|
|
54
|
-
"beta",
|
|
55
|
-
"alpha",
|
|
56
|
-
"legacy",
|
|
57
|
-
"deprecated",
|
|
58
|
-
"retired"
|
|
59
|
-
].map((status, index) => [status, index]));
|
|
60
|
-
var tokenPattern = /[a-z]+|\d+/g;
|
|
61
|
-
var versionPattern = /(?:^|[^a-z0-9])(\d+)(?:[.\-_](\d+))?(?:[.\-_](\d+))?(?![a-z0-9])/i;
|
|
62
|
-
function searchCatalogRecords(index, models, query, limit = 50) {
|
|
63
|
-
return searchCatalogMatches(index, models, query, limit).map((match) => match.record);
|
|
64
|
-
}
|
|
65
|
-
function searchCatalogMatches(index, models, query, limit = 50) {
|
|
66
|
-
const normalizedQuery = normalizeSearch(query);
|
|
67
|
-
if (!normalizedQuery || limit === 0)
|
|
68
|
-
return [];
|
|
69
|
-
const queryTokens = tokens(normalizedQuery).filter((token) => !/^\d+$/.test(token));
|
|
70
|
-
const requestedVersion = version(query);
|
|
71
|
-
const documentById = new Map(index.documents.map((document) => [document.id, document]));
|
|
72
|
-
const referenceDate = index.updated_at.slice(0, 10);
|
|
73
|
-
const scored = models.flatMap((model) => {
|
|
74
|
-
const document = documentById.get(model.id);
|
|
75
|
-
if (!document)
|
|
76
|
-
return [];
|
|
77
|
-
const candidate = scoreRecord(model, document, index, normalizedQuery, queryTokens, requestedVersion, referenceDate);
|
|
78
|
-
return candidate ? [candidate] : [];
|
|
79
|
-
});
|
|
80
|
-
scored.sort((left, right) => compareScored(left, right, requestedVersion));
|
|
81
|
-
const results = scored.map(({ identityExact: _identityExact, releaseDate: _releaseDate, version: _version, ...candidate }) => candidate);
|
|
82
|
-
return limit === null ? results : results.slice(0, limit);
|
|
83
|
-
}
|
|
84
|
-
function scoreRecord(record, document, index, query, queryTokens, requestedVersion, referenceDate) {
|
|
85
|
-
const fields = searchFields(record);
|
|
86
|
-
const fieldScores = fields.map((field) => scoreField(field, query, new Set(queryTokens)));
|
|
87
|
-
const tokenScores = queryTokenScores(queryTokens, document.tokens);
|
|
88
|
-
if (!passesTokenGate(queryTokens, tokenScores, document.identities, requestedVersion.length > 0)) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const relevance = Math.max(...fieldScores.map((item) => item.score), tokenScores.length ? mean(tokenScores) * 0.94 : 0);
|
|
92
|
-
if (relevance < 58)
|
|
93
|
-
return;
|
|
94
|
-
const leading = fieldScores.filter((item) => item.score >= relevance - 8);
|
|
95
|
-
const identityMatch = queryTokens.length > 0 && queryTokens.every((token) => document.identities.some((identity) => tokens(identity).includes(token))) || leading.some((item) => item.field.identity);
|
|
96
|
-
const identityExact = leading.some((item) => item.kind === "exact" && ["id", "name", "alias"].includes(item.field.name));
|
|
97
|
-
const quality = {
|
|
98
|
-
leaderboard: leaderboardScore(record, queryTokens, referenceDate),
|
|
99
|
-
benchmark: benchmarkScore(record, queryTokens, referenceDate),
|
|
100
|
-
version: requestedVersion.length ? requestedVersionScore(document.version, requestedVersion) : identityMatch ? document.scores.version : neutralScore,
|
|
101
|
-
freshness: document.scores.freshness,
|
|
102
|
-
lifecycle: document.scores.lifecycle
|
|
103
|
-
};
|
|
104
|
-
const combined = round3(relevance * index.weights.relevance + quality.leaderboard * index.weights.leaderboard + quality.benchmark * index.weights.benchmark + quality.version * index.weights.version + quality.freshness * index.weights.freshness + quality.lifecycle * index.weights.lifecycle);
|
|
105
|
-
return {
|
|
106
|
-
exact: identityExact,
|
|
107
|
-
identityExact,
|
|
108
|
-
kind: identityExact ? "exact" : leading.some((item) => item.kind === "token") ? "token" : "fuzzy",
|
|
109
|
-
record,
|
|
110
|
-
relevance: round3(relevance),
|
|
111
|
-
releaseDate: record.release_date ?? null,
|
|
112
|
-
score: combined,
|
|
113
|
-
version: document.version
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function scoreField(field, query, requestedTokens) {
|
|
117
|
-
const weighted = Math.max(weightedRatio(query, field.value), tokenSetRatio(query, field.value)) * field.weight;
|
|
118
|
-
if (query === field.value)
|
|
119
|
-
return { field, kind: "exact", score: 100 };
|
|
120
|
-
if (field.value.includes(query)) {
|
|
121
|
-
return { field, kind: "token", score: Math.max(weighted, 96 * field.weight) };
|
|
122
|
-
}
|
|
123
|
-
const fieldTokens = new Set(tokens(field.value));
|
|
124
|
-
if (requestedTokens.size > 0 && [...requestedTokens].every((token) => fieldTokens.has(token))) {
|
|
125
|
-
return { field, kind: "token", score: Math.max(weighted, 94 * field.weight) };
|
|
126
|
-
}
|
|
127
|
-
return { field, kind: "fuzzy", score: weighted };
|
|
128
|
-
}
|
|
129
|
-
function passesTokenGate(queryTokens, tokenScores, identities, requireIdentity) {
|
|
130
|
-
if (queryTokens.some((token, index) => (tokenScores[index] ?? 0) < (token.length <= 3 ? 80 : 65))) {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
if (!requireIdentity || queryTokens.length === 0)
|
|
134
|
-
return true;
|
|
135
|
-
const identityTokens = new Set(identities.flatMap((identity) => tokens(identity)));
|
|
136
|
-
return Math.min(...queryTokenScores(queryTokens, [...identityTokens])) >= 75;
|
|
137
|
-
}
|
|
138
|
-
function queryTokenScores(queryTokens, candidateTokens) {
|
|
139
|
-
return queryTokens.map((token) => Math.max(0, ...candidateTokens.map((candidate) => ratio(token, candidate))));
|
|
140
|
-
}
|
|
141
|
-
function compareScored(left, right, requestedVersion) {
|
|
142
|
-
if (left.identityExact !== right.identityExact)
|
|
143
|
-
return left.identityExact ? -1 : 1;
|
|
144
|
-
if (requestedVersion.length) {
|
|
145
|
-
const distance = compareNumbers(versionDistance(left.version, requestedVersion), versionDistance(right.version, requestedVersion));
|
|
146
|
-
if (distance)
|
|
147
|
-
return distance;
|
|
148
|
-
}
|
|
149
|
-
return right.score - left.score || right.relevance - left.relevance || (statusPriority.get(left.record.status) ?? statusPriority.size) - (statusPriority.get(right.record.status) ?? statusPriority.size) || compareOptionalDateDescending(left.releaseDate, right.releaseDate) || compareText(left.record.name, right.record.name) || compareText(left.record.id, right.record.id);
|
|
150
|
-
}
|
|
151
|
-
function searchFields(record) {
|
|
152
|
-
const fields = [
|
|
153
|
-
field("id", record.id, 1, true),
|
|
154
|
-
field("name", record.name, 1, true),
|
|
155
|
-
...record.aliases.map((value) => field("alias", value, 1, true)),
|
|
156
|
-
field("publisher", record.publisher ?? "", 0.98, true),
|
|
157
|
-
field("family", record.family ?? "", 0.98, true),
|
|
158
|
-
field("type", record.type, 0.9),
|
|
159
|
-
field("status", record.status, 0.86),
|
|
160
|
-
field("license", record.license ?? "", 0.84),
|
|
161
|
-
...record.tasks.map((value) => field("task", value, 0.94)),
|
|
162
|
-
...record.use_cases.map((value) => field("use case", value, 0.94)),
|
|
163
|
-
...record.modalities.input.map((value) => field("input modality", value, 0.9)),
|
|
164
|
-
...record.modalities.output.map((value) => field("output modality", value, 0.9)),
|
|
165
|
-
...record.rankings.map((value) => field("leaderboard domain", value.domain, 0.92)),
|
|
166
|
-
...record.rankings.map((value) => field("leaderboard category", value.category, 0.88)),
|
|
167
|
-
...record.benchmarks.map((value) => field("benchmark", value.name, 0.92)),
|
|
168
|
-
field("description", record.description, 0.76)
|
|
169
|
-
];
|
|
170
|
-
for (const [name, value] of Object.entries(record.capabilities)) {
|
|
171
|
-
const objectValue = isRecord(value) ? value : undefined;
|
|
172
|
-
if (value === true || objectValue?.supported === true) {
|
|
173
|
-
fields.push(field("capability", name.replaceAll("_", " "), 0.94));
|
|
174
|
-
}
|
|
175
|
-
if (name === "reasoning" && objectValue) {
|
|
176
|
-
const effort = Array.isArray(objectValue.effort) ? objectValue.effort : [];
|
|
177
|
-
for (const level of effort)
|
|
178
|
-
fields.push(field("reasoning effort", `${String(level)} reasoning`, 0.94));
|
|
179
|
-
if (objectValue.toggle === true)
|
|
180
|
-
fields.push(field("reasoning control", "reasoning toggle", 0.92));
|
|
181
|
-
if (objectValue.budget)
|
|
182
|
-
fields.push(field("reasoning control", "reasoning token budget", 0.92));
|
|
183
|
-
if (typeof objectValue.description === "string") {
|
|
184
|
-
fields.push(field("reasoning description", objectValue.description, 0.8));
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
for (const [cloud, availability] of Object.entries(record.availability)) {
|
|
189
|
-
fields.push(field("cloud", cloud, 0.9));
|
|
190
|
-
fields.push(field("availability", availability.status, 0.82));
|
|
191
|
-
fields.push(...availability.serving_modes.map((mode) => field("serving mode", mode, 0.9)));
|
|
192
|
-
if (availability.details)
|
|
193
|
-
fields.push(field("availability details", availability.details, 0.72));
|
|
194
|
-
}
|
|
195
|
-
for (const notice of record.notices) {
|
|
196
|
-
fields.push(field("notice", notice.kind, 0.74));
|
|
197
|
-
fields.push(field("notice", notice.title ?? "", 0.74));
|
|
198
|
-
fields.push(field("notice", notice.text, 0.7));
|
|
199
|
-
}
|
|
200
|
-
return fields.map((value) => ({ ...value, value: normalizeSearch(value.value) })).filter((value) => value.value.length > 0);
|
|
201
|
-
}
|
|
202
|
-
function field(name, value, weight, identity = false) {
|
|
203
|
-
return { identity, name, value, weight };
|
|
204
|
-
}
|
|
205
|
-
function leaderboardScore(record, queryTokens, referenceDate) {
|
|
206
|
-
const matched = record.rankings.filter((ranking) => evidenceMatches(queryTokens, ranking.domain, ranking.category));
|
|
207
|
-
const selected = matched.length ? matched : record.rankings.filter((ranking) => ranking.category.toLowerCase() === "overall");
|
|
208
|
-
if (!selected.length)
|
|
209
|
-
return neutralScore;
|
|
210
|
-
return aggregateEvidence(selected.map((ranking) => ageAdjustedScore(rankScore(ranking.rank, 20), ranking.published_at ?? null, referenceDate, 180, "votes" in ranking ? ranking.votes : ranking.observations, 5000)));
|
|
211
|
-
}
|
|
212
|
-
function benchmarkScore(record, queryTokens, referenceDate) {
|
|
213
|
-
const matched = record.benchmarks.filter((benchmark) => evidenceMatches(queryTokens, benchmark.name));
|
|
214
|
-
const selected = matched.length ? matched : record.benchmarks;
|
|
215
|
-
if (!selected.length)
|
|
216
|
-
return neutralScore;
|
|
217
|
-
return aggregateEvidence(selected.map((benchmark) => ageAdjustedScore(rankScore(benchmark.rank, 10), benchmark.published_at ?? null, referenceDate, 365, benchmark.task_count, 20)));
|
|
218
|
-
}
|
|
219
|
-
function evidenceMatches(queryTokens, ...values) {
|
|
220
|
-
if (!queryTokens.length)
|
|
221
|
-
return false;
|
|
222
|
-
const evidence = new Set(tokens(normalizeSearch(values.join(" "))));
|
|
223
|
-
return queryTokens.some((token) => evidence.has(token));
|
|
224
|
-
}
|
|
225
|
-
function ageAdjustedScore(score, publishedAt, referenceDate, halfLifeDays, confidenceCount, confidenceTarget) {
|
|
226
|
-
const ageDays = publishedAt ? Math.max(0, dateDays(referenceDate) - dateDays(publishedAt)) : halfLifeDays;
|
|
227
|
-
const ageFactor = 0.5 ** (ageDays / halfLifeDays);
|
|
228
|
-
const confidence = confidenceCount === null || confidenceCount === undefined ? 0 : Math.min(1, Math.log1p(confidenceCount) / Math.log1p(confidenceTarget));
|
|
229
|
-
const evidenceFactor = ageFactor * (0.75 + confidence * 0.25);
|
|
230
|
-
return neutralScore + (score - neutralScore) * evidenceFactor;
|
|
231
|
-
}
|
|
232
|
-
function aggregateEvidence(scores) {
|
|
233
|
-
if (!scores.length)
|
|
234
|
-
return neutralScore;
|
|
235
|
-
const aggregate = median(scores) * 0.6 + mean(scores) * 0.4;
|
|
236
|
-
const coverageFactor = 0.85 + Math.min(scores.length, 5) / 5 * 0.15;
|
|
237
|
-
return neutralScore + (aggregate - neutralScore) * coverageFactor;
|
|
238
|
-
}
|
|
239
|
-
function requestedVersionScore(candidate, requested) {
|
|
240
|
-
if (!candidate.length)
|
|
241
|
-
return 0;
|
|
242
|
-
const [candidateMajor = 0, candidateMinor = 0, candidatePatch = 0] = candidate;
|
|
243
|
-
const [requestedMajor = 0, requestedMinor = 0, requestedPatch = 0] = requested;
|
|
244
|
-
if (candidateMajor !== requestedMajor) {
|
|
245
|
-
return Math.max(0, 40 - Math.abs(candidateMajor - requestedMajor) * 15);
|
|
246
|
-
}
|
|
247
|
-
return Math.max(0, 100 - Math.abs(candidateMinor - requestedMinor) * 15 - Math.abs(candidatePatch - requestedPatch) * 5);
|
|
248
|
-
}
|
|
249
|
-
function versionDistance(candidate, requested) {
|
|
250
|
-
if (!candidate.length)
|
|
251
|
-
return [1, 1, 1000, 1000, 1000];
|
|
252
|
-
const [candidateMajor = 0, candidateMinor = 0, candidatePatch = 0] = candidate;
|
|
253
|
-
const [requestedMajor = 0, requestedMinor = 0, requestedPatch = 0] = requested;
|
|
254
|
-
return [
|
|
255
|
-
0,
|
|
256
|
-
candidateMajor === requestedMajor ? 0 : 1,
|
|
257
|
-
Math.abs(candidateMajor - requestedMajor),
|
|
258
|
-
Math.abs(candidateMinor - requestedMinor),
|
|
259
|
-
Math.abs(candidatePatch - requestedPatch)
|
|
260
|
-
];
|
|
261
|
-
}
|
|
262
|
-
function weightedRatio(left, right) {
|
|
263
|
-
if (!left || !right)
|
|
264
|
-
return 0;
|
|
265
|
-
const lengthRatio = Math.max(left.length, right.length) / Math.min(left.length, right.length);
|
|
266
|
-
const base = ratio(left, right);
|
|
267
|
-
if (lengthRatio < 1.5) {
|
|
268
|
-
return Math.max(base, tokenRatio(left, right) * 0.95);
|
|
269
|
-
}
|
|
270
|
-
const partialScale = lengthRatio <= 8 ? 0.9 : 0.6;
|
|
271
|
-
return Math.max(base, partialRatio(left, right) * partialScale, partialTokenRatio(left, right) * 0.95 * partialScale);
|
|
272
|
-
}
|
|
273
|
-
function tokenRatio(left, right) {
|
|
274
|
-
return Math.max(tokenSetRatio(left, right), ratio(sortTokens(left), sortTokens(right)));
|
|
275
|
-
}
|
|
276
|
-
function partialTokenRatio(left, right) {
|
|
277
|
-
const leftTokens = left.split(/\s+/).filter(Boolean);
|
|
278
|
-
const rightTokens = right.split(/\s+/).filter(Boolean);
|
|
279
|
-
const leftSet = new Set(leftTokens);
|
|
280
|
-
const rightSet = new Set(rightTokens);
|
|
281
|
-
if ([...leftSet].some((token) => rightSet.has(token)))
|
|
282
|
-
return 100;
|
|
283
|
-
const base = partialRatio([...leftTokens].sort().join(" "), [...rightTokens].sort().join(" "));
|
|
284
|
-
const leftDiff = [...leftSet].filter((token) => !rightSet.has(token));
|
|
285
|
-
const rightDiff = [...rightSet].filter((token) => !leftSet.has(token));
|
|
286
|
-
if (leftTokens.length === leftDiff.length && rightTokens.length === rightDiff.length)
|
|
287
|
-
return base;
|
|
288
|
-
return Math.max(base, partialRatio(leftDiff.sort().join(" "), rightDiff.sort().join(" ")));
|
|
289
|
-
}
|
|
290
|
-
function tokenSetRatio(left, right) {
|
|
291
|
-
const leftSet = new Set(left.split(/\s+/).filter(Boolean));
|
|
292
|
-
const rightSet = new Set(right.split(/\s+/).filter(Boolean));
|
|
293
|
-
if (!leftSet.size || !rightSet.size)
|
|
294
|
-
return 0;
|
|
295
|
-
const intersection = [...leftSet].filter((token) => rightSet.has(token));
|
|
296
|
-
const leftDiff = [...leftSet].filter((token) => !rightSet.has(token)).sort().join(" ");
|
|
297
|
-
const rightDiff = [...rightSet].filter((token) => !leftSet.has(token)).sort().join(" ");
|
|
298
|
-
if (intersection.length && (!leftDiff || !rightDiff))
|
|
299
|
-
return 100;
|
|
300
|
-
const intersectionLength = intersection.join(" ").length;
|
|
301
|
-
const leftLength = intersectionLength + (intersectionLength ? 1 : 0) + leftDiff.length;
|
|
302
|
-
const rightLength = intersectionLength + (intersectionLength ? 1 : 0) + rightDiff.length;
|
|
303
|
-
const distance = indelDistance(leftDiff, rightDiff);
|
|
304
|
-
const differenceScore = normalizedDistanceScore(distance, leftLength + rightLength);
|
|
305
|
-
if (!intersectionLength)
|
|
306
|
-
return differenceScore;
|
|
307
|
-
const leftIntersectionScore = normalizedDistanceScore(1 + leftDiff.length, intersectionLength + leftLength);
|
|
308
|
-
const rightIntersectionScore = normalizedDistanceScore(1 + rightDiff.length, intersectionLength + rightLength);
|
|
309
|
-
return Math.max(differenceScore, leftIntersectionScore, rightIntersectionScore);
|
|
310
|
-
}
|
|
311
|
-
function partialRatio(left, right) {
|
|
312
|
-
if (!left && !right)
|
|
313
|
-
return 100;
|
|
314
|
-
if (!left || !right)
|
|
315
|
-
return 0;
|
|
316
|
-
const shorter = left.length <= right.length ? left : right;
|
|
317
|
-
const longer = left.length <= right.length ? right : left;
|
|
318
|
-
let best = 0;
|
|
319
|
-
for (let end = 1;end < shorter.length; end += 1) {
|
|
320
|
-
best = Math.max(best, ratio(shorter, longer.slice(0, end)));
|
|
321
|
-
}
|
|
322
|
-
for (let start = 0;start <= longer.length - shorter.length; start += 1) {
|
|
323
|
-
best = Math.max(best, ratio(shorter, longer.slice(start, start + shorter.length)));
|
|
324
|
-
}
|
|
325
|
-
for (let start = Math.max(0, longer.length - shorter.length + 1);start < longer.length; start += 1) {
|
|
326
|
-
best = Math.max(best, ratio(shorter, longer.slice(start)));
|
|
327
|
-
}
|
|
328
|
-
return best;
|
|
329
|
-
}
|
|
330
|
-
function ratio(left, right) {
|
|
331
|
-
const total = left.length + right.length;
|
|
332
|
-
return total ? 2 * longestCommonSubsequence(left, right) / total * 100 : 100;
|
|
333
|
-
}
|
|
334
|
-
function indelDistance(left, right) {
|
|
335
|
-
return left.length + right.length - 2 * longestCommonSubsequence(left, right);
|
|
336
|
-
}
|
|
337
|
-
function longestCommonSubsequence(left, right) {
|
|
338
|
-
if (!left || !right)
|
|
339
|
-
return 0;
|
|
340
|
-
const needle = left.length <= right.length ? left : right;
|
|
341
|
-
const haystack = left.length <= right.length ? right : left;
|
|
342
|
-
const blocks = new Map;
|
|
343
|
-
let bit = 1n;
|
|
344
|
-
for (const character of needle) {
|
|
345
|
-
blocks.set(character, (blocks.get(character) ?? 0n) | bit);
|
|
346
|
-
bit <<= 1n;
|
|
347
|
-
}
|
|
348
|
-
let state = (1n << BigInt(needle.length)) - 1n;
|
|
349
|
-
for (const character of haystack) {
|
|
350
|
-
const matches = blocks.get(character) ?? 0n;
|
|
351
|
-
const overlap = state & matches;
|
|
352
|
-
state = state + overlap | state - overlap;
|
|
353
|
-
}
|
|
354
|
-
const mask = (1n << BigInt(needle.length)) - 1n;
|
|
355
|
-
return needle.length - popCount(state & mask);
|
|
356
|
-
}
|
|
357
|
-
function popCount(value) {
|
|
358
|
-
let count = 0;
|
|
359
|
-
let current = value;
|
|
360
|
-
while (current) {
|
|
361
|
-
current &= current - 1n;
|
|
362
|
-
count += 1;
|
|
363
|
-
}
|
|
364
|
-
return count;
|
|
365
|
-
}
|
|
366
|
-
function normalizedDistanceScore(distance, lengthSum) {
|
|
367
|
-
return lengthSum ? 100 - 100 * distance / lengthSum : 100;
|
|
368
|
-
}
|
|
369
|
-
function sortTokens(value) {
|
|
370
|
-
return value.split(/\s+/).filter(Boolean).sort().join(" ");
|
|
371
|
-
}
|
|
372
|
-
function normalizeSearch(value) {
|
|
373
|
-
return (value.normalize("NFKC").toLowerCase().match(tokenPattern) ?? []).join(" ");
|
|
374
|
-
}
|
|
375
|
-
function tokens(value) {
|
|
376
|
-
return value.match(tokenPattern) ?? [];
|
|
377
|
-
}
|
|
378
|
-
function version(value) {
|
|
379
|
-
const match = versionPattern.exec(value.toLowerCase());
|
|
380
|
-
return match ? match.slice(1).filter((part) => Boolean(part)).map(Number) : [];
|
|
381
|
-
}
|
|
382
|
-
function rankScore(rank, offset) {
|
|
383
|
-
return (offset + 1) / (offset + rank) * 100;
|
|
384
|
-
}
|
|
385
|
-
function dateDays(value) {
|
|
386
|
-
return Math.floor(Date.parse(`${value.slice(0, 10)}T00:00:00Z`) / 86400000);
|
|
387
|
-
}
|
|
388
|
-
function median(values) {
|
|
389
|
-
const sorted = [...values].sort((left, right) => left - right);
|
|
390
|
-
const middle = Math.floor(sorted.length / 2);
|
|
391
|
-
return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2;
|
|
392
|
-
}
|
|
393
|
-
function mean(values) {
|
|
394
|
-
return values.reduce((total, value) => total + value, 0) / values.length;
|
|
395
|
-
}
|
|
396
|
-
function round3(value) {
|
|
397
|
-
return Math.round(value * 1000) / 1000;
|
|
398
|
-
}
|
|
399
|
-
function compareNumbers(left, right) {
|
|
400
|
-
for (let index = 0;index < Math.max(left.length, right.length); index += 1) {
|
|
401
|
-
const difference = (left[index] ?? 0) - (right[index] ?? 0);
|
|
402
|
-
if (difference)
|
|
403
|
-
return difference;
|
|
404
|
-
}
|
|
405
|
-
return 0;
|
|
406
|
-
}
|
|
407
|
-
function compareOptionalDateDescending(left, right) {
|
|
408
|
-
if (left === right)
|
|
409
|
-
return 0;
|
|
410
|
-
if (left === null)
|
|
411
|
-
return 1;
|
|
412
|
-
if (right === null)
|
|
413
|
-
return -1;
|
|
414
|
-
return right.localeCompare(left);
|
|
415
|
-
}
|
|
416
|
-
function compareText(left, right) {
|
|
417
|
-
const normalizedLeft = left.toLowerCase();
|
|
418
|
-
const normalizedRight = right.toLowerCase();
|
|
419
|
-
return normalizedLeft < normalizedRight ? -1 : normalizedLeft > normalizedRight ? 1 : 0;
|
|
420
|
-
}
|
|
421
|
-
function isRecord(value) {
|
|
422
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
// src/filter.ts
|
|
426
|
-
function filterCatalogRecords(records, searchIndex, filters = {}) {
|
|
427
|
-
const limit = filters.limit === undefined ? 50 : filters.limit;
|
|
428
|
-
if (limit !== null && (!Number.isSafeInteger(limit) || limit < 0 || limit > 1000)) {
|
|
429
|
-
throw new RangeError("limit must be an integer between 0 and 1000, or null");
|
|
430
|
-
}
|
|
431
|
-
const filtered = records.filter((record) => includes(filters.status, record.status) && includes(filters.type, record.type) && includes(filters.publisher, record.publisher) && (filters.task ?? []).every((task) => record.tasks.includes(task)) && (filters.capability ?? []).every((capability) => hasCapability(record, capability)));
|
|
432
|
-
const query = filters.query?.trim();
|
|
433
|
-
if (query)
|
|
434
|
-
return searchCatalogRecords(searchIndex, filtered, query, limit);
|
|
435
|
-
filtered.sort((left, right) => compareText2(left.name, right.name) || compareText2(left.id, right.id));
|
|
436
|
-
return limit === null ? filtered : filtered.slice(0, limit);
|
|
437
|
-
}
|
|
438
|
-
function includes(expected, actual) {
|
|
439
|
-
return !expected?.length || actual !== null && actual !== undefined && expected.includes(actual);
|
|
440
|
-
}
|
|
441
|
-
function hasCapability(record, capability) {
|
|
442
|
-
const field = capability.replaceAll("-", "_");
|
|
443
|
-
const value = record.capabilities[field];
|
|
444
|
-
return capability === "reasoning" ? value !== null && value !== undefined : value === true;
|
|
445
|
-
}
|
|
446
|
-
function compareText2(left, right) {
|
|
447
|
-
const normalizedLeft = left.toLowerCase();
|
|
448
|
-
const normalizedRight = right.toLowerCase();
|
|
449
|
-
return normalizedLeft < normalizedRight ? -1 : normalizedLeft > normalizedRight ? 1 : 0;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// src/catalog-index.ts
|
|
453
|
-
class ModelCatalogIndex {
|
|
454
|
-
catalog;
|
|
455
|
-
searchIndex;
|
|
456
|
-
records;
|
|
457
|
-
exact = new Map;
|
|
458
|
-
normalized = new Map;
|
|
459
|
-
constructor(catalog, searchIndex) {
|
|
460
|
-
this.catalog = catalog;
|
|
461
|
-
this.searchIndex = searchIndex;
|
|
462
|
-
if (catalog.schema_version !== searchIndex.catalog_schema_version) {
|
|
463
|
-
throw new Error(`Catalog schema v${catalog.schema_version} does not match search index schema v${searchIndex.catalog_schema_version}`);
|
|
464
|
-
}
|
|
465
|
-
if (catalog.updated_at !== searchIndex.updated_at) {
|
|
466
|
-
throw new Error("Catalog and search index timestamps do not match");
|
|
467
|
-
}
|
|
468
|
-
this.records = Object.entries(catalog.models).map(([id, model]) => ({ ...model, id }));
|
|
469
|
-
for (const record of this.records) {
|
|
470
|
-
for (const identity of modelIdentities(record)) {
|
|
471
|
-
this.exact.set(identity.value.toLowerCase(), { identity, record });
|
|
472
|
-
const key = normalizeModelIdentity(identity.value);
|
|
473
|
-
const current = this.normalized.get(key);
|
|
474
|
-
this.normalized.set(key, current === undefined ? { identity, record } : null);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
get(id) {
|
|
479
|
-
return this.catalog.models[id] ? { ...this.catalog.models[id], id } : undefined;
|
|
480
|
-
}
|
|
481
|
-
resolve(value) {
|
|
482
|
-
const exact = this.exact.get(value.trim().toLowerCase());
|
|
483
|
-
if (exact)
|
|
484
|
-
return exact;
|
|
485
|
-
return this.normalized.get(normalizeModelIdentity(value)) ?? undefined;
|
|
486
|
-
}
|
|
487
|
-
matchAny(values) {
|
|
488
|
-
for (const value of values) {
|
|
489
|
-
const match = this.resolve(value);
|
|
490
|
-
if (match)
|
|
491
|
-
return match;
|
|
492
|
-
}
|
|
493
|
-
return;
|
|
494
|
-
}
|
|
495
|
-
list(filters = {}) {
|
|
496
|
-
return filterCatalogRecords(this.records, this.searchIndex, filters);
|
|
497
|
-
}
|
|
498
|
-
search(query, limit = 50) {
|
|
499
|
-
return searchCatalogMatches(this.searchIndex, this.records, query, limit);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
function createModelCatalogIndex(catalog, searchIndex) {
|
|
503
|
-
return new ModelCatalogIndex(catalog, searchIndex);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
// src/local-client.ts
|
|
507
|
-
function createModelCatalogClient(catalog, searchIndex) {
|
|
508
|
-
const index = createModelCatalogIndex(catalog, searchIndex);
|
|
509
|
-
const records = [...index.records];
|
|
510
|
-
return {
|
|
511
|
-
async catalog() {
|
|
512
|
-
return catalog;
|
|
513
|
-
},
|
|
514
|
-
async searchIndex() {
|
|
515
|
-
return searchIndex;
|
|
516
|
-
},
|
|
517
|
-
async list(filters = {}) {
|
|
518
|
-
return filterCatalogRecords(records, searchIndex, filters);
|
|
519
|
-
},
|
|
520
|
-
async get(identity) {
|
|
521
|
-
return index.resolve(identity)?.record;
|
|
522
|
-
},
|
|
523
|
-
async resolve(identity) {
|
|
524
|
-
return index.resolve(identity);
|
|
525
|
-
},
|
|
526
|
-
async search(query, limit = 50) {
|
|
527
|
-
return index.search(query, limit);
|
|
528
|
-
},
|
|
529
|
-
async* stream(filters = {}) {
|
|
530
|
-
for (const record of filterCatalogRecords(records, searchIndex, filters))
|
|
531
|
-
yield record;
|
|
532
|
-
},
|
|
533
|
-
close() {}
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
// src/validation.ts
|
|
538
|
-
import { z } from "zod";
|
|
539
|
-
|
|
540
|
-
// src/_generated/json-schema.ts
|
|
541
|
-
var MODEL_CATALOG_JSON_SCHEMA = { additionalProperties: false, description: "Published Databricks model catalog with identity, capabilities, availability, pricing, lifecycle, rankings, and benchmarks.", properties: { schema_version: { const: 16, title: "Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, models: { additionalProperties: { $ref: "#/$defs/CatalogModel" }, propertyNames: { minLength: 1 }, title: "Models", type: "object" } }, required: ["schema_version", "updated_at", "models"], title: "ModelCatalog", type: "object", $defs: { Availability: { additionalProperties: false, description: "Model availability on one Databricks cloud provider.", properties: { status: { $ref: "#/$defs/Status1" }, serving_modes: { items: { $ref: "#/$defs/ServingMode" }, title: "Serving Modes", type: "array" }, details: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Details" } }, required: ["status", "serving_modes"], title: "Availability", type: "object" }, AveragePrice: { additionalProperties: false, description: "Normalized Databricks price in one currency.", properties: { unit: { $ref: "#/$defs/Unit" }, rates: { additionalProperties: { minimum: 0, type: "number" }, propertyNames: { minLength: 1 }, title: "Rates", type: "object" } }, required: ["unit", "rates"], title: "AveragePrice", type: "object" }, Benchmark: { additionalProperties: false, description: "Task-suite benchmark result.", properties: { name: { title: "Name", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, score: { title: "Score", type: "number" }, task_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Task Count", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant2" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" } }, required: ["name", "rank", "score", "task_count", "sources"], title: "Benchmark", type: "object" }, Budget: { additionalProperties: false, description: "Supported reasoning-token budget range.", properties: { min: { anyOf: [{ maximum: 9007199254740991, minimum: -9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Min" }, max: { anyOf: [{ maximum: 9007199254740991, minimum: -9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Max" } }, title: "Budget", type: "object" }, Capabilities: { additionalProperties: false, description: "Capabilities used to select the model for a workload.", properties: { attachments: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Attachments" }, tools: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Tools" }, structured_output: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Structured Output" }, temperature: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Temperature" }, interleaved_reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Interleaved Reasoning" }, responses: { title: "Responses", type: "boolean" }, apply_patch: { title: "Apply Patch", type: "boolean" }, web_search: { title: "Web Search", type: "boolean" }, reasoning: { anyOf: [{ $ref: "#/$defs/Reasoning" }, { $ref: "#/$defs/Reasoning1" }, { type: "null" }], default: null, title: "Reasoning" } }, required: ["responses", "apply_patch", "web_search"], title: "Capabilities", type: "object" }, CatalogFilters: { additionalProperties: false, properties: { query: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Query" }, status: { items: { $ref: "#/$defs/Status" }, title: "Status", type: "array" }, type: { items: { $ref: "#/$defs/Type" }, title: "Type", type: "array" }, publisher: { items: { type: "string" }, title: "Publisher", type: "array" }, task: { items: { type: "string" }, title: "Task", type: "array" }, capability: { items: { enum: ["apply-patch", "attachments", "reasoning", "responses", "structured-output", "tools", "web-search"], type: "string" }, title: "Capability", type: "array" }, limit: { anyOf: [{ maximum: 1000, minimum: 0, type: "integer" }, { type: "null" }], default: 50, title: "Limit" } }, title: "CatalogFilters", type: "object" }, CatalogModel: { additionalProperties: false, description: "Published statistics for one Databricks model.", properties: { name: { title: "Name", type: "string" }, description: { title: "Description", type: "string" }, aliases: { items: { type: "string" }, title: "Aliases", type: "array" }, type: { $ref: "#/$defs/Type" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, publisher: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Publisher" }, license: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "License" }, open_weights: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Open Weights" }, status: { $ref: "#/$defs/Status" }, release_date: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Release Date" }, last_updated: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Last Updated" }, knowledge_cutoff: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Knowledge Cutoff" }, retirement: { anyOf: [{ $ref: "#/$defs/Retirement" }, { type: "null" }], default: null }, modalities: { $ref: "#/$defs/Modalities" }, capabilities: { $ref: "#/$defs/Capabilities" }, limits: { anyOf: [{ $ref: "#/$defs/Limits" }, { type: "null" }], default: null }, rate_limits: { anyOf: [{ $ref: "#/$defs/RateLimits" }, { type: "null" }], default: null }, latency: { anyOf: [{ $ref: "#/$defs/Latency" }, { type: "null" }], default: null }, tasks: { items: { type: "string" }, title: "Tasks", type: "array" }, use_cases: { items: { type: "string" }, title: "Use Cases", type: "array" }, availability: { additionalProperties: { $ref: "#/$defs/Availability" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Availability", type: "object" }, price: { additionalProperties: { additionalProperties: { $ref: "#/$defs/Price" }, propertyNames: { enum: ["DBU", "USD"] }, type: "object" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Price", type: "object" }, average_price: { additionalProperties: { $ref: "#/$defs/AveragePrice" }, propertyNames: { enum: ["DBU", "USD"] }, title: "Average Price", type: "object" }, sources: { additionalProperties: { items: { $ref: "#/$defs/SourceLink" }, type: "array" }, propertyNames: { minLength: 1 }, title: "Sources", type: "object" }, notices: { items: { $ref: "#/$defs/Notice" }, title: "Notices", type: "array" }, rankings: { items: { anyOf: [{ $ref: "#/$defs/Rankings" }, { $ref: "#/$defs/Rankings1" }] }, title: "Rankings", type: "array" }, benchmarks: { items: { $ref: "#/$defs/Benchmark" }, title: "Benchmarks", type: "array" } }, required: ["name", "description", "aliases", "type", "status", "modalities", "capabilities", "tasks", "use_cases", "availability", "price", "average_price", "sources", "notices", "rankings", "benchmarks"], title: "CatalogModel", type: "object" }, CatalogModelRecord: { additionalProperties: false, properties: { name: { title: "Name", type: "string" }, description: { title: "Description", type: "string" }, aliases: { items: { type: "string" }, title: "Aliases", type: "array" }, type: { $ref: "#/$defs/Type" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, publisher: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Publisher" }, license: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "License" }, open_weights: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Open Weights" }, status: { $ref: "#/$defs/Status" }, release_date: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Release Date" }, last_updated: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Last Updated" }, knowledge_cutoff: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Knowledge Cutoff" }, retirement: { anyOf: [{ $ref: "#/$defs/Retirement" }, { type: "null" }], default: null }, modalities: { $ref: "#/$defs/Modalities" }, capabilities: { $ref: "#/$defs/Capabilities" }, limits: { anyOf: [{ $ref: "#/$defs/Limits" }, { type: "null" }], default: null }, rate_limits: { anyOf: [{ $ref: "#/$defs/RateLimits" }, { type: "null" }], default: null }, latency: { anyOf: [{ $ref: "#/$defs/Latency" }, { type: "null" }], default: null }, tasks: { items: { type: "string" }, title: "Tasks", type: "array" }, use_cases: { items: { type: "string" }, title: "Use Cases", type: "array" }, availability: { additionalProperties: { $ref: "#/$defs/Availability" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Availability", type: "object" }, price: { additionalProperties: { additionalProperties: { $ref: "#/$defs/Price" }, propertyNames: { enum: ["DBU", "USD"] }, type: "object" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Price", type: "object" }, average_price: { additionalProperties: { $ref: "#/$defs/AveragePrice" }, propertyNames: { enum: ["DBU", "USD"] }, title: "Average Price", type: "object" }, sources: { additionalProperties: { items: { $ref: "#/$defs/SourceLink" }, type: "array" }, propertyNames: { minLength: 1 }, title: "Sources", type: "object" }, notices: { items: { $ref: "#/$defs/Notice" }, title: "Notices", type: "array" }, rankings: { items: { anyOf: [{ $ref: "#/$defs/Rankings" }, { $ref: "#/$defs/Rankings1" }] }, title: "Rankings", type: "array" }, benchmarks: { items: { $ref: "#/$defs/Benchmark" }, title: "Benchmarks", type: "array" }, id: { minLength: 1, title: "Id", type: "string" } }, required: ["name", "description", "aliases", "type", "status", "modalities", "capabilities", "tasks", "use_cases", "availability", "price", "average_price", "sources", "notices", "rankings", "benchmarks", "id"], title: "CatalogModelRecord", type: "object" }, CatalogSearchIndexDocument: { additionalProperties: false, properties: { id: { title: "Id", type: "string" }, exact_identities: { items: { type: "string" }, title: "Exact Identities", type: "array" }, identities: { items: { type: "string" }, title: "Identities", type: "array" }, keywords: { title: "Keywords", type: "string" }, description: { title: "Description", type: "string" }, tokens: { items: { type: "string" }, title: "Tokens", type: "array" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, version: { items: { type: "integer" }, title: "Version", type: "array" }, quality_score: { maximum: 100, minimum: 0, title: "Quality Score", type: "number" }, scores: { $ref: "#/$defs/CatalogSearchQualityScores" } }, required: ["id", "exact_identities", "identities", "keywords", "description", "tokens", "version", "quality_score", "scores"], title: "CatalogSearchIndexDocument", type: "object" }, CatalogSearchIndexPayload: { additionalProperties: false, properties: { schema_version: { title: "Schema Version", type: "integer" }, catalog_schema_version: { title: "Catalog Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, weights: { $ref: "#/$defs/CatalogSearchWeights" }, documents: { items: { $ref: "#/$defs/CatalogSearchIndexDocument" }, title: "Documents", type: "array" } }, required: ["schema_version", "catalog_schema_version", "updated_at", "weights", "documents"], title: "CatalogSearchIndexPayload", type: "object" }, CatalogSearchQualityScores: { additionalProperties: false, properties: { leaderboard: { maximum: 100, minimum: 0, title: "Leaderboard", type: "number" }, benchmark: { maximum: 100, minimum: 0, title: "Benchmark", type: "number" }, version: { maximum: 100, minimum: 0, title: "Version", type: "number" }, freshness: { maximum: 100, minimum: 0, title: "Freshness", type: "number" }, lifecycle: { maximum: 100, minimum: 0, title: "Lifecycle", type: "number" } }, required: ["leaderboard", "benchmark", "version", "freshness", "lifecycle"], title: "CatalogSearchQualityScores", type: "object" }, CatalogSearchWeights: { additionalProperties: false, properties: { relevance: { title: "Relevance", type: "number" }, leaderboard: { title: "Leaderboard", type: "number" }, benchmark: { title: "Benchmark", type: "number" }, version: { title: "Version", type: "number" }, freshness: { title: "Freshness", type: "number" }, lifecycle: { title: "Lifecycle", type: "number" } }, required: ["relevance", "leaderboard", "benchmark", "version", "freshness", "lifecycle"], title: "CatalogSearchWeights", type: "object" }, DefaultEffort: { description: "Default reasoning effort when no level is specified.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "DefaultEffort", type: "string" }, EffortEnum: { description: "Normalized reasoning effort level.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "EffortEnum", type: "string" }, GetCatalogRequest: { properties: { action: { const: "get_catalog", default: "get_catalog", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "GetCatalogRequest", type: "object" }, GetCatalogResponse: { properties: { action: { const: "catalog", default: "catalog", title: "Action", type: "string" }, payload: { $ref: "#/$defs/ModelCatalog" } }, required: ["payload"], title: "GetCatalogResponse", type: "object" }, GetSearchIndexRequest: { properties: { action: { const: "get_search_index", default: "get_search_index", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "GetSearchIndexRequest", type: "object" }, GetSearchIndexResponse: { properties: { action: { const: "search_index", default: "search_index", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogSearchIndexPayload" } }, required: ["payload"], title: "GetSearchIndexResponse", type: "object" }, Input: { description: "Known model input and output modalities.", enum: ["text", "image", "audio", "video", "application/pdf", "embedding", "reranking", "decision"], title: "Input", type: "string" }, Kind: { description: "Known Databricks documentation notice kinds.", enum: ["note", "important", "warning", "tip", "caution", "info"], title: "Kind", type: "string" }, Latency: { additionalProperties: false, description: "Normalized response-time score and public benchmark measurements.", properties: { score: { exclusiveMinimum: 0, title: "Score", type: "number" }, measurements: { $ref: "#/$defs/LatencyMeasurements" } }, required: ["score", "measurements"], title: "Latency", type: "object" }, LatencyMeasurements: { additionalProperties: false, description: "Public benchmark measurements underlying one latency score.", properties: { time_to_first_token_ms: { minimum: 0, title: "Time To First Token Ms", type: "number" }, output_tokens_per_second: { exclusiveMinimum: 0, title: "Output Tokens Per Second", type: "number" }, successful_run_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Successful Run Count", type: "integer" }, completion_token_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Completion Token Count", type: "integer" }, measured_at: { format: "date-time", title: "Measured At", type: "string" } }, required: ["time_to_first_token_ms", "output_tokens_per_second", "successful_run_count", "completion_token_count", "measured_at"], title: "LatencyMeasurements", type: "object" }, Limits: { additionalProperties: false, description: "Documented token limits.", properties: { context: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Context" }, input: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Input" }, output: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Output" } }, title: "Limits", type: "object" }, ListModelsRequest: { properties: { action: { const: "list_models", default: "list_models", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "ListModelsRequest", type: "object" }, ListModelsResponse: { properties: { action: { const: "models", default: "models", title: "Action", type: "string" }, payload: { items: { $ref: "#/$defs/CatalogModelRecord" }, title: "Payload", type: "array" } }, required: ["payload"], title: "ListModelsResponse", type: "object" }, Modalities: { additionalProperties: false, description: "Model input and output modalities.", properties: { input: { items: { anyOf: [{ $ref: "#/$defs/Input" }, { pattern: "^(text|image|audio|video|application)\\/[A-Za-z0-9.+-]+$", type: "string" }] }, title: "Input", type: "array" }, output: { items: { anyOf: [{ $ref: "#/$defs/Output" }, { pattern: "^(text|image|audio|video|application)\\/[A-Za-z0-9.+-]+$", type: "string" }] }, title: "Output", type: "array" } }, required: ["input", "output"], title: "Modalities", type: "object" }, ModelCatalog: { additionalProperties: false, description: "Published Databricks model catalog with identity, capabilities, availability, pricing, lifecycle, rankings, and benchmarks.", properties: { schema_version: { const: 16, title: "Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, models: { additionalProperties: { $ref: "#/$defs/CatalogModel" }, propertyNames: { minLength: 1 }, title: "Models", type: "object" } }, required: ["schema_version", "updated_at", "models"], title: "ModelCatalog", type: "object" }, Notice: { additionalProperties: false, description: "Important Databricks documentation notice.", properties: { kind: { anyOf: [{ $ref: "#/$defs/Kind" }, { minLength: 1, type: "string" }], title: "Kind" }, title: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Title" }, text: { title: "Text", type: "string" }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" } }, required: ["kind", "text", "sources"], title: "Notice", type: "object" }, Output: { description: "Known model input and output modalities.", enum: ["text", "image", "audio", "video", "application/pdf", "embedding", "reranking", "decision"], title: "Output", type: "string" }, Price: { additionalProperties: false, description: "Normalized Databricks price in one currency.", properties: { unit: { $ref: "#/$defs/Unit" }, rates: { additionalProperties: { minimum: 0, type: "number" }, propertyNames: { minLength: 1 }, title: "Rates", type: "object" } }, required: ["unit", "rates"], title: "Price", type: "object" }, ProblemDetails: { description: "An RFC 9457 problem details object, the payload of an error frame. See https://python.chanx.dev/en/latest/protocol.html#protocol-errors", properties: { type: { description: "A URI reference that identifies the problem type.", format: "uri-reference", type: "string" }, title: { description: "A short, human-readable summary of the problem type.", type: "string" }, status: { description: "The HTTP status code generated by the origin server for this occurrence of the problem.", maximum: 599, minimum: 100, type: "integer" }, detail: { description: "A human-readable explanation specific to this occurrence of the problem.", type: "string" }, instance: { description: "A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.", format: "uri-reference", type: "string" }, errors: { description: "The validation failures, when type is validation-failed.", items: { $ref: "#/$defs/ValidationFailure" }, type: "array" } }, required: ["type", "title", "detail"], title: "ProblemDetails", type: "object" }, Rankings: { additionalProperties: false, description: "Competitive ranking based on human preference ratings.", properties: { domain: { title: "Domain", type: "string" }, category: { title: "Category", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" }, metric: { const: "rating", title: "Metric", type: "string" }, rating: { title: "Rating", type: "number" }, lower: { title: "Lower", type: "number" }, upper: { title: "Upper", type: "number" }, variance: { minimum: 0, title: "Variance", type: "number" }, votes: { maximum: 9007199254740991, minimum: 0, title: "Votes", type: "integer" } }, required: ["domain", "category", "rank", "sources", "metric", "rating", "lower", "upper", "variance", "votes"], title: "Rankings", type: "object" }, Rankings1: { additionalProperties: false, description: "Competitive ranking based on a scored evaluation.", properties: { domain: { title: "Domain", type: "string" }, category: { title: "Category", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant1" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" }, metric: { const: "score", title: "Metric", type: "string" }, score: { title: "Score", type: "number" }, lower: { title: "Lower", type: "number" }, upper: { title: "Upper", type: "number" }, observations: { maximum: 9007199254740991, minimum: 0, title: "Observations", type: "integer" }, sessions: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Sessions" } }, required: ["domain", "category", "rank", "sources", "metric", "score", "lower", "upper", "observations", "sessions"], title: "Rankings1", type: "object" }, RateLimits: { additionalProperties: false, description: "Published pay-per-token limits for one model.", properties: { input_tokens_per_minute: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Input Tokens Per Minute" }, output_tokens_per_minute: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Output Tokens Per Minute" }, queries_per_hour: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Queries Per Hour" } }, required: ["input_tokens_per_minute", "output_tokens_per_minute", "queries_per_hour"], title: "RateLimits", type: "object" }, Reasoning: { additionalProperties: false, description: "Reasoning support and controls when known.", properties: { supported: { const: false, title: "Supported", type: "boolean" } }, required: ["supported"], title: "Reasoning", type: "object" }, Reasoning1: { additionalProperties: false, description: "Reasoning support and controls when known.", properties: { supported: { const: true, title: "Supported", type: "boolean" }, effort: { anyOf: [{ items: { $ref: "#/$defs/EffortEnum" }, type: "array" }, { type: "null" }], default: null, title: "Effort" }, default_effort: { anyOf: [{ $ref: "#/$defs/DefaultEffort" }, { type: "null" }], default: null }, toggle: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Toggle" }, budget: { anyOf: [{ $ref: "#/$defs/Budget" }, { type: "null" }], default: null }, description: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Description" } }, required: ["supported"], title: "Reasoning1", type: "object" }, ReasoningEffort: { description: "Reasoning effort used by the evaluated variant.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "ReasoningEffort", type: "string" }, ReasoningMode: { description: "Reasoning execution mode used by the evaluated variant.", enum: ["auto", "thinking"], title: "ReasoningMode", type: "string" }, Retirement: { additionalProperties: false, description: "Databricks retirement and replacement information.", properties: { schedules: { items: { $ref: "#/$defs/Schedule" }, title: "Schedules", type: "array" }, replacement: { anyOf: [{ minLength: 1, type: "string" }, { type: "null" }], default: null, title: "Replacement" }, replacement_name: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Replacement Name" } }, required: ["schedules"], title: "Retirement", type: "object" }, Schedule: { additionalProperties: false, description: "Retirement dates for one serving offering.", properties: { offering: { title: "Offering", type: "string" }, dates: { items: { format: "date", type: "string" }, title: "Dates", type: "array" } }, required: ["offering", "dates"], title: "Schedule", type: "object" }, ServingMode: { description: "Databricks serving mode available for the model.", enum: ["pay_per_token", "priority_pay_per_token", "provisioned_throughput", "batch"], title: "ServingMode", type: "string" }, SourceLink: { additionalProperties: false, description: "Openable attribution for published catalog data.", properties: { label: { minLength: 1, title: "Label", type: "string" }, url: { minLength: 1, pattern: "^https?://", title: "Url", type: "string" } }, required: ["label", "url"], title: "SourceLink", type: "object" }, Status: { description: "Current normalized lifecycle state.", enum: ["active", "preview", "alpha", "beta", "legacy", "deprecated", "retired"], title: "Status", type: "string" }, Status1: { description: "Lifecycle state for this cloud-provider deployment.", enum: ["active", "preview", "alpha", "beta", "legacy", "deprecated", "retired"], title: "Status1", type: "string" }, StreamModelsRequest: { properties: { action: { const: "stream_models", default: "stream_models", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "StreamModelsRequest", type: "object" }, StreamModelsResponse: { properties: { action: { const: "model", default: "model", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogModelRecord" } }, required: ["payload"], title: "StreamModelsResponse", type: "object" }, Type: { description: "Normalized model type.", enum: ["chat", "image", "video", "embedding", "reranking", "decision", "transcription", "speech", "realtime", "extraction", "audio"], title: "Type", type: "string" }, Unit: { description: "Quantity to which the rates apply.", enum: ["per_million_tokens", "per_hour", "per_hour_per_50_model_units"], title: "Unit", type: "string" }, ValidationFailure: { description: "One validation failure, shaped like RFC 9457's validation example.", properties: { keyword: { description: "The JSON Schema keyword that failed, or custom.", type: "string" }, pointer: { description: "A JSON Pointer to the failing value in the frame; for required, the object lacking the member.", type: "string" }, detail: { description: "A human-readable message.", type: "string" }, property: { anyOf: [{ type: "string" }, { type: "integer" }], description: "For required only: the missing member." } }, required: ["keyword", "pointer", "detail"], title: "ValidationFailure", type: "object" }, Variant: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant", type: "object" }, Variant1: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant1", type: "object" }, Variant2: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant2", type: "object" } } };
|
|
542
|
-
var CATALOG_SEARCH_INDEX_JSON_SCHEMA = { additionalProperties: false, properties: { schema_version: { title: "Schema Version", type: "integer" }, catalog_schema_version: { title: "Catalog Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, weights: { $ref: "#/$defs/CatalogSearchWeights" }, documents: { items: { $ref: "#/$defs/CatalogSearchIndexDocument" }, title: "Documents", type: "array" } }, required: ["schema_version", "catalog_schema_version", "updated_at", "weights", "documents"], title: "CatalogSearchIndexPayload", type: "object", $defs: { Availability: { additionalProperties: false, description: "Model availability on one Databricks cloud provider.", properties: { status: { $ref: "#/$defs/Status1" }, serving_modes: { items: { $ref: "#/$defs/ServingMode" }, title: "Serving Modes", type: "array" }, details: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Details" } }, required: ["status", "serving_modes"], title: "Availability", type: "object" }, AveragePrice: { additionalProperties: false, description: "Normalized Databricks price in one currency.", properties: { unit: { $ref: "#/$defs/Unit" }, rates: { additionalProperties: { minimum: 0, type: "number" }, propertyNames: { minLength: 1 }, title: "Rates", type: "object" } }, required: ["unit", "rates"], title: "AveragePrice", type: "object" }, Benchmark: { additionalProperties: false, description: "Task-suite benchmark result.", properties: { name: { title: "Name", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, score: { title: "Score", type: "number" }, task_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Task Count", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant2" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" } }, required: ["name", "rank", "score", "task_count", "sources"], title: "Benchmark", type: "object" }, Budget: { additionalProperties: false, description: "Supported reasoning-token budget range.", properties: { min: { anyOf: [{ maximum: 9007199254740991, minimum: -9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Min" }, max: { anyOf: [{ maximum: 9007199254740991, minimum: -9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Max" } }, title: "Budget", type: "object" }, Capabilities: { additionalProperties: false, description: "Capabilities used to select the model for a workload.", properties: { attachments: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Attachments" }, tools: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Tools" }, structured_output: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Structured Output" }, temperature: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Temperature" }, interleaved_reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Interleaved Reasoning" }, responses: { title: "Responses", type: "boolean" }, apply_patch: { title: "Apply Patch", type: "boolean" }, web_search: { title: "Web Search", type: "boolean" }, reasoning: { anyOf: [{ $ref: "#/$defs/Reasoning" }, { $ref: "#/$defs/Reasoning1" }, { type: "null" }], default: null, title: "Reasoning" } }, required: ["responses", "apply_patch", "web_search"], title: "Capabilities", type: "object" }, CatalogFilters: { additionalProperties: false, properties: { query: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Query" }, status: { items: { $ref: "#/$defs/Status" }, title: "Status", type: "array" }, type: { items: { $ref: "#/$defs/Type" }, title: "Type", type: "array" }, publisher: { items: { type: "string" }, title: "Publisher", type: "array" }, task: { items: { type: "string" }, title: "Task", type: "array" }, capability: { items: { enum: ["apply-patch", "attachments", "reasoning", "responses", "structured-output", "tools", "web-search"], type: "string" }, title: "Capability", type: "array" }, limit: { anyOf: [{ maximum: 1000, minimum: 0, type: "integer" }, { type: "null" }], default: 50, title: "Limit" } }, title: "CatalogFilters", type: "object" }, CatalogModel: { additionalProperties: false, description: "Published statistics for one Databricks model.", properties: { name: { title: "Name", type: "string" }, description: { title: "Description", type: "string" }, aliases: { items: { type: "string" }, title: "Aliases", type: "array" }, type: { $ref: "#/$defs/Type" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, publisher: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Publisher" }, license: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "License" }, open_weights: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Open Weights" }, status: { $ref: "#/$defs/Status" }, release_date: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Release Date" }, last_updated: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Last Updated" }, knowledge_cutoff: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Knowledge Cutoff" }, retirement: { anyOf: [{ $ref: "#/$defs/Retirement" }, { type: "null" }], default: null }, modalities: { $ref: "#/$defs/Modalities" }, capabilities: { $ref: "#/$defs/Capabilities" }, limits: { anyOf: [{ $ref: "#/$defs/Limits" }, { type: "null" }], default: null }, rate_limits: { anyOf: [{ $ref: "#/$defs/RateLimits" }, { type: "null" }], default: null }, latency: { anyOf: [{ $ref: "#/$defs/Latency" }, { type: "null" }], default: null }, tasks: { items: { type: "string" }, title: "Tasks", type: "array" }, use_cases: { items: { type: "string" }, title: "Use Cases", type: "array" }, availability: { additionalProperties: { $ref: "#/$defs/Availability" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Availability", type: "object" }, price: { additionalProperties: { additionalProperties: { $ref: "#/$defs/Price" }, propertyNames: { enum: ["DBU", "USD"] }, type: "object" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Price", type: "object" }, average_price: { additionalProperties: { $ref: "#/$defs/AveragePrice" }, propertyNames: { enum: ["DBU", "USD"] }, title: "Average Price", type: "object" }, sources: { additionalProperties: { items: { $ref: "#/$defs/SourceLink" }, type: "array" }, propertyNames: { minLength: 1 }, title: "Sources", type: "object" }, notices: { items: { $ref: "#/$defs/Notice" }, title: "Notices", type: "array" }, rankings: { items: { anyOf: [{ $ref: "#/$defs/Rankings" }, { $ref: "#/$defs/Rankings1" }] }, title: "Rankings", type: "array" }, benchmarks: { items: { $ref: "#/$defs/Benchmark" }, title: "Benchmarks", type: "array" } }, required: ["name", "description", "aliases", "type", "status", "modalities", "capabilities", "tasks", "use_cases", "availability", "price", "average_price", "sources", "notices", "rankings", "benchmarks"], title: "CatalogModel", type: "object" }, CatalogModelRecord: { additionalProperties: false, properties: { name: { title: "Name", type: "string" }, description: { title: "Description", type: "string" }, aliases: { items: { type: "string" }, title: "Aliases", type: "array" }, type: { $ref: "#/$defs/Type" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, publisher: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Publisher" }, license: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "License" }, open_weights: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Open Weights" }, status: { $ref: "#/$defs/Status" }, release_date: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Release Date" }, last_updated: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Last Updated" }, knowledge_cutoff: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Knowledge Cutoff" }, retirement: { anyOf: [{ $ref: "#/$defs/Retirement" }, { type: "null" }], default: null }, modalities: { $ref: "#/$defs/Modalities" }, capabilities: { $ref: "#/$defs/Capabilities" }, limits: { anyOf: [{ $ref: "#/$defs/Limits" }, { type: "null" }], default: null }, rate_limits: { anyOf: [{ $ref: "#/$defs/RateLimits" }, { type: "null" }], default: null }, latency: { anyOf: [{ $ref: "#/$defs/Latency" }, { type: "null" }], default: null }, tasks: { items: { type: "string" }, title: "Tasks", type: "array" }, use_cases: { items: { type: "string" }, title: "Use Cases", type: "array" }, availability: { additionalProperties: { $ref: "#/$defs/Availability" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Availability", type: "object" }, price: { additionalProperties: { additionalProperties: { $ref: "#/$defs/Price" }, propertyNames: { enum: ["DBU", "USD"] }, type: "object" }, propertyNames: { enum: ["aws", "azure", "gcp"] }, title: "Price", type: "object" }, average_price: { additionalProperties: { $ref: "#/$defs/AveragePrice" }, propertyNames: { enum: ["DBU", "USD"] }, title: "Average Price", type: "object" }, sources: { additionalProperties: { items: { $ref: "#/$defs/SourceLink" }, type: "array" }, propertyNames: { minLength: 1 }, title: "Sources", type: "object" }, notices: { items: { $ref: "#/$defs/Notice" }, title: "Notices", type: "array" }, rankings: { items: { anyOf: [{ $ref: "#/$defs/Rankings" }, { $ref: "#/$defs/Rankings1" }] }, title: "Rankings", type: "array" }, benchmarks: { items: { $ref: "#/$defs/Benchmark" }, title: "Benchmarks", type: "array" }, id: { minLength: 1, title: "Id", type: "string" } }, required: ["name", "description", "aliases", "type", "status", "modalities", "capabilities", "tasks", "use_cases", "availability", "price", "average_price", "sources", "notices", "rankings", "benchmarks", "id"], title: "CatalogModelRecord", type: "object" }, CatalogSearchIndexDocument: { additionalProperties: false, properties: { id: { title: "Id", type: "string" }, exact_identities: { items: { type: "string" }, title: "Exact Identities", type: "array" }, identities: { items: { type: "string" }, title: "Identities", type: "array" }, keywords: { title: "Keywords", type: "string" }, description: { title: "Description", type: "string" }, tokens: { items: { type: "string" }, title: "Tokens", type: "array" }, family: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Family" }, version: { items: { type: "integer" }, title: "Version", type: "array" }, quality_score: { maximum: 100, minimum: 0, title: "Quality Score", type: "number" }, scores: { $ref: "#/$defs/CatalogSearchQualityScores" } }, required: ["id", "exact_identities", "identities", "keywords", "description", "tokens", "version", "quality_score", "scores"], title: "CatalogSearchIndexDocument", type: "object" }, CatalogSearchIndexPayload: { additionalProperties: false, properties: { schema_version: { title: "Schema Version", type: "integer" }, catalog_schema_version: { title: "Catalog Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, weights: { $ref: "#/$defs/CatalogSearchWeights" }, documents: { items: { $ref: "#/$defs/CatalogSearchIndexDocument" }, title: "Documents", type: "array" } }, required: ["schema_version", "catalog_schema_version", "updated_at", "weights", "documents"], title: "CatalogSearchIndexPayload", type: "object" }, CatalogSearchQualityScores: { additionalProperties: false, properties: { leaderboard: { maximum: 100, minimum: 0, title: "Leaderboard", type: "number" }, benchmark: { maximum: 100, minimum: 0, title: "Benchmark", type: "number" }, version: { maximum: 100, minimum: 0, title: "Version", type: "number" }, freshness: { maximum: 100, minimum: 0, title: "Freshness", type: "number" }, lifecycle: { maximum: 100, minimum: 0, title: "Lifecycle", type: "number" } }, required: ["leaderboard", "benchmark", "version", "freshness", "lifecycle"], title: "CatalogSearchQualityScores", type: "object" }, CatalogSearchWeights: { additionalProperties: false, properties: { relevance: { title: "Relevance", type: "number" }, leaderboard: { title: "Leaderboard", type: "number" }, benchmark: { title: "Benchmark", type: "number" }, version: { title: "Version", type: "number" }, freshness: { title: "Freshness", type: "number" }, lifecycle: { title: "Lifecycle", type: "number" } }, required: ["relevance", "leaderboard", "benchmark", "version", "freshness", "lifecycle"], title: "CatalogSearchWeights", type: "object" }, DefaultEffort: { description: "Default reasoning effort when no level is specified.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "DefaultEffort", type: "string" }, EffortEnum: { description: "Normalized reasoning effort level.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "EffortEnum", type: "string" }, GetCatalogRequest: { properties: { action: { const: "get_catalog", default: "get_catalog", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "GetCatalogRequest", type: "object" }, GetCatalogResponse: { properties: { action: { const: "catalog", default: "catalog", title: "Action", type: "string" }, payload: { $ref: "#/$defs/ModelCatalog" } }, required: ["payload"], title: "GetCatalogResponse", type: "object" }, GetSearchIndexRequest: { properties: { action: { const: "get_search_index", default: "get_search_index", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "GetSearchIndexRequest", type: "object" }, GetSearchIndexResponse: { properties: { action: { const: "search_index", default: "search_index", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogSearchIndexPayload" } }, required: ["payload"], title: "GetSearchIndexResponse", type: "object" }, Input: { description: "Known model input and output modalities.", enum: ["text", "image", "audio", "video", "application/pdf", "embedding", "reranking", "decision"], title: "Input", type: "string" }, Kind: { description: "Known Databricks documentation notice kinds.", enum: ["note", "important", "warning", "tip", "caution", "info"], title: "Kind", type: "string" }, Latency: { additionalProperties: false, description: "Normalized response-time score and public benchmark measurements.", properties: { score: { exclusiveMinimum: 0, title: "Score", type: "number" }, measurements: { $ref: "#/$defs/LatencyMeasurements" } }, required: ["score", "measurements"], title: "Latency", type: "object" }, LatencyMeasurements: { additionalProperties: false, description: "Public benchmark measurements underlying one latency score.", properties: { time_to_first_token_ms: { minimum: 0, title: "Time To First Token Ms", type: "number" }, output_tokens_per_second: { exclusiveMinimum: 0, title: "Output Tokens Per Second", type: "number" }, successful_run_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Successful Run Count", type: "integer" }, completion_token_count: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Completion Token Count", type: "integer" }, measured_at: { format: "date-time", title: "Measured At", type: "string" } }, required: ["time_to_first_token_ms", "output_tokens_per_second", "successful_run_count", "completion_token_count", "measured_at"], title: "LatencyMeasurements", type: "object" }, Limits: { additionalProperties: false, description: "Documented token limits.", properties: { context: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Context" }, input: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Input" }, output: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], default: null, title: "Output" } }, title: "Limits", type: "object" }, ListModelsRequest: { properties: { action: { const: "list_models", default: "list_models", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "ListModelsRequest", type: "object" }, ListModelsResponse: { properties: { action: { const: "models", default: "models", title: "Action", type: "string" }, payload: { items: { $ref: "#/$defs/CatalogModelRecord" }, title: "Payload", type: "array" } }, required: ["payload"], title: "ListModelsResponse", type: "object" }, Modalities: { additionalProperties: false, description: "Model input and output modalities.", properties: { input: { items: { anyOf: [{ $ref: "#/$defs/Input" }, { pattern: "^(text|image|audio|video|application)\\/[A-Za-z0-9.+-]+$", type: "string" }] }, title: "Input", type: "array" }, output: { items: { anyOf: [{ $ref: "#/$defs/Output" }, { pattern: "^(text|image|audio|video|application)\\/[A-Za-z0-9.+-]+$", type: "string" }] }, title: "Output", type: "array" } }, required: ["input", "output"], title: "Modalities", type: "object" }, ModelCatalog: { additionalProperties: false, description: "Published Databricks model catalog with identity, capabilities, availability, pricing, lifecycle, rankings, and benchmarks.", properties: { schema_version: { const: 16, title: "Schema Version", type: "integer" }, updated_at: { format: "date-time", title: "Updated At", type: "string" }, models: { additionalProperties: { $ref: "#/$defs/CatalogModel" }, propertyNames: { minLength: 1 }, title: "Models", type: "object" } }, required: ["schema_version", "updated_at", "models"], title: "ModelCatalog", type: "object" }, Notice: { additionalProperties: false, description: "Important Databricks documentation notice.", properties: { kind: { anyOf: [{ $ref: "#/$defs/Kind" }, { minLength: 1, type: "string" }], title: "Kind" }, title: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Title" }, text: { title: "Text", type: "string" }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" } }, required: ["kind", "text", "sources"], title: "Notice", type: "object" }, Output: { description: "Known model input and output modalities.", enum: ["text", "image", "audio", "video", "application/pdf", "embedding", "reranking", "decision"], title: "Output", type: "string" }, Price: { additionalProperties: false, description: "Normalized Databricks price in one currency.", properties: { unit: { $ref: "#/$defs/Unit" }, rates: { additionalProperties: { minimum: 0, type: "number" }, propertyNames: { minLength: 1 }, title: "Rates", type: "object" } }, required: ["unit", "rates"], title: "Price", type: "object" }, ProblemDetails: { description: "An RFC 9457 problem details object, the payload of an error frame. See https://python.chanx.dev/en/latest/protocol.html#protocol-errors", properties: { type: { description: "A URI reference that identifies the problem type.", format: "uri-reference", type: "string" }, title: { description: "A short, human-readable summary of the problem type.", type: "string" }, status: { description: "The HTTP status code generated by the origin server for this occurrence of the problem.", maximum: 599, minimum: 100, type: "integer" }, detail: { description: "A human-readable explanation specific to this occurrence of the problem.", type: "string" }, instance: { description: "A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.", format: "uri-reference", type: "string" }, errors: { description: "The validation failures, when type is validation-failed.", items: { $ref: "#/$defs/ValidationFailure" }, type: "array" } }, required: ["type", "title", "detail"], title: "ProblemDetails", type: "object" }, Rankings: { additionalProperties: false, description: "Competitive ranking based on human preference ratings.", properties: { domain: { title: "Domain", type: "string" }, category: { title: "Category", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" }, metric: { const: "rating", title: "Metric", type: "string" }, rating: { title: "Rating", type: "number" }, lower: { title: "Lower", type: "number" }, upper: { title: "Upper", type: "number" }, variance: { minimum: 0, title: "Variance", type: "number" }, votes: { maximum: 9007199254740991, minimum: 0, title: "Votes", type: "integer" } }, required: ["domain", "category", "rank", "sources", "metric", "rating", "lower", "upper", "variance", "votes"], title: "Rankings", type: "object" }, Rankings1: { additionalProperties: false, description: "Competitive ranking based on a scored evaluation.", properties: { domain: { title: "Domain", type: "string" }, category: { title: "Category", type: "string" }, rank: { exclusiveMinimum: 0, maximum: 9007199254740991, title: "Rank", type: "integer" }, published_at: { anyOf: [{ format: "date", type: "string" }, { type: "null" }], default: null, title: "Published At" }, variant: { anyOf: [{ $ref: "#/$defs/Variant1" }, { type: "null" }], default: null }, sources: { items: { $ref: "#/$defs/SourceLink" }, title: "Sources", type: "array" }, metric: { const: "score", title: "Metric", type: "string" }, score: { title: "Score", type: "number" }, lower: { title: "Lower", type: "number" }, upper: { title: "Upper", type: "number" }, observations: { maximum: 9007199254740991, minimum: 0, title: "Observations", type: "integer" }, sessions: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Sessions" } }, required: ["domain", "category", "rank", "sources", "metric", "score", "lower", "upper", "observations", "sessions"], title: "Rankings1", type: "object" }, RateLimits: { additionalProperties: false, description: "Published pay-per-token limits for one model.", properties: { input_tokens_per_minute: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Input Tokens Per Minute" }, output_tokens_per_minute: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Output Tokens Per Minute" }, queries_per_hour: { anyOf: [{ maximum: 9007199254740991, minimum: 0, type: "integer" }, { type: "null" }], title: "Queries Per Hour" } }, required: ["input_tokens_per_minute", "output_tokens_per_minute", "queries_per_hour"], title: "RateLimits", type: "object" }, Reasoning: { additionalProperties: false, description: "Reasoning support and controls when known.", properties: { supported: { const: false, title: "Supported", type: "boolean" } }, required: ["supported"], title: "Reasoning", type: "object" }, Reasoning1: { additionalProperties: false, description: "Reasoning support and controls when known.", properties: { supported: { const: true, title: "Supported", type: "boolean" }, effort: { anyOf: [{ items: { $ref: "#/$defs/EffortEnum" }, type: "array" }, { type: "null" }], default: null, title: "Effort" }, default_effort: { anyOf: [{ $ref: "#/$defs/DefaultEffort" }, { type: "null" }], default: null }, toggle: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Toggle" }, budget: { anyOf: [{ $ref: "#/$defs/Budget" }, { type: "null" }], default: null }, description: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Description" } }, required: ["supported"], title: "Reasoning1", type: "object" }, ReasoningEffort: { description: "Reasoning effort used by the evaluated variant.", enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max", "default"], title: "ReasoningEffort", type: "string" }, ReasoningMode: { description: "Reasoning execution mode used by the evaluated variant.", enum: ["auto", "thinking"], title: "ReasoningMode", type: "string" }, Retirement: { additionalProperties: false, description: "Databricks retirement and replacement information.", properties: { schedules: { items: { $ref: "#/$defs/Schedule" }, title: "Schedules", type: "array" }, replacement: { anyOf: [{ minLength: 1, type: "string" }, { type: "null" }], default: null, title: "Replacement" }, replacement_name: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Replacement Name" } }, required: ["schedules"], title: "Retirement", type: "object" }, Schedule: { additionalProperties: false, description: "Retirement dates for one serving offering.", properties: { offering: { title: "Offering", type: "string" }, dates: { items: { format: "date", type: "string" }, title: "Dates", type: "array" } }, required: ["offering", "dates"], title: "Schedule", type: "object" }, ServingMode: { description: "Databricks serving mode available for the model.", enum: ["pay_per_token", "priority_pay_per_token", "provisioned_throughput", "batch"], title: "ServingMode", type: "string" }, SourceLink: { additionalProperties: false, description: "Openable attribution for published catalog data.", properties: { label: { minLength: 1, title: "Label", type: "string" }, url: { minLength: 1, pattern: "^https?://", title: "Url", type: "string" } }, required: ["label", "url"], title: "SourceLink", type: "object" }, Status: { description: "Current normalized lifecycle state.", enum: ["active", "preview", "alpha", "beta", "legacy", "deprecated", "retired"], title: "Status", type: "string" }, Status1: { description: "Lifecycle state for this cloud-provider deployment.", enum: ["active", "preview", "alpha", "beta", "legacy", "deprecated", "retired"], title: "Status1", type: "string" }, StreamModelsRequest: { properties: { action: { const: "stream_models", default: "stream_models", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogFilters" } }, required: ["payload"], title: "StreamModelsRequest", type: "object" }, StreamModelsResponse: { properties: { action: { const: "model", default: "model", title: "Action", type: "string" }, payload: { $ref: "#/$defs/CatalogModelRecord" } }, required: ["payload"], title: "StreamModelsResponse", type: "object" }, Type: { description: "Normalized model type.", enum: ["chat", "image", "video", "embedding", "reranking", "decision", "transcription", "speech", "realtime", "extraction", "audio"], title: "Type", type: "string" }, Unit: { description: "Quantity to which the rates apply.", enum: ["per_million_tokens", "per_hour", "per_hour_per_50_model_units"], title: "Unit", type: "string" }, ValidationFailure: { description: "One validation failure, shaped like RFC 9457's validation example.", properties: { keyword: { description: "The JSON Schema keyword that failed, or custom.", type: "string" }, pointer: { description: "A JSON Pointer to the failing value in the frame; for required, the object lacking the member.", type: "string" }, detail: { description: "A human-readable message.", type: "string" }, property: { anyOf: [{ type: "string" }, { type: "integer" }], description: "For required only: the missing member." } }, required: ["keyword", "pointer", "detail"], title: "ValidationFailure", type: "object" }, Variant: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant", type: "object" }, Variant1: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant1", type: "object" }, Variant2: { additionalProperties: false, description: "Evaluated model variant when it differs from the base model.", properties: { reasoning: { anyOf: [{ type: "boolean" }, { type: "null" }], default: null, title: "Reasoning" }, reasoning_effort: { anyOf: [{ $ref: "#/$defs/ReasoningEffort" }, { type: "null" }], default: null }, reasoning_mode: { anyOf: [{ $ref: "#/$defs/ReasoningMode" }, { type: "null" }], default: null }, harness: { anyOf: [{ type: "string" }, { type: "null" }], default: null, title: "Harness" }, context: { anyOf: [{ exclusiveMinimum: 0, maximum: 9007199254740991, type: "integer" }, { type: "null" }], default: null, title: "Context" } }, title: "Variant2", type: "object" } } };
|
|
543
|
-
|
|
544
|
-
// src/validation.ts
|
|
545
|
-
function modelCatalogDefinitionSchema(definition) {
|
|
546
|
-
return z.fromJSONSchema({
|
|
547
|
-
...MODEL_CATALOG_JSON_SCHEMA.$defs[definition],
|
|
548
|
-
$defs: MODEL_CATALOG_JSON_SCHEMA.$defs
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
var ModelCatalogSchema = z.fromJSONSchema(MODEL_CATALOG_JSON_SCHEMA);
|
|
552
|
-
var CatalogSearchIndexSchema = z.fromJSONSchema(CATALOG_SEARCH_INDEX_JSON_SCHEMA);
|
|
553
|
-
var CatalogModelSchema = modelCatalogDefinitionSchema("CatalogModel");
|
|
554
|
-
var CatalogModelRecordSchema = modelCatalogDefinitionSchema("CatalogModelRecord");
|
|
555
|
-
var CatalogCapabilitiesSchema = modelCatalogDefinitionSchema("Capabilities");
|
|
556
|
-
var CatalogRateLimitsSchema = modelCatalogDefinitionSchema("RateLimits");
|
|
557
|
-
var CatalogLatencySchema = modelCatalogDefinitionSchema("Latency");
|
|
558
|
-
var CatalogPriceSchema = modelCatalogDefinitionSchema("Price");
|
|
559
|
-
var CatalogAveragePriceSchema = modelCatalogDefinitionSchema("AveragePrice");
|
|
560
|
-
var CatalogPreferenceRankingSchema = modelCatalogDefinitionSchema("Rankings");
|
|
561
|
-
var CatalogScoreRankingSchema = modelCatalogDefinitionSchema("Rankings1");
|
|
562
|
-
var CatalogRankingSchema = z.union([
|
|
563
|
-
CatalogPreferenceRankingSchema,
|
|
564
|
-
CatalogScoreRankingSchema
|
|
565
|
-
]);
|
|
566
|
-
var CatalogStatusSchema = modelCatalogDefinitionSchema("Status");
|
|
567
|
-
function parseModelCatalog(value) {
|
|
568
|
-
return ModelCatalogSchema.parse(value);
|
|
569
|
-
}
|
|
570
|
-
function parseCatalogSearchIndex(value) {
|
|
571
|
-
return CatalogSearchIndexSchema.parse(value);
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
// src/browser.ts
|
|
575
|
-
async function loadModelCatalog(options = {}) {
|
|
576
|
-
const index = await loadModelCatalogIndex(options);
|
|
577
|
-
return createModelCatalogClient(index.catalog, index.searchIndex);
|
|
578
|
-
}
|
|
579
|
-
async function loadModelCatalogIndex(options = {}) {
|
|
580
|
-
const loader = options.fetch ?? globalThis.fetch;
|
|
581
|
-
const catalogUrl = options.catalogUrl ?? PUBLISHED_CATALOG_URL;
|
|
582
|
-
const searchIndexUrl = options.searchIndexUrl ?? (options.catalogUrl ? new URL("search-index.json", options.catalogUrl).toString() : PUBLISHED_CATALOG_SEARCH_INDEX_URL);
|
|
583
|
-
const [catalogResponse, searchIndexResponse] = await Promise.all([
|
|
584
|
-
loader(catalogUrl),
|
|
585
|
-
loader(searchIndexUrl)
|
|
586
|
-
]);
|
|
587
|
-
if (!catalogResponse.ok)
|
|
588
|
-
throw new Error(`Catalog request failed with ${catalogResponse.status}`);
|
|
589
|
-
if (!searchIndexResponse.ok) {
|
|
590
|
-
throw new Error(`Search index request failed with ${searchIndexResponse.status}`);
|
|
591
|
-
}
|
|
592
|
-
return createModelCatalogIndex(parseModelCatalog(await catalogResponse.json()), parseCatalogSearchIndex(await searchIndexResponse.json()));
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
// src/index.ts
|
|
596
|
-
var packageRootUrl = new URL("..", import.meta.url);
|
|
597
|
-
var packageRoot = fileURLToPath(packageRootUrl);
|
|
598
|
-
async function connectModelCatalog(input) {
|
|
599
|
-
const options = typeof input === "string" ? { catalogUrl: input } : input ?? {};
|
|
600
|
-
const configuredPath = options.catalogPath ?? process.env.DBX_MODEL_CATALOG_PATH;
|
|
601
|
-
const configuredUrl = options.catalogUrl?.trim() || undefined;
|
|
602
|
-
if (configuredUrl?.startsWith("ws:") || configuredUrl?.startsWith("wss:")) {
|
|
603
|
-
throw new Error("WebSocket connections use @dbx-tools/dbx-model-catalog/pynect");
|
|
604
|
-
}
|
|
605
|
-
const loaded = configuredPath ? await loadFiles(configuredPath, options.searchIndexPath) : await loadUrls(configuredUrl, options.searchIndexUrl, options.fetch);
|
|
606
|
-
const client = createModelCatalogClient(loaded.catalog, loaded.searchIndex);
|
|
607
|
-
const close = async () => {
|
|
608
|
-
client.close();
|
|
609
|
-
};
|
|
610
|
-
return {
|
|
611
|
-
client,
|
|
612
|
-
mode: configuredPath ? "file" : configuredUrl ? "url" : "published",
|
|
613
|
-
root: packageRoot,
|
|
614
|
-
source: loaded.source,
|
|
615
|
-
close,
|
|
616
|
-
async[Symbol.asyncDispose]() {
|
|
617
|
-
await close();
|
|
618
|
-
}
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
async function loadFiles(catalogPath, searchIndexPath) {
|
|
622
|
-
const resolvedCatalogPath = resolve(catalogPath);
|
|
623
|
-
const resolvedSearchIndexPath = resolve(searchIndexPath ?? resolve(dirname(resolvedCatalogPath), "search-index.json"));
|
|
624
|
-
const [catalog, searchIndex] = await Promise.all([
|
|
625
|
-
readFile(resolvedCatalogPath, "utf8").then((value) => parseModelCatalog(JSON.parse(value))),
|
|
626
|
-
readFile(resolvedSearchIndexPath, "utf8").then((value) => parseCatalogSearchIndex(JSON.parse(value)))
|
|
627
|
-
]);
|
|
628
|
-
return { catalog, searchIndex, source: resolvedCatalogPath };
|
|
629
|
-
}
|
|
630
|
-
async function loadUrls(catalogUrl, searchIndexUrl, fetcher = globalThis.fetch) {
|
|
631
|
-
const source = catalogUrl ?? PUBLISHED_CATALOG_URL;
|
|
632
|
-
const indexSource = searchIndexUrl ?? (catalogUrl ? new URL("search-index.json", catalogUrl).toString() : PUBLISHED_CATALOG_SEARCH_INDEX_URL);
|
|
633
|
-
const [catalogResponse, searchIndexResponse] = await Promise.all([
|
|
634
|
-
fetcher(source),
|
|
635
|
-
fetcher(indexSource)
|
|
636
|
-
]);
|
|
637
|
-
if (!catalogResponse.ok)
|
|
638
|
-
throw new Error(`Catalog request failed with ${catalogResponse.status}`);
|
|
639
|
-
if (!searchIndexResponse.ok) {
|
|
640
|
-
throw new Error(`Search index request failed with ${searchIndexResponse.status}`);
|
|
641
|
-
}
|
|
642
|
-
return {
|
|
643
|
-
catalog: parseModelCatalog(await catalogResponse.json()),
|
|
644
|
-
searchIndex: parseCatalogSearchIndex(await searchIndexResponse.json()),
|
|
645
|
-
source
|
|
646
|
-
};
|
|
647
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
ModelCatalogSchema2,
|
|
3
|
+
CatalogSearchIndexSchema2,
|
|
4
|
+
CatalogModelSchema2,
|
|
5
|
+
CatalogModelRecordSchema2,
|
|
6
|
+
CatalogCapabilitiesSchema2,
|
|
7
|
+
CatalogRateLimitsSchema2,
|
|
8
|
+
CatalogLatencySchema2,
|
|
9
|
+
CatalogPriceSchema2,
|
|
10
|
+
CatalogAveragePriceSchema2,
|
|
11
|
+
CatalogPreferenceRankingSchema2,
|
|
12
|
+
CatalogScoreRankingSchema2,
|
|
13
|
+
CatalogRankingSchema2,
|
|
14
|
+
CatalogStatusSchema2,
|
|
15
|
+
EffectiveModelCatalogSchema2,
|
|
16
|
+
WorkspaceRefreshSchema2,
|
|
17
|
+
parseModelCatalog2,
|
|
18
|
+
parseCatalogSearchIndex2,
|
|
19
|
+
parseCatalogModelRecord2,
|
|
20
|
+
parseEffectiveModelCatalog2,
|
|
21
|
+
EFFECTIVE_CATALOG_CONTRACT_VERSION2,
|
|
22
|
+
PUBLISHED_CATALOG_SCHEMA_VERSION2,
|
|
23
|
+
PUBLISHED_CATALOG_ROOT_URL2,
|
|
24
|
+
PUBLISHED_CATALOG_INDEX_URL2,
|
|
25
|
+
PUBLISHED_CATALOG_SCHEMA_URL2,
|
|
26
|
+
PUBLISHED_CATALOG_URL2,
|
|
27
|
+
PUBLISHED_CATALOG_SEARCH_INDEX_URL2,
|
|
28
|
+
PUBLISHED_CATALOG_DATABASE_URL2,
|
|
29
|
+
createPersistentWorkspaceCatalogCache2,
|
|
30
|
+
createModelCatalogClient2
|
|
31
|
+
} from "./chunk-gzjer0mc.js";
|
|
648
32
|
export {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
33
|
+
CatalogAveragePriceSchema2 as CatalogAveragePriceSchema,
|
|
34
|
+
CatalogCapabilitiesSchema2 as CatalogCapabilitiesSchema,
|
|
35
|
+
CatalogLatencySchema2 as CatalogLatencySchema,
|
|
36
|
+
CatalogModelRecordSchema2 as CatalogModelRecordSchema,
|
|
37
|
+
CatalogModelSchema2 as CatalogModelSchema,
|
|
38
|
+
CatalogPreferenceRankingSchema2 as CatalogPreferenceRankingSchema,
|
|
39
|
+
CatalogPriceSchema2 as CatalogPriceSchema,
|
|
40
|
+
CatalogRankingSchema2 as CatalogRankingSchema,
|
|
41
|
+
CatalogRateLimitsSchema2 as CatalogRateLimitsSchema,
|
|
42
|
+
CatalogScoreRankingSchema2 as CatalogScoreRankingSchema,
|
|
43
|
+
CatalogSearchIndexSchema2 as CatalogSearchIndexSchema,
|
|
44
|
+
CatalogStatusSchema2 as CatalogStatusSchema,
|
|
45
|
+
EFFECTIVE_CATALOG_CONTRACT_VERSION2 as EFFECTIVE_CATALOG_CONTRACT_VERSION,
|
|
46
|
+
EffectiveModelCatalogSchema2 as EffectiveModelCatalogSchema,
|
|
47
|
+
ModelCatalogSchema2 as ModelCatalogSchema,
|
|
48
|
+
PUBLISHED_CATALOG_DATABASE_URL2 as PUBLISHED_CATALOG_DATABASE_URL,
|
|
49
|
+
PUBLISHED_CATALOG_INDEX_URL2 as PUBLISHED_CATALOG_INDEX_URL,
|
|
50
|
+
PUBLISHED_CATALOG_ROOT_URL2 as PUBLISHED_CATALOG_ROOT_URL,
|
|
51
|
+
PUBLISHED_CATALOG_SCHEMA_URL2 as PUBLISHED_CATALOG_SCHEMA_URL,
|
|
52
|
+
PUBLISHED_CATALOG_SCHEMA_VERSION2 as PUBLISHED_CATALOG_SCHEMA_VERSION,
|
|
53
|
+
PUBLISHED_CATALOG_SEARCH_INDEX_URL2 as PUBLISHED_CATALOG_SEARCH_INDEX_URL,
|
|
54
|
+
PUBLISHED_CATALOG_URL2 as PUBLISHED_CATALOG_URL,
|
|
55
|
+
WorkspaceRefreshSchema2 as WorkspaceRefreshSchema,
|
|
56
|
+
createModelCatalogClient2 as createModelCatalogClient,
|
|
57
|
+
createPersistentWorkspaceCatalogCache2 as createPersistentWorkspaceCatalogCache,
|
|
58
|
+
parseCatalogModelRecord2 as parseCatalogModelRecord,
|
|
59
|
+
parseCatalogSearchIndex2 as parseCatalogSearchIndex,
|
|
60
|
+
parseEffectiveModelCatalog2 as parseEffectiveModelCatalog,
|
|
61
|
+
parseModelCatalog2 as parseModelCatalog
|
|
662
62
|
};
|