langsmith 0.1.13 → 0.1.14
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/client.cjs +37 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +37 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -265,6 +265,12 @@ class Client {
|
|
|
265
265
|
writable: true,
|
|
266
266
|
value: void 0
|
|
267
267
|
});
|
|
268
|
+
Object.defineProperty(this, "fetchOptions", {
|
|
269
|
+
enumerable: true,
|
|
270
|
+
configurable: true,
|
|
271
|
+
writable: true,
|
|
272
|
+
value: void 0
|
|
273
|
+
});
|
|
268
274
|
const defaultConfig = Client.getDefaultClientConfig();
|
|
269
275
|
this.tracingSampleRate = getTracingSamplingRate();
|
|
270
276
|
this.apiUrl = trimQuotes(config.apiUrl ?? defaultConfig.apiUrl) ?? "";
|
|
@@ -281,6 +287,7 @@ class Client {
|
|
|
281
287
|
this.autoBatchTracing = config.autoBatchTracing ?? this.autoBatchTracing;
|
|
282
288
|
this.pendingAutoBatchedRunLimit =
|
|
283
289
|
config.pendingAutoBatchedRunLimit ?? this.pendingAutoBatchedRunLimit;
|
|
290
|
+
this.fetchOptions = config.fetchOptions || {};
|
|
284
291
|
}
|
|
285
292
|
static getDefaultClientConfig() {
|
|
286
293
|
const apiKey = (0, env_js_1.getEnvironmentVariable)("LANGCHAIN_API_KEY");
|
|
@@ -368,6 +375,7 @@ class Client {
|
|
|
368
375
|
method: "GET",
|
|
369
376
|
headers: this.headers,
|
|
370
377
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
378
|
+
...this.fetchOptions,
|
|
371
379
|
});
|
|
372
380
|
if (!response.ok) {
|
|
373
381
|
throw new Error(`Failed to fetch ${path}: ${response.status} ${response.statusText}`);
|
|
@@ -389,6 +397,7 @@ class Client {
|
|
|
389
397
|
method: "GET",
|
|
390
398
|
headers: this.headers,
|
|
391
399
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
400
|
+
...this.fetchOptions,
|
|
392
401
|
});
|
|
393
402
|
if (!response.ok) {
|
|
394
403
|
throw new Error(`Failed to fetch ${path}: ${response.status} ${response.statusText}`);
|
|
@@ -411,6 +420,7 @@ class Client {
|
|
|
411
420
|
method: requestMethod,
|
|
412
421
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
413
422
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
423
|
+
...this.fetchOptions,
|
|
414
424
|
body: JSON.stringify(bodyParams),
|
|
415
425
|
});
|
|
416
426
|
const responseBody = await response.json();
|
|
@@ -504,6 +514,7 @@ class Client {
|
|
|
504
514
|
method: "GET",
|
|
505
515
|
headers: { Accept: "application/json" },
|
|
506
516
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
517
|
+
...this.fetchOptions,
|
|
507
518
|
});
|
|
508
519
|
if (!response.ok) {
|
|
509
520
|
// consume the response body to release the connection
|
|
@@ -551,6 +562,7 @@ class Client {
|
|
|
551
562
|
headers,
|
|
552
563
|
body: JSON.stringify(mergedRunCreateParams[0]),
|
|
553
564
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
565
|
+
...this.fetchOptions,
|
|
554
566
|
});
|
|
555
567
|
await raiseForStatus(response, "create run");
|
|
556
568
|
}
|
|
@@ -650,6 +662,7 @@ class Client {
|
|
|
650
662
|
headers,
|
|
651
663
|
body: body,
|
|
652
664
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
665
|
+
...this.fetchOptions,
|
|
653
666
|
});
|
|
654
667
|
await raiseForStatus(response, "batch create run");
|
|
655
668
|
}
|
|
@@ -686,6 +699,7 @@ class Client {
|
|
|
686
699
|
headers,
|
|
687
700
|
body: JSON.stringify(run),
|
|
688
701
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
702
|
+
...this.fetchOptions,
|
|
689
703
|
});
|
|
690
704
|
await raiseForStatus(response, "update run");
|
|
691
705
|
}
|
|
@@ -880,6 +894,7 @@ class Client {
|
|
|
880
894
|
headers: this.headers,
|
|
881
895
|
body: JSON.stringify(data),
|
|
882
896
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
897
|
+
...this.fetchOptions,
|
|
883
898
|
});
|
|
884
899
|
const result = await response.json();
|
|
885
900
|
if (result === null || !("share_token" in result)) {
|
|
@@ -893,6 +908,7 @@ class Client {
|
|
|
893
908
|
method: "DELETE",
|
|
894
909
|
headers: this.headers,
|
|
895
910
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
911
|
+
...this.fetchOptions,
|
|
896
912
|
});
|
|
897
913
|
await raiseForStatus(response, "unshare run");
|
|
898
914
|
}
|
|
@@ -902,6 +918,7 @@ class Client {
|
|
|
902
918
|
method: "GET",
|
|
903
919
|
headers: this.headers,
|
|
904
920
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
921
|
+
...this.fetchOptions,
|
|
905
922
|
});
|
|
906
923
|
const result = await response.json();
|
|
907
924
|
if (result === null || !("share_token" in result)) {
|
|
@@ -923,6 +940,7 @@ class Client {
|
|
|
923
940
|
method: "GET",
|
|
924
941
|
headers: this.headers,
|
|
925
942
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
943
|
+
...this.fetchOptions,
|
|
926
944
|
});
|
|
927
945
|
const runs = await response.json();
|
|
928
946
|
return runs;
|
|
@@ -940,6 +958,7 @@ class Client {
|
|
|
940
958
|
method: "GET",
|
|
941
959
|
headers: this.headers,
|
|
942
960
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
961
|
+
...this.fetchOptions,
|
|
943
962
|
});
|
|
944
963
|
const shareSchema = await response.json();
|
|
945
964
|
shareSchema.url = `${this.getHostUrl()}/public/${shareSchema.share_token}/d`;
|
|
@@ -962,6 +981,7 @@ class Client {
|
|
|
962
981
|
headers: this.headers,
|
|
963
982
|
body: JSON.stringify(data),
|
|
964
983
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
984
|
+
...this.fetchOptions,
|
|
965
985
|
});
|
|
966
986
|
const shareSchema = await response.json();
|
|
967
987
|
shareSchema.url = `${this.getHostUrl()}/public/${shareSchema.share_token}/d`;
|
|
@@ -973,6 +993,7 @@ class Client {
|
|
|
973
993
|
method: "DELETE",
|
|
974
994
|
headers: this.headers,
|
|
975
995
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
996
|
+
...this.fetchOptions,
|
|
976
997
|
});
|
|
977
998
|
await raiseForStatus(response, "unshare dataset");
|
|
978
999
|
}
|
|
@@ -982,6 +1003,7 @@ class Client {
|
|
|
982
1003
|
method: "GET",
|
|
983
1004
|
headers: this.headers,
|
|
984
1005
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1006
|
+
...this.fetchOptions,
|
|
985
1007
|
});
|
|
986
1008
|
const dataset = await response.json();
|
|
987
1009
|
return dataset;
|
|
@@ -1006,6 +1028,7 @@ class Client {
|
|
|
1006
1028
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1007
1029
|
body: JSON.stringify(body),
|
|
1008
1030
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1031
|
+
...this.fetchOptions,
|
|
1009
1032
|
});
|
|
1010
1033
|
const result = await response.json();
|
|
1011
1034
|
if (!response.ok) {
|
|
@@ -1030,6 +1053,7 @@ class Client {
|
|
|
1030
1053
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1031
1054
|
body: JSON.stringify(body),
|
|
1032
1055
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1056
|
+
...this.fetchOptions,
|
|
1033
1057
|
});
|
|
1034
1058
|
const result = await response.json();
|
|
1035
1059
|
if (!response.ok) {
|
|
@@ -1058,6 +1082,7 @@ class Client {
|
|
|
1058
1082
|
method: "GET",
|
|
1059
1083
|
headers: this.headers,
|
|
1060
1084
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1085
|
+
...this.fetchOptions,
|
|
1061
1086
|
});
|
|
1062
1087
|
// consume the response body to release the connection
|
|
1063
1088
|
// https://undici.nodejs.org/#/?id=garbage-collection
|
|
@@ -1168,6 +1193,7 @@ class Client {
|
|
|
1168
1193
|
method: "DELETE",
|
|
1169
1194
|
headers: this.headers,
|
|
1170
1195
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1196
|
+
...this.fetchOptions,
|
|
1171
1197
|
});
|
|
1172
1198
|
await raiseForStatus(response, `delete session ${projectId_} (${projectName})`);
|
|
1173
1199
|
}
|
|
@@ -1195,6 +1221,7 @@ class Client {
|
|
|
1195
1221
|
headers: this.headers,
|
|
1196
1222
|
body: formData,
|
|
1197
1223
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1224
|
+
...this.fetchOptions,
|
|
1198
1225
|
});
|
|
1199
1226
|
if (!response.ok) {
|
|
1200
1227
|
const result = await response.json();
|
|
@@ -1219,6 +1246,7 @@ class Client {
|
|
|
1219
1246
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1220
1247
|
body: JSON.stringify(body),
|
|
1221
1248
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1249
|
+
...this.fetchOptions,
|
|
1222
1250
|
});
|
|
1223
1251
|
if (!response.ok) {
|
|
1224
1252
|
const result = await response.json();
|
|
@@ -1342,6 +1370,7 @@ class Client {
|
|
|
1342
1370
|
method: "DELETE",
|
|
1343
1371
|
headers: this.headers,
|
|
1344
1372
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1373
|
+
...this.fetchOptions,
|
|
1345
1374
|
});
|
|
1346
1375
|
if (!response.ok) {
|
|
1347
1376
|
throw new Error(`Failed to delete ${path}: ${response.status} ${response.statusText}`);
|
|
@@ -1373,6 +1402,7 @@ class Client {
|
|
|
1373
1402
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1374
1403
|
body: JSON.stringify(data),
|
|
1375
1404
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1405
|
+
...this.fetchOptions,
|
|
1376
1406
|
});
|
|
1377
1407
|
if (!response.ok) {
|
|
1378
1408
|
throw new Error(`Failed to create example: ${response.status} ${response.statusText}`);
|
|
@@ -1407,6 +1437,7 @@ class Client {
|
|
|
1407
1437
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1408
1438
|
body: JSON.stringify(formattedExamples),
|
|
1409
1439
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1440
|
+
...this.fetchOptions,
|
|
1410
1441
|
});
|
|
1411
1442
|
if (!response.ok) {
|
|
1412
1443
|
throw new Error(`Failed to create examples: ${response.status} ${response.statusText}`);
|
|
@@ -1476,6 +1507,7 @@ class Client {
|
|
|
1476
1507
|
method: "DELETE",
|
|
1477
1508
|
headers: this.headers,
|
|
1478
1509
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1510
|
+
...this.fetchOptions,
|
|
1479
1511
|
});
|
|
1480
1512
|
if (!response.ok) {
|
|
1481
1513
|
throw new Error(`Failed to delete ${path}: ${response.status} ${response.statusText}`);
|
|
@@ -1489,6 +1521,7 @@ class Client {
|
|
|
1489
1521
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1490
1522
|
body: JSON.stringify(update),
|
|
1491
1523
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1524
|
+
...this.fetchOptions,
|
|
1492
1525
|
});
|
|
1493
1526
|
if (!response.ok) {
|
|
1494
1527
|
throw new Error(`Failed to update example ${exampleId}: ${response.status} ${response.statusText}`);
|
|
@@ -1558,6 +1591,7 @@ class Client {
|
|
|
1558
1591
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1559
1592
|
body: JSON.stringify(feedback),
|
|
1560
1593
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1594
|
+
...this.fetchOptions,
|
|
1561
1595
|
});
|
|
1562
1596
|
await raiseForStatus(response, "create feedback");
|
|
1563
1597
|
return feedback;
|
|
@@ -1582,6 +1616,7 @@ class Client {
|
|
|
1582
1616
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1583
1617
|
body: JSON.stringify(feedbackUpdate),
|
|
1584
1618
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1619
|
+
...this.fetchOptions,
|
|
1585
1620
|
});
|
|
1586
1621
|
await raiseForStatus(response, "update feedback");
|
|
1587
1622
|
}
|
|
@@ -1598,6 +1633,7 @@ class Client {
|
|
|
1598
1633
|
method: "DELETE",
|
|
1599
1634
|
headers: this.headers,
|
|
1600
1635
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1636
|
+
...this.fetchOptions,
|
|
1601
1637
|
});
|
|
1602
1638
|
if (!response.ok) {
|
|
1603
1639
|
throw new Error(`Failed to delete ${path}: ${response.status} ${response.statusText}`);
|
|
@@ -1662,6 +1698,7 @@ class Client {
|
|
|
1662
1698
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1663
1699
|
body: JSON.stringify(body),
|
|
1664
1700
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1701
|
+
...this.fetchOptions,
|
|
1665
1702
|
});
|
|
1666
1703
|
const result = await response.json();
|
|
1667
1704
|
return result;
|
package/dist/client.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface ClientConfig {
|
|
|
11
11
|
hideOutputs?: boolean;
|
|
12
12
|
autoBatchTracing?: boolean;
|
|
13
13
|
pendingAutoBatchedRunLimit?: number;
|
|
14
|
+
fetchOptions?: RequestInit;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Represents the parameters for listing runs (spans) from the Langsmith server.
|
|
@@ -162,6 +163,7 @@ export declare class Client {
|
|
|
162
163
|
private autoBatchInitialDelayMs;
|
|
163
164
|
private autoBatchAggregationDelayMs;
|
|
164
165
|
private serverInfo;
|
|
166
|
+
private fetchOptions;
|
|
165
167
|
constructor(config?: ClientConfig);
|
|
166
168
|
static getDefaultClientConfig(): {
|
|
167
169
|
apiUrl: string;
|
package/dist/client.js
CHANGED
|
@@ -238,6 +238,12 @@ export class Client {
|
|
|
238
238
|
writable: true,
|
|
239
239
|
value: void 0
|
|
240
240
|
});
|
|
241
|
+
Object.defineProperty(this, "fetchOptions", {
|
|
242
|
+
enumerable: true,
|
|
243
|
+
configurable: true,
|
|
244
|
+
writable: true,
|
|
245
|
+
value: void 0
|
|
246
|
+
});
|
|
241
247
|
const defaultConfig = Client.getDefaultClientConfig();
|
|
242
248
|
this.tracingSampleRate = getTracingSamplingRate();
|
|
243
249
|
this.apiUrl = trimQuotes(config.apiUrl ?? defaultConfig.apiUrl) ?? "";
|
|
@@ -254,6 +260,7 @@ export class Client {
|
|
|
254
260
|
this.autoBatchTracing = config.autoBatchTracing ?? this.autoBatchTracing;
|
|
255
261
|
this.pendingAutoBatchedRunLimit =
|
|
256
262
|
config.pendingAutoBatchedRunLimit ?? this.pendingAutoBatchedRunLimit;
|
|
263
|
+
this.fetchOptions = config.fetchOptions || {};
|
|
257
264
|
}
|
|
258
265
|
static getDefaultClientConfig() {
|
|
259
266
|
const apiKey = getEnvironmentVariable("LANGCHAIN_API_KEY");
|
|
@@ -341,6 +348,7 @@ export class Client {
|
|
|
341
348
|
method: "GET",
|
|
342
349
|
headers: this.headers,
|
|
343
350
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
351
|
+
...this.fetchOptions,
|
|
344
352
|
});
|
|
345
353
|
if (!response.ok) {
|
|
346
354
|
throw new Error(`Failed to fetch ${path}: ${response.status} ${response.statusText}`);
|
|
@@ -362,6 +370,7 @@ export class Client {
|
|
|
362
370
|
method: "GET",
|
|
363
371
|
headers: this.headers,
|
|
364
372
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
373
|
+
...this.fetchOptions,
|
|
365
374
|
});
|
|
366
375
|
if (!response.ok) {
|
|
367
376
|
throw new Error(`Failed to fetch ${path}: ${response.status} ${response.statusText}`);
|
|
@@ -384,6 +393,7 @@ export class Client {
|
|
|
384
393
|
method: requestMethod,
|
|
385
394
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
386
395
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
396
|
+
...this.fetchOptions,
|
|
387
397
|
body: JSON.stringify(bodyParams),
|
|
388
398
|
});
|
|
389
399
|
const responseBody = await response.json();
|
|
@@ -477,6 +487,7 @@ export class Client {
|
|
|
477
487
|
method: "GET",
|
|
478
488
|
headers: { Accept: "application/json" },
|
|
479
489
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
490
|
+
...this.fetchOptions,
|
|
480
491
|
});
|
|
481
492
|
if (!response.ok) {
|
|
482
493
|
// consume the response body to release the connection
|
|
@@ -524,6 +535,7 @@ export class Client {
|
|
|
524
535
|
headers,
|
|
525
536
|
body: JSON.stringify(mergedRunCreateParams[0]),
|
|
526
537
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
538
|
+
...this.fetchOptions,
|
|
527
539
|
});
|
|
528
540
|
await raiseForStatus(response, "create run");
|
|
529
541
|
}
|
|
@@ -623,6 +635,7 @@ export class Client {
|
|
|
623
635
|
headers,
|
|
624
636
|
body: body,
|
|
625
637
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
638
|
+
...this.fetchOptions,
|
|
626
639
|
});
|
|
627
640
|
await raiseForStatus(response, "batch create run");
|
|
628
641
|
}
|
|
@@ -659,6 +672,7 @@ export class Client {
|
|
|
659
672
|
headers,
|
|
660
673
|
body: JSON.stringify(run),
|
|
661
674
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
675
|
+
...this.fetchOptions,
|
|
662
676
|
});
|
|
663
677
|
await raiseForStatus(response, "update run");
|
|
664
678
|
}
|
|
@@ -853,6 +867,7 @@ export class Client {
|
|
|
853
867
|
headers: this.headers,
|
|
854
868
|
body: JSON.stringify(data),
|
|
855
869
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
870
|
+
...this.fetchOptions,
|
|
856
871
|
});
|
|
857
872
|
const result = await response.json();
|
|
858
873
|
if (result === null || !("share_token" in result)) {
|
|
@@ -866,6 +881,7 @@ export class Client {
|
|
|
866
881
|
method: "DELETE",
|
|
867
882
|
headers: this.headers,
|
|
868
883
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
884
|
+
...this.fetchOptions,
|
|
869
885
|
});
|
|
870
886
|
await raiseForStatus(response, "unshare run");
|
|
871
887
|
}
|
|
@@ -875,6 +891,7 @@ export class Client {
|
|
|
875
891
|
method: "GET",
|
|
876
892
|
headers: this.headers,
|
|
877
893
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
894
|
+
...this.fetchOptions,
|
|
878
895
|
});
|
|
879
896
|
const result = await response.json();
|
|
880
897
|
if (result === null || !("share_token" in result)) {
|
|
@@ -896,6 +913,7 @@ export class Client {
|
|
|
896
913
|
method: "GET",
|
|
897
914
|
headers: this.headers,
|
|
898
915
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
916
|
+
...this.fetchOptions,
|
|
899
917
|
});
|
|
900
918
|
const runs = await response.json();
|
|
901
919
|
return runs;
|
|
@@ -913,6 +931,7 @@ export class Client {
|
|
|
913
931
|
method: "GET",
|
|
914
932
|
headers: this.headers,
|
|
915
933
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
934
|
+
...this.fetchOptions,
|
|
916
935
|
});
|
|
917
936
|
const shareSchema = await response.json();
|
|
918
937
|
shareSchema.url = `${this.getHostUrl()}/public/${shareSchema.share_token}/d`;
|
|
@@ -935,6 +954,7 @@ export class Client {
|
|
|
935
954
|
headers: this.headers,
|
|
936
955
|
body: JSON.stringify(data),
|
|
937
956
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
957
|
+
...this.fetchOptions,
|
|
938
958
|
});
|
|
939
959
|
const shareSchema = await response.json();
|
|
940
960
|
shareSchema.url = `${this.getHostUrl()}/public/${shareSchema.share_token}/d`;
|
|
@@ -946,6 +966,7 @@ export class Client {
|
|
|
946
966
|
method: "DELETE",
|
|
947
967
|
headers: this.headers,
|
|
948
968
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
969
|
+
...this.fetchOptions,
|
|
949
970
|
});
|
|
950
971
|
await raiseForStatus(response, "unshare dataset");
|
|
951
972
|
}
|
|
@@ -955,6 +976,7 @@ export class Client {
|
|
|
955
976
|
method: "GET",
|
|
956
977
|
headers: this.headers,
|
|
957
978
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
979
|
+
...this.fetchOptions,
|
|
958
980
|
});
|
|
959
981
|
const dataset = await response.json();
|
|
960
982
|
return dataset;
|
|
@@ -979,6 +1001,7 @@ export class Client {
|
|
|
979
1001
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
980
1002
|
body: JSON.stringify(body),
|
|
981
1003
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1004
|
+
...this.fetchOptions,
|
|
982
1005
|
});
|
|
983
1006
|
const result = await response.json();
|
|
984
1007
|
if (!response.ok) {
|
|
@@ -1003,6 +1026,7 @@ export class Client {
|
|
|
1003
1026
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1004
1027
|
body: JSON.stringify(body),
|
|
1005
1028
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1029
|
+
...this.fetchOptions,
|
|
1006
1030
|
});
|
|
1007
1031
|
const result = await response.json();
|
|
1008
1032
|
if (!response.ok) {
|
|
@@ -1031,6 +1055,7 @@ export class Client {
|
|
|
1031
1055
|
method: "GET",
|
|
1032
1056
|
headers: this.headers,
|
|
1033
1057
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1058
|
+
...this.fetchOptions,
|
|
1034
1059
|
});
|
|
1035
1060
|
// consume the response body to release the connection
|
|
1036
1061
|
// https://undici.nodejs.org/#/?id=garbage-collection
|
|
@@ -1141,6 +1166,7 @@ export class Client {
|
|
|
1141
1166
|
method: "DELETE",
|
|
1142
1167
|
headers: this.headers,
|
|
1143
1168
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1169
|
+
...this.fetchOptions,
|
|
1144
1170
|
});
|
|
1145
1171
|
await raiseForStatus(response, `delete session ${projectId_} (${projectName})`);
|
|
1146
1172
|
}
|
|
@@ -1168,6 +1194,7 @@ export class Client {
|
|
|
1168
1194
|
headers: this.headers,
|
|
1169
1195
|
body: formData,
|
|
1170
1196
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1197
|
+
...this.fetchOptions,
|
|
1171
1198
|
});
|
|
1172
1199
|
if (!response.ok) {
|
|
1173
1200
|
const result = await response.json();
|
|
@@ -1192,6 +1219,7 @@ export class Client {
|
|
|
1192
1219
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1193
1220
|
body: JSON.stringify(body),
|
|
1194
1221
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1222
|
+
...this.fetchOptions,
|
|
1195
1223
|
});
|
|
1196
1224
|
if (!response.ok) {
|
|
1197
1225
|
const result = await response.json();
|
|
@@ -1315,6 +1343,7 @@ export class Client {
|
|
|
1315
1343
|
method: "DELETE",
|
|
1316
1344
|
headers: this.headers,
|
|
1317
1345
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1346
|
+
...this.fetchOptions,
|
|
1318
1347
|
});
|
|
1319
1348
|
if (!response.ok) {
|
|
1320
1349
|
throw new Error(`Failed to delete ${path}: ${response.status} ${response.statusText}`);
|
|
@@ -1346,6 +1375,7 @@ export class Client {
|
|
|
1346
1375
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1347
1376
|
body: JSON.stringify(data),
|
|
1348
1377
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1378
|
+
...this.fetchOptions,
|
|
1349
1379
|
});
|
|
1350
1380
|
if (!response.ok) {
|
|
1351
1381
|
throw new Error(`Failed to create example: ${response.status} ${response.statusText}`);
|
|
@@ -1380,6 +1410,7 @@ export class Client {
|
|
|
1380
1410
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1381
1411
|
body: JSON.stringify(formattedExamples),
|
|
1382
1412
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1413
|
+
...this.fetchOptions,
|
|
1383
1414
|
});
|
|
1384
1415
|
if (!response.ok) {
|
|
1385
1416
|
throw new Error(`Failed to create examples: ${response.status} ${response.statusText}`);
|
|
@@ -1449,6 +1480,7 @@ export class Client {
|
|
|
1449
1480
|
method: "DELETE",
|
|
1450
1481
|
headers: this.headers,
|
|
1451
1482
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1483
|
+
...this.fetchOptions,
|
|
1452
1484
|
});
|
|
1453
1485
|
if (!response.ok) {
|
|
1454
1486
|
throw new Error(`Failed to delete ${path}: ${response.status} ${response.statusText}`);
|
|
@@ -1462,6 +1494,7 @@ export class Client {
|
|
|
1462
1494
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1463
1495
|
body: JSON.stringify(update),
|
|
1464
1496
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1497
|
+
...this.fetchOptions,
|
|
1465
1498
|
});
|
|
1466
1499
|
if (!response.ok) {
|
|
1467
1500
|
throw new Error(`Failed to update example ${exampleId}: ${response.status} ${response.statusText}`);
|
|
@@ -1531,6 +1564,7 @@ export class Client {
|
|
|
1531
1564
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1532
1565
|
body: JSON.stringify(feedback),
|
|
1533
1566
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1567
|
+
...this.fetchOptions,
|
|
1534
1568
|
});
|
|
1535
1569
|
await raiseForStatus(response, "create feedback");
|
|
1536
1570
|
return feedback;
|
|
@@ -1555,6 +1589,7 @@ export class Client {
|
|
|
1555
1589
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1556
1590
|
body: JSON.stringify(feedbackUpdate),
|
|
1557
1591
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1592
|
+
...this.fetchOptions,
|
|
1558
1593
|
});
|
|
1559
1594
|
await raiseForStatus(response, "update feedback");
|
|
1560
1595
|
}
|
|
@@ -1571,6 +1606,7 @@ export class Client {
|
|
|
1571
1606
|
method: "DELETE",
|
|
1572
1607
|
headers: this.headers,
|
|
1573
1608
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1609
|
+
...this.fetchOptions,
|
|
1574
1610
|
});
|
|
1575
1611
|
if (!response.ok) {
|
|
1576
1612
|
throw new Error(`Failed to delete ${path}: ${response.status} ${response.statusText}`);
|
|
@@ -1635,6 +1671,7 @@ export class Client {
|
|
|
1635
1671
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
1636
1672
|
body: JSON.stringify(body),
|
|
1637
1673
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
1674
|
+
...this.fetchOptions,
|
|
1638
1675
|
});
|
|
1639
1676
|
const result = await response.json();
|
|
1640
1677
|
return result;
|
package/dist/index.cjs
CHANGED
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "Client", { enumerable: true, get: function () {
|
|
|
6
6
|
var run_trees_js_1 = require("./run_trees.cjs");
|
|
7
7
|
Object.defineProperty(exports, "RunTree", { enumerable: true, get: function () { return run_trees_js_1.RunTree; } });
|
|
8
8
|
// Update using yarn bump-version
|
|
9
|
-
exports.__version__ = "0.1.
|
|
9
|
+
exports.__version__ = "0.1.14";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Client } from "./client.js";
|
|
2
2
|
export type { Dataset, Example, TracerSession, Run, Feedback, } from "./schemas.js";
|
|
3
3
|
export { RunTree, type RunTreeConfig } from "./run_trees.js";
|
|
4
|
-
export declare const __version__ = "0.1.
|
|
4
|
+
export declare const __version__ = "0.1.14";
|
package/dist/index.js
CHANGED