langsmith 0.3.15 → 0.3.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/dist/client.cjs +3 -2
- package/dist/client.js +3 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/run_trees.cjs +19 -3
- package/dist/run_trees.js +19 -3
- package/dist/schemas.d.ts +1 -0
- package/dist/utils/jestlike/index.cjs +3 -0
- package/dist/utils/jestlike/index.js +4 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -2928,7 +2928,7 @@ class Client {
|
|
|
2928
2928
|
}
|
|
2929
2929
|
async _updateExamplesMultipart(datasetId, updates = []) {
|
|
2930
2930
|
if (!(await this._getMultiPartSupport())) {
|
|
2931
|
-
throw new Error("Your LangSmith
|
|
2931
|
+
throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");
|
|
2932
2932
|
}
|
|
2933
2933
|
const formData = new FormData();
|
|
2934
2934
|
for (const example of updates) {
|
|
@@ -3006,7 +3006,7 @@ class Client {
|
|
|
3006
3006
|
}
|
|
3007
3007
|
async _uploadExamplesMultipart(datasetId, uploads = []) {
|
|
3008
3008
|
if (!(await this._getMultiPartSupport())) {
|
|
3009
|
-
throw new Error("Your LangSmith
|
|
3009
|
+
throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");
|
|
3010
3010
|
}
|
|
3011
3011
|
const formData = new FormData();
|
|
3012
3012
|
for (const example of uploads) {
|
|
@@ -3070,6 +3070,7 @@ class Client {
|
|
|
3070
3070
|
headers: this.headers,
|
|
3071
3071
|
body: formData,
|
|
3072
3072
|
});
|
|
3073
|
+
await (0, error_js_1.raiseForStatus)(response, "upload examples");
|
|
3073
3074
|
const result = await response.json();
|
|
3074
3075
|
return result;
|
|
3075
3076
|
}
|
package/dist/client.js
CHANGED
|
@@ -2890,7 +2890,7 @@ export class Client {
|
|
|
2890
2890
|
}
|
|
2891
2891
|
async _updateExamplesMultipart(datasetId, updates = []) {
|
|
2892
2892
|
if (!(await this._getMultiPartSupport())) {
|
|
2893
|
-
throw new Error("Your LangSmith
|
|
2893
|
+
throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");
|
|
2894
2894
|
}
|
|
2895
2895
|
const formData = new FormData();
|
|
2896
2896
|
for (const example of updates) {
|
|
@@ -2968,7 +2968,7 @@ export class Client {
|
|
|
2968
2968
|
}
|
|
2969
2969
|
async _uploadExamplesMultipart(datasetId, uploads = []) {
|
|
2970
2970
|
if (!(await this._getMultiPartSupport())) {
|
|
2971
|
-
throw new Error("Your LangSmith
|
|
2971
|
+
throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");
|
|
2972
2972
|
}
|
|
2973
2973
|
const formData = new FormData();
|
|
2974
2974
|
for (const example of uploads) {
|
|
@@ -3032,6 +3032,7 @@ export class Client {
|
|
|
3032
3032
|
headers: this.headers,
|
|
3033
3033
|
body: formData,
|
|
3034
3034
|
});
|
|
3035
|
+
await raiseForStatus(response, "upload examples");
|
|
3035
3036
|
const result = await response.json();
|
|
3036
3037
|
return result;
|
|
3037
3038
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "RunTree", { enumerable: true, get: function () {
|
|
|
8
8
|
var fetch_js_1 = require("./singletons/fetch.cjs");
|
|
9
9
|
Object.defineProperty(exports, "overrideFetchImplementation", { enumerable: true, get: function () { return fetch_js_1.overrideFetchImplementation; } });
|
|
10
10
|
// Update using yarn bump-version
|
|
11
|
-
exports.__version__ = "0.3.
|
|
11
|
+
exports.__version__ = "0.3.17";
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { Client, type ClientConfig, type LangSmithTracingClientInterface, } from
|
|
|
2
2
|
export type { Dataset, Example, TracerSession, Run, Feedback, RetrieverOutput, } from "./schemas.js";
|
|
3
3
|
export { RunTree, type RunTreeConfig } from "./run_trees.js";
|
|
4
4
|
export { overrideFetchImplementation } from "./singletons/fetch.js";
|
|
5
|
-
export declare const __version__ = "0.3.
|
|
5
|
+
export declare const __version__ = "0.3.17";
|
package/dist/index.js
CHANGED
package/dist/run_trees.cjs
CHANGED
|
@@ -56,7 +56,7 @@ function convertToDottedOrderFormat(epoch, runId, executionOrder = 1) {
|
|
|
56
56
|
* Baggage header information
|
|
57
57
|
*/
|
|
58
58
|
class Baggage {
|
|
59
|
-
constructor(metadata, tags) {
|
|
59
|
+
constructor(metadata, tags, project_name) {
|
|
60
60
|
Object.defineProperty(this, "metadata", {
|
|
61
61
|
enumerable: true,
|
|
62
62
|
configurable: true,
|
|
@@ -69,13 +69,21 @@ class Baggage {
|
|
|
69
69
|
writable: true,
|
|
70
70
|
value: void 0
|
|
71
71
|
});
|
|
72
|
+
Object.defineProperty(this, "project_name", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true,
|
|
75
|
+
writable: true,
|
|
76
|
+
value: void 0
|
|
77
|
+
});
|
|
72
78
|
this.metadata = metadata;
|
|
73
79
|
this.tags = tags;
|
|
80
|
+
this.project_name = project_name;
|
|
74
81
|
}
|
|
75
82
|
static fromHeader(value) {
|
|
76
83
|
const items = value.split(",");
|
|
77
84
|
let metadata = {};
|
|
78
85
|
let tags = [];
|
|
86
|
+
let project_name;
|
|
79
87
|
for (const item of items) {
|
|
80
88
|
const [key, uriValue] = item.split("=");
|
|
81
89
|
const value = decodeURIComponent(uriValue);
|
|
@@ -85,8 +93,11 @@ class Baggage {
|
|
|
85
93
|
else if (key === "langsmith-tags") {
|
|
86
94
|
tags = value.split(",");
|
|
87
95
|
}
|
|
96
|
+
else if (key === "langsmith-project") {
|
|
97
|
+
project_name = value;
|
|
98
|
+
}
|
|
88
99
|
}
|
|
89
|
-
return new Baggage(metadata, tags);
|
|
100
|
+
return new Baggage(metadata, tags, project_name);
|
|
90
101
|
}
|
|
91
102
|
toHeader() {
|
|
92
103
|
const items = [];
|
|
@@ -96,6 +107,9 @@ class Baggage {
|
|
|
96
107
|
if (this.tags && this.tags.length > 0) {
|
|
97
108
|
items.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`);
|
|
98
109
|
}
|
|
110
|
+
if (this.project_name) {
|
|
111
|
+
items.push(`langsmith-project=${encodeURIComponent(this.project_name)}`);
|
|
112
|
+
}
|
|
99
113
|
return items.join(",");
|
|
100
114
|
}
|
|
101
115
|
}
|
|
@@ -434,6 +448,7 @@ class RunTree {
|
|
|
434
448
|
trace_id: this.trace_id,
|
|
435
449
|
tags: this.tags,
|
|
436
450
|
attachments: this.attachments,
|
|
451
|
+
session_name: this.project_name,
|
|
437
452
|
};
|
|
438
453
|
await this.client.updateRun(this.id, runUpdate);
|
|
439
454
|
}
|
|
@@ -541,13 +556,14 @@ class RunTree {
|
|
|
541
556
|
const baggage = Baggage.fromHeader(rawHeaders["baggage"]);
|
|
542
557
|
config.metadata = baggage.metadata;
|
|
543
558
|
config.tags = baggage.tags;
|
|
559
|
+
config.project_name = baggage.project_name;
|
|
544
560
|
}
|
|
545
561
|
return new RunTree(config);
|
|
546
562
|
}
|
|
547
563
|
toHeaders(headers) {
|
|
548
564
|
const result = {
|
|
549
565
|
"langsmith-trace": this.dotted_order,
|
|
550
|
-
baggage: new Baggage(this.extra?.metadata, this.tags).toHeader(),
|
|
566
|
+
baggage: new Baggage(this.extra?.metadata, this.tags, this.project_name).toHeader(),
|
|
551
567
|
};
|
|
552
568
|
if (headers) {
|
|
553
569
|
for (const [key, value] of Object.entries(result)) {
|
package/dist/run_trees.js
CHANGED
|
@@ -17,7 +17,7 @@ export function convertToDottedOrderFormat(epoch, runId, executionOrder = 1) {
|
|
|
17
17
|
* Baggage header information
|
|
18
18
|
*/
|
|
19
19
|
class Baggage {
|
|
20
|
-
constructor(metadata, tags) {
|
|
20
|
+
constructor(metadata, tags, project_name) {
|
|
21
21
|
Object.defineProperty(this, "metadata", {
|
|
22
22
|
enumerable: true,
|
|
23
23
|
configurable: true,
|
|
@@ -30,13 +30,21 @@ class Baggage {
|
|
|
30
30
|
writable: true,
|
|
31
31
|
value: void 0
|
|
32
32
|
});
|
|
33
|
+
Object.defineProperty(this, "project_name", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true,
|
|
37
|
+
value: void 0
|
|
38
|
+
});
|
|
33
39
|
this.metadata = metadata;
|
|
34
40
|
this.tags = tags;
|
|
41
|
+
this.project_name = project_name;
|
|
35
42
|
}
|
|
36
43
|
static fromHeader(value) {
|
|
37
44
|
const items = value.split(",");
|
|
38
45
|
let metadata = {};
|
|
39
46
|
let tags = [];
|
|
47
|
+
let project_name;
|
|
40
48
|
for (const item of items) {
|
|
41
49
|
const [key, uriValue] = item.split("=");
|
|
42
50
|
const value = decodeURIComponent(uriValue);
|
|
@@ -46,8 +54,11 @@ class Baggage {
|
|
|
46
54
|
else if (key === "langsmith-tags") {
|
|
47
55
|
tags = value.split(",");
|
|
48
56
|
}
|
|
57
|
+
else if (key === "langsmith-project") {
|
|
58
|
+
project_name = value;
|
|
59
|
+
}
|
|
49
60
|
}
|
|
50
|
-
return new Baggage(metadata, tags);
|
|
61
|
+
return new Baggage(metadata, tags, project_name);
|
|
51
62
|
}
|
|
52
63
|
toHeader() {
|
|
53
64
|
const items = [];
|
|
@@ -57,6 +68,9 @@ class Baggage {
|
|
|
57
68
|
if (this.tags && this.tags.length > 0) {
|
|
58
69
|
items.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`);
|
|
59
70
|
}
|
|
71
|
+
if (this.project_name) {
|
|
72
|
+
items.push(`langsmith-project=${encodeURIComponent(this.project_name)}`);
|
|
73
|
+
}
|
|
60
74
|
return items.join(",");
|
|
61
75
|
}
|
|
62
76
|
}
|
|
@@ -395,6 +409,7 @@ export class RunTree {
|
|
|
395
409
|
trace_id: this.trace_id,
|
|
396
410
|
tags: this.tags,
|
|
397
411
|
attachments: this.attachments,
|
|
412
|
+
session_name: this.project_name,
|
|
398
413
|
};
|
|
399
414
|
await this.client.updateRun(this.id, runUpdate);
|
|
400
415
|
}
|
|
@@ -502,13 +517,14 @@ export class RunTree {
|
|
|
502
517
|
const baggage = Baggage.fromHeader(rawHeaders["baggage"]);
|
|
503
518
|
config.metadata = baggage.metadata;
|
|
504
519
|
config.tags = baggage.tags;
|
|
520
|
+
config.project_name = baggage.project_name;
|
|
505
521
|
}
|
|
506
522
|
return new RunTree(config);
|
|
507
523
|
}
|
|
508
524
|
toHeaders(headers) {
|
|
509
525
|
const result = {
|
|
510
526
|
"langsmith-trace": this.dotted_order,
|
|
511
|
-
baggage: new Baggage(this.extra?.metadata, this.tags).toHeader(),
|
|
527
|
+
baggage: new Baggage(this.extra?.metadata, this.tags, this.project_name).toHeader(),
|
|
512
528
|
};
|
|
513
529
|
if (headers) {
|
|
514
530
|
for (const [key, value] of Object.entries(result)) {
|
package/dist/schemas.d.ts
CHANGED
|
@@ -230,6 +230,9 @@ function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
|
|
|
230
230
|
return storageValue;
|
|
231
231
|
}
|
|
232
232
|
function wrapDescribeMethod(method) {
|
|
233
|
+
if ((0, env_js_1.isJsDom)()) {
|
|
234
|
+
console.error(`[LANGSMITH]: You seem to be using a jsdom environment. This is not supported and you may experience unexpected behavior. Please set the "environment" or "testEnvironment" field in your test config file to "node".`);
|
|
235
|
+
}
|
|
233
236
|
return function (testSuiteName, fn, experimentConfig) {
|
|
234
237
|
const client = experimentConfig?.client ?? globals_js_1.DEFAULT_TEST_CLIENT;
|
|
235
238
|
const suiteName = experimentConfig?.testSuiteName ?? testSuiteName;
|
|
@@ -11,7 +11,7 @@ import { randomName } from "../../evaluation/_random_name.js";
|
|
|
11
11
|
import { toBeRelativeCloseTo, toBeAbsoluteCloseTo, toBeSemanticCloseTo, } from "./matchers.js";
|
|
12
12
|
import { evaluatorLogFeedbackPromises, testWrapperAsyncLocalStorageInstance, _logTestFeedback, syncExamplePromises, trackingEnabled, DEFAULT_TEST_CLIENT, } from "./globals.js";
|
|
13
13
|
import { wrapExpect } from "./vendor/chain.js";
|
|
14
|
-
import { getEnvironmentVariable } from "../env.js";
|
|
14
|
+
import { getEnvironmentVariable, isJsDom } from "../env.js";
|
|
15
15
|
import { STRIP_ANSI_REGEX, TEST_ID_DELIMITER, DEFAULT_TEST_TIMEOUT, UUID5_NAMESPACE, } from "./constants.js";
|
|
16
16
|
export function logFeedback(feedback, config) {
|
|
17
17
|
const context = testWrapperAsyncLocalStorageInstance.getStore();
|
|
@@ -183,6 +183,9 @@ export function generateWrapperFromJestlikeMethods(methods, testRunnerName) {
|
|
|
183
183
|
return storageValue;
|
|
184
184
|
}
|
|
185
185
|
function wrapDescribeMethod(method) {
|
|
186
|
+
if (isJsDom()) {
|
|
187
|
+
console.error(`[LANGSMITH]: You seem to be using a jsdom environment. This is not supported and you may experience unexpected behavior. Please set the "environment" or "testEnvironment" field in your test config file to "node".`);
|
|
188
|
+
}
|
|
186
189
|
return function (testSuiteName, fn, experimentConfig) {
|
|
187
190
|
const client = experimentConfig?.client ?? DEFAULT_TEST_CLIENT;
|
|
188
191
|
const suiteName = experimentConfig?.testSuiteName ?? testSuiteName;
|