langsmith 0.5.22 → 0.5.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/dist/client.js CHANGED
@@ -7,12 +7,12 @@ import { getEnvironmentVariable, getLangSmithEnvVarsMetadata, getLangSmithEnviro
7
7
  import { __version__ } from "./index.js";
8
8
  import { assertUuid } from "./utils/_uuid.js";
9
9
  import { warnOnce } from "./utils/warn.js";
10
- import { parsePromptIdentifier } from "./utils/prompts.js";
11
- import { raiseForStatus, isLangSmithNotFoundError } from "./utils/error.js";
10
+ import { parseHubIdentifier } from "./utils/prompts.js";
11
+ import { raiseForStatus, isLangSmithNotFoundError, isLangSmithConflictError, } from "./utils/error.js";
12
12
  import { promptCacheSingleton, } from "./utils/prompt_cache/index.js";
13
13
  import * as fsUtils from "./utils/fs.js";
14
14
  import { _shouldStreamForGlobalFetchImplementation, _getFetchImplementation, } from "./singletons/fetch.js";
15
- import { serialize as serializePayloadForTracing } from "./utils/fast-safe-stringify/index.js";
15
+ import { serialize as serializePayloadForTracing, estimateSerializedSize, } from "./utils/fast-safe-stringify/index.js";
16
16
  /**
17
17
  * Catches timestamps without a timezone suffix.
18
18
  */
@@ -152,7 +152,19 @@ export class AutoBatchQueue {
152
152
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise
153
153
  itemPromiseResolve = resolve;
154
154
  });
155
- const size = serializePayloadForTracing(item.item, `Serializing run with id: ${item.item.id}`).length;
155
+ // By default we compute the exact serialized size here by stringifying
156
+ // the payload. This is expensive: JSON.stringify on large payloads
157
+ // blocks the event loop on the user's hot path.
158
+ //
159
+ // Opting into LANGSMITH_PERF_OPTIMIZATION=true switches to a cheap
160
+ // structural estimate instead. The estimate is only used for soft
161
+ // memory accounting (queue size limit and downstream async caller
162
+ // memory tracking), never for anything correctness-critical -- the
163
+ // real serialization still happens later, off the hot path, when the
164
+ // batch is assembled for sending.
165
+ const size = getLangSmithEnvironmentVariable("PERF_OPTIMIZATION") === "true"
166
+ ? estimateSerializedSize(item.item)
167
+ : serializePayloadForTracing(item.item, `Serializing run with id: ${item.item.id}`).length;
156
168
  // Check if adding this item would exceed the size limit
157
169
  // Allow the run if the queue is empty (to support large single traces)
