@langchain/langgraph-sdk 0.0.57 → 0.0.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
@@ -446,6 +446,29 @@ class ThreadsClient extends BaseClient {
446
446
  },
447
447
  });
448
448
  }
449
+ /**
450
+ * Create a new thread from a batch states.
451
+ */
452
+ async bulkUpdateState(supersteps, options) {
453
+ return this.fetch("/threads/state/batch", {
454
+ method: "POST",
455
+ json: {
456
+ supersteps: supersteps.map((s) => ({
457
+ updates: s.updates.map((u) => ({
458
+ values: u.values,
459
+ command: u.command,
460
+ as_node: u.asNode,
461
+ })),
462
+ })),
463
+ thread_id: options?.threadId,
464
+ metadata: {
465
+ ...options?.metadata,
466
+ graph_id: options?.graphId,
467
+ },
468
+ if_exists: options?.ifExists,
469
+ },
470
+ });
471
+ }
449
472
  /**
450
473
  * Patch the metadata of a thread.
451
474
  *
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Assistant, AssistantGraph, CancelAction, Config, DefaultValues, GraphSchema, Metadata, Run, RunStatus, Thread, ThreadState, Cron, AssistantVersion, Subgraphs, Checkpoint, SearchItemsResponse, ListNamespaceResponse, Item, ThreadStatus, CronCreateResponse, CronCreateForThreadResponse } from "./schema.js";
2
2
  import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
3
- import type { RunsCreatePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent, CronsCreatePayload, OnConflictBehavior } from "./types.js";
3
+ import type { RunsCreatePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent, CronsCreatePayload, OnConflictBehavior, Command } from "./types.js";
4
4
  import type { TypedAsyncGenerator, StreamMode } from "./types.stream.js";
5
5
  /**
6
6
  * Get the API key from the environment.
@@ -262,6 +262,21 @@ export declare class ThreadsClient<TStateType = DefaultValues, TUpdateType = TSt
262
262
  checkpointId?: string;
263
263
  asNode?: string;
264
264
  }): Promise<Pick<Config, "configurable">>;
265
+ /**
266
+ * Create a new thread from a batch states.
267
+ */
268
+ bulkUpdateState(supersteps: Array<{
269
+ updates: Array<{
270
+ values: unknown;
271
+ command?: Command;
272
+ asNode: string;
273
+ }>;
274
+ }>, options?: {
275
+ graphId?: string;
276
+ threadId?: string;
277
+ metadata?: Metadata;
278
+ ifExists?: OnConflictBehavior;
279
+ }): Promise<Thread<TStateType>>;
265
280
  /**
266
281
  * Patch the metadata of a thread.
267
282
  *
package/dist/client.js CHANGED
@@ -440,6 +440,29 @@ export class ThreadsClient extends BaseClient {
440
440
  },
441
441
  });
442
442
  }
443
+ /**
444
+ * Create a new thread from a batch states.
445
+ */
446
+ async bulkUpdateState(supersteps, options) {
447
+ return this.fetch("/threads/state/batch", {
448
+ method: "POST",
449
+ json: {
450
+ supersteps: supersteps.map((s) => ({
451
+ updates: s.updates.map((u) => ({
452
+ values: u.values,
453
+ command: u.command,
454
+ as_node: u.asNode,
455
+ })),
456
+ })),
457
+ thread_id: options?.threadId,
458
+ metadata: {
459
+ ...options?.metadata,
460
+ graph_id: options?.graphId,
461
+ },
462
+ if_exists: options?.ifExists,
463
+ },
464
+ });
465
+ }
443
466
  /**
444
467
  * Patch the metadata of a thread.
445
468
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-sdk",
3
- "version": "0.0.57",
3
+ "version": "0.0.59",
4
4
  "description": "Client library for interacting with the LangGraph API",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@1.22.19",