@langchain/langgraph-sdk 0.0.109 → 0.0.111

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @langchain/langgraph-sdk
2
2
 
3
+ ## 0.0.111
4
+
5
+ ### Patch Changes
6
+
7
+ - b5f14d0: Add methods to connect with the /count endpoints
8
+
3
9
  ## 0.0.109
4
10
 
5
11
  ### Patch Changes
package/dist/client.cjs CHANGED
@@ -304,6 +304,22 @@ class CronsClient extends BaseClient {
304
304
  },
305
305
  });
306
306
  }
307
+ /**
308
+ * Count cron jobs matching filters.
309
+ *
310
+ * @param query.assistantId Assistant ID to filter by.
311
+ * @param query.threadId Thread ID to filter by.
312
+ * @returns Number of cron jobs matching the criteria.
313
+ */
314
+ async count(query) {
315
+ return this.fetch(`/runs/crons/count`, {
316
+ method: "POST",
317
+ json: {
318
+ assistant_id: query?.assistantId ?? undefined,
319
+ thread_id: query?.threadId ?? undefined,
320
+ },
321
+ });
322
+ }
307
323
  }
308
324
  exports.CronsClient = CronsClient;
309
325
  class AssistantsClient extends BaseClient {
@@ -418,6 +434,22 @@ class AssistantsClient extends BaseClient {
418
434
  },
419
435
  });
420
436
  }
437
+ /**
438
+ * Count assistants matching filters.
439
+ *
440
+ * @param query.metadata Metadata to filter by. Exact match for each key/value.
441
+ * @param query.graphId Optional graph id to filter by.
442
+ * @returns Number of assistants matching the criteria.
443
+ */
444
+ async count(query) {
445
+ return this.fetch(`/assistants/count`, {
446
+ method: "POST",
447
+ json: {
448
+ metadata: query?.metadata ?? undefined,
449
+ graph_id: query?.graphId ?? undefined,
450
+ },
451
+ });
452
+ }
421
453
  /**
422
454
  * List all versions of an assistant.
423
455
  *
@@ -538,6 +570,24 @@ class ThreadsClient extends BaseClient {
538
570
  },
539
571
  });
540
572
  }
573
+ /**
574
+ * Count threads matching filters.
575
+ *
576
+ * @param query.metadata Thread metadata to filter on.
577
+ * @param query.values State values to filter on.
578
+ * @param query.status Thread status to filter on.
579
+ * @returns Number of threads matching the criteria.
580
+ */
581
+ async count(query) {
582
+ return this.fetch(`/threads/count`, {
583
+ method: "POST",
584
+ json: {
585
+ metadata: query?.metadata ?? undefined,
586
+ values: query?.values ?? undefined,
587
+ status: query?.status ?? undefined,
588
+ },
589
+ });
590
+ }
541
591
  /**
542
592
  * Get state for a thread.
543
593
  *
package/dist/client.d.ts CHANGED
@@ -87,6 +87,17 @@ export declare class CronsClient extends BaseClient {
87
87
  sortOrder?: SortOrder;
88
88
  select?: CronSelectField[];
89
89
  }): Promise<Cron[]>;
90
+ /**
91
+ * Count cron jobs matching filters.
92
+ *
93
+ * @param query.assistantId Assistant ID to filter by.
94
+ * @param query.threadId Thread ID to filter by.
95
+ * @returns Number of cron jobs matching the criteria.
96
+ */
97
+ count(query?: {
98
+ assistantId?: string;
99
+ threadId?: string;
100
+ }): Promise<number>;
90
101
  }
