langsmith 0.0.16 → 0.0.19

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.
@@ -23,7 +23,7 @@ services:
23
23
  depends_on:
24
24
  - langchain-db
25
25
  langchain-db:
26
- image: postgres:14.1
26
+ image: postgres:14.7
27
27
  command:
28
28
  [
29
29
  "postgres",
package/dist/client.cjs CHANGED
@@ -304,6 +304,45 @@ class Client {
304
304
  });
305
305
  await raiseForStatus(response, "delete run");
306
306
  }
307
+ async shareRun(runId, { shareId } = {}) {
308
+ const data = {
309
+ run_id: runId,
310
+ share_token: shareId || uuid.v4(),
311
+ };
312
+ const response = await this.caller.call(fetch, `${this.apiUrl}/runs/${runId}/share`, {
313
+ method: "PUT",
314
+ headers: this.headers,
315
+ body: JSON.stringify(data),
316
+ signal: AbortSignal.timeout(this.timeout_ms),
317
+ });
318
+ // await raiseForStatus(response, "share run");
319
+ const result = await response.json();
320
+ if (result === null || !("share_token" in result)) {
321
+ throw new Error("Invalid response from server");
322
+ }
323
+ return `${this.getHostUrl()}/public/${result["share_token"]}/r`;
324
+ }
325
+ async unshareRun(runId) {
326
+ const response = await this.caller.call(fetch, `${this.apiUrl}/runs/${runId}/share`, {
327
+ method: "DELETE",
328
+ headers: this.headers,
329
+ signal: AbortSignal.timeout(this.timeout_ms),
330
+ });
331
+ await raiseForStatus(response, "unshare run");
332
+ }
333
+ async readRunSharedLink(runId) {
334
+ const response = await this.caller.call(fetch, `${this.apiUrl}/runs/${runId}/share`, {
335
+ method: "GET",
336
+ headers: this.headers,
337
+ signal: AbortSignal.timeout(this.timeout_ms),
338
+ });
339
+ // await raiseForStatus(response, "read run shared link");
340
+ const result = await response.json();
341
+ if (result === null || !("share_token" in result)) {
342
+ return undefined;
343
+ }
344
+ return `${this.getHostUrl()}/public/${result["share_token"]}/r`;
345
+ }
307
346
  async createProject({ projectName, projectExtra, upsert, }) {
308
347
  const upsert_ = upsert ? `?upsert=true` : "";
309
348
  const endpoint = `${this.apiUrl}/sessions${upsert_}`;
package/dist/client.d.ts CHANGED
@@ -77,6 +77,11 @@ export declare class Client {
77
77
  private _loadChildRuns;
78
78
  listRuns({ projectId, projectName, parentRunId, referenceExampleId, datasetId, startTime, endTime, executionOrder, runType, error, id, limit, offset, query, filter, orderBy, }: ListRunsParams): AsyncIterable<Run>;
79
79
  deleteRun(runId: string): Promise<void>;
80
+ shareRun(runId: string, { shareId }?: {
81
+ shareId?: string;
82
+ }): Promise<string>;
83
+ unshareRun(runId: string): Promise<void>;
84
+ readRunSharedLink(runId: string): Promise<string | undefined>;
80
85
  createProject({ projectName, projectExtra, upsert, }: {
81
86
  projectName: string;
82
87
  projectExtra?: object;
package/dist/client.js CHANGED
@@ -278,6 +278,45 @@ export class Client {
278
278
  });
279
279
  await raiseForStatus(response, "delete run");
280
280
  }
281
+ async shareRun(runId, { shareId } = {}) {
282
+ const data = {
283
+ run_id: runId,
284
+ share_token: shareId || uuid.v4(),
285
+ };
286
+ const response = await this.caller.call(fetch, `${this.apiUrl}/runs/${runId}/share`, {
287
+ method: "PUT",
288
+ headers: this.headers,
289
+ body: JSON.stringify(data),
290
+ signal: AbortSignal.timeout(this.timeout_ms),
291
+ });
292
+ // await raiseForStatus(response, "share run");
293
+ const result = await response.json();
294
+ if (result === null || !("share_token" in result)) {
295
+ throw new Error("Invalid response from server");
296
+ }
297
+ return `${this.getHostUrl()}/public/${result["share_token"]}/r`;
298
+ }
299
+ async unshareRun(runId) {
300
+ const response = await this.caller.call(fetch, `${this.apiUrl}/runs/${runId}/share`, {
301
+ method: "DELETE",
302
+ headers: this.headers,
303
+ signal: AbortSignal.timeout(this.timeout_ms),
304
+ });
305
+ await raiseForStatus(response, "unshare run");
306
+ }
307
+ async readRunSharedLink(runId) {
308
+ const response = await this.caller.call(fetch, `${this.apiUrl}/runs/${runId}/share`, {
309
+ method: "GET",
310
+ headers: this.headers,
311
+ signal: AbortSignal.timeout(this.timeout_ms),
312
+ });
313
+ // await raiseForStatus(response, "read run shared link");
314
+ const result = await response.json();
315
+ if (result === null || !("share_token" in result)) {
316
+ return undefined;
317
+ }
318
+ return `${this.getHostUrl()}/public/${result["share_token"]}/r`;
319
+ }
281
320
  async createProject({ projectName, projectExtra, upsert, }) {
282
321
  const upsert_ = upsert ? `?upsert=true` : "";
283
322
  const endpoint = `${this.apiUrl}/sessions${upsert_}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.0.16",
3
+ "version": "0.0.19",
4
4
  "description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.",
5
5
  "files": [
6
6
  "dist/",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "repository": {
44
44
  "type": "git",
45
- "url": "git+https://github.com/langchain-ai/langchainplus-sdk.git"
45
+ "url": "git+https://github.com/langchain-ai/langsmith-sdk.git"
46
46
  },
47
47
  "keywords": [
48
48
  "LLM",
@@ -53,9 +53,9 @@
53
53
  "author": "LangChain",
54
54
  "license": "MIT",
55
55
  "bugs": {
56
- "url": "https://github.com/langchain-ai/langchainplus-sdk/issues"
56
+ "url": "https://github.com/langchain-ai/langsmith-sdk/issues"
57
57
  },
58
- "homepage": "https://github.com/langchain-ai/langchainplus-sdk#readme",
58
+ "homepage": "https://github.com/langchain-ai/langsmith-sdk#readme",
59
59
  "devDependencies": {
60
60
  "@babel/preset-env": "^7.22.4",
61
61
  "@jest/globals": "^29.5.0",