langsmith 0.1.57 → 0.1.59

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
@@ -2140,6 +2140,145 @@ class Client {
2140
2140
  const [results] = await this._logEvaluationFeedback(evaluatorResponse, run, sourceInfo);
2141
2141
  return results;
2142
2142
  }
2143
+ /**
2144
+ * API for managing annotation queues
2145
+ */
2146
+ /**
2147
+ * List the annotation queues on the LangSmith API.
2148
+ * @param options - The options for listing annotation queues
2149
+ * @param options.queueIds - The IDs of the queues to filter by
2150
+ * @param options.name - The name of the queue to filter by
2151
+ * @param options.nameContains - The substring that the queue name should contain
2152
+ * @param options.limit - The maximum number of queues to return
2153
+ * @returns An iterator of AnnotationQueue objects
2154
+ */
2155
+ async *listAnnotationQueues(options = {}) {
2156
+ const { queueIds, name, nameContains, limit } = options;
2157
+ const params = new URLSearchParams();
2158
+ if (queueIds) {
2159
+ queueIds.forEach((id, i) => {
2160
+ (0, _uuid_js_1.assertUuid)(id, `queueIds[${i}]`);
2161
+ params.append("ids", id);
2162
+ });
2163
+ }
2164
+ if (name)
2165
+ params.append("name", name);
2166
+ if (nameContains)
2167
+ params.append("name_contains", nameContains);
2168
+ params.append("limit", (limit !== undefined ? Math.min(limit, 100) : 100).toString());
2169
+ let count = 0;
2170
+ for await (const queues of this._getPaginated("/annotation-queues", params)) {
2171
+ yield* queues;
2172
+ count++;
2173
+ if (limit !== undefined && count >= limit)
2174
+ break;
2175
+ }
2176
+ }
2177
+ /**
2178
+ * Create an annotation queue on the LangSmith API.
2179
+ * @param options - The options for creating an annotation queue
2180
+ * @param options.name - The name of the annotation queue
2181
+ * @param options.description - The description of the annotation queue
2182
+ * @param options.queueId - The ID of the annotation queue
2183
+ * @returns The created AnnotationQueue object
2184
+ */
2185
+ async createAnnotationQueue(options) {
2186
+ const { name, description, queueId } = options;
2187
+ const body = {
2188
+ name,
2189
+ description,
2190
+ id: queueId || uuid.v4(),
2191
+ };
2192
+ const response = await this.caller.call((0, fetch_js_1._getFetchImplementation)(), `${this.apiUrl}/annotation-queues`, {
2193
+ method: "POST",
2194
+ headers: { ...this.headers, "Content-Type": "application/json" },
2195
+ body: JSON.stringify(Object.fromEntries(Object.entries(body).filter(([_, v]) => v !== undefined))),
2196
+ signal: AbortSignal.timeout(this.timeout_ms),
2197
+ ...this.fetchOptions,
2198
+ });
2199
+ await (0, error_js_1.raiseForStatus)(response, "create annotation queue");
2200
+ const data = await response.json();
2201
+ return data;
2202
+ }
2203
+ /**
2204
+ * Read an annotation queue with the specified queue ID.
2205
+ * @param queueId - The ID of the annotation queue to read
2206
+ * @returns The AnnotationQueue object
2207
+ */
2208
+ async readAnnotationQueue(queueId) {
2209
+ // TODO: Replace when actual endpoint is added
2210
+ const queueIteratorResult = await this.listAnnotationQueues({
2211
+ queueIds: [queueId],
2212
+ }).next();
2213
+ if (queueIteratorResult.done) {
2214
+ throw new Error(`Annotation queue with ID ${queueId} not found`);
2215
+ }
2216
+ return queueIteratorResult.value;
2217
+ }
2218
+ /**
2219
+ * Update an annotation queue with the specified queue ID.
2220
+ * @param queueId - The ID of the annotation queue to update
2221
+ * @param options - The options for updating the annotation queue
2222
+ * @param options.name - The new name for the annotation queue
2223
+ * @param options.description - The new description for the annotation queue
2224
+ */
2225
+ async updateAnnotationQueue(queueId, options) {
2226
+ const { name, description } = options;
2227
+ const response = await this.caller.call((0, fetch_js_1._getFetchImplementation)(), `${this.apiUrl}/annotation-queues/${(0, _uuid_js_1.assertUuid)(queueId, "queueId")}`, {
2228
+ method: "PATCH",
2229
+ headers: { ...this.headers, "Content-Type": "application/json" },
2230
+ body: JSON.stringify({ name, description }),
2231
+ signal: AbortSignal.timeout(this.timeout_ms),
2232
+ ...this.fetchOptions,
2233
+ });
2234
+ await (0, error_js_1.raiseForStatus)(response, "update annotation queue");
2235
+ }
2236
+ /**
2237
+ * Delete an annotation queue with the specified queue ID.
2238
+ * @param queueId - The ID of the annotation queue to delete
2239
+ */
2240
+ async deleteAnnotationQueue(queueId) {
2241
+ const response = await this.caller.call((0, fetch_js_1._getFetchImplementation)(), `${this.apiUrl}/annotation-queues/${(0, _uuid_js_1.assertUuid)(queueId, "queueId")}`, {
2242
+ method: "DELETE",
2243
+ headers: { ...this.headers, Accept: "application/json" },
2244
+ signal: AbortSignal.timeout(this.timeout_ms),
2245
+ ...this.fetchOptions,
2246
+ });
2247
+ await (0, error_js_1.raiseForStatus)(response, "delete annotation queue");
2248
+ }
2249
+ /**
2250
+ * Add runs to an annotation queue with the specified queue ID.
2251
+ * @param queueId - The ID of the annotation queue
2252
+ * @param runIds - The IDs of the runs to be added to the annotation queue
2253
+ */
2254
+ async addRunsToAnnotationQueue(queueId, runIds) {
2255
+ const response = await this.caller.call((0, fetch_js_1._getFetchImplementation)(), `${this.apiUrl}/annotation-queues/${(0, _uuid_js_1.assertUuid)(queueId, "queueId")}/runs`, {
2256
+ method: "POST",
2257
+ headers: { ...this.headers, "Content-Type": "application/json" },
2258
+ body: JSON.stringify(runIds.map((id, i) => (0, _uuid_js_1.assertUuid)(id, `runIds[${i}]`).toString())),
2259
+ signal: AbortSignal.timeout(this.timeout_ms),
2260
+ ...this.fetchOptions,
2261
+ });
2262
+ await (0, error_js_1.raiseForStatus)(response, "add runs to annotation queue");
2263
+ }
2264
+ /**
2265
+ * Get a run from an annotation queue at the specified index.
2266
+ * @param queueId - The ID of the annotation queue
2267
+ * @param index - The index of the run to retrieve
2268
+ * @returns A Promise that resolves to a RunWithAnnotationQueueInfo object
2269
+ * @throws {Error} If the run is not found at the given index or for other API-related errors
2270
+ */
2271
+ async getRunFromAnnotationQueue(queueId, index) {
2272
+ const baseUrl = `/annotation-queues/${(0, _uuid_js_1.assertUuid)(queueId, "queueId")}/run`;
2273
+ const response = await this.caller.call((0, fetch_js_1._getFetchImplementation)(), `${this.apiUrl}${baseUrl}/${index}`, {
2274
+ method: "GET",
2275
+ headers: this.headers,
2276
+ signal: AbortSignal.timeout(this.timeout_ms),
2277
+ ...this.fetchOptions,
2278
+ });
2279
+ await (0, error_js_1.raiseForStatus)(response, "get run from annotation queue");
2280
+ return await response.json();
2281
+ }
2143
2282
  async _currentTenantIsOwner(owner) {
2144
2283
  const settings = await this._getSettings();
2145
2284
  return owner == "-" || settings.tenant_handle === owner;
@@ -2215,7 +2354,7 @@ class Client {
2215
2354
  return this._likeOrUnlikePrompt(promptIdentifier, false);
2216
2355
  }
2217
2356
  async *listCommits(promptOwnerAndName) {
2218
- for await (const commits of this._getPaginated(`/commits/${promptOwnerAndName}/`, {}, (res) => res.commits)) {
2357
+ for await (const commits of this._getPaginated(`/commits/${promptOwnerAndName}/`, new URLSearchParams(), (res) => res.commits)) {
2219
2358
  yield* commits;
2220
2359
  }
2221
2360
  }
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AsyncCallerParams } from "./utils/async_caller.js";
2
- import { ComparativeExperiment, DataType, Dataset, DatasetDiffInfo, DatasetShareSchema, Example, ExampleUpdate, ExampleUpdateWithId, Feedback, FeedbackConfig, FeedbackIngestToken, KVMap, LangChainBaseMessage, LangSmithSettings, LikePromptResponse, Prompt, PromptCommit, PromptSortField, Run, RunCreate, RunUpdate, ScoreType, ExampleSearch, TimeDelta, TracerSession, TracerSessionResult, ValueType } from "./schemas.js";
2
+ import { ComparativeExperiment, DataType, Dataset, DatasetDiffInfo, DatasetShareSchema, Example, ExampleUpdate, ExampleUpdateWithId, Feedback, FeedbackConfig, FeedbackIngestToken, KVMap, LangChainBaseMessage, LangSmithSettings, LikePromptResponse, Prompt, PromptCommit, PromptSortField, Run, RunCreate, RunUpdate, ScoreType, ExampleSearch, TimeDelta, TracerSession, TracerSessionResult, ValueType, AnnotationQueue, RunWithAnnotationQueueInfo } from "./schemas.js";
3
3
  import { EvaluationResult, EvaluationResults, RunEvaluator } from "./evaluation/evaluator.js";
4
4
  export interface ClientConfig {
5
5
  apiUrl?: string;
@@ -601,6 +601,73 @@ export declare class Client {
601
601
  logEvaluationFeedback(evaluatorResponse: EvaluationResult | EvaluationResults, run?: Run, sourceInfo?: {
602
602
  [key: string]: any;
603
603
  }): Promise<EvaluationResult[]>;
604
+ /**
605
+ * API for managing annotation queues
606
+ */
607
+ /**
608
+ * List the annotation queues on the LangSmith API.
609
+ * @param options - The options for listing annotation queues
610
+ * @param options.queueIds - The IDs of the queues to filter by
611
+ * @param options.name - The name of the queue to filter by
612
+ * @param options.nameContains - The substring that the queue name should contain
613
+ * @param options.limit - The maximum number of queues to return
614
+ * @returns An iterator of AnnotationQueue objects
615
+ */
616
+ listAnnotationQueues(options?: {
617
+ queueIds?: string[];
618
+ name?: string;
619
+ nameContains?: string;
620
+ limit?: number;
621
+ }): AsyncIterableIterator<AnnotationQueue>;
622
+ /**
623
+ * Create an annotation queue on the LangSmith API.
624
+ * @param options - The options for creating an annotation queue
625
+ * @param options.name - The name of the annotation queue
626
+ * @param options.description - The description of the annotation queue
627
+ * @param options.queueId - The ID of the annotation queue
628
+ * @returns The created AnnotationQueue object
629
+ */
630
+ createAnnotationQueue(options: {
631
+ name: string;
632
+ description?: string;
633
+ queueId?: string;
634
+ }): Promise<AnnotationQueue>;
635
+ /**
636
+ * Read an annotation queue with the specified queue ID.
637
+ * @param queueId - The ID of the annotation queue to read
638
+ * @returns The AnnotationQueue object
639
+ */
640
+ readAnnotationQueue(queueId: string): Promise<AnnotationQueue>;
641
+ /**
642
+ * Update an annotation queue with the specified queue ID.
643
+ * @param queueId - The ID of the annotation queue to update
644
+ * @param options - The options for updating the annotation queue
645
+ * @param options.name - The new name for the annotation queue
646
+ * @param options.description - The new description for the annotation queue
647
+ */
648
+ updateAnnotationQueue(queueId: string, options: {
649
+ name: string;
650
+ description?: string;
651
+ }): Promise<void>;
652
+ /**
653
+ * Delete an annotation queue with the specified queue ID.
654
+ * @param queueId - The ID of the annotation queue to delete
655
+ */
656
+ deleteAnnotationQueue(queueId: string): Promise<void>;
657
+ /**
658
+ * Add runs to an annotation queue with the specified queue ID.
659
+ * @param queueId - The ID of the annotation queue
660
+ * @param runIds - The IDs of the runs to be added to the annotation queue
661
+ */
662
+ addRunsToAnnotationQueue(queueId: string, runIds: string[]): Promise<void>;
663
+ /**
664
+ * Get a run from an annotation queue at the specified index.
665
+ * @param queueId - The ID of the annotation queue
666
+ * @param index - The index of the run to retrieve
667
+ * @returns A Promise that resolves to a RunWithAnnotationQueueInfo object
668
+ * @throws {Error} If the run is not found at the given index or for other API-related errors
669
+ */
670
+ getRunFromAnnotationQueue(queueId: string, index: number): Promise<RunWithAnnotationQueueInfo>;
604
671
  protected _currentTenantIsOwner(owner: string): Promise<boolean>;
605
672
  protected _ownerConflictError(action: string, owner: string): Promise<Error>;
606
673
  protected _getLatestCommitHash(promptOwnerAndName: string): Promise<string | undefined>;
package/dist/client.js CHANGED
@@ -2113,6 +2113,145 @@ export class Client {
2113
2113
  const [results] = await this._logEvaluationFeedback(evaluatorResponse, run, sourceInfo);
2114
2114
  return results;
2115
2115
  }
2116
+ /**
2117
+ * API for managing annotation queues
2118
+ */
2119
+ /**
2120
+ * List the annotation queues on the LangSmith API.
2121
+ * @param options - The options for listing annotation queues
2122
+ * @param options.queueIds - The IDs of the queues to filter by
2123
+ * @param options.name - The name of the queue to filter by
2124
+ * @param options.nameContains - The substring that the queue name should contain
2125
+ * @param options.limit - The maximum number of queues to return
2126
+ * @returns An iterator of AnnotationQueue objects
2127
+ */
2128
+ async *listAnnotationQueues(options = {}) {
2129
+ const { queueIds, name, nameContains, limit } = options;
2130
+ const params = new URLSearchParams();
2131
+ if (queueIds) {
2132
+ queueIds.forEach((id, i) => {
2133
+ assertUuid(id, `queueIds[${i}]`);
2134
+ params.append("ids", id);
2135
+ });
2136
+ }
2137
+ if (name)
2138
+ params.append("name", name);
2139
+ if (nameContains)
2140
+ params.append("name_contains", nameContains);
2141
+ params.append("limit", (limit !== undefined ? Math.min(limit, 100) : 100).toString());
2142
+ let count = 0;
2143
+ for await (const queues of this._getPaginated("/annotation-queues", params)) {
2144
+ yield* queues;
2145
+ count++;
2146
+ if (limit !== undefined && count >= limit)
2147
+ break;
2148
+ }
2149
+ }
2150
+ /**
2151
+ * Create an annotation queue on the LangSmith API.
2152
+ * @param options - The options for creating an annotation queue
2153
+ * @param options.name - The name of the annotation queue
2154
+ * @param options.description - The description of the annotation queue
2155
+ * @param options.queueId - The ID of the annotation queue
2156
+ * @returns The created AnnotationQueue object
2157
+ */
2158
+ async createAnnotationQueue(options) {
2159
+ const { name, description, queueId } = options;
2160
+ const body = {
2161
+ name,
2162
+ description,
2163
+ id: queueId || uuid.v4(),
2164
+ };
2165
+ const response = await this.caller.call(_getFetchImplementation(), `${this.apiUrl}/annotation-queues`, {
2166
+ method: "POST",
2167
+ headers: { ...this.headers, "Content-Type": "application/json" },
2168
+ body: JSON.stringify(Object.fromEntries(Object.entries(body).filter(([_, v]) => v !== undefined))),
2169
+ signal: AbortSignal.timeout(this.timeout_ms),
2170
+ ...this.fetchOptions,
2171
+ });
2172
+ await raiseForStatus(response, "create annotation queue");
2173
+ const data = await response.json();
2174
+ return data;
2175
+ }
2176
+ /**
2177
+ * Read an annotation queue with the specified queue ID.
2178
+ * @param queueId - The ID of the annotation queue to read
2179
+ * @returns The AnnotationQueue object
2180
+ */
2181
+ async readAnnotationQueue(queueId) {
2182
+ // TODO: Replace when actual endpoint is added
2183
+ const queueIteratorResult = await this.listAnnotationQueues({
2184
+ queueIds: [queueId],
2185
+ }).next();
2186
+ if (queueIteratorResult.done) {
2187
+ throw new Error(`Annotation queue with ID ${queueId} not found`);
2188
+ }
2189
+ return queueIteratorResult.value;
2190
+ }
2191
+ /**
2192
+ * Update an annotation queue with the specified queue ID.
2193
+ * @param queueId - The ID of the annotation queue to update
2194
+ * @param options - The options for updating the annotation queue
2195
+ * @param options.name - The new name for the annotation queue
2196
+ * @param options.description - The new description for the annotation queue
2197
+ */
2198
+ async updateAnnotationQueue(queueId, options) {
2199
+ const { name, description } = options;
2200
+ const response = await this.caller.call(_getFetchImplementation(), `${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}`, {
2201
+ method: "PATCH",
2202
+ headers: { ...this.headers, "Content-Type": "application/json" },
2203
+ body: JSON.stringify({ name, description }),
2204
+ signal: AbortSignal.timeout(this.timeout_ms),
2205
+ ...this.fetchOptions,
2206
+ });
2207
+ await raiseForStatus(response, "update annotation queue");
2208
+ }
2209
+ /**
2210
+ * Delete an annotation queue with the specified queue ID.
2211
+ * @param queueId - The ID of the annotation queue to delete
2212
+ */
2213
+ async deleteAnnotationQueue(queueId) {
2214
+ const response = await this.caller.call(_getFetchImplementation(), `${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}`, {
2215
+ method: "DELETE",
2216
+ headers: { ...this.headers, Accept: "application/json" },
2217
+ signal: AbortSignal.timeout(this.timeout_ms),
2218
+ ...this.fetchOptions,
2219
+ });
2220
+ await raiseForStatus(response, "delete annotation queue");
2221
+ }
2222
+ /**
2223
+ * Add runs to an annotation queue with the specified queue ID.
2224
+ * @param queueId - The ID of the annotation queue
2225
+ * @param runIds - The IDs of the runs to be added to the annotation queue
2226
+ */
2227
+ async addRunsToAnnotationQueue(queueId, runIds) {
2228
+ const response = await this.caller.call(_getFetchImplementation(), `${this.apiUrl}/annotation-queues/${assertUuid(queueId, "queueId")}/runs`, {
2229
+ method: "POST",
2230
+ headers: { ...this.headers, "Content-Type": "application/json" },
2231
+ body: JSON.stringify(runIds.map((id, i) => assertUuid(id, `runIds[${i}]`).toString())),
2232
+ signal: AbortSignal.timeout(this.timeout_ms),
2233
+ ...this.fetchOptions,
2234
+ });
2235
+ await raiseForStatus(response, "add runs to annotation queue");
2236
+ }
2237
+ /**
2238
+ * Get a run from an annotation queue at the specified index.
2239
+ * @param queueId - The ID of the annotation queue
2240
+ * @param index - The index of the run to retrieve
2241
+ * @returns A Promise that resolves to a RunWithAnnotationQueueInfo object
2242
+ * @throws {Error} If the run is not found at the given index or for other API-related errors
2243
+ */
2244
+ async getRunFromAnnotationQueue(queueId, index) {
2245
+ const baseUrl = `/annotation-queues/${assertUuid(queueId, "queueId")}/run`;
2246
+ const response = await this.caller.call(_getFetchImplementation(), `${this.apiUrl}${baseUrl}/${index}`, {
2247
+ method: "GET",
2248
+ headers: this.headers,
2249
+ signal: AbortSignal.timeout(this.timeout_ms),
2250
+ ...this.fetchOptions,
2251
+ });
2252
+ await raiseForStatus(response, "get run from annotation queue");
2253
+ return await response.json();
2254
+ }
2116
2255
  async _currentTenantIsOwner(owner) {
2117
2256
  const settings = await this._getSettings();
2118
2257
  return owner == "-" || settings.tenant_handle === owner;
@@ -2188,7 +2327,7 @@ export class Client {
2188
2327
  return this._likeOrUnlikePrompt(promptIdentifier, false);
2189
2328
  }
2190
2329
  async *listCommits(promptOwnerAndName) {
2191
- for await (const commits of this._getPaginated(`/commits/${promptOwnerAndName}/`, {}, (res) => res.commits)) {
2330
+ for await (const commits of this._getPaginated(`/commits/${promptOwnerAndName}/`, new URLSearchParams(), (res) => res.commits)) {
2192
2331
  yield* commits;
2193
2332
  }
2194
2333
  }
@@ -421,6 +421,7 @@ class _ExperimentManager {
421
421
  : new Date(example.created_at).toISOString(),
422
422
  },
423
423
  client: fields.client,
424
+ tracingEnabled: true,
424
425
  };
425
426
  const evaluatorResponse = await evaluator.evaluateRun(run, example, options);
426
427
  evaluationResults.results.push(...(await fields.client.logEvaluationFeedback(evaluatorResponse, run)));
@@ -417,6 +417,7 @@ export class _ExperimentManager {
417
417
  : new Date(example.created_at).toISOString(),
418
418
  },
419
419
  client: fields.client,
420
+ tracingEnabled: true,
420
421
  };
421
422
  const evaluatorResponse = await evaluator.evaluateRun(run, example, options);
422
423
  evaluationResults.results.push(...(await fields.client.logEvaluationFeedback(evaluatorResponse, run)));
package/dist/index.cjs CHANGED
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "RunTree", { enumerable: true, get: function () {
8
8
  var fetch_js_1 = require("./singletons/fetch.cjs");
9
9
  Object.defineProperty(exports, "overrideFetchImplementation", { enumerable: true, get: function () { return fetch_js_1.overrideFetchImplementation; } });
10
10
  // Update using yarn bump-version
11
- exports.__version__ = "0.1.57";
11
+ exports.__version__ = "0.1.59";
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export { Client, type ClientConfig } from "./client.js";
2
2
  export type { Dataset, Example, TracerSession, Run, Feedback, RetrieverOutput, } from "./schemas.js";
3
3
  export { RunTree, type RunTreeConfig } from "./run_trees.js";
4
4
  export { overrideFetchImplementation } from "./singletons/fetch.js";
5
- export declare const __version__ = "0.1.57";
5
+ export declare const __version__ = "0.1.59";
package/dist/index.js CHANGED
@@ -2,4 +2,4 @@ export { Client } from "./client.js";
2
2
  export { RunTree } from "./run_trees.js";
3
3
  export { overrideFetchImplementation } from "./singletons/fetch.js";
4
4
  // Update using yarn bump-version
5
- export const __version__ = "0.1.57";
5
+ export const __version__ = "0.1.59";
package/dist/schemas.d.ts CHANGED
@@ -371,4 +371,24 @@ export interface LangSmithSettings {
371
371
  created_at: string;
372
372
  tenant_handle?: string;
373
373
  }
374
+ export interface AnnotationQueue {
375
+ /** The unique identifier of the annotation queue. */
376
+ id: string;
377
+ /** The name of the annotation queue. */
378
+ name: string;
379
+ /** An optional description of the annotation queue. */
380
+ description?: string;
381
+ /** The timestamp when the annotation queue was created. */
382
+ created_at: string;
383
+ /** The timestamp when the annotation queue was last updated. */
384
+ updated_at: string;
385
+ /** The ID of the tenant associated with the annotation queue. */
386
+ tenant_id: string;
387
+ }
388
+ export interface RunWithAnnotationQueueInfo extends BaseRun {
389
+ /** The last time this run was reviewed. */
390
+ last_reviewed_time?: string;
391
+ /** The time this run was added to the queue. */
392
+ added_at?: string;
393
+ }
374
394
  export {};
@@ -25,9 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.assertUuid = void 0;
27
27
  const uuid = __importStar(require("uuid"));
28
- function assertUuid(str) {
28
+ function assertUuid(str, which) {
29
29
  if (!uuid.validate(str)) {
30
- throw new Error(`Invalid UUID: ${str}`);
30
+ const msg = which !== undefined
31
+ ? `Invalid UUID for ${which}: ${str}`
32
+ : `Invalid UUID: ${str}`;
33
+ throw new Error(msg);
31
34
  }
35
+ return str;
32
36
  }
33
37
  exports.assertUuid = assertUuid;
@@ -1 +1 @@
1
- export declare function assertUuid(str: string): void;
1
+ export declare function assertUuid(str: string, which?: string): string;
@@ -1,6 +1,10 @@
1
1
  import * as uuid from "uuid";
2
- export function assertUuid(str) {
2
+ export function assertUuid(str, which) {
3
3
  if (!uuid.validate(str)) {
4
- throw new Error(`Invalid UUID: ${str}`);
4
+ const msg = which !== undefined
5
+ ? `Invalid UUID for ${which}: ${str}`
6
+ : `Invalid UUID: ${str}`;
7
+ throw new Error(msg);
5
8
  }
9
+ return str;
6
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.1.57",
3
+ "version": "0.1.59",
4
4
  "description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.",
5
5
  "packageManager": "yarn@1.22.19",
6
6
  "files": [