91
102
  export declare class AssistantsClient extends BaseClient {
92
103
  /**
@@ -171,6 +182,17 @@ export declare class AssistantsClient extends BaseClient {
171
182
  sortOrder?: SortOrder;
172
183
  select?: AssistantSelectField[];
173
184
  }): Promise<Assistant[]>;
185
+ /**
186
+ * Count assistants matching filters.
187
+ *
188
+ * @param query.metadata Metadata to filter by. Exact match for each key/value.
189
+ * @param query.graphId Optional graph id to filter by.
190
+ * @returns Number of assistants matching the criteria.
191
+ */
192
+ count(query?: {
193
+ metadata?: Metadata;
194
+ graphId?: string;
195
+ }): Promise<number>;
174
196
  /**
175
197
  * List all versions of an assistant.
176
198
  *
@@ -299,6 +321,19 @@ export declare class ThreadsClient<TStateType = DefaultValues, TUpdateType = TSt
299
321
  sortOrder?: SortOrder;
300
322
  select?: ThreadSelectField[];
301
323
  }): Promise<Thread<ValuesType>[]>;
324
+ /**
325
+ * Count threads matching filters.
326
+ *
327
+ * @param query.metadata Thread metadata to filter on.
328
+ * @param query.values State values to filter on.
329
+ * @param query.status Thread status to filter on.
330
+ * @returns Number of threads matching the criteria.
331
+ */
332
+ count<ValuesType = TStateType>(query?: {
333
+ metadata?: Metadata;
334
+ values?: ValuesType;
335
+ status?: ThreadStatus;
336
+ }): Promise<number>;
302
337
  /**
303
338
  * Get state for a thread.
304
339
  *
package/dist/client.js CHANGED
@@ -299,6 +299,22 @@ export class CronsClient extends BaseClient {
299
299
  },
300
300
  });
301
301
  }
302
+ /**
303
+ * Count cron jobs matching filters.
304
+ *
305
+ * @param query.assistantId Assistant ID to filter by.
306
+ * @param query.threadId Thread ID to filter by.
307
+ * @returns Number of cron jobs matching the criteria.
308
+ */
309
+ async count(query) {
310
+ return this.fetch(`/runs/crons/count`, {
311
+ method: "POST",
312
+ json: {
313
+ assistant_id: query?.assistantId ?? undefined,
314
+ thread_id: query?.threadId ?? undefined,
315
+ },
316
+ });
317
+ }
302
318
  }
303
319
  export class AssistantsClient extends BaseClient {
304
320
  /**
@@ -412,6 +428,22 @@ export class AssistantsClient extends BaseClient {
412
428
  },
413
429
  });
414
430
  }
431
+ /**
432
+ * Count assistants matching filters.
433
+ *
434
+ * @param query.metadata Metadata to filter by. Exact match for each key/value.
435
+ * @param query.graphId Optional graph id to filter by.
436
+ * @returns Number of assistants matching the criteria.
437
+ */
438
+ async count(query) {
439
+ return this.fetch(`/assistants/count`, {
440
+ method: "POST",
441
+ json: {
442
+ metadata: query?.metadata ?? undefined,
443
+ graph_id: query?.graphId ?? undefined,
444
+ },
445
+ });
446
+ }
415
447
  /**
416
448
  * List all versions of an assistant.
417
449
  *
@@ -531,6 +563,24 @@ export class ThreadsClient extends BaseClient {
531
563
  },
532
564
  });
533
565
  }
566
+ /**
567
+ * Count threads matching filters.
568
+ *
569
+ * @param query.metadata Thread metadata to filter on.
570
+ * @param query.values State values to filter on.
571
+ * @param query.status Thread status to filter on.
572
+ * @returns Number of threads matching the criteria.
573
+ */
574
+ async count(query) {
575
+ return this.fetch(`/threads/count`, {
576
+ method: "POST",
577
+ json: {
578
+ metadata: query?.metadata ?? undefined,
579
+ values: query?.values ?? undefined,
580
+ status: query?.status ?? undefined,
581
+ },
582
+ });
583
+ }
534
584
  /**
535
585
  * Get state for a thread.
536
586
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-sdk",
3
- "version": "0.0.109",
3
+ "version": "0.0.111",
4
4
  "description": "Client library for interacting with the LangGraph API",
5
5
  "type": "module",
6
6
  "scripts": {