158
170
  if (this.sizeBytes + size > this.maxSizeBytes && this.items.length > 0) {
@@ -3783,7 +3795,7 @@ export class Client {
3783
3795
  return json.commits[0].commit_hash;
3784
3796
  }
3785
3797
  async _likeOrUnlikePrompt(promptIdentifier, like) {
3786
- const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);
3798
+ const [owner, promptName, _] = parseHubIdentifier(promptIdentifier);
3787
3799
  const body = JSON.stringify({ like: like });
3788
3800
  const response = await this.caller.call(async () => {
3789
3801
  const res = await this._fetch(`${this.apiUrl}/likes/${owner}/${promptName}`, {
@@ -3802,7 +3814,7 @@ export class Client {
3802
3814
  return response.json();
3803
3815
  }
3804
3816
  async _getPromptUrl(promptIdentifier) {
3805
- const [owner, promptName, commitHash] = parsePromptIdentifier(promptIdentifier);
3817
+ const [owner, promptName, commitHash] = parseHubIdentifier(promptIdentifier);
3806
3818
  if (!(await this._currentTenantIsOwner(owner))) {
3807
3819
  if (commitHash !== "latest") {
3808
3820
  return `${this.getHostUrl()}/hub/${owner}/${promptName}/${commitHash.substring(0, 8)}`;
@@ -3894,7 +3906,7 @@ export class Client {
3894
3906
  * ```
3895
3907
  */
3896
3908
  async *listCommits(promptIdentifier) {
3897
- const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);
3909
+ const [owner, promptName, _] = parseHubIdentifier(promptIdentifier);
3898
3910
  for await (const commits of this._getPaginated(`/commits/${owner}/${promptName}/`, new URLSearchParams(), (res) => res.commits)) {
3899
3911
  yield* commits;
3900
3912
  }
@@ -3957,7 +3969,7 @@ export class Client {
3957
3969
  * ```
3958
3970
  */
3959
3971
  async getPrompt(promptIdentifier) {
3960
- const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);
3972
+ const [owner, promptName, _] = parseHubIdentifier(promptIdentifier);
3961
3973
  const response = await this.caller.call(async () => {
3962
3974
  const res = await this._fetch(`${this.apiUrl}/repos/${owner}/${promptName}`, {
3963
3975
  method: "GET",
@@ -4014,7 +4026,7 @@ export class Client {
4014
4026
  You can add a handle by creating a public prompt at:\n
4015
4027
  https://smith.langchain.com/prompts`);
4016
4028
  }
4017
- const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);
4029
+ const [owner, promptName, _] = parseHubIdentifier(promptIdentifier);
4018
4030
  if (!(await this._currentTenantIsOwner(owner))) {
4019
4031
  throw await this._ownerConflictError("create a prompt", owner);
4020
4032
  }
@@ -4073,7 +4085,7 @@ export class Client {
4073
4085
  if (!(await this.promptExists(promptIdentifier))) {
4074
4086
  throw new Error("Prompt does not exist, you must create it first.");
4075
4087
  }
4076
- const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);
4088
+ const [owner, promptName, _] = parseHubIdentifier(promptIdentifier);
4077
4089
  const resolvedParentCommitHash = options?.parentCommitHash === "latest" || !options?.parentCommitHash
4078
4090
  ? await this._getLatestCommitHash(`${owner}/${promptName}`)
4079
4091
  : options?.parentCommitHash;
@@ -4271,7 +4283,7 @@ export class Client {
4271
4283
  if (!(await this.promptExists(promptIdentifier))) {
4272
4284
  throw new Error("Prompt does not exist, you must create it first.");
4273
4285
  }
4274
- const [owner, promptName] = parsePromptIdentifier(promptIdentifier);
4286
+ const [owner, promptName] = parseHubIdentifier(promptIdentifier);
4275
4287
  if (!(await this._currentTenantIsOwner(owner))) {
4276
4288
  throw await this._ownerConflictError("update a prompt", owner);
4277
4289
  }
@@ -4311,7 +4323,7 @@ export class Client {
4311
4323
  if (!(await this.promptExists(promptIdentifier))) {
4312
4324
  throw new Error("Prompt does not exist, you must create it first.");
4313
4325
  }
4314
- const [owner, promptName, _] = parsePromptIdentifier(promptIdentifier);
4326
+ const [owner, promptName, _] = parseHubIdentifier(promptIdentifier);
4315
4327
  if (!(await this._currentTenantIsOwner(owner))) {
4316
4328
  throw await this._ownerConflictError("delete a prompt", owner);
4317
4329
  }
@@ -4339,7 +4351,7 @@ export class Client {
4339
4351
  * Fetch a prompt commit directly from the API (bypassing cache).
4340
4352
  */
4341
4353
  async _fetchPromptFromApi(promptIdentifier, options) {
4342
- const [owner, promptName, commitHash] = parsePromptIdentifier(promptIdentifier);
4354
+ const [owner, promptName, commitHash] = parseHubIdentifier(promptIdentifier);
4343
4355
  const response = await this.caller.call(async () => {
4344
4356
  const res = await this._fetch(`${this.apiUrl}/commits/${owner}/${promptName}/${commitHash}${options?.includeModel ? "?include_model=true" : ""}`, {
4345
4357
  method: "GET",
@@ -4419,6 +4431,251 @@ export class Client {
4419
4431
  });
4420
4432
  return url;
4421
4433
  }
4434
+ /**
4435
+ * Check if an agent repo exists.
4436
+ */
4437
+ async agentExists(identifier) {
4438
+ const [owner, name] = parseHubIdentifier(identifier);
4439
+ return this._repoExists(owner, name);
4440
+ }
4441
+ /**
4442
+ * Check if a skill repo exists.
4443
+ */
4444
+ async skillExists(identifier) {
4445
+ const [owner, name] = parseHubIdentifier(identifier);
4446
+ return this._repoExists(owner, name);
4447
+ }
4448
+ /**
4449
+ * Pull an agent directory from Hub.
4450
+ * @param identifier The identifier (owner/name[:version]).
4451
+ * @param options.version Commit hash or tag; overrides identifier's version.
4452
+ */
4453
+ async pullAgent(identifier, options) {
4454
+ return (await this._pullDirectory(identifier, "agent", options?.version));
4455
+ }
4456
+ /**
4457
+ * Pull a skill directory from Hub.
4458
+ */
4459
+ async pullSkill(identifier, options) {
4460
+ return (await this._pullDirectory(identifier, "skill", options?.version));
4461
+ }
4462
+ /**
4463
+ * Push an agent to Hub. Creates the repo if missing, patches metadata if
4464
+ * provided, then commits the given files.
4465
+ * @returns The URL of the resulting commit.
4466
+ */
4467
+ async pushAgent(identifier, options) {
4468
+ return this._pushDirectory(identifier, "agent", options);
4469
+ }
4470
+ /**
4471
+ * Push a skill to Hub.
4472
+ */
4473
+ async pushSkill(identifier, options) {
4474
+ return this._pushDirectory(identifier, "skill", options);
4475
+ }
4476
+ /**
4477
+ * Delete an agent and all its owned child file repos.
4478
+ */
4479
+ async deleteAgent(identifier) {
4480
+ return this._deleteDirectory(identifier);
4481
+ }
4482
+ /**
4483
+ * Delete a skill and all its owned child file repos.
4484
+ */
4485
+ async deleteSkill(identifier) {
4486
+ return this._deleteDirectory(identifier);
4487
+ }
4488
+ /**
4489
+ * List agent repos. Yields one at a time, auto-paginating.
4490
+ */
4491
+ async *listAgents(options) {
4492
+ yield* this._listReposByType("agent", options);
4493
+ }
4494
+ /**
4495
+ * List skill repos. Yields one at a time, auto-paginating.
4496
+ */
4497
+ async *listSkills(options) {
4498
+ yield* this._listReposByType("skill", options);
4499
+ }
4500
+ async *_listReposByType(repoType, options) {
4501
+ const params = new URLSearchParams();
4502
+ params.append("repo_type", repoType);
4503
+ params.append("is_archived", (!!options?.isArchived).toString());
4504
+ if (options?.isPublic !== undefined) {
4505
+ params.append("is_public", options.isPublic.toString());
4506
+ }
4507
+ if (options?.query) {
4508
+ params.append("query", options.query);
4509
+ }
4510
+ for await (const repos of this._getPaginated("/repos", params, (res) => res.repos)) {
4511
+ yield* repos;
4512
+ }
4513
+ }
4514
+ async _pullDirectory(identifier, repoType, version) {
4515
+ const [owner, name, parsedVersion] = parseHubIdentifier(identifier);
4516
+ const resolvedVersion = version ?? (parsedVersion !== "latest" ? parsedVersion : undefined);
4517
+ const url = new URL(`${this.apiUrl}/v1/platform/hub/repos/${owner}/${name}/directories`);
4518
+ url.searchParams.set("repo_type", repoType);
4519
+ if (resolvedVersion) {
4520
+ url.searchParams.set("commit", resolvedVersion);
4521
+ }
4522
+ const response = await this.caller.call(async () => {
4523
+ const res = await this._fetch(url.toString(), {
4524
+ method: "GET",
4525
+ headers: this._mergedHeaders,
4526
+ signal: AbortSignal.timeout(this.timeout_ms),
4527
+ ...this.fetchOptions,
4528
+ });
4529
+ await raiseForStatus(res, "pull directory");
4530
+ return res;
4531
+ });
4532
+ return (await response.json());
4533
+ }
4534
+ async _pushDirectory(identifier, repoType, options) {
4535
+ if (options.parentCommit !== undefined &&
4536
+ (options.parentCommit.length < 8 || options.parentCommit.length > 64)) {
4537
+ throw new Error("parent_commit must be 8-64 characters");
4538
+ }
4539
+ const [owner, name] = parseHubIdentifier(identifier);
4540
+ if (!(await this._currentTenantIsOwner(owner))) {
4541
+ throw await this._ownerConflictError(`push ${repoType}`, owner);
4542
+ }
4543
+ if (await this._repoExists(owner, name)) {
4544
+ if (options.description !== undefined ||
4545
+ options.readme !== undefined ||
4546
+ options.tags !== undefined ||
4547
+ options.isPublic !== undefined) {
4548
+ await this._updateRepoMetadata(owner, name, options);
4549
+ }
4550
+ }
4551
+ else {
4552
+ const REPO_HANDLE_PATTERN = /^[a-z][a-z0-9-_]*$/;
4553
+ if (!REPO_HANDLE_PATTERN.test(name)) {
4554
+ throw new Error(`Invalid repo_handle ${JSON.stringify(name)}: must match ${REPO_HANDLE_PATTERN}`);
4555
+ }
4556
+ await this._createRepo(name, repoType, options);
4557
+ }
4558
+ const body = { files: options.files };
4559
+ if (options.parentCommit) {
4560
+ body.parent_commit = options.parentCommit;
4561
+ }
4562
+ const response = await this.caller.call(async () => {
4563
+ const res = await this._fetch(`${this.apiUrl}/v1/platform/hub/repos/${owner}/${name}/directories/commits`, {
4564
+ method: "POST",
4565
+ headers: {
4566
+ ...this._mergedHeaders,
4567
+ "Content-Type": "application/json",
4568
+ },
4569
+ signal: AbortSignal.timeout(this.timeout_ms),
4570
+ ...this.fetchOptions,
4571
+ body: JSON.stringify(body),
4572
+ });
4573
+ await raiseForStatus(res, `push ${repoType}`);
4574
+ return res;
4575
+ });
4576
+ const data = (await response.json());
4577
+ const commitHash = data.commit.commit_hash;
4578
+ return `${this.getHostUrl()}/hub/${owner}/${name}:${commitHash.slice(0, 8)}`;
4579
+ }
4580
+ async _deleteDirectory(identifier) {
4581
+ const [owner, name] = parseHubIdentifier(identifier);
4582
+ if (!(await this._currentTenantIsOwner(owner))) {
4583
+ throw await this._ownerConflictError("delete", owner);
4584
+ }
4585
+ await this.caller.call(async () => {
4586
+ const res = await this._fetch(`${this.apiUrl}/v1/platform/hub/repos/${owner}/${name}/directories`, {
4587
+ method: "DELETE",
4588
+ headers: this._mergedHeaders,
4589
+ signal: AbortSignal.timeout(this.timeout_ms),
4590
+ ...this.fetchOptions,
4591
+ });
4592
+ await raiseForStatus(res, "delete directory");
4593
+ return res;
4594
+ });
4595
+ }
4596
+ async _repoExists(owner, name) {
4597
+ try {
4598
+ await this.caller.call(async () => {
4599
+ const res = await this._fetch(`${this.apiUrl}/repos/${owner}/${name}`, {
4600
+ method: "GET",
4601
+ headers: this._mergedHeaders,
4602
+ signal: AbortSignal.timeout(this.timeout_ms),
4603
+ ...this.fetchOptions,
4604
+ });
4605
+ await raiseForStatus(res, "check repo exists");
4606
+ return res;
4607
+ });
4608
+ return true;
4609
+ }
4610
+ catch (e) {
4611
+ if (isLangSmithNotFoundError(e)) {
4612
+ return false;
4613
+ }
4614
+ throw e;
4615
+ }
4616
+ }
4617
+ async _createRepo(name, repoType, options) {
4618
+ const body = {
4619
+ repo_handle: name,
4620
+ repo_type: repoType,
4621
+ is_public: !!options.isPublic,
4622
+ };
4623
+ if (options.description !== undefined)
4624
+ body.description = options.description;
4625
+ if (options.readme !== undefined)
4626
+ body.readme = options.readme;
4627
+ if (options.tags !== undefined)
4628
+ body.tags = options.tags;
4629
+ try {
4630
+ await this.caller.call(async () => {
4631
+ const res = await this._fetch(`${this.apiUrl}/repos/`, {
4632
+ method: "POST",
4633
+ headers: {
4634
+ ...this._mergedHeaders,
4635
+ "Content-Type": "application/json",
4636
+ },
4637
+ signal: AbortSignal.timeout(this.timeout_ms),
4638
+ ...this.fetchOptions,
4639
+ body: JSON.stringify(body),
4640
+ });
4641
+ await raiseForStatus(res, `create ${repoType}`);
4642
+ return res;
4643
+ });
4644
+ }
4645
+ catch (e) {
4646
+ if (isLangSmithConflictError(e)) {
4647
+ return;
4648
+ }
4649
+ throw e;
4650
+ }
4651
+ }
4652
+ async _updateRepoMetadata(owner, name, options) {
4653
+ const body = {};
4654
+ if (options.description !== undefined)
4655
+ body.description = options.description;
4656
+ if (options.readme !== undefined)
4657
+ body.readme = options.readme;
4658
+ if (options.tags !== undefined)
4659
+ body.tags = options.tags;
4660
+ if (options.isPublic !== undefined)
4661
+ body.is_public = options.isPublic;
4662
+ if (Object.keys(body).length === 0)
4663
+ return;
4664
+ await this.caller.call(async () => {
4665
+ const res = await this._fetch(`${this.apiUrl}/repos/${owner}/${name}`, {
4666
+ method: "PATCH",
4667
+ headers: {
4668
+ ...this._mergedHeaders,
4669
+ "Content-Type": "application/json",
4670
+ },
4671
+ signal: AbortSignal.timeout(this.timeout_ms),
4672
+ ...this.fetchOptions,
4673
+ body: JSON.stringify(body),
4674
+ });
4675
+ await raiseForStatus(res, "update repo metadata");
4676
+ return res;
4677
+ });
4678
+ }
4422
4679
  /**
4423
4680
  * Clone a public dataset to your own langsmith tenant.
4424
4681
  * This operation is idempotent. If you already have a dataset with the given name,
@@ -726,10 +726,7 @@ async function _evaluate(target, fields) {
726
726
  const standardFields = fields;
727
727
  const [experiment_, newRuns] = await _resolveExperiment(fields.experiment ?? null, runs, client);
728
728
  let manager = await new _ExperimentManager({
729
- data: Array.isArray(standardFields.data) ? undefined : standardFields.data,
730
- examples: Array.isArray(standardFields.data)
731
- ? standardFields.data
732
- : undefined,
729
+ data: standardFields.data,
733
730
  client,
734
731
  metadata: fields.metadata,
735
732
  experiment: experiment_ ?? fields.experimentPrefix,
@@ -719,10 +719,7 @@ async function _evaluate(target, fields) {
719
719
  const standardFields = fields;
720
720
  const [experiment_, newRuns] = await _resolveExperiment(fields.experiment ?? null, runs, client);
721
721
  let manager = await new _ExperimentManager({
722
- data: Array.isArray(standardFields.data) ? undefined : standardFields.data,
723
- examples: Array.isArray(standardFields.data)
724
- ? standardFields.data
725
- : undefined,
722
+ data: standardFields.data,
726
723
  client,
727
724
  metadata: fields.metadata,
728
725
  experiment: experiment_ ?? fields.experimentPrefix,
package/dist/index.cjs CHANGED
@@ -18,4 +18,4 @@ Object.defineProperty(exports, "PromptCache", { enumerable: true, get: function
18
18
  Object.defineProperty(exports, "configureGlobalPromptCache", { enumerable: true, get: function () { return index_js_1.configureGlobalPromptCache; } });
19
19
  Object.defineProperty(exports, "promptCacheSingleton", { enumerable: true, get: function () { return index_js_1.promptCacheSingleton; } });
20
20
  // Update using pnpm bump-version
21
- exports.__version__ = "0.5.22";
21
+ exports.__version__ = "0.5.23";
package/dist/index.d.ts CHANGED
@@ -5,4 +5,4 @@ export { overrideFetchImplementation } from "./singletons/fetch.js";
5
5
  export { getDefaultProjectName } from "./utils/project.js";
6
6
  export { uuid7, uuid7FromTime } from "./uuid.js";
7
7
  export { Cache, PromptCache, type CacheConfig, type CacheMetrics, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
8
- export declare const __version__ = "0.5.22";
8
+ export declare const __version__ = "0.5.23";
package/dist/index.js CHANGED
@@ -5,4 +5,4 @@ export { getDefaultProjectName } from "./utils/project.js";
5
5
  export { uuid7, uuid7FromTime } from "./uuid.js";
6
6
  export { Cache, PromptCache, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
7
7
  // Update using pnpm bump-version
8
- export const __version__ = "0.5.22";
8
+ export const __version__ = "0.5.23";
package/dist/schemas.d.ts CHANGED
@@ -435,6 +435,60 @@ export type PromptSortField = "num_downloads" | "num_views" | "updated_at" | "nu
435
435
  export interface LikePromptResponse {
436
436
  likes: number;
437
437
  }
438
+ export interface FileEntry {
439
+ type: "file";
440
+ content: string;
441
+ }
442
+ export interface AgentEntry {
443
+ type: "agent";
444
+ repo_handle: string;
445
+ commit_id?: string;
446
+ owner?: string;
447
+ commit_hash?: string;
448
+ }
449
+ export interface SkillEntry {
450
+ type: "skill";
451
+ repo_handle: string;
452
+ commit_id?: string;
453
+ owner?: string;
454
+ commit_hash?: string;
455
+ }
456
+ export type Entry = FileEntry | AgentEntry | SkillEntry;
457
+ /** The type of a non-prompt hub repo. */
458
+ export type HubRepoType = "agent" | "skill";
459
+ /**
460
+ * An agent pulled from hub.
461
+ */
462
+ export interface AgentContext {
463
+ /** The commit ID. */
464
+ commit_id: string;
465
+ /** The commit hash. */
466
+ commit_hash: string;
467
+ /** The files in the agent. */
468
+ files: Record<string, Entry>;
469
+ }
470
+ /**
471
+ * A skill pulled from hub.
472
+ */
473
+ export interface SkillContext {
474
+ /** The commit ID. */
475
+ commit_id: string;
476
+ /** The commit hash. */
477
+ commit_hash: string;
478
+ /** The files in the skill. */
479
+ files: Record<string, Entry>;
480
+ }
481
+ /** Response body for `POST /directories/commits`. */
482
+ export interface DirectoryCommitResponse {
483
+ commit: {
484
+ /** The commit ID. */
485
+ id: string;
486
+ /** The commit hash. */
487
+ commit_hash: string;
488
+ /** When the commit was created. */
489
+ created_at: string;
490
+ };
491
+ }
438
492
  export interface LangSmithSettings {
439
493
  id: string;
440
494
  display_name: string;
@@ -4,6 +4,7 @@ exports.ConflictingEndpointsError = exports.LangSmithNotFoundError = exports.Lan
4
4
  exports.getInvalidPromptIdentifierMsg = getInvalidPromptIdentifierMsg;
5
5
  exports.printErrorStackTrace = printErrorStackTrace;
6
6
  exports.isLangSmithNotFoundError = isLangSmithNotFoundError;
7
+ exports.isLangSmithConflictError = isLangSmithConflictError;
7
8
  exports.raiseForStatus = raiseForStatus;
8
9
  exports.isConflictingEndpointsError = isConflictingEndpointsError;
9
10
  /**
@@ -115,6 +116,12 @@ function isLangSmithNotFoundError(error) {
115
116
  "name" in error &&
116
117
  error?.name === "LangSmithNotFoundError");
117
118
  }
119
+ function isLangSmithConflictError(error) {
120
+ return (error != null &&
121
+ typeof error === "object" &&
122
+ "name" in error &&
123
+ error?.name === "LangSmithConflictError");
124
+ }
118
125
  /**
119
126
  * Throws an appropriate error based on the response status and body.
120
127
  *
@@ -55,6 +55,7 @@ export declare class LangSmithNotFoundError extends Error {
55
55
  constructor(message: string);
56
56
  }
57
57
  export declare function isLangSmithNotFoundError(error: unknown): error is LangSmithNotFoundError;
58
+ export declare function isLangSmithConflictError(error: unknown): error is LangSmithConflictError;
58
59
  /**
59
60
  * Throws an appropriate error based on the response status and body.
60
61
  *
@@ -105,6 +105,12 @@ export function isLangSmithNotFoundError(error) {
105
105
  "name" in error &&
106
106
  error?.name === "LangSmithNotFoundError");
107
107
  }
108
+ export function isLangSmithConflictError(error) {
109
+ return (error != null &&
110
+ typeof error === "object" &&
111
+ "name" in error &&
112
+ error?.name === "LangSmithConflictError");
113
+ }
108
114
  /**
109
115
  * Throws an appropriate error based on the response status and body.
110
116
  *