langsmith 0.5.15 → 0.5.17
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 +2 -2
- package/dist/client.cjs +116 -143
- package/dist/client.d.ts +19 -40
- package/dist/client.js +116 -143
- package/dist/experimental/anthropic/index.cjs +4 -1
- package/dist/experimental/anthropic/index.js +4 -1
- package/dist/experimental/vercel/index.cjs +1 -0
- package/dist/experimental/vercel/index.js +1 -0
- package/dist/experimental/vercel/middleware.cjs +2 -0
- package/dist/experimental/vercel/middleware.js +2 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/schemas.d.ts +1 -3
- package/dist/utils/chalk/source/index.cjs +187 -0
- package/dist/utils/chalk/source/index.d.ts +19 -0
- package/dist/utils/chalk/source/index.js +173 -0
- package/dist/utils/chalk/source/utilities.cjs +35 -0
- package/dist/utils/chalk/source/utilities.d.ts +2 -0
- package/dist/utils/chalk/source/utilities.js +31 -0
- package/dist/utils/chalk/source/vendor/ansi-styles/index.cjs +193 -0
- package/dist/utils/chalk/source/vendor/ansi-styles/index.d.ts +58 -0
- package/dist/utils/chalk/source/vendor/ansi-styles/index.js +190 -0
- package/dist/utils/chalk/source/vendor/supports-color/browser.cjs +31 -0
- package/dist/utils/chalk/source/vendor/supports-color/browser.d.ts +15 -0
- package/dist/utils/chalk/source/vendor/supports-color/browser.js +29 -0
- package/dist/utils/chalk/source/vendor/supports-color/index.cjs +155 -0
- package/dist/utils/chalk/source/vendor/supports-color/index.d.ts +21 -0
- package/dist/utils/chalk/source/vendor/supports-color/index.js +149 -0
- package/dist/utils/console-table-printer/index.cjs +11 -0
- package/dist/utils/console-table-printer/index.d.ts +4 -0
- package/dist/utils/console-table-printer/index.js +3 -0
- package/dist/utils/console-table-printer/src/console-table-printer.cjs +42 -0
- package/dist/utils/console-table-printer/src/console-table-printer.d.ts +14 -0
- package/dist/utils/console-table-printer/src/console-table-printer.js +36 -0
- package/dist/utils/console-table-printer/src/internalTable/input-converter.cjs +25 -0
- package/dist/utils/console-table-printer/src/internalTable/input-converter.d.ts +6 -0
- package/dist/utils/console-table-printer/src/internalTable/input-converter.js +20 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table-printer.cjs +142 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table-printer.d.ts +6 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table-printer.js +133 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table.cjs +186 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table.d.ts +31 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table.js +184 -0
- package/dist/utils/console-table-printer/src/internalTable/table-pre-processors.cjs +53 -0
- package/dist/utils/console-table-printer/src/internalTable/table-pre-processors.d.ts +3 -0
- package/dist/utils/console-table-printer/src/internalTable/table-pre-processors.js +48 -0
- package/dist/utils/console-table-printer/src/models/common.cjs +2 -0
- package/dist/utils/console-table-printer/src/models/common.d.ts +14 -0
- package/dist/utils/console-table-printer/src/models/common.js +1 -0
- package/dist/utils/console-table-printer/src/models/external-table.cjs +2 -0
- package/dist/utils/console-table-printer/src/models/external-table.d.ts +99 -0
- package/dist/utils/console-table-printer/src/models/external-table.js +1 -0
- package/dist/utils/console-table-printer/src/models/internal-table.cjs +2 -0
- package/dist/utils/console-table-printer/src/models/internal-table.d.ts +24 -0
- package/dist/utils/console-table-printer/src/models/internal-table.js +1 -0
- package/dist/utils/console-table-printer/src/utils/colored-console-line.cjs +43 -0
- package/dist/utils/console-table-printer/src/utils/colored-console-line.d.ts +12 -0
- package/dist/utils/console-table-printer/src/utils/colored-console-line.js +39 -0
- package/dist/utils/console-table-printer/src/utils/console-utils.cjs +23 -0
- package/dist/utils/console-table-printer/src/utils/console-utils.d.ts +3 -0
- package/dist/utils/console-table-printer/src/utils/console-utils.js +18 -0
- package/dist/utils/console-table-printer/src/utils/string-utils.cjs +68 -0
- package/dist/utils/console-table-printer/src/utils/string-utils.d.ts +4 -0
- package/dist/utils/console-table-printer/src/utils/string-utils.js +62 -0
- package/dist/utils/console-table-printer/src/utils/table-constants.cjs +55 -0
- package/dist/utils/console-table-printer/src/utils/table-constants.d.ts +11 -0
- package/dist/utils/console-table-printer/src/utils/table-constants.js +52 -0
- package/dist/utils/console-table-printer/src/utils/table-helpers.cjs +101 -0
- package/dist/utils/console-table-printer/src/utils/table-helpers.d.ts +29 -0
- package/dist/utils/console-table-printer/src/utils/table-helpers.js +88 -0
- package/dist/utils/fs.d.ts +1 -1
- package/dist/utils/jestlike/reporter.cjs +23 -23
- package/dist/utils/jestlike/reporter.js +2 -2
- package/dist/utils/prompts.cjs +0 -10
- package/dist/utils/prompts.d.ts +0 -1
- package/dist/utils/prompts.js +0 -9
- package/dist/utils/simple-wcswidth/index.cjs +10 -0
- package/dist/utils/simple-wcswidth/index.d.ts +3 -0
- package/dist/utils/simple-wcswidth/index.js +3 -0
- package/dist/utils/simple-wcswidth/src/binary-search.cjs +24 -0
- package/dist/utils/simple-wcswidth/src/binary-search.d.ts +3 -0
- package/dist/utils/simple-wcswidth/src/binary-search.js +22 -0
- package/dist/utils/simple-wcswidth/src/models.cjs +2 -0
- package/dist/utils/simple-wcswidth/src/models.d.ts +4 -0
- package/dist/utils/simple-wcswidth/src/models.js +1 -0
- package/dist/utils/simple-wcswidth/src/non-spacing-chars.cjs +149 -0
- package/dist/utils/simple-wcswidth/src/non-spacing-chars.d.ts +3 -0
- package/dist/utils/simple-wcswidth/src/non-spacing-chars.js +147 -0
- package/dist/utils/simple-wcswidth/src/wcswidth.cjs +20 -0
- package/dist/utils/simple-wcswidth/src/wcswidth.d.ts +2 -0
- package/dist/utils/simple-wcswidth/src/wcswidth.js +15 -0
- package/dist/utils/simple-wcswidth/src/wcwidth.cjs +67 -0
- package/dist/utils/simple-wcswidth/src/wcwidth.d.ts +2 -0
- package/dist/utils/simple-wcswidth/src/wcwidth.js +62 -0
- package/dist/wrappers/anthropic.cjs +4 -0
- package/dist/wrappers/anthropic.d.ts +1 -0
- package/dist/wrappers/anthropic.js +4 -0
- package/package.json +20 -19
package/dist/client.js
CHANGED
|
@@ -430,6 +430,12 @@ export class Client {
|
|
|
430
430
|
writable: true,
|
|
431
431
|
value: 100 * 1024 * 1024
|
|
432
432
|
});
|
|
433
|
+
Object.defineProperty(this, "_customHeaders", {
|
|
434
|
+
enumerable: true,
|
|
435
|
+
configurable: true,
|
|
436
|
+
writable: true,
|
|
437
|
+
value: {}
|
|
438
|
+
});
|
|
433
439
|
Object.defineProperty(this, "debug", {
|
|
434
440
|
enumerable: true,
|
|
435
441
|
configurable: true,
|
|
@@ -526,6 +532,8 @@ export class Client {
|
|
|
526
532
|
// Use the global singleton instance
|
|
527
533
|
this._promptCache = promptCacheSingleton;
|
|
528
534
|
}
|
|
535
|
+
// Initialize custom headers
|
|
536
|
+
this._customHeaders = config.headers ?? {};
|
|
529
537
|
}
|
|
530
538
|
static getDefaultClientConfig() {
|
|
531
539
|
const apiKey = getLangSmithEnvironmentVariable("API_KEY");
|
|
@@ -565,6 +573,10 @@ export class Client {
|
|
|
565
573
|
this.webUrl = "https://eu.smith.langchain.com";
|
|
566
574
|
return this.webUrl;
|
|
567
575
|
}
|
|
576
|
+
else if (this.apiUrl.split(".", 1)[0].includes("aws")) {
|
|
577
|
+
this.webUrl = "https://aws.smith.langchain.com";
|
|
578
|
+
return this.webUrl;
|
|
579
|
+
}
|
|
568
580
|
else if (this.apiUrl.split(".", 1)[0].includes("beta")) {
|
|
569
581
|
this.webUrl = "https://beta.smith.langchain.com";
|
|
570
582
|
return this.webUrl;
|
|
@@ -574,10 +586,13 @@ export class Client {
|
|
|
574
586
|
return this.webUrl;
|
|
575
587
|
}
|
|
576
588
|
}
|
|
577
|
-
get
|
|
589
|
+
get _mergedHeaders() {
|
|
590
|
+
// Start with custom headers so they don't override required headers
|
|
578
591
|
const headers = {
|
|
579
592
|
"User-Agent": `langsmith-js/${__version__}`,
|
|
593
|
+
...this._customHeaders,
|
|
580
594
|
};
|
|
595
|
+
// Required headers that should not be overridden
|
|
581
596
|
if (this.apiKey) {
|
|
582
597
|
headers["x-api-key"] = `${this.apiKey}`;
|
|
583
598
|
}
|
|
@@ -586,6 +601,17 @@ export class Client {
|
|
|
586
601
|
}
|
|
587
602
|
return headers;
|
|
588
603
|
}
|
|
604
|
+
/**
|
|
605
|
+
* Get or set custom headers for the client.
|
|
606
|
+
* Custom headers are merged with default headers (User-Agent, x-api-key, x-tenant-id).
|
|
607
|
+
* Custom headers will not override the default required headers.
|
|
608
|
+
*/
|
|
609
|
+
get headers() {
|
|
610
|
+
return this._customHeaders;
|
|
611
|
+
}
|
|
612
|
+
set headers(value) {
|
|
613
|
+
this._customHeaders = value ?? {};
|
|
614
|
+
}
|
|
589
615
|
_getPlatformEndpointPath(path) {
|
|
590
616
|
// Check if apiUrl already ends with /v1 or /v1/ to avoid double /v1/v1/ paths
|
|
591
617
|
const needsV1Prefix = this.apiUrl.slice(-3) !== "/v1" && this.apiUrl.slice(-4) !== "/v1/";
|
|
@@ -631,7 +657,7 @@ export class Client {
|
|
|
631
657
|
const response = await this.caller.call(async () => {
|
|
632
658
|
const res = await this._fetch(url, {
|
|
633
659
|
method: "GET",
|
|
634
|
-
headers: this.
|
|
660
|
+
headers: this._mergedHeaders,
|
|
635
661
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
636
662
|
...this.fetchOptions,
|
|
637
663
|
});
|
|
@@ -654,7 +680,7 @@ export class Client {
|
|
|
654
680
|
const response = await this.caller.call(async () => {
|
|
655
681
|
const res = await this._fetch(url, {
|
|
656
682
|
method: "GET",
|
|
657
|
-
headers: this.
|
|
683
|
+
headers: this._mergedHeaders,
|
|
658
684
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
659
685
|
...this.fetchOptions,
|
|
660
686
|
});
|
|
@@ -681,7 +707,10 @@ export class Client {
|
|
|
681
707
|
const response = await this.caller.call(async () => {
|
|
682
708
|
const res = await this._fetch(`${this.apiUrl}${path}`, {
|
|
683
709
|
method: requestMethod,
|
|
684
|
-
headers: {
|
|
710
|
+
headers: {
|
|
711
|
+
...this._mergedHeaders,
|
|
712
|
+
"Content-Type": "application/json",
|
|
713
|
+
},
|
|
685
714
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
686
715
|
...this.fetchOptions,
|
|
687
716
|
body,
|
|
@@ -1058,7 +1087,7 @@ export class Client {
|
|
|
1058
1087
|
return;
|
|
1059
1088
|
}
|
|
1060
1089
|
const headers = {
|
|
1061
|
-
...this.
|
|
1090
|
+
...this._mergedHeaders,
|
|
1062
1091
|
"Content-Type": "application/json",
|
|
1063
1092
|
};
|
|
1064
1093
|
const session_name = run.project_name;
|
|
@@ -1165,7 +1194,7 @@ export class Client {
|
|
|
1165
1194
|
}
|
|
1166
1195
|
async _postBatchIngestRuns(body, options) {
|
|
1167
1196
|
const headers = {
|
|
1168
|
-
...this.
|
|
1197
|
+
...this._mergedHeaders,
|
|
1169
1198
|
"Content-Type": "application/json",
|
|
1170
1199
|
Accept: "application/json",
|
|
1171
1200
|
};
|
|
@@ -1389,7 +1418,7 @@ export class Client {
|
|
|
1389
1418
|
return this.batchIngestCaller.callWithOptions({ sizeBytes: options?.sizeBytes }, async () => {
|
|
1390
1419
|
const body = await bodyFactory();
|
|
1391
1420
|
const headers = {
|
|
1392
|
-
...this.
|
|
1421
|
+
...this._mergedHeaders,
|
|
1393
1422
|
"Content-Type": `multipart/form-data; boundary=${boundary}`,
|
|
1394
1423
|
};
|
|
1395
1424
|
if (options?.apiKey !== undefined) {
|
|
@@ -1500,7 +1529,7 @@ export class Client {
|
|
|
1500
1529
|
return;
|
|
1501
1530
|
}
|
|
1502
1531
|
const headers = {
|
|
1503
|
-
...this.
|
|
1532
|
+
...this._mergedHeaders,
|
|
1504
1533
|
"Content-Type": "application/json",
|
|
1505
1534
|
};
|
|
1506
1535
|
if (options?.apiKey !== undefined) {
|
|
@@ -1786,7 +1815,10 @@ export class Client {
|
|
|
1786
1815
|
const response = await this.caller.call(async () => {
|
|
1787
1816
|
const res = await this._fetch(url, {
|
|
1788
1817
|
method: "POST",
|
|
1789
|
-
headers: {
|
|
1818
|
+
headers: {
|
|
1819
|
+
...this._mergedHeaders,
|
|
1820
|
+
"Content-Type": "application/json",
|
|
1821
|
+
},
|
|
1790
1822
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1791
1823
|
...this.fetchOptions,
|
|
1792
1824
|
body,
|
|
@@ -1962,7 +1994,7 @@ export class Client {
|
|
|
1962
1994
|
const response = await this.caller.call(async () => {
|
|
1963
1995
|
const res = await this._fetch(`${this.apiUrl}/runs/stats`, {
|
|
1964
1996
|
method: "POST",
|
|
1965
|
-
headers: { ...this.
|
|
1997
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
1966
1998
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1967
1999
|
...this.fetchOptions,
|
|
1968
2000
|
body,
|
|
@@ -1983,7 +2015,7 @@ export class Client {
|
|
|
1983
2015
|
const response = await this.caller.call(async () => {
|
|
1984
2016
|
const res = await this._fetch(`${this.apiUrl}/runs/${runId}/share`, {
|
|
1985
2017
|
method: "PUT",
|
|
1986
|
-
headers: this.
|
|
2018
|
+
headers: this._mergedHeaders,
|
|
1987
2019
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1988
2020
|
...this.fetchOptions,
|
|
1989
2021
|
body,
|
|
@@ -2002,7 +2034,7 @@ export class Client {
|
|
|
2002
2034
|
await this.caller.call(async () => {
|
|
2003
2035
|
const res = await this._fetch(`${this.apiUrl}/runs/${runId}/share`, {
|
|
2004
2036
|
method: "DELETE",
|
|
2005
|
-
headers: this.
|
|
2037
|
+
headers: this._mergedHeaders,
|
|
2006
2038
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2007
2039
|
...this.fetchOptions,
|
|
2008
2040
|
});
|
|
@@ -2015,7 +2047,7 @@ export class Client {
|
|
|
2015
2047
|
const response = await this.caller.call(async () => {
|
|
2016
2048
|
const res = await this._fetch(`${this.apiUrl}/runs/${runId}/share`, {
|
|
2017
2049
|
method: "GET",
|
|
2018
|
-
headers: this.
|
|
2050
|
+
headers: this._mergedHeaders,
|
|
2019
2051
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2020
2052
|
...this.fetchOptions,
|
|
2021
2053
|
});
|
|
@@ -2041,7 +2073,7 @@ export class Client {
|
|
|
2041
2073
|
const response = await this.caller.call(async () => {
|
|
2042
2074
|
const res = await this._fetch(`${this.apiUrl}/public/${shareToken}/runs${queryParams}`, {
|
|
2043
2075
|
method: "GET",
|
|
2044
|
-
headers: this.
|
|
2076
|
+
headers: this._mergedHeaders,
|
|
2045
2077
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2046
2078
|
...this.fetchOptions,
|
|
2047
2079
|
});
|
|
@@ -2063,7 +2095,7 @@ export class Client {
|
|
|
2063
2095
|
const response = await this.caller.call(async () => {
|
|
2064
2096
|
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId}/share`, {
|
|
2065
2097
|
method: "GET",
|
|
2066
|
-
headers: this.
|
|
2098
|
+
headers: this._mergedHeaders,
|
|
2067
2099
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2068
2100
|
...this.fetchOptions,
|
|
2069
2101
|
});
|
|
@@ -2090,7 +2122,7 @@ export class Client {
|
|
|
2090
2122
|
const response = await this.caller.call(async () => {
|
|
2091
2123
|
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId}/share`, {
|
|
2092
2124
|
method: "PUT",
|
|
2093
|
-
headers: this.
|
|
2125
|
+
headers: this._mergedHeaders,
|
|
2094
2126
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2095
2127
|
...this.fetchOptions,
|
|
2096
2128
|
body,
|
|
@@ -2107,7 +2139,7 @@ export class Client {
|
|
|
2107
2139
|
await this.caller.call(async () => {
|
|
2108
2140
|
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId}/share`, {
|
|
2109
2141
|
method: "DELETE",
|
|
2110
|
-
headers: this.
|
|
2142
|
+
headers: this._mergedHeaders,
|
|
2111
2143
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2112
2144
|
...this.fetchOptions,
|
|
2113
2145
|
});
|
|
@@ -2120,7 +2152,7 @@ export class Client {
|
|
|
2120
2152
|
const response = await this.caller.call(async () => {
|
|
2121
2153
|
const res = await this._fetch(`${this.apiUrl}/public/${shareToken}/datasets`, {
|
|
2122
2154
|
method: "GET",
|
|
2123
|
-
headers: this.
|
|
2155
|
+
headers: this._mergedHeaders,
|
|
2124
2156
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2125
2157
|
...this.fetchOptions,
|
|
2126
2158
|
});
|
|
@@ -2155,7 +2187,7 @@ export class Client {
|
|
|
2155
2187
|
const response = await this.caller.call(async () => {
|
|
2156
2188
|
const res = await this._fetch(`${this.apiUrl}/public/${shareToken}/examples?${urlParams.toString()}`, {
|
|
2157
2189
|
method: "GET",
|
|
2158
|
-
headers: this.
|
|
2190
|
+
headers: this._mergedHeaders,
|
|
2159
2191
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2160
2192
|
...this.fetchOptions,
|
|
2161
2193
|
});
|
|
@@ -2195,7 +2227,7 @@ export class Client {
|
|
|
2195
2227
|
const response = await this.caller.call(async () => {
|
|
2196
2228
|
const res = await this._fetch(endpoint, {
|
|
2197
2229
|
method: "POST",
|
|
2198
|
-
headers: { ...this.
|
|
2230
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
2199
2231
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2200
2232
|
...this.fetchOptions,
|
|
2201
2233
|
body: serializedBody,
|
|
@@ -2221,7 +2253,7 @@ export class Client {
|
|
|
2221
2253
|
const response = await this.caller.call(async () => {
|
|
2222
2254
|
const res = await this._fetch(endpoint, {
|
|
2223
2255
|
method: "PATCH",
|
|
2224
|
-
headers: { ...this.
|
|
2256
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
2225
2257
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2226
2258
|
...this.fetchOptions,
|
|
2227
2259
|
body,
|
|
@@ -2252,7 +2284,7 @@ export class Client {
|
|
|
2252
2284
|
const response = await this.caller.call(async () => {
|
|
2253
2285
|
const res = await this._fetch(`${this.apiUrl}${path}?${params}`, {
|
|
2254
2286
|
method: "GET",
|
|
2255
|
-
headers: this.
|
|
2287
|
+
headers: this._mergedHeaders,
|
|
2256
2288
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2257
2289
|
...this.fetchOptions,
|
|
2258
2290
|
});
|
|
@@ -2392,7 +2424,7 @@ export class Client {
|
|
|
2392
2424
|
await this.caller.call(async () => {
|
|
2393
2425
|
const res = await this._fetch(`${this.apiUrl}/sessions/${projectId_}`, {
|
|
2394
2426
|
method: "DELETE",
|
|
2395
|
-
headers: this.
|
|
2427
|
+
headers: this._mergedHeaders,
|
|
2396
2428
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2397
2429
|
...this.fetchOptions,
|
|
2398
2430
|
});
|
|
@@ -2423,7 +2455,7 @@ export class Client {
|
|
|
2423
2455
|
const response = await this.caller.call(async () => {
|
|
2424
2456
|
const res = await this._fetch(url, {
|
|
2425
2457
|
method: "POST",
|
|
2426
|
-
headers: this.
|
|
2458
|
+
headers: this._mergedHeaders,
|
|
2427
2459
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2428
2460
|
...this.fetchOptions,
|
|
2429
2461
|
body: formData,
|
|
@@ -2453,7 +2485,7 @@ export class Client {
|
|
|
2453
2485
|
const response = await this.caller.call(async () => {
|
|
2454
2486
|
const res = await this._fetch(`${this.apiUrl}/datasets`, {
|
|
2455
2487
|
method: "POST",
|
|
2456
|
-
headers: { ...this.
|
|
2488
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
2457
2489
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2458
2490
|
...this.fetchOptions,
|
|
2459
2491
|
body: serializedBody,
|
|
@@ -2589,7 +2621,7 @@ export class Client {
|
|
|
2589
2621
|
const response = await this.caller.call(async () => {
|
|
2590
2622
|
const res = await this._fetch(`${this.apiUrl}/datasets/${_datasetId}`, {
|
|
2591
2623
|
method: "PATCH",
|
|
2592
|
-
headers: { ...this.
|
|
2624
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
2593
2625
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2594
2626
|
...this.fetchOptions,
|
|
2595
2627
|
body,
|
|
@@ -2628,7 +2660,10 @@ export class Client {
|
|
|
2628
2660
|
await this.caller.call(async () => {
|
|
2629
2661
|
const res = await this._fetch(`${this.apiUrl}/datasets/${_datasetId}/tags`, {
|
|
2630
2662
|
method: "PUT",
|
|
2631
|
-
headers: {
|
|
2663
|
+
headers: {
|
|
2664
|
+
...this._mergedHeaders,
|
|
2665
|
+
"Content-Type": "application/json",
|
|
2666
|
+
},
|
|
2632
2667
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2633
2668
|
...this.fetchOptions,
|
|
2634
2669
|
body,
|
|
@@ -2657,7 +2692,7 @@ export class Client {
|
|
|
2657
2692
|
await this.caller.call(async () => {
|
|
2658
2693
|
const res = await this._fetch(this.apiUrl + path, {
|
|
2659
2694
|
method: "DELETE",
|
|
2660
|
-
headers: this.
|
|
2695
|
+
headers: this._mergedHeaders,
|
|
2661
2696
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2662
2697
|
...this.fetchOptions,
|
|
2663
2698
|
});
|
|
@@ -2665,90 +2700,6 @@ export class Client {
|
|
|
2665
2700
|
return res;
|
|
2666
2701
|
});
|
|
2667
2702
|
}
|
|
2668
|
-
async indexDataset({ datasetId, datasetName, tag, }) {
|
|
2669
|
-
let datasetId_ = datasetId;
|
|
2670
|
-
if (!datasetId_ && !datasetName) {
|
|
2671
|
-
throw new Error("Must provide either datasetName or datasetId");
|
|
2672
|
-
}
|
|
2673
|
-
else if (datasetId_ && datasetName) {
|
|
2674
|
-
throw new Error("Must provide either datasetName or datasetId, not both");
|
|
2675
|
-
}
|
|
2676
|
-
else if (!datasetId_) {
|
|
2677
|
-
const dataset = await this.readDataset({ datasetName });
|
|
2678
|
-
datasetId_ = dataset.id;
|
|
2679
|
-
}
|
|
2680
|
-
assertUuid(datasetId_);
|
|
2681
|
-
const data = {
|
|
2682
|
-
tag: tag,
|
|
2683
|
-
};
|
|
2684
|
-
const body = JSON.stringify(data);
|
|
2685
|
-
const response = await this.caller.call(async () => {
|
|
2686
|
-
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId_}/index`, {
|
|
2687
|
-
method: "POST",
|
|
2688
|
-
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
2689
|
-
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2690
|
-
...this.fetchOptions,
|
|
2691
|
-
body,
|
|
2692
|
-
});
|
|
2693
|
-
await raiseForStatus(res, "index dataset");
|
|
2694
|
-
return res;
|
|
2695
|
-
});
|
|
2696
|
-
await response.json();
|
|
2697
|
-
}
|
|
2698
|
-
/**
|
|
2699
|
-
* Lets you run a similarity search query on a dataset.
|
|
2700
|
-
*
|
|
2701
|
-
* Requires the dataset to be indexed. Please see the `indexDataset` method to set up indexing.
|
|
2702
|
-
*
|
|
2703
|
-
* @param inputs The input on which to run the similarity search. Must have the
|
|
2704
|
-
* same schema as the dataset.
|
|
2705
|
-
*
|
|
2706
|
-
* @param datasetId The dataset to search for similar examples.
|
|
2707
|
-
*
|
|
2708
|
-
* @param limit The maximum number of examples to return. Will return the top `limit` most
|
|
2709
|
-
* similar examples in order of most similar to least similar. If no similar
|
|
2710
|
-
* examples are found, random examples will be returned.
|
|
2711
|
-
*
|
|
2712
|
-
* @param filter A filter string to apply to the search. Only examples will be returned that
|
|
2713
|
-
* match the filter string. Some examples of filters
|
|
2714
|
-
*
|
|
2715
|
-
* - eq(metadata.mykey, "value")
|
|
2716
|
-
* - and(neq(metadata.my.nested.key, "value"), neq(metadata.mykey, "value"))
|
|
2717
|
-
* - or(eq(metadata.mykey, "value"), eq(metadata.mykey, "othervalue"))
|
|
2718
|
-
*
|
|
2719
|
-
* @returns A list of similar examples.
|
|
2720
|
-
*
|
|
2721
|
-
*
|
|
2722
|
-
* @example
|
|
2723
|
-
* dataset_id = "123e4567-e89b-12d3-a456-426614174000"
|
|
2724
|
-
* inputs = {"text": "How many people live in Berlin?"}
|
|
2725
|
-
* limit = 5
|
|
2726
|
-
* examples = await client.similarExamples(inputs, dataset_id, limit)
|
|
2727
|
-
*/
|
|
2728
|
-
async similarExamples(inputs, datasetId, limit, { filter, } = {}) {
|
|
2729
|
-
const data = {
|
|
2730
|
-
limit: limit,
|
|
2731
|
-
inputs: inputs,
|
|
2732
|
-
};
|
|
2733
|
-
if (filter !== undefined) {
|
|
2734
|
-
data["filter"] = filter;
|
|
2735
|
-
}
|
|
2736
|
-
assertUuid(datasetId);
|
|
2737
|
-
const body = JSON.stringify(data);
|
|
2738
|
-
const response = await this.caller.call(async () => {
|
|
2739
|
-
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId}/search`, {
|
|
2740
|
-
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
2741
|
-
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2742
|
-
...this.fetchOptions,
|
|
2743
|
-
method: "POST",
|
|
2744
|
-
body,
|
|
2745
|
-
});
|
|
2746
|
-
await raiseForStatus(res, "fetch similar examples");
|
|
2747
|
-
return res;
|
|
2748
|
-
});
|
|
2749
|
-
const result = await response.json();
|
|
2750
|
-
return result["examples"];
|
|
2751
|
-
}
|
|
2752
2703
|
async createExample(inputsOrUpdate, outputs, options) {
|
|
2753
2704
|
if (isExampleCreate(inputsOrUpdate)) {
|
|
2754
2705
|
if (outputs !== undefined || options !== undefined) {
|
|
@@ -2960,7 +2911,7 @@ export class Client {
|
|
|
2960
2911
|
await this.caller.call(async () => {
|
|
2961
2912
|
const res = await this._fetch(this.apiUrl + path, {
|
|
2962
2913
|
method: "DELETE",
|
|
2963
|
-
headers: this.
|
|
2914
|
+
headers: this._mergedHeaders,
|
|
2964
2915
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
2965
2916
|
...this.fetchOptions,
|
|
2966
2917
|
});
|
|
@@ -2983,7 +2934,10 @@ export class Client {
|
|
|
2983
2934
|
await this.caller.call(async () => {
|
|
2984
2935
|
const res = await this._fetch(`${this.apiUrl}${path}`, {
|
|
2985
2936
|
method: "POST",
|
|
2986
|
-
headers: {
|
|
2937
|
+
headers: {
|
|
2938
|
+
...this._mergedHeaders,
|
|
2939
|
+
"Content-Type": "application/json",
|
|
2940
|
+
},
|
|
2987
2941
|
body: JSON.stringify({
|
|
2988
2942
|
example_ids: exampleIds,
|
|
2989
2943
|
hard_delete: true,
|
|
@@ -3002,7 +2956,7 @@ export class Client {
|
|
|
3002
2956
|
await this.caller.call(async () => {
|
|
3003
2957
|
const res = await this._fetch(`${this.apiUrl}/examples?${params.toString()}`, {
|
|
3004
2958
|
method: "DELETE",
|
|
3005
|
-
headers: this.
|
|
2959
|
+
headers: this._mergedHeaders,
|
|
3006
2960
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3007
2961
|
...this.fetchOptions,
|
|
3008
2962
|
});
|
|
@@ -3084,7 +3038,7 @@ export class Client {
|
|
|
3084
3038
|
const response = await this.caller.call(async () => {
|
|
3085
3039
|
const res = await this._fetch(`${this.apiUrl}/datasets/${resolvedDatasetId}/version?${params.toString()}`, {
|
|
3086
3040
|
method: "GET",
|
|
3087
|
-
headers: { ...this.
|
|
3041
|
+
headers: { ...this._mergedHeaders },
|
|
3088
3042
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3089
3043
|
...this.fetchOptions,
|
|
3090
3044
|
});
|
|
@@ -3149,7 +3103,10 @@ export class Client {
|
|
|
3149
3103
|
await this.caller.call(async () => {
|
|
3150
3104
|
const res = await this._fetch(`${this.apiUrl}/datasets/${datasetId_}/splits`, {
|
|
3151
3105
|
method: "PUT",
|
|
3152
|
-
headers: {
|
|
3106
|
+
headers: {
|
|
3107
|
+
...this._mergedHeaders,
|
|
3108
|
+
"Content-Type": "application/json",
|
|
3109
|
+
},
|
|
3153
3110
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3154
3111
|
...this.fetchOptions,
|
|
3155
3112
|
body,
|
|
@@ -3197,7 +3154,7 @@ export class Client {
|
|
|
3197
3154
|
await this.caller.call(async () => {
|
|
3198
3155
|
const res = await this._fetch(url, {
|
|
3199
3156
|
method: "POST",
|
|
3200
|
-
headers: { ...this.
|
|
3157
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
3201
3158
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3202
3159
|
...this.fetchOptions,
|
|
3203
3160
|
body,
|
|
@@ -3226,7 +3183,7 @@ export class Client {
|
|
|
3226
3183
|
await this.caller.call(async () => {
|
|
3227
3184
|
const res = await this._fetch(`${this.apiUrl}/feedback/${feedbackId}`, {
|
|
3228
3185
|
method: "PATCH",
|
|
3229
|
-
headers: { ...this.
|
|
3186
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
3230
3187
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3231
3188
|
...this.fetchOptions,
|
|
3232
3189
|
body,
|
|
@@ -3247,7 +3204,7 @@ export class Client {
|
|
|
3247
3204
|
await this.caller.call(async () => {
|
|
3248
3205
|
const res = await this._fetch(this.apiUrl + path, {
|
|
3249
3206
|
method: "DELETE",
|
|
3250
|
-
headers: this.
|
|
3207
|
+
headers: this._mergedHeaders,
|
|
3251
3208
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3252
3209
|
...this.fetchOptions,
|
|
3253
3210
|
});
|
|
@@ -3315,7 +3272,7 @@ export class Client {
|
|
|
3315
3272
|
const response = await this.caller.call(async () => {
|
|
3316
3273
|
const res = await this._fetch(`${this.apiUrl}/feedback/tokens`, {
|
|
3317
3274
|
method: "POST",
|
|
3318
|
-
headers: { ...this.
|
|
3275
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
3319
3276
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3320
3277
|
...this.fetchOptions,
|
|
3321
3278
|
body: serializedBody,
|
|
@@ -3352,7 +3309,7 @@ export class Client {
|
|
|
3352
3309
|
const response = await this.caller.call(async () => {
|
|
3353
3310
|
const res = await this._fetch(`${this.apiUrl}/datasets/comparative`, {
|
|
3354
3311
|
method: "POST",
|
|
3355
|
-
headers: { ...this.
|
|
3312
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
3356
3313
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3357
3314
|
...this.fetchOptions,
|
|
3358
3315
|
body: serializedBody,
|
|
@@ -3446,7 +3403,7 @@ export class Client {
|
|
|
3446
3403
|
const response = await this.caller.call(async () => {
|
|
3447
3404
|
const res = await this._fetch(`${this.apiUrl}/feedback-configs`, {
|
|
3448
3405
|
method: "POST",
|
|
3449
|
-
headers: { ...this.
|
|
3406
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
3450
3407
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3451
3408
|
...this.fetchOptions,
|
|
3452
3409
|
body: JSON.stringify(body),
|
|
@@ -3503,7 +3460,7 @@ export class Client {
|
|
|
3503
3460
|
const response = await this.caller.call(async () => {
|
|
3504
3461
|
const res = await this._fetch(`${this.apiUrl}/feedback-configs`, {
|
|
3505
3462
|
method: "PATCH",
|
|
3506
|
-
headers: { ...this.
|
|
3463
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
3507
3464
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3508
3465
|
...this.fetchOptions,
|
|
3509
3466
|
body: JSON.stringify(body),
|
|
@@ -3522,7 +3479,7 @@ export class Client {
|
|
|
3522
3479
|
await this.caller.call(async () => {
|
|
3523
3480
|
const res = await this._fetch(`${this.apiUrl}/feedback-configs?${params}`, {
|
|
3524
3481
|
method: "DELETE",
|
|
3525
|
-
headers: this.
|
|
3482
|
+
headers: this._mergedHeaders,
|
|
3526
3483
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3527
3484
|
...this.fetchOptions,
|
|
3528
3485
|
});
|
|
@@ -3585,7 +3542,7 @@ export class Client {
|
|
|
3585
3542
|
const response = await this.caller.call(async () => {
|
|
3586
3543
|
const res = await this._fetch(`${this.apiUrl}/annotation-queues`, {
|
|
3587
3544
|
method: "POST",
|
|
3588
|
-
headers: { ...this.
|
|
3545
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
3589
3546
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3590
3547
|
...this.fetchOptions,
|
|
3591
3548
|
body: serializedBody,
|
|
@@ -3604,7 +3561,7 @@ export class Client {
|
|
|
3604
3561
|
const response = await this.caller.call(async () => {
|
|
3605
3562
|
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}`, {
|
|
3606
3563
|
method: "GET",
|
|
3607
|
-
headers: this.
|
|
3564
|
+
headers: this._mergedHeaders,
|
|
3608
3565
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3609
3566
|
...this.fetchOptions,
|
|
3610
3567
|
});
|
|
@@ -3635,7 +3592,10 @@ export class Client {
|
|
|
3635
3592
|
await this.caller.call(async () => {
|
|
3636
3593
|
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}`, {
|
|
3637
3594
|
method: "PATCH",
|
|
3638
|
-
headers: {
|
|
3595
|
+
headers: {
|
|
3596
|
+
...this._mergedHeaders,
|
|
3597
|
+
"Content-Type": "application/json",
|
|
3598
|
+
},
|
|
3639
3599
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3640
3600
|
...this.fetchOptions,
|
|
3641
3601
|
body,
|
|
@@ -3652,7 +3612,7 @@ export class Client {
|
|
|
3652
3612
|
await this.caller.call(async () => {
|
|
3653
3613
|
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}`, {
|
|
3654
3614
|
method: "DELETE",
|
|
3655
|
-
headers: { ...this.
|
|
3615
|
+
headers: { ...this._mergedHeaders, Accept: "application/json" },
|
|
3656
3616
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3657
3617
|
...this.fetchOptions,
|
|
3658
3618
|
});
|
|
@@ -3670,7 +3630,10 @@ export class Client {
|
|
|
3670
3630
|
await this.caller.call(async () => {
|
|
3671
3631
|
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}/runs`, {
|
|
3672
3632
|
method: "POST",
|
|
3673
|
-
headers: {
|
|
3633
|
+
headers: {
|
|
3634
|
+
...this._mergedHeaders,
|
|
3635
|
+
"Content-Type": "application/json",
|
|
3636
|
+
},
|
|
3674
3637
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3675
3638
|
...this.fetchOptions,
|
|
3676
3639
|
body,
|
|
@@ -3691,7 +3654,7 @@ export class Client {
|
|
|
3691
3654
|
const response = await this.caller.call(async () => {
|
|
3692
3655
|
const res = await this._fetch(`${this.apiUrl}${baseUrl}/${index}`, {
|
|
3693
3656
|
method: "GET",
|
|
3694
|
-
headers: this.
|
|
3657
|
+
headers: this._mergedHeaders,
|
|
3695
3658
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3696
3659
|
...this.fetchOptions,
|
|
3697
3660
|
});
|
|
@@ -3710,7 +3673,7 @@ export class Client {
|
|
|
3710
3673
|
await this.caller.call(async () => {
|
|
3711
3674
|
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}/runs/${assertUuid(queueRunId, "queueRunId")}`, {
|
|
3712
3675
|
method: "DELETE",
|
|
3713
|
-
headers: { ...this.
|
|
3676
|
+
headers: { ...this._mergedHeaders, Accept: "application/json" },
|
|
3714
3677
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3715
3678
|
...this.fetchOptions,
|
|
3716
3679
|
});
|
|
@@ -3726,7 +3689,7 @@ export class Client {
|
|
|
3726
3689
|
const response = await this.caller.call(async () => {
|
|
3727
3690
|
const res = await this._fetch(`${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}/size`, {
|
|
3728
3691
|
method: "GET",
|
|
3729
|
-
headers: this.
|
|
3692
|
+
headers: this._mergedHeaders,
|
|
3730
3693
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3731
3694
|
...this.fetchOptions,
|
|
3732
3695
|
});
|
|
@@ -3749,7 +3712,7 @@ export class Client {
|
|
|
3749
3712
|
const response = await this.caller.call(async () => {
|
|
3750
3713
|
const res = await this._fetch(`${this.apiUrl}/commits/${promptOwnerAndName}/?limit=${1}&offset=${0}`, {
|
|
3751
3714
|
method: "GET",
|
|
3752
|
-
headers: this.
|
|
3715
|
+
headers: this._mergedHeaders,
|
|
3753
3716
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3754
3717
|
...this.fetchOptions,
|
|
3755
3718
|
});
|
|
@@ -3768,7 +3731,10 @@ export class Client {
|
|
|
3768
3731
|
const response = await this.caller.call(async () => {
|
|
3769
3732
|
const res = await this._fetch(`${this.apiUrl}/likes/${owner}/${promptName}`, {
|
|
3770
3733
|
method: "POST",
|
|
3771
|
-
headers: {
|
|
3734
|
+
headers: {
|
|
3735
|
+
...this._mergedHeaders,
|
|
3736
|
+
"Content-Type": "application/json",
|
|
3737
|
+
},
|
|
3772
3738
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3773
3739
|
...this.fetchOptions,
|
|
3774
3740
|
body,
|
|
@@ -3938,7 +3904,7 @@ export class Client {
|
|
|
3938
3904
|
const response = await this.caller.call(async () => {
|
|
3939
3905
|
const res = await this._fetch(`${this.apiUrl}/repos/${owner}/${promptName}`, {
|
|
3940
3906
|
method: "GET",
|
|
3941
|
-
headers: this.
|
|
3907
|
+
headers: this._mergedHeaders,
|
|
3942
3908
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
3943
3909
|
...this.fetchOptions,
|
|
3944
3910
|
});
|
|
@@ -4006,7 +3972,7 @@ export class Client {
|
|
|
4006
3972
|
const response = await this.caller.call(async () => {
|
|
4007
3973
|
const res = await this._fetch(`${this.apiUrl}/repos/`, {
|
|
4008
3974
|
method: "POST",
|
|
4009
|
-
headers: { ...this.
|
|
3975
|
+
headers: { ...this._mergedHeaders, "Content-Type": "application/json" },
|
|
4010
3976
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
4011
3977
|
...this.fetchOptions,
|
|
4012
3978
|
body,
|
|
@@ -4057,12 +4023,18 @@ export class Client {
|
|
|
4057
4023
|
const payload = {
|
|
4058
4024
|
manifest: JSON.parse(JSON.stringify(object)),
|
|
4059
4025
|
parent_commit: resolvedParentCommitHash,
|
|
4026
|
+
...(options?.description !== undefined && {
|
|
4027
|
+
description: options.description,
|
|
4028
|
+
}),
|
|
4060
4029
|
};
|
|
4061
4030
|
const body = JSON.stringify(payload);
|
|
4062
4031
|
const response = await this.caller.call(async () => {
|
|
4063
4032
|
const res = await this._fetch(`${this.apiUrl}/commits/${owner}/${promptName}`, {
|
|
4064
4033
|
method: "POST",
|
|
4065
|
-
headers: {
|
|
4034
|
+
headers: {
|
|
4035
|
+
...this._mergedHeaders,
|
|
4036
|
+
"Content-Type": "application/json",
|
|
4037
|
+
},
|
|
4066
4038
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
4067
4039
|
...this.fetchOptions,
|
|
4068
4040
|
body,
|
|
@@ -4145,7 +4117,7 @@ export class Client {
|
|
|
4145
4117
|
const response = await this.caller.call(async () => {
|
|
4146
4118
|
const res = await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${datasetIdToUse}/examples`)}`, {
|
|
4147
4119
|
method: "PATCH",
|
|
4148
|
-
headers: this.
|
|
4120
|
+
headers: this._mergedHeaders,
|
|
4149
4121
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
4150
4122
|
...this.fetchOptions,
|
|
4151
4123
|
body: formData,
|
|
@@ -4228,7 +4200,7 @@ export class Client {
|
|
|
4228
4200
|
const response = await this.caller.call(async () => {
|
|
4229
4201
|
const res = await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${datasetId}/examples`)}`, {
|
|
4230
4202
|
method: "POST",
|
|
4231
|
-
headers: this.
|
|
4203
|
+
headers: this._mergedHeaders,
|
|
4232
4204
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
4233
4205
|
...this.fetchOptions,
|
|
4234
4206
|
body: formData,
|
|
@@ -4266,7 +4238,7 @@ export class Client {
|
|
|
4266
4238
|
const res = await this._fetch(`${this.apiUrl}/repos/${owner}/${promptName}`, {
|
|
4267
4239
|
method: "PATCH",
|
|
4268
4240
|
headers: {
|
|
4269
|
-
...this.
|
|
4241
|
+
...this._mergedHeaders,
|
|
4270
4242
|
"Content-Type": "application/json",
|
|
4271
4243
|
},
|
|
4272
4244
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
@@ -4289,7 +4261,7 @@ export class Client {
|
|
|
4289
4261
|
const response = await this.caller.call(async () => {
|
|
4290
4262
|
const res = await this._fetch(`${this.apiUrl}/repos/${owner}/${promptName}`, {
|
|
4291
4263
|
method: "DELETE",
|
|
4292
|
-
headers: this.
|
|
4264
|
+
headers: this._mergedHeaders,
|
|
4293
4265
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
4294
4266
|
...this.fetchOptions,
|
|
4295
4267
|
});
|
|
@@ -4314,7 +4286,7 @@ export class Client {
|
|
|
4314
4286
|
const response = await this.caller.call(async () => {
|
|
4315
4287
|
const res = await this._fetch(`${this.apiUrl}/commits/${owner}/${promptName}/${commitHash}${options?.includeModel ? "?include_model=true" : ""}`, {
|
|
4316
4288
|
method: "GET",
|
|
4317
|
-
headers: this.
|
|
4289
|
+
headers: this._mergedHeaders,
|
|
4318
4290
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
4319
4291
|
...this.fetchOptions,
|
|
4320
4292
|
});
|
|
@@ -4386,6 +4358,7 @@ export class Client {
|
|
|
4386
4358
|
// Create a commit with the new manifest
|
|
4387
4359
|
const url = await this.createCommit(promptIdentifier, options?.object, {
|
|
4388
4360
|
parentCommitHash: options?.parentCommitHash,
|
|
4361
|
+
description: options?.commitDescription,
|
|
4389
4362
|
});
|
|
4390
4363
|
return url;
|
|
4391
4364
|
}
|