langsmith 0.0.26 → 0.0.28
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 +7 -19
- package/dist/client.d.ts +3 -6
- package/dist/client.js +7 -19
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -236,7 +236,7 @@ class Client {
|
|
|
236
236
|
}
|
|
237
237
|
return run;
|
|
238
238
|
}
|
|
239
|
-
async *listRuns({ projectId, projectName, parentRunId, referenceExampleId,
|
|
239
|
+
async *listRuns({ projectId, projectName, parentRunId, referenceExampleId, startTime, executionOrder, runType, error, id, limit, offset, query, filter, }) {
|
|
240
240
|
const queryParams = new URLSearchParams();
|
|
241
241
|
let projectId_ = projectId;
|
|
242
242
|
if (projectName) {
|
|
@@ -254,15 +254,9 @@ class Client {
|
|
|
254
254
|
if (referenceExampleId) {
|
|
255
255
|
queryParams.append("reference_example", referenceExampleId);
|
|
256
256
|
}
|
|
257
|
-
if (datasetId) {
|
|
258
|
-
queryParams.append("dataset", datasetId);
|
|
259
|
-
}
|
|
260
257
|
if (startTime) {
|
|
261
258
|
queryParams.append("start_time", startTime.toISOString());
|
|
262
259
|
}
|
|
263
|
-
if (endTime) {
|
|
264
|
-
queryParams.append("end_time", endTime.toISOString());
|
|
265
|
-
}
|
|
266
260
|
if (executionOrder) {
|
|
267
261
|
queryParams.append("execution_order", executionOrder.toString());
|
|
268
262
|
}
|
|
@@ -289,21 +283,10 @@ class Client {
|
|
|
289
283
|
if (filter !== undefined) {
|
|
290
284
|
queryParams.append("filter", filter);
|
|
291
285
|
}
|
|
292
|
-
if (orderBy !== undefined) {
|
|
293
|
-
orderBy.map((order) => queryParams.append("order_by", order));
|
|
294
|
-
}
|
|
295
286
|
for await (const runs of this._getPaginated("/runs", queryParams)) {
|
|
296
287
|
yield* runs;
|
|
297
288
|
}
|
|
298
289
|
}
|
|
299
|
-
async deleteRun(runId) {
|
|
300
|
-
const response = await this.caller.call(fetch, `${this.apiUrl}/runs/${runId}`, {
|
|
301
|
-
method: "DELETE",
|
|
302
|
-
headers: this.headers,
|
|
303
|
-
signal: AbortSignal.timeout(this.timeout_ms),
|
|
304
|
-
});
|
|
305
|
-
await raiseForStatus(response, "delete run");
|
|
306
|
-
}
|
|
307
290
|
async shareRun(runId, { shareId } = {}) {
|
|
308
291
|
const data = {
|
|
309
292
|
run_id: runId,
|
|
@@ -668,7 +651,7 @@ class Client {
|
|
|
668
651
|
feedbackSourceType: "MODEL",
|
|
669
652
|
});
|
|
670
653
|
}
|
|
671
|
-
async createFeedback(runId, key, { score, value, correction, comment, sourceInfo, feedbackSourceType = "API", }) {
|
|
654
|
+
async createFeedback(runId, key, { score, value, correction, comment, sourceInfo, feedbackSourceType = "API", sourceRunId, }) {
|
|
672
655
|
let feedback_source;
|
|
673
656
|
if (feedbackSourceType === "API") {
|
|
674
657
|
feedback_source = { type: "api", metadata: sourceInfo ?? {} };
|
|
@@ -679,6 +662,11 @@ class Client {
|
|
|
679
662
|
else {
|
|
680
663
|
throw new Error(`Unknown feedback source type ${feedbackSourceType}`);
|
|
681
664
|
}
|
|
665
|
+
if (sourceRunId !== undefined &&
|
|
666
|
+
feedback_source?.metadata !== undefined &&
|
|
667
|
+
!feedback_source.metadata["__run"]) {
|
|
668
|
+
feedback_source.metadata["__run"] = { run_id: sourceRunId };
|
|
669
|
+
}
|
|
682
670
|
const feedback = {
|
|
683
671
|
id: uuid.v4(),
|
|
684
672
|
run_id: runId,
|
package/dist/client.d.ts
CHANGED
|
@@ -13,9 +13,7 @@ interface ListRunsParams {
|
|
|
13
13
|
executionOrder?: number;
|
|
14
14
|
parentRunId?: string;
|
|
15
15
|
referenceExampleId?: string;
|
|
16
|
-
datasetId?: string;
|
|
17
16
|
startTime?: Date;
|
|
18
|
-
endTime?: Date;
|
|
19
17
|
runType?: string;
|
|
20
18
|
error?: boolean;
|
|
21
19
|
id?: string[];
|
|
@@ -23,7 +21,6 @@ interface ListRunsParams {
|
|
|
23
21
|
offset?: number;
|
|
24
22
|
query?: string;
|
|
25
23
|
filter?: string;
|
|
26
|
-
orderBy?: string[];
|
|
27
24
|
}
|
|
28
25
|
interface UploadCSVParams {
|
|
29
26
|
csvFile: Blob;
|
|
@@ -75,8 +72,7 @@ export declare class Client {
|
|
|
75
72
|
runId: string;
|
|
76
73
|
}): Promise<string | undefined>;
|
|
77
74
|
private _loadChildRuns;
|
|
78
|
-
listRuns({ projectId, projectName, parentRunId, referenceExampleId,
|
|
79
|
-
deleteRun(runId: string): Promise<void>;
|
|
75
|
+
listRuns({ projectId, projectName, parentRunId, referenceExampleId, startTime, executionOrder, runType, error, id, limit, offset, query, filter, }: ListRunsParams): AsyncIterable<Run>;
|
|
80
76
|
shareRun(runId: string, { shareId }?: {
|
|
81
77
|
shareId?: string;
|
|
82
78
|
}): Promise<string>;
|
|
@@ -133,13 +129,14 @@ export declare class Client {
|
|
|
133
129
|
sourceInfo?: KVMap;
|
|
134
130
|
loadChildRuns: boolean;
|
|
135
131
|
}): Promise<Feedback>;
|
|
136
|
-
createFeedback(runId: string, key: string, { score, value, correction, comment, sourceInfo, feedbackSourceType, }: {
|
|
132
|
+
createFeedback(runId: string, key: string, { score, value, correction, comment, sourceInfo, feedbackSourceType, sourceRunId, }: {
|
|
137
133
|
score?: ScoreType;
|
|
138
134
|
value?: ValueType;
|
|
139
135
|
correction?: object;
|
|
140
136
|
comment?: string;
|
|
141
137
|
sourceInfo?: object;
|
|
142
138
|
feedbackSourceType?: "API" | "MODEL";
|
|
139
|
+
sourceRunId?: string;
|
|
143
140
|
}): Promise<Feedback>;
|
|
144
141
|
updateFeedback(feedbackId: string, { score, value, correction, comment, }: {
|
|
145
142
|
score?: number | boolean | null;
|
package/dist/client.js
CHANGED
|
@@ -210,7 +210,7 @@ export class Client {
|
|
|
210
210
|
}
|
|
211
211
|
return run;
|
|
212
212
|
}
|
|
213
|
-
async *listRuns({ projectId, projectName, parentRunId, referenceExampleId,
|
|
213
|
+
async *listRuns({ projectId, projectName, parentRunId, referenceExampleId, startTime, executionOrder, runType, error, id, limit, offset, query, filter, }) {
|
|
214
214
|
const queryParams = new URLSearchParams();
|
|
215
215
|
let projectId_ = projectId;
|
|
216
216
|
if (projectName) {
|
|
@@ -228,15 +228,9 @@ export class Client {
|
|
|
228
228
|
if (referenceExampleId) {
|
|
229
229
|
queryParams.append("reference_example", referenceExampleId);
|
|
230
230
|
}
|
|
231
|
-
if (datasetId) {
|
|
232
|
-
queryParams.append("dataset", datasetId);
|
|
233
|
-
}
|
|
234
231
|
if (startTime) {
|
|
235
232
|
queryParams.append("start_time", startTime.toISOString());
|
|
236
233
|
}
|
|
237
|
-
if (endTime) {
|
|
238
|
-
queryParams.append("end_time", endTime.toISOString());
|
|
239
|
-
}
|
|
240
234
|
if (executionOrder) {
|
|
241
235
|
queryParams.append("execution_order", executionOrder.toString());
|
|
242
236
|
}
|
|
@@ -263,21 +257,10 @@ export class Client {
|
|
|
263
257
|
if (filter !== undefined) {
|
|
264
258
|
queryParams.append("filter", filter);
|
|
265
259
|
}
|
|
266
|
-
if (orderBy !== undefined) {
|
|
267
|
-
orderBy.map((order) => queryParams.append("order_by", order));
|
|
268
|
-
}
|
|
269
260
|
for await (const runs of this._getPaginated("/runs", queryParams)) {
|
|
270
261
|
yield* runs;
|
|
271
262
|
}
|
|
272
263
|
}
|
|
273
|
-
async deleteRun(runId) {
|
|
274
|
-
const response = await this.caller.call(fetch, `${this.apiUrl}/runs/${runId}`, {
|
|
275
|
-
method: "DELETE",
|
|
276
|
-
headers: this.headers,
|
|
277
|
-
signal: AbortSignal.timeout(this.timeout_ms),
|
|
278
|
-
});
|
|
279
|
-
await raiseForStatus(response, "delete run");
|
|
280
|
-
}
|
|
281
264
|
async shareRun(runId, { shareId } = {}) {
|
|
282
265
|
const data = {
|
|
283
266
|
run_id: runId,
|
|
@@ -642,7 +625,7 @@ export class Client {
|
|
|
642
625
|
feedbackSourceType: "MODEL",
|
|
643
626
|
});
|
|
644
627
|
}
|
|
645
|
-
async createFeedback(runId, key, { score, value, correction, comment, sourceInfo, feedbackSourceType = "API", }) {
|
|
628
|
+
async createFeedback(runId, key, { score, value, correction, comment, sourceInfo, feedbackSourceType = "API", sourceRunId, }) {
|
|
646
629
|
let feedback_source;
|
|
647
630
|
if (feedbackSourceType === "API") {
|
|
648
631
|
feedback_source = { type: "api", metadata: sourceInfo ?? {} };
|
|
@@ -653,6 +636,11 @@ export class Client {
|
|
|
653
636
|
else {
|
|
654
637
|
throw new Error(`Unknown feedback source type ${feedbackSourceType}`);
|
|
655
638
|
}
|
|
639
|
+
if (sourceRunId !== undefined &&
|
|
640
|
+
feedback_source?.metadata !== undefined &&
|
|
641
|
+
!feedback_source.metadata["__run"]) {
|
|
642
|
+
feedback_source.metadata["__run"] = { run_id: sourceRunId };
|
|
643
|
+
}
|
|
656
644
|
const feedback = {
|
|
657
645
|
id: uuid.v4(),
|
|
658
646
|
run_id: runId,
|