langsmith 0.0.19 → 0.0.23

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 CHANGED
@@ -12,6 +12,8 @@ LangSmith helps you and your team develop and evaluate language models and intel
12
12
 
13
13
  > **Note**: You can enjoy the benefits of LangSmith without using the LangChain open-source packages! To get started with your own proprietary framework, set up your account and then skip to [Logging Traces Outside LangChain](#logging-traces-outside-langchain).
14
14
 
15
+ > **Cookbook:** For tutorials on how to get more value out of LangSmith, check out the [Langsmith Cookbook](https://github.com/langchain-ai/langsmith-cookbook/tree/main) repo.
16
+
15
17
  A typical workflow looks like:
16
18
 
17
19
  1. Set up an account with LangSmith.
package/dist/client.cjs CHANGED
@@ -506,12 +506,23 @@ class Client {
506
506
  }
507
507
  return result;
508
508
  }
509
- async *listDatasets({ limit = 100, offset = 0, } = {}) {
509
+ async *listDatasets({ limit = 100, offset = 0, datasetIds, datasetName, datasetNameContains, } = {}) {
510
510
  const path = "/datasets";
511
511
  const params = new URLSearchParams({
512
512
  limit: limit.toString(),
513
513
  offset: offset.toString(),
514
514
  });
515
+ if (datasetIds !== undefined) {
516
+ for (const id_ of datasetIds) {
517
+ params.append("id", id_);
518
+ }
519
+ }
520
+ if (datasetName !== undefined) {
521
+ params.append("name", datasetName);
522
+ }
523
+ if (datasetNameContains !== undefined) {
524
+ params.append("name_contains", datasetNameContains);
525
+ }
515
526
  for await (const datasets of this._getPaginated(path, params)) {
516
527
  yield* datasets;
517
528
  }
@@ -685,6 +696,28 @@ class Client {
685
696
  const result = await response.json();
686
697
  return result;
687
698
  }
699
+ async updateFeedback(feedbackId, { score, value, correction, comment, }) {
700
+ const feedbackUpdate = {};
701
+ if (score !== undefined && score !== null) {
702
+ feedbackUpdate["score"] = score;
703
+ }
704
+ if (value !== undefined && value !== null) {
705
+ feedbackUpdate["value"] = value;
706
+ }
707
+ if (correction !== undefined && correction !== null) {
708
+ feedbackUpdate["correction"] = correction;
709
+ }
710
+ if (comment !== undefined && comment !== null) {
711
+ feedbackUpdate["comment"] = comment;
712
+ }
713
+ const response = await this.caller.call(fetch, `${this.apiUrl}/feedback/${feedbackId}`, {
714
+ method: "PATCH",
715
+ headers: { ...this.headers, "Content-Type": "application/json" },
716
+ body: JSON.stringify(feedbackUpdate),
717
+ signal: AbortSignal.timeout(this.timeout_ms),
718
+ });
719
+ return response.json();
720
+ }
688
721
  async readFeedback(feedbackId) {
689
722
  const path = `/feedback/${feedbackId}`;
690
723
  const response = await this._get(path);
package/dist/client.d.ts CHANGED
@@ -105,9 +105,12 @@ export declare class Client {
105
105
  datasetId?: string;
106
106
  datasetName?: string;
107
107
  }): Promise<Dataset>;
108
- listDatasets({ limit, offset, }?: {
108
+ listDatasets({ limit, offset, datasetIds, datasetName, datasetNameContains, }?: {
109
109
  limit?: number;
110
110
  offset?: number;
111
+ datasetIds?: string[];
112
+ datasetName?: string;
113
+ datasetNameContains?: string;
111
114
  }): AsyncIterable<Dataset>;
112
115
  deleteDataset({ datasetId, datasetName, }: {
113
116
  datasetId?: string;
@@ -132,11 +135,17 @@ export declare class Client {
132
135
  createFeedback(runId: string, key: string, { score, value, correction, comment, sourceInfo, feedbackSourceType, }: {
133
136
  score?: ScoreType;
134
137
  value?: ValueType;
135
- correction?: string | object;
138
+ correction?: object;
136
139
  comment?: string;
137
140
  sourceInfo?: object;
138
141
  feedbackSourceType?: "API" | "MODEL";
139
142
  }): Promise<Feedback>;
143
+ updateFeedback(feedbackId: string, { score, value, correction, comment, }: {
144
+ score?: number | boolean | null;
145
+ value?: number | boolean | string | object | null;
146
+ correction?: object | null;
147
+ comment?: string | null;
148
+ }): Promise<Feedback>;
140
149
  readFeedback(feedbackId: string): Promise<Feedback>;
141
150
  deleteFeedback(feedbackId: string): Promise<void>;
142
151
  listFeedback({ runIds, }?: {
package/dist/client.js CHANGED
@@ -480,12 +480,23 @@ export class Client {
480
480
  }
481
481
  return result;
482
482
  }
483
- async *listDatasets({ limit = 100, offset = 0, } = {}) {
483
+ async *listDatasets({ limit = 100, offset = 0, datasetIds, datasetName, datasetNameContains, } = {}) {
484
484
  const path = "/datasets";
485
485
  const params = new URLSearchParams({
486
486
  limit: limit.toString(),
487
487
  offset: offset.toString(),
488
488
  });
489
+ if (datasetIds !== undefined) {
490
+ for (const id_ of datasetIds) {
491
+ params.append("id", id_);
492
+ }
493
+ }
494
+ if (datasetName !== undefined) {
495
+ params.append("name", datasetName);
496
+ }
497
+ if (datasetNameContains !== undefined) {
498
+ params.append("name_contains", datasetNameContains);
499
+ }
489
500
  for await (const datasets of this._getPaginated(path, params)) {
490
501
  yield* datasets;
491
502
  }
@@ -659,6 +670,28 @@ export class Client {
659
670
  const result = await response.json();
660
671
  return result;
661
672
  }
673
+ async updateFeedback(feedbackId, { score, value, correction, comment, }) {
674
+ const feedbackUpdate = {};
675
+ if (score !== undefined && score !== null) {
676
+ feedbackUpdate["score"] = score;
677
+ }
678
+ if (value !== undefined && value !== null) {
679
+ feedbackUpdate["value"] = value;
680
+ }
681
+ if (correction !== undefined && correction !== null) {
682
+ feedbackUpdate["correction"] = correction;
683
+ }
684
+ if (comment !== undefined && comment !== null) {
685
+ feedbackUpdate["comment"] = comment;
686
+ }
687
+ const response = await this.caller.call(fetch, `${this.apiUrl}/feedback/${feedbackId}`, {
688
+ method: "PATCH",
689
+ headers: { ...this.headers, "Content-Type": "application/json" },
690
+ body: JSON.stringify(feedbackUpdate),
691
+ signal: AbortSignal.timeout(this.timeout_ms),
692
+ });
693
+ return response.json();
694
+ }
662
695
  async readFeedback(feedbackId) {
663
696
  const path = `/feedback/${feedbackId}`;
664
697
  const response = await this._get(path);
@@ -4,7 +4,7 @@ export interface EvaluationResult {
4
4
  score?: ScoreType;
5
5
  value?: ValueType;
6
6
  comment?: string;
7
- correction?: string | object;
7
+ correction?: object;
8
8
  evaluatorInfo?: KVMap;
9
9
  }
10
10
  export interface RunEvaluator {
@@ -5,7 +5,7 @@ export interface GradingFunctionResult {
5
5
  score?: ScoreType;
6
6
  value?: ValueType;
7
7
  comment?: string;
8
- correction?: string | object;
8
+ correction?: object;
9
9
  }
10
10
  export interface GradingFunctionParams {
11
11
  input: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.0.19",
3
+ "version": "0.0.23",
4
4
  "description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.",
5
5
  "files": [
6
6
  "dist/",