langsmith 0.0.36 → 0.0.38
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/cli/docker-compose.yaml +1 -1
- package/dist/client.cjs +10 -9
- package/dist/client.d.ts +6 -3
- package/dist/client.js +10 -9
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ services:
|
|
|
26
26
|
environment:
|
|
27
27
|
- LANGCHAIN_ENV=local_docker
|
|
28
28
|
- LOG_LEVEL=warning
|
|
29
|
-
entrypoint: "rq worker --with-scheduler -u redis://langchain-redis:6379 --serializer lc_database.queue.serializer.ORJSONSerializer --worker-class lc_database.queue.worker.Worker --connection-class lc_database.queue.connection.RedisRetry"
|
|
29
|
+
entrypoint: "rq worker --with-scheduler -u redis://langchain-redis:6379 --serializer lc_database.queue.serializer.ORJSONSerializer --worker-class lc_database.queue.worker.Worker --connection-class lc_database.queue.connection.RedisRetry --job-class lc_database.queue.job.AsyncJob"
|
|
30
30
|
langchain-hub:
|
|
31
31
|
image: langchain/${_LANGSMITH_IMAGE_PREFIX-}langchainhub-backend:latest
|
|
32
32
|
environment:
|
package/dist/client.cjs
CHANGED
|
@@ -347,7 +347,7 @@ class Client {
|
|
|
347
347
|
}
|
|
348
348
|
return `${this.getHostUrl()}/public/${result["share_token"]}/r`;
|
|
349
349
|
}
|
|
350
|
-
async createProject({ projectName, projectExtra, upsert, }) {
|
|
350
|
+
async createProject({ projectName, projectExtra, upsert, referenceDatasetId, }) {
|
|
351
351
|
const upsert_ = upsert ? `?upsert=true` : "";
|
|
352
352
|
const endpoint = `${this.apiUrl}/sessions${upsert_}`;
|
|
353
353
|
const body = {
|
|
@@ -356,6 +356,9 @@ class Client {
|
|
|
356
356
|
if (projectExtra !== undefined) {
|
|
357
357
|
body["extra"] = projectExtra;
|
|
358
358
|
}
|
|
359
|
+
if (referenceDatasetId !== undefined) {
|
|
360
|
+
body["reference_dataset_id"] = referenceDatasetId;
|
|
361
|
+
}
|
|
359
362
|
const response = await this.caller.call(fetch, endpoint, {
|
|
360
363
|
method: "POST",
|
|
361
364
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
@@ -581,7 +584,7 @@ class Client {
|
|
|
581
584
|
}
|
|
582
585
|
await response.json();
|
|
583
586
|
}
|
|
584
|
-
async createExample(inputs, outputs, { datasetId, datasetName, createdAt }) {
|
|
587
|
+
async createExample(inputs, outputs, { datasetId, datasetName, createdAt, exampleId }) {
|
|
585
588
|
let datasetId_ = datasetId;
|
|
586
589
|
if (datasetId_ === undefined && datasetName === undefined) {
|
|
587
590
|
throw new Error("Must provide either datasetName or datasetId");
|
|
@@ -599,6 +602,7 @@ class Client {
|
|
|
599
602
|
inputs,
|
|
600
603
|
outputs,
|
|
601
604
|
created_at: createdAt_.toISOString(),
|
|
605
|
+
id: exampleId,
|
|
602
606
|
};
|
|
603
607
|
const response = await this.caller.call(fetch, `${this.apiUrl}/examples`, {
|
|
604
608
|
method: "POST",
|
|
@@ -711,7 +715,7 @@ class Client {
|
|
|
711
715
|
feedbackSourceType: "model",
|
|
712
716
|
});
|
|
713
717
|
}
|
|
714
|
-
async createFeedback(runId, key, { score, value, correction, comment, sourceInfo, feedbackSourceType = "api", sourceRunId, }) {
|
|
718
|
+
async createFeedback(runId, key, { score, value, correction, comment, sourceInfo, feedbackSourceType = "api", sourceRunId, feedbackId, }) {
|
|
715
719
|
const feedback_source = {
|
|
716
720
|
type: feedbackSourceType ?? "api",
|
|
717
721
|
metadata: sourceInfo ?? {},
|
|
@@ -722,7 +726,7 @@ class Client {
|
|
|
722
726
|
feedback_source.metadata["__run"] = { run_id: sourceRunId };
|
|
723
727
|
}
|
|
724
728
|
const feedback = {
|
|
725
|
-
id: uuid.v4(),
|
|
729
|
+
id: feedbackId ?? uuid.v4(),
|
|
726
730
|
run_id: runId,
|
|
727
731
|
key,
|
|
728
732
|
score,
|
|
@@ -737,11 +741,8 @@ class Client {
|
|
|
737
741
|
body: JSON.stringify(feedback),
|
|
738
742
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
739
743
|
});
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
}
|
|
743
|
-
const result = await response.json();
|
|
744
|
-
return result;
|
|
744
|
+
await raiseForStatus(response, "create feedback");
|
|
745
|
+
return feedback;
|
|
745
746
|
}
|
|
746
747
|
async updateFeedback(feedbackId, { score, value, correction, comment, }) {
|
|
747
748
|
const feedbackUpdate = {};
|
package/dist/client.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export type CreateExampleOptions = {
|
|
|
53
53
|
datasetId?: string;
|
|
54
54
|
datasetName?: string;
|
|
55
55
|
createdAt?: Date;
|
|
56
|
+
exampleId?: string;
|
|
56
57
|
};
|
|
57
58
|
export declare class Client {
|
|
58
59
|
private apiKey?;
|
|
@@ -84,10 +85,11 @@ export declare class Client {
|
|
|
84
85
|
}): Promise<string>;
|
|
85
86
|
unshareRun(runId: string): Promise<void>;
|
|
86
87
|
readRunSharedLink(runId: string): Promise<string | undefined>;
|
|
87
|
-
createProject({ projectName, projectExtra, upsert, }: {
|
|
88
|
+
createProject({ projectName, projectExtra, upsert, referenceDatasetId, }: {
|
|
88
89
|
projectName: string;
|
|
89
90
|
projectExtra?: object;
|
|
90
91
|
upsert?: boolean;
|
|
92
|
+
referenceDatasetId?: string;
|
|
91
93
|
}): Promise<TracerSession>;
|
|
92
94
|
readProject({ projectId, projectName, }: {
|
|
93
95
|
projectId?: string;
|
|
@@ -125,7 +127,7 @@ export declare class Client {
|
|
|
125
127
|
datasetId?: string;
|
|
126
128
|
datasetName?: string;
|
|
127
129
|
}): Promise<void>;
|
|
128
|
-
createExample(inputs: KVMap, outputs: KVMap, { datasetId, datasetName, createdAt }: CreateExampleOptions): Promise<Example>;
|
|
130
|
+
createExample(inputs: KVMap, outputs: KVMap, { datasetId, datasetName, createdAt, exampleId }: CreateExampleOptions): Promise<Example>;
|
|
129
131
|
createLLMExample(input: string, generation: string | undefined, options: CreateExampleOptions): Promise<Example>;
|
|
130
132
|
createChatExample(input: KVMap[] | LangChainBaseMessage[], generations: KVMap | LangChainBaseMessage | undefined, options: CreateExampleOptions): Promise<Example>;
|
|
131
133
|
readExample(exampleId: string): Promise<Example>;
|
|
@@ -140,7 +142,7 @@ export declare class Client {
|
|
|
140
142
|
sourceInfo?: KVMap;
|
|
141
143
|
loadChildRuns: boolean;
|
|
142
144
|
}): Promise<Feedback>;
|
|
143
|
-
createFeedback(runId: string, key: string, { score, value, correction, comment, sourceInfo, feedbackSourceType, sourceRunId, }: {
|
|
145
|
+
createFeedback(runId: string, key: string, { score, value, correction, comment, sourceInfo, feedbackSourceType, sourceRunId, feedbackId, }: {
|
|
144
146
|
score?: ScoreType;
|
|
145
147
|
value?: ValueType;
|
|
146
148
|
correction?: object;
|
|
@@ -148,6 +150,7 @@ export declare class Client {
|
|
|
148
150
|
sourceInfo?: object;
|
|
149
151
|
feedbackSourceType?: FeedbackSourceType;
|
|
150
152
|
sourceRunId?: string;
|
|
153
|
+
feedbackId?: string;
|
|
151
154
|
}): Promise<Feedback>;
|
|
152
155
|
updateFeedback(feedbackId: string, { score, value, correction, comment, }: {
|
|
153
156
|
score?: number | boolean | null;
|
package/dist/client.js
CHANGED
|
@@ -321,7 +321,7 @@ export class Client {
|
|
|
321
321
|
}
|
|
322
322
|
return `${this.getHostUrl()}/public/${result["share_token"]}/r`;
|
|
323
323
|
}
|
|
324
|
-
async createProject({ projectName, projectExtra, upsert, }) {
|
|
324
|
+
async createProject({ projectName, projectExtra, upsert, referenceDatasetId, }) {
|
|
325
325
|
const upsert_ = upsert ? `?upsert=true` : "";
|
|
326
326
|
const endpoint = `${this.apiUrl}/sessions${upsert_}`;
|
|
327
327
|
const body = {
|
|
@@ -330,6 +330,9 @@ export class Client {
|
|
|
330
330
|
if (projectExtra !== undefined) {
|
|
331
331
|
body["extra"] = projectExtra;
|
|
332
332
|
}
|
|
333
|
+
if (referenceDatasetId !== undefined) {
|
|
334
|
+
body["reference_dataset_id"] = referenceDatasetId;
|
|
335
|
+
}
|
|
333
336
|
const response = await this.caller.call(fetch, endpoint, {
|
|
334
337
|
method: "POST",
|
|
335
338
|
headers: { ...this.headers, "Content-Type": "application/json" },
|
|
@@ -555,7 +558,7 @@ export class Client {
|
|
|
555
558
|
}
|
|
556
559
|
await response.json();
|
|
557
560
|
}
|
|
558
|
-
async createExample(inputs, outputs, { datasetId, datasetName, createdAt }) {
|
|
561
|
+
async createExample(inputs, outputs, { datasetId, datasetName, createdAt, exampleId }) {
|
|
559
562
|
let datasetId_ = datasetId;
|
|
560
563
|
if (datasetId_ === undefined && datasetName === undefined) {
|
|
561
564
|
throw new Error("Must provide either datasetName or datasetId");
|
|
@@ -573,6 +576,7 @@ export class Client {
|
|
|
573
576
|
inputs,
|
|
574
577
|
outputs,
|
|
575
578
|
created_at: createdAt_.toISOString(),
|
|
579
|
+
id: exampleId,
|
|
576
580
|
};
|
|
577
581
|
const response = await this.caller.call(fetch, `${this.apiUrl}/examples`, {
|
|
578
582
|
method: "POST",
|
|
@@ -685,7 +689,7 @@ export class Client {
|
|
|
685
689
|
feedbackSourceType: "model",
|
|
686
690
|
});
|
|
687
691
|
}
|
|
688
|
-
async createFeedback(runId, key, { score, value, correction, comment, sourceInfo, feedbackSourceType = "api", sourceRunId, }) {
|
|
692
|
+
async createFeedback(runId, key, { score, value, correction, comment, sourceInfo, feedbackSourceType = "api", sourceRunId, feedbackId, }) {
|
|
689
693
|
const feedback_source = {
|
|
690
694
|
type: feedbackSourceType ?? "api",
|
|
691
695
|
metadata: sourceInfo ?? {},
|
|
@@ -696,7 +700,7 @@ export class Client {
|
|
|
696
700
|
feedback_source.metadata["__run"] = { run_id: sourceRunId };
|
|
697
701
|
}
|
|
698
702
|
const feedback = {
|
|
699
|
-
id: uuid.v4(),
|
|
703
|
+
id: feedbackId ?? uuid.v4(),
|
|
700
704
|
run_id: runId,
|
|
701
705
|
key,
|
|
702
706
|
score,
|
|
@@ -711,11 +715,8 @@ export class Client {
|
|
|
711
715
|
body: JSON.stringify(feedback),
|
|
712
716
|
signal: AbortSignal.timeout(this.timeout_ms),
|
|
713
717
|
});
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
}
|
|
717
|
-
const result = await response.json();
|
|
718
|
-
return result;
|
|
718
|
+
await raiseForStatus(response, "create feedback");
|
|
719
|
+
return feedback;
|
|
719
720
|
}
|
|
720
721
|
async updateFeedback(feedbackId, { score, value, correction, comment, }) {
|
|
721
722
|
const feedbackUpdate = {};
|