@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/cli.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
+
import {
|
|
3
|
+
createModelCatalogClient2
|
|
4
|
+
} from "./chunk-gzjer0mc.js";
|
|
2
5
|
var __dispose = Symbol.dispose || /* @__PURE__ */ Symbol.for("Symbol.dispose");
|
|
3
6
|
var __asyncDispose = Symbol.asyncDispose || /* @__PURE__ */ Symbol.for("Symbol.asyncDispose");
|
|
4
7
|
var __using = (stack, value, async) => {
|
|
@@ -37,654 +40,6 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
37
40
|
return next();
|
|
38
41
|
};
|
|
39
42
|
|
|
40
|
-
// src/index.ts
|
|
41
|
-
import { readFile } from "node:fs/promises";
|
|
42
|
-
import { dirname, resolve } from "node:path";
|
|
43
|
-
import { fileURLToPath } from "node:url";
|
|
44
|
-
|
|
45
|
-
// src/_generated/published.ts
|
|
46
|
-
var PUBLISHED_CATALOG_SCHEMA_VERSION = 16;
|
|
47
|
-
var PUBLISHED_CATALOG_ROOT_URL = "https://raw.githubusercontent.com/reggie-db/dbx-model-catalog/main/packages/js/web";
|
|
48
|
-
var PUBLISHED_CATALOG_INDEX_URL = `${PUBLISHED_CATALOG_ROOT_URL}/catalog/index.json`;
|
|
49
|
-
var PUBLISHED_CATALOG_SCHEMA_URL = `${PUBLISHED_CATALOG_ROOT_URL}/catalog/v${PUBLISHED_CATALOG_SCHEMA_VERSION}`;
|
|
50
|
-
var PUBLISHED_CATALOG_URL = `${PUBLISHED_CATALOG_SCHEMA_URL}/catalog.json`;
|
|
51
|
-
var PUBLISHED_CATALOG_SEARCH_INDEX_URL = `${PUBLISHED_CATALOG_SCHEMA_URL}/search-index.json`;
|
|
52
|
-
var PUBLISHED_CATALOG_DATABASE_URL = `${PUBLISHED_CATALOG_SCHEMA_URL}/catalog.sqlite`;
|
|
53
|
-
|
|
54
|
-
// src/identity.ts
|
|
55
|
-
var providerPrefixes = new Set([
|
|
56
|
-
"alibaba",
|
|
57
|
-
"anthropic",
|
|
58
|
-
"deepseek",
|
|
59
|
-
"google",
|
|
60
|
-
"meta",
|
|
61
|
-
"moonshot",
|
|
62
|
-
"openai",
|
|
63
|
-
"xai",
|
|
64
|
-
"zhipu"
|
|
65
|
-
]);
|
|
66
|
-
function normalizeModelIdentity(value) {
|
|
67
|
-
return value.trim().toLowerCase().replace(/^system\.ai[.-]/, "").replace(/^databricks-/, "").replace(/([a-z])(\d)/g, "$1-$2").replace(/(\d)([a-z])/g, "$1-$2").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
68
|
-
}
|
|
69
|
-
function modelIdentities(record) {
|
|
70
|
-
const identities = [record.id, ...record.aliases];
|
|
71
|
-
return identities.map((value, index) => {
|
|
72
|
-
if (index === 0 || value.startsWith("databricks-"))
|
|
73
|
-
return { kind: "endpoint", value };
|
|
74
|
-
if (value.startsWith("system.ai."))
|
|
75
|
-
return { kind: "model-service", value };
|
|
76
|
-
const separator = value.indexOf("/");
|
|
77
|
-
if (separator > 0 && providerPrefixes.has(value.slice(0, separator).toLowerCase())) {
|
|
78
|
-
return {
|
|
79
|
-
kind: "provider",
|
|
80
|
-
provider: value.slice(0, separator).toLowerCase(),
|
|
81
|
-
value
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
return { kind: "alias", value };
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// src/search.ts
|
|
89
|
-
var neutralScore = 50;
|
|
90
|
-
var statusPriority = new Map([
|
|
91
|
-
"active",
|
|
92
|
-
"preview",
|
|
93
|
-
"beta",
|
|
94
|
-
"alpha",
|
|
95
|
-
"legacy",
|
|
96
|
-
"deprecated",
|
|
97
|
-
"retired"
|
|
98
|
-
].map((status, index) => [status, index]));
|
|
99
|
-
var tokenPattern = /[a-z]+|\d+/g;
|
|
100
|
-
var versionPattern = /(?:^|[^a-z0-9])(\d+)(?:[.\-_](\d+))?(?:[.\-_](\d+))?(?![a-z0-9])/i;
|
|
101
|
-
function searchCatalogRecords(index, models, query, limit = 50) {
|
|
102
|
-
return searchCatalogMatches(index, models, query, limit).map((match) => match.record);
|
|
103
|
-
}
|
|
104
|
-
function searchCatalogMatches(index, models, query, limit = 50) {
|
|
105
|
-
const normalizedQuery = normalizeSearch(query);
|
|
106
|
-
if (!normalizedQuery || limit === 0)
|
|
107
|
-
return [];
|
|
108
|
-
const queryTokens = tokens(normalizedQuery).filter((token) => !/^\d+$/.test(token));
|
|
109
|
-
const requestedVersion = version(query);
|
|
110
|
-
const documentById = new Map(index.documents.map((document) => [document.id, document]));
|
|
111
|
-
const referenceDate = index.updated_at.slice(0, 10);
|
|
112
|
-
const scored = models.flatMap((model) => {
|
|
113
|
-
const document = documentById.get(model.id);
|
|
114
|
-
if (!document)
|
|
115
|
-
return [];
|
|
116
|
-
const candidate = scoreRecord(model, document, index, normalizedQuery, queryTokens, requestedVersion, referenceDate);
|
|
117
|
-
return candidate ? [candidate] : [];
|
|
118
|
-
});
|
|
119
|
-
scored.sort((left, right) => compareScored(left, right, requestedVersion));
|
|
120
|
-
const results = scored.map(({ identityExact: _identityExact, releaseDate: _releaseDate, version: _version, ...candidate }) => candidate);
|
|
121
|
-
return limit === null ? results : results.slice(0, limit);
|
|
122
|
-
}
|
|
123
|
-
function scoreRecord(record, document, index, query, queryTokens, requestedVersion, referenceDate) {
|
|
124
|
-
const fields = searchFields(record);
|
|
125
|
-
const fieldScores = fields.map((field) => scoreField(field, query, new Set(queryTokens)));
|
|
126
|
-
const tokenScores = queryTokenScores(queryTokens, document.tokens);
|
|
127
|
-
if (!passesTokenGate(queryTokens, tokenScores, document.identities, requestedVersion.length > 0)) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
const relevance = Math.max(...fieldScores.map((item) => item.score), tokenScores.length ? mean(tokenScores) * 0.94 : 0);
|
|
131
|
-
if (relevance < 58)
|
|
132
|
-
return;
|
|
133
|
-
const leading = fieldScores.filter((item) => item.score >= relevance - 8);
|
|
134
|
-
const identityMatch = queryTokens.length > 0 && queryTokens.every((token) => document.identities.some((identity) => tokens(identity).includes(token))) || leading.some((item) => item.field.identity);
|
|
135
|
-
const identityExact = leading.some((item) => item.kind === "exact" && ["id", "name", "alias"].includes(item.field.name));
|
|
136
|
-
const quality = {
|
|
137
|
-
leaderboard: leaderboardScore(record, queryTokens, referenceDate),
|
|
138
|
-
benchmark: benchmarkScore(record, queryTokens, referenceDate),
|
|
139
|
-
version: requestedVersion.length ? requestedVersionScore(document.version, requestedVersion) : identityMatch ? document.scores.version : neutralScore,
|
|
140
|
-
freshness: document.scores.freshness,
|
|
141
|
-
lifecycle: document.scores.lifecycle
|
|
142
|
-
};
|
|
143
|
-
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);
|
|
144
|
-
return {
|
|
145
|
-
exact: identityExact,
|
|
146
|
-
identityExact,
|
|
147
|
-
kind: identityExact ? "exact" : leading.some((item) => item.kind === "token") ? "token" : "fuzzy",
|
|
148
|
-
record,
|
|
149
|
-
relevance: round3(relevance),
|
|
150
|
-
releaseDate: record.release_date ?? null,
|
|
151
|
-
score: combined,
|
|
152
|
-
version: document.version
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
function scoreField(field, query, requestedTokens) {
|
|
156
|
-
const weighted = Math.max(weightedRatio(query, field.value), tokenSetRatio(query, field.value)) * field.weight;
|
|
157
|
-
if (query === field.value)
|
|
158
|
-
return { field, kind: "exact", score: 100 };
|
|
159
|
-
if (field.value.includes(query)) {
|
|
160
|
-
return { field, kind: "token", score: Math.max(weighted, 96 * field.weight) };
|
|
161
|
-
}
|
|
162
|
-
const fieldTokens = new Set(tokens(field.value));
|
|
163
|
-
if (requestedTokens.size > 0 && [...requestedTokens].every((token) => fieldTokens.has(token))) {
|
|
164
|
-
return { field, kind: "token", score: Math.max(weighted, 94 * field.weight) };
|
|
165
|
-
}
|
|
166
|
-
return { field, kind: "fuzzy", score: weighted };
|
|
167
|
-
}
|
|
168
|
-
function passesTokenGate(queryTokens, tokenScores, identities, requireIdentity) {
|
|
169
|
-
if (queryTokens.some((token, index) => (tokenScores[index] ?? 0) < (token.length <= 3 ? 80 : 65))) {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
if (!requireIdentity || queryTokens.length === 0)
|
|
173
|
-
return true;
|
|
174
|
-
const identityTokens = new Set(identities.flatMap((identity) => tokens(identity)));
|
|
175
|
-
return Math.min(...queryTokenScores(queryTokens, [...identityTokens])) >= 75;
|
|
176
|
-
}
|
|
177
|
-
function queryTokenScores(queryTokens, candidateTokens) {
|
|
178
|
-
return queryTokens.map((token) => Math.max(0, ...candidateTokens.map((candidate) => ratio(token, candidate))));
|
|
179
|
-
}
|
|
180
|
-
function compareScored(left, right, requestedVersion) {
|
|
181
|
-
if (left.identityExact !== right.identityExact)
|
|
182
|
-
return left.identityExact ? -1 : 1;
|
|
183
|
-
if (requestedVersion.length) {
|
|
184
|
-
const distance = compareNumbers(versionDistance(left.version, requestedVersion), versionDistance(right.version, requestedVersion));
|
|
185
|
-
if (distance)
|
|
186
|
-
return distance;
|
|
187
|
-
}
|
|
188
|
-
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);
|
|
189
|
-
}
|
|
190
|
-
function searchFields(record) {
|
|
191
|
-
const fields = [
|
|
192
|
-
field("id", record.id, 1, true),
|
|
193
|
-
field("name", record.name, 1, true),
|
|
194
|
-
...record.aliases.map((value) => field("alias", value, 1, true)),
|
|
195
|
-
field("publisher", record.publisher ?? "", 0.98, true),
|
|
196
|
-
field("family", record.family ?? "", 0.98, true),
|
|
197
|
-
field("type", record.type, 0.9),
|
|
198
|
-
field("status", record.status, 0.86),
|
|
199
|
-
field("license", record.license ?? "", 0.84),
|
|
200
|
-
...record.tasks.map((value) => field("task", value, 0.94)),
|
|
201
|
-
...record.use_cases.map((value) => field("use case", value, 0.94)),
|
|
202
|
-
...record.modalities.input.map((value) => field("input modality", value, 0.9)),
|
|
203
|
-
...record.modalities.output.map((value) => field("output modality", value, 0.9)),
|
|
204
|
-
...record.rankings.map((value) => field("leaderboard domain", value.domain, 0.92)),
|
|
205
|
-
...record.rankings.map((value) => field("leaderboard category", value.category, 0.88)),
|
|
206
|
-
...record.benchmarks.map((value) => field("benchmark", value.name, 0.92)),
|
|
207
|
-
field("description", record.description, 0.76)
|
|
208
|
-
];
|
|
209
|
-
for (const [name, value] of Object.entries(record.capabilities)) {
|
|
210
|
-
const objectValue = isRecord(value) ? value : undefined;
|
|
211
|
-
if (value === true || objectValue?.supported === true) {
|
|
212
|
-
fields.push(field("capability", name.replaceAll("_", " "), 0.94));
|
|
213
|
-
}
|
|
214
|
-
if (name === "reasoning" && objectValue) {
|
|
215
|
-
const effort = Array.isArray(objectValue.effort) ? objectValue.effort : [];
|
|
216
|
-
for (const level of effort)
|
|
217
|
-
fields.push(field("reasoning effort", `${String(level)} reasoning`, 0.94));
|
|
218
|
-
if (objectValue.toggle === true)
|
|
219
|
-
fields.push(field("reasoning control", "reasoning toggle", 0.92));
|
|
220
|
-
if (objectValue.budget)
|
|
221
|
-
fields.push(field("reasoning control", "reasoning token budget", 0.92));
|
|
222
|
-
if (typeof objectValue.description === "string") {
|
|
223
|
-
fields.push(field("reasoning description", objectValue.description, 0.8));
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
for (const [cloud, availability] of Object.entries(record.availability)) {
|
|
228
|
-
fields.push(field("cloud", cloud, 0.9));
|
|
229
|
-
fields.push(field("availability", availability.status, 0.82));
|
|
230
|
-
fields.push(...availability.serving_modes.map((mode) => field("serving mode", mode, 0.9)));
|
|
231
|
-
if (availability.details)
|
|
232
|
-
fields.push(field("availability details", availability.details, 0.72));
|
|
233
|
-
}
|
|
234
|
-
for (const notice of record.notices) {
|
|
235
|
-
fields.push(field("notice", notice.kind, 0.74));
|
|
236
|
-
fields.push(field("notice", notice.title ?? "", 0.74));
|
|
237
|
-
fields.push(field("notice", notice.text, 0.7));
|
|
238
|
-
}
|
|
239
|
-
return fields.map((value) => ({ ...value, value: normalizeSearch(value.value) })).filter((value) => value.value.length > 0);
|
|
240
|
-
}
|
|
241
|
-
function field(name, value, weight, identity = false) {
|
|
242
|
-
return { identity, name, value, weight };
|
|
243
|
-
}
|
|
244
|
-
function leaderboardScore(record, queryTokens, referenceDate) {
|
|
245
|
-
const matched = record.rankings.filter((ranking) => evidenceMatches(queryTokens, ranking.domain, ranking.category));
|
|
246
|
-
const selected = matched.length ? matched : record.rankings.filter((ranking) => ranking.category.toLowerCase() === "overall");
|
|
247
|
-
if (!selected.length)
|
|
248
|
-
return neutralScore;
|
|
249
|
-
return aggregateEvidence(selected.map((ranking) => ageAdjustedScore(rankScore(ranking.rank, 20), ranking.published_at ?? null, referenceDate, 180, "votes" in ranking ? ranking.votes : ranking.observations, 5000)));
|
|
250
|
-
}
|
|
251
|
-
function benchmarkScore(record, queryTokens, referenceDate) {
|
|
252
|
-
const matched = record.benchmarks.filter((benchmark) => evidenceMatches(queryTokens, benchmark.name));
|
|
253
|
-
const selected = matched.length ? matched : record.benchmarks;
|
|
254
|
-
if (!selected.length)
|
|
255
|
-
return neutralScore;
|
|
256
|
-
return aggregateEvidence(selected.map((benchmark) => ageAdjustedScore(rankScore(benchmark.rank, 10), benchmark.published_at ?? null, referenceDate, 365, benchmark.task_count, 20)));
|
|
257
|
-
}
|
|
258
|
-
function evidenceMatches(queryTokens, ...values) {
|
|
259
|
-
if (!queryTokens.length)
|
|
260
|
-
return false;
|
|
261
|
-
const evidence = new Set(tokens(normalizeSearch(values.join(" "))));
|
|
262
|
-
return queryTokens.some((token) => evidence.has(token));
|
|
263
|
-
}
|
|
264
|
-
function ageAdjustedScore(score, publishedAt, referenceDate, halfLifeDays, confidenceCount, confidenceTarget) {
|
|
265
|
-
const ageDays = publishedAt ? Math.max(0, dateDays(referenceDate) - dateDays(publishedAt)) : halfLifeDays;
|
|
266
|
-
const ageFactor = 0.5 ** (ageDays / halfLifeDays);
|
|
267
|
-
const confidence = confidenceCount === null || confidenceCount === undefined ? 0 : Math.min(1, Math.log1p(confidenceCount) / Math.log1p(confidenceTarget));
|
|
268
|
-
const evidenceFactor = ageFactor * (0.75 + confidence * 0.25);
|
|
269
|
-
return neutralScore + (score - neutralScore) * evidenceFactor;
|
|
270
|
-
}
|
|
271
|
-
function aggregateEvidence(scores) {
|
|
272
|
-
if (!scores.length)
|
|
273
|
-
return neutralScore;
|
|
274
|
-
const aggregate = median(scores) * 0.6 + mean(scores) * 0.4;
|
|
275
|
-
const coverageFactor = 0.85 + Math.min(scores.length, 5) / 5 * 0.15;
|
|
276
|
-
return neutralScore + (aggregate - neutralScore) * coverageFactor;
|
|
277
|
-
}
|
|
278
|
-
function requestedVersionScore(candidate, requested) {
|
|
279
|
-
if (!candidate.length)
|
|
280
|
-
return 0;
|
|
281
|
-
const [candidateMajor = 0, candidateMinor = 0, candidatePatch = 0] = candidate;
|
|
282
|
-
const [requestedMajor = 0, requestedMinor = 0, requestedPatch = 0] = requested;
|
|
283
|
-
if (candidateMajor !== requestedMajor) {
|
|
284
|
-
return Math.max(0, 40 - Math.abs(candidateMajor - requestedMajor) * 15);
|
|
285
|
-
}
|
|
286
|
-
return Math.max(0, 100 - Math.abs(candidateMinor - requestedMinor) * 15 - Math.abs(candidatePatch - requestedPatch) * 5);
|
|
287
|
-
}
|
|
288
|
-
function versionDistance(candidate, requested) {
|
|
289
|
-
if (!candidate.length)
|
|
290
|
-
return [1, 1, 1000, 1000, 1000];
|
|
291
|
-
const [candidateMajor = 0, candidateMinor = 0, candidatePatch = 0] = candidate;
|
|
292
|
-
const [requestedMajor = 0, requestedMinor = 0, requestedPatch = 0] = requested;
|
|
293
|
-
return [
|
|
294
|
-
0,
|
|
295
|
-
candidateMajor === requestedMajor ? 0 : 1,
|
|
296
|
-
Math.abs(candidateMajor - requestedMajor),
|
|
297
|
-
Math.abs(candidateMinor - requestedMinor),
|
|
298
|
-
Math.abs(candidatePatch - requestedPatch)
|
|
299
|
-
];
|
|
300
|
-
}
|
|
301
|
-
function weightedRatio(left, right) {
|
|
302
|
-
if (!left || !right)
|
|
303
|
-
return 0;
|
|
304
|
-
const lengthRatio = Math.max(left.length, right.length) / Math.min(left.length, right.length);
|
|
305
|
-
const base = ratio(left, right);
|
|
306
|
-
if (lengthRatio < 1.5) {
|
|
307
|
-
return Math.max(base, tokenRatio(left, right) * 0.95);
|
|
308
|
-
}
|
|
309
|
-
const partialScale = lengthRatio <= 8 ? 0.9 : 0.6;
|
|
310
|
-
return Math.max(base, partialRatio(left, right) * partialScale, partialTokenRatio(left, right) * 0.95 * partialScale);
|
|
311
|
-
}
|
|
312
|
-
function tokenRatio(left, right) {
|
|
313
|
-
return Math.max(tokenSetRatio(left, right), ratio(sortTokens(left), sortTokens(right)));
|
|
314
|
-
}
|
|
315
|
-
function partialTokenRatio(left, right) {
|
|
316
|
-
const leftTokens = left.split(/\s+/).filter(Boolean);
|
|
317
|
-
const rightTokens = right.split(/\s+/).filter(Boolean);
|
|
318
|
-
const leftSet = new Set(leftTokens);
|
|
319
|
-
const rightSet = new Set(rightTokens);
|
|
320
|
-
if ([...leftSet].some((token) => rightSet.has(token)))
|
|
321
|
-
return 100;
|
|
322
|
-
const base = partialRatio([...leftTokens].sort().join(" "), [...rightTokens].sort().join(" "));
|
|
323
|
-
const leftDiff = [...leftSet].filter((token) => !rightSet.has(token));
|
|
324
|
-
const rightDiff = [...rightSet].filter((token) => !leftSet.has(token));
|
|
325
|
-
if (leftTokens.length === leftDiff.length && rightTokens.length === rightDiff.length)
|
|
326
|
-
return base;
|
|
327
|
-
return Math.max(base, partialRatio(leftDiff.sort().join(" "), rightDiff.sort().join(" ")));
|
|
328
|
-
}
|
|
329
|
-
function tokenSetRatio(left, right) {
|
|
330
|
-
const leftSet = new Set(left.split(/\s+/).filter(Boolean));
|
|
331
|
-
const rightSet = new Set(right.split(/\s+/).filter(Boolean));
|
|
332
|
-
if (!leftSet.size || !rightSet.size)
|
|
333
|
-
return 0;
|
|
334
|
-
const intersection = [...leftSet].filter((token) => rightSet.has(token));
|
|
335
|
-
const leftDiff = [...leftSet].filter((token) => !rightSet.has(token)).sort().join(" ");
|
|
336
|
-
const rightDiff = [...rightSet].filter((token) => !leftSet.has(token)).sort().join(" ");
|
|
337
|
-
if (intersection.length && (!leftDiff || !rightDiff))
|
|
338
|
-
return 100;
|
|
339
|
-
const intersectionLength = intersection.join(" ").length;
|
|
340
|
-
const leftLength = intersectionLength + (intersectionLength ? 1 : 0) + leftDiff.length;
|
|
341
|
-
const rightLength = intersectionLength + (intersectionLength ? 1 : 0) + rightDiff.length;
|
|
342
|
-
const distance = indelDistance(leftDiff, rightDiff);
|
|
343
|
-
const differenceScore = normalizedDistanceScore(distance, leftLength + rightLength);
|
|
344
|
-
if (!intersectionLength)
|
|
345
|
-
return differenceScore;
|
|
346
|
-
const leftIntersectionScore = normalizedDistanceScore(1 + leftDiff.length, intersectionLength + leftLength);
|
|
347
|
-
const rightIntersectionScore = normalizedDistanceScore(1 + rightDiff.length, intersectionLength + rightLength);
|
|
348
|
-
return Math.max(differenceScore, leftIntersectionScore, rightIntersectionScore);
|
|
349
|
-
}
|
|
350
|
-
function partialRatio(left, right) {
|
|
351
|
-
if (!left && !right)
|
|
352
|
-
return 100;
|
|
353
|
-
if (!left || !right)
|
|
354
|
-
return 0;
|
|
355
|
-
const shorter = left.length <= right.length ? left : right;
|
|
356
|
-
const longer = left.length <= right.length ? right : left;
|
|
357
|
-
let best = 0;
|
|
358
|
-
for (let end = 1;end < shorter.length; end += 1) {
|
|
359
|
-
best = Math.max(best, ratio(shorter, longer.slice(0, end)));
|
|
360
|
-
}
|
|
361
|
-
for (let start = 0;start <= longer.length - shorter.length; start += 1) {
|
|
362
|
-
best = Math.max(best, ratio(shorter, longer.slice(start, start + shorter.length)));
|
|
363
|
-
}
|
|
364
|
-
for (let start = Math.max(0, longer.length - shorter.length + 1);start < longer.length; start += 1) {
|
|
365
|
-
best = Math.max(best, ratio(shorter, longer.slice(start)));
|
|
366
|
-
}
|
|
367
|
-
return best;
|
|
368
|
-
}
|
|
369
|
-
function ratio(left, right) {
|
|
370
|
-
const total = left.length + right.length;
|
|
371
|
-
return total ? 2 * longestCommonSubsequence(left, right) / total * 100 : 100;
|
|
372
|
-
}
|
|
373
|
-
function indelDistance(left, right) {
|
|
374
|
-
return left.length + right.length - 2 * longestCommonSubsequence(left, right);
|
|
375
|
-
}
|
|
376
|
-
function longestCommonSubsequence(left, right) {
|
|
377
|
-
if (!left || !right)
|
|
378
|
-
return 0;
|
|
379
|
-
const needle = left.length <= right.length ? left : right;
|
|
380
|
-
const haystack = left.length <= right.length ? right : left;
|
|
381
|
-
const blocks = new Map;
|
|
382
|
-
let bit = 1n;
|
|
383
|
-
for (const character of needle) {
|
|
384
|
-
blocks.set(character, (blocks.get(character) ?? 0n) | bit);
|
|
385
|
-
bit <<= 1n;
|
|
386
|
-
}
|
|
387
|
-
let state = (1n << BigInt(needle.length)) - 1n;
|
|
388
|
-
for (const character of haystack) {
|
|
389
|
-
const matches = blocks.get(character) ?? 0n;
|
|
390
|
-
const overlap = state & matches;
|
|
391
|
-
state = state + overlap | state - overlap;
|
|
392
|
-
}
|
|
393
|
-
const mask = (1n << BigInt(needle.length)) - 1n;
|
|
394
|
-
return needle.length - popCount(state & mask);
|
|
395
|
-
}
|
|
396
|
-
function popCount(value) {
|
|
397
|
-
let count = 0;
|
|
398
|
-
let current = value;
|
|
399
|
-
while (current) {
|
|
400
|
-
current &= current - 1n;
|
|
401
|
-
count += 1;
|
|
402
|
-
}
|
|
403
|
-
return count;
|
|
404
|
-
}
|
|
405
|
-
function normalizedDistanceScore(distance, lengthSum) {
|
|
406
|
-
return lengthSum ? 100 - 100 * distance / lengthSum : 100;
|
|
407
|
-
}
|
|
408
|
-
function sortTokens(value) {
|
|
409
|
-
return value.split(/\s+/).filter(Boolean).sort().join(" ");
|
|
410
|
-
}
|
|
411
|
-
function normalizeSearch(value) {
|
|
412
|
-
return (value.normalize("NFKC").toLowerCase().match(tokenPattern) ?? []).join(" ");
|
|
413
|
-
}
|
|
414
|
-
function tokens(value) {
|
|
415
|
-
return value.match(tokenPattern) ?? [];
|
|
416
|
-
}
|
|
417
|
-
function version(value) {
|
|
418
|
-
const match = versionPattern.exec(value.toLowerCase());
|
|
419
|
-
return match ? match.slice(1).filter((part) => Boolean(part)).map(Number) : [];
|
|
420
|
-
}
|
|
421
|
-
function rankScore(rank, offset) {
|
|
422
|
-
return (offset + 1) / (offset + rank) * 100;
|
|
423
|
-
}
|
|
424
|
-
function dateDays(value) {
|
|
425
|
-
return Math.floor(Date.parse(`${value.slice(0, 10)}T00:00:00Z`) / 86400000);
|
|
426
|
-
}
|
|
427
|
-
function median(values) {
|
|
428
|
-
const sorted = [...values].sort((left, right) => left - right);
|
|
429
|
-
const middle = Math.floor(sorted.length / 2);
|
|
430
|
-
return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2;
|
|
431
|
-
}
|
|
432
|
-
function mean(values) {
|
|
433
|
-
return values.reduce((total, value) => total + value, 0) / values.length;
|
|
434
|
-
}
|
|
435
|
-
function round3(value) {
|
|
436
|
-
return Math.round(value * 1000) / 1000;
|
|
437
|
-
}
|
|
438
|
-
function compareNumbers(left, right) {
|
|
439
|
-
for (let index = 0;index < Math.max(left.length, right.length); index += 1) {
|
|
440
|
-
const difference = (left[index] ?? 0) - (right[index] ?? 0);
|
|
441
|
-
if (difference)
|
|
442
|
-
return difference;
|
|
443
|
-
}
|
|
444
|
-
return 0;
|
|
445
|
-
}
|
|
446
|
-
function compareOptionalDateDescending(left, right) {
|
|
447
|
-
if (left === right)
|
|
448
|
-
return 0;
|
|
449
|
-
if (left === null)
|
|
450
|
-
return 1;
|
|
451
|
-
if (right === null)
|
|
452
|
-
return -1;
|
|
453
|
-
return right.localeCompare(left);
|
|
454
|
-
}
|
|
455
|
-
function compareText(left, right) {
|
|
456
|
-
const normalizedLeft = left.toLowerCase();
|
|
457
|
-
const normalizedRight = right.toLowerCase();
|
|
458
|
-
return normalizedLeft < normalizedRight ? -1 : normalizedLeft > normalizedRight ? 1 : 0;
|
|
459
|
-
}
|
|
460
|
-
function isRecord(value) {
|
|
461
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
// src/filter.ts
|
|
465
|
-
function filterCatalogRecords(records, searchIndex, filters = {}) {
|
|
466
|
-
const limit = filters.limit === undefined ? 50 : filters.limit;
|
|
467
|
-
if (limit !== null && (!Number.isSafeInteger(limit) || limit < 0 || limit > 1000)) {
|
|
468
|
-
throw new RangeError("limit must be an integer between 0 and 1000, or null");
|
|
469
|
-
}
|
|
470
|
-
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)));
|
|
471
|
-
const query = filters.query?.trim();
|
|
472
|
-
if (query)
|
|
473
|
-
return searchCatalogRecords(searchIndex, filtered, query, limit);
|
|
474
|
-
filtered.sort((left, right) => compareText2(left.name, right.name) || compareText2(left.id, right.id));
|
|
475
|
-
return limit === null ? filtered : filtered.slice(0, limit);
|
|
476
|
-
}
|
|
477
|
-
function includes(expected, actual) {
|
|
478
|
-
return !expected?.length || actual !== null && actual !== undefined && expected.includes(actual);
|
|
479
|
-
}
|
|
480
|
-
function hasCapability(record, capability) {
|
|
481
|
-
const field = capability.replaceAll("-", "_");
|
|
482
|
-
const value = record.capabilities[field];
|
|
483
|
-
return capability === "reasoning" ? value !== null && value !== undefined : value === true;
|
|
484
|
-
}
|
|
485
|
-
function compareText2(left, right) {
|
|
486
|
-
const normalizedLeft = left.toLowerCase();
|
|
487
|
-
const normalizedRight = right.toLowerCase();
|
|
488
|
-
return normalizedLeft < normalizedRight ? -1 : normalizedLeft > normalizedRight ? 1 : 0;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
// src/catalog-index.ts
|
|
492
|
-
class ModelCatalogIndex {
|
|
493
|
-
catalog;
|
|
494
|
-
searchIndex;
|
|
495
|
-
records;
|
|
496
|
-
exact = new Map;
|
|
497
|
-
normalized = new Map;
|
|
498
|
-
constructor(catalog, searchIndex) {
|
|
499
|
-
this.catalog = catalog;
|
|
500
|
-
this.searchIndex = searchIndex;
|
|
501
|
-
if (catalog.schema_version !== searchIndex.catalog_schema_version) {
|
|
502
|
-
throw new Error(`Catalog schema v${catalog.schema_version} does not match search index schema v${searchIndex.catalog_schema_version}`);
|
|
503
|
-
}
|
|
504
|
-
if (catalog.updated_at !== searchIndex.updated_at) {
|
|
505
|
-
throw new Error("Catalog and search index timestamps do not match");
|
|
506
|
-
}
|
|
507
|
-
this.records = Object.entries(catalog.models).map(([id, model]) => ({ ...model, id }));
|
|
508
|
-
for (const record of this.records) {
|
|
509
|
-
for (const identity of modelIdentities(record)) {
|
|
510
|
-
this.exact.set(identity.value.toLowerCase(), { identity, record });
|
|
511
|
-
const key = normalizeModelIdentity(identity.value);
|
|
512
|
-
const current = this.normalized.get(key);
|
|
513
|
-
this.normalized.set(key, current === undefined ? { identity, record } : null);
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
get(id) {
|
|
518
|
-
return this.catalog.models[id] ? { ...this.catalog.models[id], id } : undefined;
|
|
519
|
-
}
|
|
520
|
-
resolve(value) {
|
|
521
|
-
const exact = this.exact.get(value.trim().toLowerCase());
|
|
522
|
-
if (exact)
|
|
523
|
-
return exact;
|
|
524
|
-
return this.normalized.get(normalizeModelIdentity(value)) ?? undefined;
|
|
525
|
-
}
|
|
526
|
-
matchAny(values) {
|
|
527
|
-
for (const value of values) {
|
|
528
|
-
const match = this.resolve(value);
|
|
529
|
-
if (match)
|
|
530
|
-
return match;
|
|
531
|
-
}
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
list(filters = {}) {
|
|
535
|
-
return filterCatalogRecords(this.records, this.searchIndex, filters);
|
|
536
|
-
}
|
|
537
|
-
search(query, limit = 50) {
|
|
538
|
-
return searchCatalogMatches(this.searchIndex, this.records, query, limit);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
function createModelCatalogIndex(catalog, searchIndex) {
|
|
542
|
-
return new ModelCatalogIndex(catalog, searchIndex);
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
// src/local-client.ts
|
|
546
|
-
function createModelCatalogClient(catalog, searchIndex) {
|
|
547
|
-
const index = createModelCatalogIndex(catalog, searchIndex);
|
|
548
|
-
const records = [...index.records];
|
|
549
|
-
return {
|
|
550
|
-
async catalog() {
|
|
551
|
-
return catalog;
|
|
552
|
-
},
|
|
553
|
-
async searchIndex() {
|
|
554
|
-
return searchIndex;
|
|
555
|
-
},
|
|
556
|
-
async list(filters = {}) {
|
|
557
|
-
return filterCatalogRecords(records, searchIndex, filters);
|
|
558
|
-
},
|
|
559
|
-
async get(identity) {
|
|
560
|
-
return index.resolve(identity)?.record;
|
|
561
|
-
},
|
|
562
|
-
async resolve(identity) {
|
|
563
|
-
return index.resolve(identity);
|
|
564
|
-
},
|
|
565
|
-
async search(query, limit = 50) {
|
|
566
|
-
return index.search(query, limit);
|
|
567
|
-
},
|
|
568
|
-
async* stream(filters = {}) {
|
|
569
|
-
for (const record of filterCatalogRecords(records, searchIndex, filters))
|
|
570
|
-
yield record;
|
|
571
|
-
},
|
|
572
|
-
close() {}
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
// src/validation.ts
|
|
577
|
-
import { z } from "zod";
|
|
578
|
-
|
|
579
|
-
// src/_generated/json-schema.ts
|
|
580
|
-
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" } } };
|
|
581
|
-
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" } } };
|
|
582
|
-
|
|
583
|
-
// src/validation.ts
|
|
584
|
-
function modelCatalogDefinitionSchema(definition) {
|
|
585
|
-
return z.fromJSONSchema({
|
|
586
|
-
...MODEL_CATALOG_JSON_SCHEMA.$defs[definition],
|
|
587
|
-
$defs: MODEL_CATALOG_JSON_SCHEMA.$defs
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
var ModelCatalogSchema = z.fromJSONSchema(MODEL_CATALOG_JSON_SCHEMA);
|
|
591
|
-
var CatalogSearchIndexSchema = z.fromJSONSchema(CATALOG_SEARCH_INDEX_JSON_SCHEMA);
|
|
592
|
-
var CatalogModelSchema = modelCatalogDefinitionSchema("CatalogModel");
|
|
593
|
-
var CatalogModelRecordSchema = modelCatalogDefinitionSchema("CatalogModelRecord");
|
|
594
|
-
var CatalogCapabilitiesSchema = modelCatalogDefinitionSchema("Capabilities");
|
|
595
|
-
var CatalogRateLimitsSchema = modelCatalogDefinitionSchema("RateLimits");
|
|
596
|
-
var CatalogLatencySchema = modelCatalogDefinitionSchema("Latency");
|
|
597
|
-
var CatalogPriceSchema = modelCatalogDefinitionSchema("Price");
|
|
598
|
-
var CatalogAveragePriceSchema = modelCatalogDefinitionSchema("AveragePrice");
|
|
599
|
-
var CatalogPreferenceRankingSchema = modelCatalogDefinitionSchema("Rankings");
|
|
600
|
-
var CatalogScoreRankingSchema = modelCatalogDefinitionSchema("Rankings1");
|
|
601
|
-
var CatalogRankingSchema = z.union([
|
|
602
|
-
CatalogPreferenceRankingSchema,
|
|
603
|
-
CatalogScoreRankingSchema
|
|
604
|
-
]);
|
|
605
|
-
var CatalogStatusSchema = modelCatalogDefinitionSchema("Status");
|
|
606
|
-
function parseModelCatalog(value) {
|
|
607
|
-
return ModelCatalogSchema.parse(value);
|
|
608
|
-
}
|
|
609
|
-
function parseCatalogSearchIndex(value) {
|
|
610
|
-
return CatalogSearchIndexSchema.parse(value);
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
// src/browser.ts
|
|
614
|
-
async function loadModelCatalog(options = {}) {
|
|
615
|
-
const index = await loadModelCatalogIndex(options);
|
|
616
|
-
return createModelCatalogClient(index.catalog, index.searchIndex);
|
|
617
|
-
}
|
|
618
|
-
async function loadModelCatalogIndex(options = {}) {
|
|
619
|
-
const loader = options.fetch ?? globalThis.fetch;
|
|
620
|
-
const catalogUrl = options.catalogUrl ?? PUBLISHED_CATALOG_URL;
|
|
621
|
-
const searchIndexUrl = options.searchIndexUrl ?? (options.catalogUrl ? new URL("search-index.json", options.catalogUrl).toString() : PUBLISHED_CATALOG_SEARCH_INDEX_URL);
|
|
622
|
-
const [catalogResponse, searchIndexResponse] = await Promise.all([
|
|
623
|
-
loader(catalogUrl),
|
|
624
|
-
loader(searchIndexUrl)
|
|
625
|
-
]);
|
|
626
|
-
if (!catalogResponse.ok)
|
|
627
|
-
throw new Error(`Catalog request failed with ${catalogResponse.status}`);
|
|
628
|
-
if (!searchIndexResponse.ok) {
|
|
629
|
-
throw new Error(`Search index request failed with ${searchIndexResponse.status}`);
|
|
630
|
-
}
|
|
631
|
-
return createModelCatalogIndex(parseModelCatalog(await catalogResponse.json()), parseCatalogSearchIndex(await searchIndexResponse.json()));
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
// src/index.ts
|
|
635
|
-
var packageRootUrl = new URL("..", import.meta.url);
|
|
636
|
-
var packageRoot = fileURLToPath(packageRootUrl);
|
|
637
|
-
async function connectModelCatalog(input) {
|
|
638
|
-
const options = typeof input === "string" ? { catalogUrl: input } : input ?? {};
|
|
639
|
-
const configuredPath = options.catalogPath ?? process.env.DBX_MODEL_CATALOG_PATH;
|
|
640
|
-
const configuredUrl = options.catalogUrl?.trim() || undefined;
|
|
641
|
-
if (configuredUrl?.startsWith("ws:") || configuredUrl?.startsWith("wss:")) {
|
|
642
|
-
throw new Error("WebSocket connections use @dbx-tools/dbx-model-catalog/pynect");
|
|
643
|
-
}
|
|
644
|
-
const loaded = configuredPath ? await loadFiles(configuredPath, options.searchIndexPath) : await loadUrls(configuredUrl, options.searchIndexUrl, options.fetch);
|
|
645
|
-
const client = createModelCatalogClient(loaded.catalog, loaded.searchIndex);
|
|
646
|
-
const close = async () => {
|
|
647
|
-
client.close();
|
|
648
|
-
};
|
|
649
|
-
return {
|
|
650
|
-
client,
|
|
651
|
-
mode: configuredPath ? "file" : configuredUrl ? "url" : "published",
|
|
652
|
-
root: packageRoot,
|
|
653
|
-
source: loaded.source,
|
|
654
|
-
close,
|
|
655
|
-
async[Symbol.asyncDispose]() {
|
|
656
|
-
await close();
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
}
|
|
660
|
-
async function loadFiles(catalogPath, searchIndexPath) {
|
|
661
|
-
const resolvedCatalogPath = resolve(catalogPath);
|
|
662
|
-
const resolvedSearchIndexPath = resolve(searchIndexPath ?? resolve(dirname(resolvedCatalogPath), "search-index.json"));
|
|
663
|
-
const [catalog, searchIndex] = await Promise.all([
|
|
664
|
-
readFile(resolvedCatalogPath, "utf8").then((value) => parseModelCatalog(JSON.parse(value))),
|
|
665
|
-
readFile(resolvedSearchIndexPath, "utf8").then((value) => parseCatalogSearchIndex(JSON.parse(value)))
|
|
666
|
-
]);
|
|
667
|
-
return { catalog, searchIndex, source: resolvedCatalogPath };
|
|
668
|
-
}
|
|
669
|
-
async function loadUrls(catalogUrl, searchIndexUrl, fetcher = globalThis.fetch) {
|
|
670
|
-
const source = catalogUrl ?? PUBLISHED_CATALOG_URL;
|
|
671
|
-
const indexSource = searchIndexUrl ?? (catalogUrl ? new URL("search-index.json", catalogUrl).toString() : PUBLISHED_CATALOG_SEARCH_INDEX_URL);
|
|
672
|
-
const [catalogResponse, searchIndexResponse] = await Promise.all([
|
|
673
|
-
fetcher(source),
|
|
674
|
-
fetcher(indexSource)
|
|
675
|
-
]);
|
|
676
|
-
if (!catalogResponse.ok)
|
|
677
|
-
throw new Error(`Catalog request failed with ${catalogResponse.status}`);
|
|
678
|
-
if (!searchIndexResponse.ok) {
|
|
679
|
-
throw new Error(`Search index request failed with ${searchIndexResponse.status}`);
|
|
680
|
-
}
|
|
681
|
-
return {
|
|
682
|
-
catalog: parseModelCatalog(await catalogResponse.json()),
|
|
683
|
-
searchIndex: parseCatalogSearchIndex(await searchIndexResponse.json()),
|
|
684
|
-
source
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
|
-
|
|
688
43
|
// src/cli.ts
|
|
689
44
|
var listOptions = new Set([
|
|
690
45
|
"--status",
|
|
@@ -697,7 +52,7 @@ var scalarOptions = new Set(["--url", "--limit"]);
|
|
|
697
52
|
function parseArgs(args) {
|
|
698
53
|
const command = args.shift();
|
|
699
54
|
if (command === undefined || command === "--help" || command === "-h") {
|
|
700
|
-
throw new Error("Usage: bun run
|
|
55
|
+
throw new Error("Usage: bun run dbx-model-catalog <catalog|models|model-feed> [query] " + "[--status VALUE] [--type VALUE] [--publisher VALUE] [--task VALUE] " + "[--capability VALUE] [--limit NUMBER] " + "[--url https://HOST/catalog.json | ws://HOST:PORT | PATH/catalog.json]");
|
|
701
56
|
}
|
|
702
57
|
if (!["catalog", "models", "model-feed"].includes(command)) {
|
|
703
58
|
throw new Error(`Unknown command: ${command}`);
|
|
@@ -750,17 +105,17 @@ async function main() {
|
|
|
750
105
|
let __stack = [];
|
|
751
106
|
try {
|
|
752
107
|
const options = parseArgs(process.argv.slice(2));
|
|
753
|
-
const
|
|
754
|
-
process.stderr.write(`Using ${
|
|
108
|
+
const client = __using(__stack, await createModelCatalogClient2(options.url), 1);
|
|
109
|
+
process.stderr.write(`Using ${client.source.kind} catalog ${client.source.location ?? ""}
|
|
755
110
|
`);
|
|
756
111
|
if (options.command === "catalog") {
|
|
757
|
-
process.stdout.write(`${JSON.stringify(await
|
|
112
|
+
process.stdout.write(`${JSON.stringify(await client.catalog())}
|
|
758
113
|
`);
|
|
759
114
|
} else if (options.command === "models") {
|
|
760
|
-
process.stdout.write(`${JSON.stringify(await
|
|
115
|
+
process.stdout.write(`${JSON.stringify(await client.list(options.filters), null, 2)}
|
|
761
116
|
`);
|
|
762
117
|
} else {
|
|
763
|
-
for await (const model of
|
|
118
|
+
for await (const model of client.stream(options.filters)) {
|
|
764
119
|
process.stdout.write(`${JSON.stringify(model)}
|
|
765
120
|
`);
|
|
766
121
|
}
|