@runtypelabs/sdk 10.17.0 → 11.0.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/dist/index.cjs +33 -5
- package/dist/index.d.cts +1331 -113
- package/dist/index.d.ts +1331 -113
- package/dist/index.mjs +33 -5
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -5234,7 +5234,7 @@ var ModelConfigsEndpoint = class {
|
|
|
5234
5234
|
this.client = client;
|
|
5235
5235
|
}
|
|
5236
5236
|
/**
|
|
5237
|
-
* Get available models catalog
|
|
5237
|
+
* Get the available models catalog, followed by the account's custom models (`uiCategory: 'custom'`)
|
|
5238
5238
|
*/
|
|
5239
5239
|
async getAvailable() {
|
|
5240
5240
|
const response = await this.client.get("/model-configs/available");
|
|
@@ -5253,13 +5253,21 @@ var ModelConfigsEndpoint = class {
|
|
|
5253
5253
|
return (await this.client.get("/model-configs/search-configured")).data || [];
|
|
5254
5254
|
}
|
|
5255
5255
|
/**
|
|
5256
|
-
* List
|
|
5256
|
+
* List every model the account can run: its model configurations plus the models its organization's
|
|
5257
|
+
* custom inference endpoints declare (`configScope: 'organization_connection'`)
|
|
5257
5258
|
*/
|
|
5258
5259
|
async list() {
|
|
5259
5260
|
const response = await this.client.get("/model-configs");
|
|
5260
5261
|
return Array.isArray(response) ? response : response.data || [];
|
|
5261
5262
|
}
|
|
5262
5263
|
/**
|
|
5264
|
+
* Get which providers may serve a model call for the account. When `mode` is `byok_only`,
|
|
5265
|
+
* only models from `byokProviders` run.
|
|
5266
|
+
*/
|
|
5267
|
+
async getCredentialPolicy() {
|
|
5268
|
+
return (await this.client.get("/model-configs")).credentialPolicy;
|
|
5269
|
+
}
|
|
5270
|
+
/**
|
|
5263
5271
|
* Create a new model configuration
|
|
5264
5272
|
*/
|
|
5265
5273
|
async create(data) {
|
|
@@ -12884,7 +12892,9 @@ function normalizeFpoDefinition(fpo) {
|
|
|
12884
12892
|
...fpo.schedules !== void 0 && fpo.schedules !== null ? { schedules: normalizeValue$1(fpo.schedules) } : {},
|
|
12885
12893
|
...fpo.secrets !== void 0 && fpo.secrets !== null ? { secrets: normalizeValue$1(fpo.secrets) } : {},
|
|
12886
12894
|
...fpo.evals !== void 0 && fpo.evals !== null ? { evals: normalizeValue$1(fpo.evals) } : {},
|
|
12887
|
-
...fpo.skills !== void 0 && fpo.skills !== null ? { skills: normalizeValue$1(fpo.skills) } : {}
|
|
12895
|
+
...fpo.skills !== void 0 && fpo.skills !== null ? { skills: normalizeValue$1(fpo.skills) } : {},
|
|
12896
|
+
...fpo.collections !== void 0 && fpo.collections !== null ? { collections: normalizeValue$1(fpo.collections) } : {},
|
|
12897
|
+
...fpo.questionSets !== void 0 && fpo.questionSets !== null ? { questionSets: normalizeValue$1(fpo.questionSets) } : {}
|
|
12888
12898
|
};
|
|
12889
12899
|
}
|
|
12890
12900
|
/** SHA-256 (hex) over the canonical normalized FPO. */
|
|
@@ -14491,7 +14501,7 @@ function transformQueryParams(params) {
|
|
|
14491
14501
|
}
|
|
14492
14502
|
//#endregion
|
|
14493
14503
|
//#region src/version.ts
|
|
14494
|
-
const SDK_VERSION = "
|
|
14504
|
+
const SDK_VERSION = "11.0.0";
|
|
14495
14505
|
/**
|
|
14496
14506
|
* Canonical client identity the API uses for attribution
|
|
14497
14507
|
* (`detectActorSource` in apps/api/src/lib/audit-log.ts keys `'sdk'` off the
|
|
@@ -14979,10 +14989,28 @@ var RuntypeClient = class {
|
|
|
14979
14989
|
errorData = { error: "Unknown error occurred" };
|
|
14980
14990
|
}
|
|
14981
14991
|
const baseMessage = isObjectRecord(errorData) && (typeof errorData.error === "string" || typeof errorData.message === "string") ? errorData.error || errorData.message || "Request failed" : "Request failed";
|
|
14982
|
-
const details = isObjectRecord(errorData)
|
|
14992
|
+
const details = isObjectRecord(errorData) ? formatErrorDetails(errorData.details) : void 0;
|
|
14983
14993
|
return new RuntypeApiError(details ? `${baseMessage}: ${details}` : baseMessage, response.status, errorData, new Headers(response.headers), response.statusText);
|
|
14984
14994
|
}
|
|
14985
14995
|
};
|
|
14996
|
+
const MAX_ERROR_DETAILS_IN_MESSAGE = 5;
|
|
14997
|
+
function formatErrorDetail(detail) {
|
|
14998
|
+
if (typeof detail === "string") return detail || void 0;
|
|
14999
|
+
if (!isObjectRecord(detail) || typeof detail.message !== "string") return void 0;
|
|
15000
|
+
const path = typeof detail.path === "string" && detail.path ? `${detail.path}: ` : "";
|
|
15001
|
+
const code = typeof detail.code === "string" && detail.code ? ` [${detail.code}]` : "";
|
|
15002
|
+
return `${path}${detail.message}${code}`;
|
|
15003
|
+
}
|
|
15004
|
+
/** Renders an error envelope's `details` (a string, or the validation detail list) for the error message. */
|
|
15005
|
+
function formatErrorDetails(details) {
|
|
15006
|
+
if (typeof details === "string") return details || void 0;
|
|
15007
|
+
if (!Array.isArray(details)) return void 0;
|
|
15008
|
+
const rendered = details.map(formatErrorDetail).filter((line) => line !== void 0);
|
|
15009
|
+
if (rendered.length === 0) return void 0;
|
|
15010
|
+
const shown = rendered.slice(0, MAX_ERROR_DETAILS_IN_MESSAGE).join("; ");
|
|
15011
|
+
const omitted = rendered.length - MAX_ERROR_DETAILS_IN_MESSAGE;
|
|
15012
|
+
return omitted > 0 ? `${shown}; and ${omitted} more` : shown;
|
|
15013
|
+
}
|
|
14986
15014
|
/**
|
|
14987
15015
|
* Custom error class for Runtype API errors
|
|
14988
15016
|
*/
|