langsmith 0.0.48 → 0.0.49

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 CHANGED
@@ -484,16 +484,19 @@ class Client {
484
484
  const dataset = await response.json();
485
485
  return dataset;
486
486
  }
487
- async createProject({ projectName, projectExtra, upsert, referenceDatasetId, }) {
487
+ async createProject({ projectName, description = null, metadata = null, upsert = false, projectExtra = null, referenceDatasetId = null, }) {
488
488
  const upsert_ = upsert ? `?upsert=true` : "";
489
489
  const endpoint = `${this.apiUrl}/sessions${upsert_}`;
490
+ const extra = projectExtra || {};
491
+ if (metadata) {
492
+ extra["metadata"] = metadata;
493
+ }
490
494
  const body = {
491
495
  name: projectName,
496
+ extra,
497
+ description,
492
498
  };
493
- if (projectExtra !== undefined) {
494
- body["extra"] = projectExtra;
495
- }
496
- if (referenceDatasetId !== undefined) {
499
+ if (referenceDatasetId !== null) {
497
500
  body["reference_dataset_id"] = referenceDatasetId;
498
501
  }
499
502
  const response = await this.caller.call(fetch, endpoint, {
@@ -508,6 +511,30 @@ class Client {
508
511
  }
509
512
  return result;
510
513
  }
514
+ async updateProject(projectId, { name = null, description = null, metadata = null, projectExtra = null, endTime = null, }) {
515
+ const endpoint = `${this.apiUrl}/sessions/${projectId}`;
516
+ let extra = projectExtra;
517
+ if (metadata) {
518
+ extra = { ...(extra || {}), metadata };
519
+ }
520
+ const body = {
521
+ name,
522
+ extra,
523
+ description,
524
+ end_time: endTime ? new Date(endTime).toISOString() : null,
525
+ };
526
+ const response = await this.caller.call(fetch, endpoint, {
527
+ method: "PATCH",
528
+ headers: { ...this.headers, "Content-Type": "application/json" },
529
+ body: JSON.stringify(body),
530
+ signal: AbortSignal.timeout(this.timeout_ms),
531
+ });
532
+ const result = await response.json();
533
+ if (!response.ok) {
534
+ throw new Error(`Failed to update project ${projectId}: ${response.status} ${response.statusText}`);
535
+ }
536
+ return result;
537
+ }
511
538
  async readProject({ projectId, projectName, }) {
512
539
  let path = "/sessions";
513
540
  const params = new URLSearchParams();
package/dist/client.d.ts CHANGED
@@ -103,11 +103,20 @@ export declare class Client {
103
103
  shareDataset(datasetId?: string, datasetName?: string): Promise<DatasetShareSchema>;
104
104
  unshareDataset(datasetId: string): Promise<void>;
105
105
  readSharedDataset(shareToken: string): Promise<Dataset>;
106
- createProject({ projectName, projectExtra, upsert, referenceDatasetId, }: {
106
+ createProject({ projectName, description, metadata, upsert, projectExtra, referenceDatasetId, }: {
107
107
  projectName: string;
108
- projectExtra?: object;
108
+ description?: string | null;
109
+ metadata?: Record<string, any> | null;
109
110
  upsert?: boolean;
110
- referenceDatasetId?: string;
111
+ projectExtra?: Record<string, any> | null;
112
+ referenceDatasetId?: string | null;
113
+ }): Promise<TracerSession>;
114
+ updateProject(projectId: string, { name, description, metadata, projectExtra, endTime, }: {
115
+ name?: string | null;
116
+ description?: string | null;
117
+ metadata?: Record<string, any> | null;
118
+ projectExtra?: Record<string, any> | null;
119
+ endTime?: string | null;
111
120
  }): Promise<TracerSession>;
112
121
  readProject({ projectId, projectName, }: {
113
122
  projectId?: string;
package/dist/client.js CHANGED
@@ -458,16 +458,19 @@ export class Client {
458
458
  const dataset = await response.json();
459
459
  return dataset;
460
460
  }
461
- async createProject({ projectName, projectExtra, upsert, referenceDatasetId, }) {
461
+ async createProject({ projectName, description = null, metadata = null, upsert = false, projectExtra = null, referenceDatasetId = null, }) {
462
462
  const upsert_ = upsert ? `?upsert=true` : "";
463
463
  const endpoint = `${this.apiUrl}/sessions${upsert_}`;
464
+ const extra = projectExtra || {};
465
+ if (metadata) {
466
+ extra["metadata"] = metadata;
467
+ }
464
468
  const body = {
465
469
  name: projectName,
470
+ extra,
471
+ description,
466
472
  };
467
- if (projectExtra !== undefined) {
468
- body["extra"] = projectExtra;
469
- }
470
- if (referenceDatasetId !== undefined) {
473
+ if (referenceDatasetId !== null) {
471
474
  body["reference_dataset_id"] = referenceDatasetId;
472
475
  }
473
476
  const response = await this.caller.call(fetch, endpoint, {
@@ -482,6 +485,30 @@ export class Client {
482
485
  }
483
486
  return result;
484
487
  }
488
+ async updateProject(projectId, { name = null, description = null, metadata = null, projectExtra = null, endTime = null, }) {
489
+ const endpoint = `${this.apiUrl}/sessions/${projectId}`;
490
+ let extra = projectExtra;
491
+ if (metadata) {
492
+ extra = { ...(extra || {}), metadata };
493
+ }
494
+ const body = {
495
+ name,
496
+ extra,
497
+ description,
498
+ end_time: endTime ? new Date(endTime).toISOString() : null,
499
+ };
500
+ const response = await this.caller.call(fetch, endpoint, {
501
+ method: "PATCH",
502
+ headers: { ...this.headers, "Content-Type": "application/json" },
503
+ body: JSON.stringify(body),
504
+ signal: AbortSignal.timeout(this.timeout_ms),
505
+ });
506
+ const result = await response.json();
507
+ if (!response.ok) {
508
+ throw new Error(`Failed to update project ${projectId}: ${response.status} ${response.statusText}`);
509
+ }
510
+ return result;
511
+ }
485
512
  async readProject({ projectId, projectName, }) {
486
513
  let path = "/sessions";
487
514
  const params = new URLSearchParams();
package/dist/schemas.d.ts CHANGED
@@ -70,7 +70,7 @@ export interface Run extends BaseRun {
70
70
  /** A unique identifier for the run, mandatory when loaded from DB. */
71
71
  id: string;
72
72
  /** Defines the sequence in which the run was executed. */
73
- execution_order: number;
73
+ execution_order?: number;
74
74
  /** The ID of the project that owns this run. */
75
75
  session_id?: string;
76
76
  /** IDs of any child runs spawned by this run. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.",
5
5
  "files": [
6
6
  "dist/",