@langchain/langgraph-sdk 0.0.47 → 0.0.49
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 +71 -5
- package/dist/client.d.ts +66 -4
- package/dist/client.js +71 -5
- package/dist/index.d.ts +1 -1
- package/dist/schema.d.ts +2 -2
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -726,9 +726,21 @@ class StoreClient extends BaseClient {
|
|
|
726
726
|
* @param namespace A list of strings representing the namespace path.
|
|
727
727
|
* @param key The unique identifier for the item within the namespace.
|
|
728
728
|
* @param value A dictionary containing the item's data.
|
|
729
|
+
* @param options.index Controls search indexing - null (use defaults), false (disable), or list of field paths to index.
|
|
730
|
+
* @param options.ttl Optional time-to-live in minutes for the item, or null for no expiration.
|
|
729
731
|
* @returns Promise<void>
|
|
730
|
-
|
|
731
|
-
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* ```typescript
|
|
735
|
+
* await client.store.putItem(
|
|
736
|
+
* ["documents", "user123"],
|
|
737
|
+
* "item456",
|
|
738
|
+
* { title: "My Document", content: "Hello World" },
|
|
739
|
+
* { ttl: 60 } // expires in 60 minutes
|
|
740
|
+
* );
|
|
741
|
+
* ```
|
|
742
|
+
*/
|
|
743
|
+
async putItem(namespace, key, value, options) {
|
|
732
744
|
namespace.forEach((label) => {
|
|
733
745
|
if (label.includes(".")) {
|
|
734
746
|
throw new Error(`Invalid namespace label '${label}'. Namespace labels cannot contain periods ('.')`);
|
|
@@ -738,6 +750,8 @@ class StoreClient extends BaseClient {
|
|
|
738
750
|
namespace,
|
|
739
751
|
key,
|
|
740
752
|
value,
|
|
753
|
+
index: options?.index,
|
|
754
|
+
ttl: options?.ttl,
|
|
741
755
|
};
|
|
742
756
|
return this.fetch("/store/items", {
|
|
743
757
|
method: "PUT",
|
|
@@ -749,16 +763,41 @@ class StoreClient extends BaseClient {
|
|
|
749
763
|
*
|
|
750
764
|
* @param namespace A list of strings representing the namespace path.
|
|
751
765
|
* @param key The unique identifier for the item.
|
|
766
|
+
* @param options.refreshTtl Whether to refresh the TTL on this read operation. If null, uses the store's default behavior.
|
|
752
767
|
* @returns Promise<Item>
|
|
753
|
-
|
|
754
|
-
|
|
768
|
+
*
|
|
769
|
+
* @example
|
|
770
|
+
* ```typescript
|
|
771
|
+
* const item = await client.store.getItem(
|
|
772
|
+
* ["documents", "user123"],
|
|
773
|
+
* "item456",
|
|
774
|
+
* { refreshTtl: true }
|
|
775
|
+
* );
|
|
776
|
+
* console.log(item);
|
|
777
|
+
* // {
|
|
778
|
+
* // namespace: ["documents", "user123"],
|
|
779
|
+
* // key: "item456",
|
|
780
|
+
* // value: { title: "My Document", content: "Hello World" },
|
|
781
|
+
* // createdAt: "2024-07-30T12:00:00Z",
|
|
782
|
+
* // updatedAt: "2024-07-30T12:00:00Z"
|
|
783
|
+
* // }
|
|
784
|
+
* ```
|
|
785
|
+
*/
|
|
786
|
+
async getItem(namespace, key, options) {
|
|
755
787
|
namespace.forEach((label) => {
|
|
756
788
|
if (label.includes(".")) {
|
|
757
789
|
throw new Error(`Invalid namespace label '${label}'. Namespace labels cannot contain periods ('.')`);
|
|
758
790
|
}
|
|
759
791
|
});
|
|
792
|
+
const params = {
|
|
793
|
+
namespace: namespace.join("."),
|
|
794
|
+
key,
|
|
795
|
+
};
|
|
796
|
+
if (options?.refreshTtl !== undefined) {
|
|
797
|
+
params.refresh_ttl = options.refreshTtl;
|
|
798
|
+
}
|
|
760
799
|
const response = await this.fetch("/store/items", {
|
|
761
|
-
params
|
|
800
|
+
params,
|
|
762
801
|
});
|
|
763
802
|
return response
|
|
764
803
|
? {
|
|
@@ -794,7 +833,33 @@ class StoreClient extends BaseClient {
|
|
|
794
833
|
* @param options.limit Maximum number of items to return (default is 10).
|
|
795
834
|
* @param options.offset Number of items to skip before returning results (default is 0).
|
|
796
835
|
* @param options.query Optional search query.
|
|
836
|
+
* @param options.refreshTtl Whether to refresh the TTL on items returned by this search. If null, uses the store's default behavior.
|
|
797
837
|
* @returns Promise<SearchItemsResponse>
|
|
838
|
+
*
|
|
839
|
+
* @example
|
|
840
|
+
* ```typescript
|
|
841
|
+
* const results = await client.store.searchItems(
|
|
842
|
+
* ["documents"],
|
|
843
|
+
* {
|
|
844
|
+
* filter: { author: "John Doe" },
|
|
845
|
+
* limit: 5,
|
|
846
|
+
* refreshTtl: true
|
|
847
|
+
* }
|
|
848
|
+
* );
|
|
849
|
+
* console.log(results);
|
|
850
|
+
* // {
|
|
851
|
+
* // items: [
|
|
852
|
+
* // {
|
|
853
|
+
* // namespace: ["documents", "user123"],
|
|
854
|
+
* // key: "item789",
|
|
855
|
+
* // value: { title: "Another Document", author: "John Doe" },
|
|
856
|
+
* // createdAt: "2024-07-30T12:00:00Z",
|
|
857
|
+
* // updatedAt: "2024-07-30T12:00:00Z"
|
|
858
|
+
* // },
|
|
859
|
+
* // // ... additional items ...
|
|
860
|
+
* // ]
|
|
861
|
+
* // }
|
|
862
|
+
* ```
|
|
798
863
|
*/
|
|
799
864
|
async searchItems(namespacePrefix, options) {
|
|
800
865
|
const payload = {
|
|
@@ -803,6 +868,7 @@ class StoreClient extends BaseClient {
|
|
|
803
868
|
limit: options?.limit ?? 10,
|
|
804
869
|
offset: options?.offset ?? 0,
|
|
805
870
|
query: options?.query,
|
|
871
|
+
refresh_ttl: options?.refreshTtl,
|
|
806
872
|
};
|
|
807
873
|
const response = await this.fetch("/store/items/search", {
|
|
808
874
|
method: "POST",
|
package/dist/client.d.ts
CHANGED
|
@@ -389,17 +389,52 @@ export declare class StoreClient extends BaseClient {
|
|
|
389
389
|
* @param namespace A list of strings representing the namespace path.
|
|
390
390
|
* @param key The unique identifier for the item within the namespace.
|
|
391
391
|
* @param value A dictionary containing the item's data.
|
|
392
|
+
* @param options.index Controls search indexing - null (use defaults), false (disable), or list of field paths to index.
|
|
393
|
+
* @param options.ttl Optional time-to-live in minutes for the item, or null for no expiration.
|
|
392
394
|
* @returns Promise<void>
|
|
393
|
-
|
|
394
|
-
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```typescript
|
|
398
|
+
* await client.store.putItem(
|
|
399
|
+
* ["documents", "user123"],
|
|
400
|
+
* "item456",
|
|
401
|
+
* { title: "My Document", content: "Hello World" },
|
|
402
|
+
* { ttl: 60 } // expires in 60 minutes
|
|
403
|
+
* );
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
putItem(namespace: string[], key: string, value: Record<string, any>, options?: {
|
|
407
|
+
index?: false | string[] | null;
|
|
408
|
+
ttl?: number | null;
|
|
409
|
+
}): Promise<void>;
|
|
395
410
|
/**
|
|
396
411
|
* Retrieve a single item.
|
|
397
412
|
*
|
|
398
413
|
* @param namespace A list of strings representing the namespace path.
|
|
399
414
|
* @param key The unique identifier for the item.
|
|
415
|
+
* @param options.refreshTtl Whether to refresh the TTL on this read operation. If null, uses the store's default behavior.
|
|
400
416
|
* @returns Promise<Item>
|
|
401
|
-
|
|
402
|
-
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```typescript
|
|
420
|
+
* const item = await client.store.getItem(
|
|
421
|
+
* ["documents", "user123"],
|
|
422
|
+
* "item456",
|
|
423
|
+
* { refreshTtl: true }
|
|
424
|
+
* );
|
|
425
|
+
* console.log(item);
|
|
426
|
+
* // {
|
|
427
|
+
* // namespace: ["documents", "user123"],
|
|
428
|
+
* // key: "item456",
|
|
429
|
+
* // value: { title: "My Document", content: "Hello World" },
|
|
430
|
+
* // createdAt: "2024-07-30T12:00:00Z",
|
|
431
|
+
* // updatedAt: "2024-07-30T12:00:00Z"
|
|
432
|
+
* // }
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
getItem(namespace: string[], key: string, options?: {
|
|
436
|
+
refreshTtl?: boolean | null;
|
|
437
|
+
}): Promise<Item | null>;
|
|
403
438
|
/**
|
|
404
439
|
* Delete an item.
|
|
405
440
|
*
|
|
@@ -416,13 +451,40 @@ export declare class StoreClient extends BaseClient {
|
|
|
416
451
|
* @param options.limit Maximum number of items to return (default is 10).
|
|
417
452
|
* @param options.offset Number of items to skip before returning results (default is 0).
|
|
418
453
|
* @param options.query Optional search query.
|
|
454
|
+
* @param options.refreshTtl Whether to refresh the TTL on items returned by this search. If null, uses the store's default behavior.
|
|
419
455
|
* @returns Promise<SearchItemsResponse>
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* ```typescript
|
|
459
|
+
* const results = await client.store.searchItems(
|
|
460
|
+
* ["documents"],
|
|
461
|
+
* {
|
|
462
|
+
* filter: { author: "John Doe" },
|
|
463
|
+
* limit: 5,
|
|
464
|
+
* refreshTtl: true
|
|
465
|
+
* }
|
|
466
|
+
* );
|
|
467
|
+
* console.log(results);
|
|
468
|
+
* // {
|
|
469
|
+
* // items: [
|
|
470
|
+
* // {
|
|
471
|
+
* // namespace: ["documents", "user123"],
|
|
472
|
+
* // key: "item789",
|
|
473
|
+
* // value: { title: "Another Document", author: "John Doe" },
|
|
474
|
+
* // createdAt: "2024-07-30T12:00:00Z",
|
|
475
|
+
* // updatedAt: "2024-07-30T12:00:00Z"
|
|
476
|
+
* // },
|
|
477
|
+
* // // ... additional items ...
|
|
478
|
+
* // ]
|
|
479
|
+
* // }
|
|
480
|
+
* ```
|
|
420
481
|
*/
|
|
421
482
|
searchItems(namespacePrefix: string[], options?: {
|
|
422
483
|
filter?: Record<string, any>;
|
|
423
484
|
limit?: number;
|
|
424
485
|
offset?: number;
|
|
425
486
|
query?: string;
|
|
487
|
+
refreshTtl?: boolean | null;
|
|
426
488
|
}): Promise<SearchItemsResponse>;
|
|
427
489
|
/**
|
|
428
490
|
* List namespaces with optional match conditions.
|
package/dist/client.js
CHANGED
|
@@ -718,9 +718,21 @@ export class StoreClient extends BaseClient {
|
|
|
718
718
|
* @param namespace A list of strings representing the namespace path.
|
|
719
719
|
* @param key The unique identifier for the item within the namespace.
|
|
720
720
|
* @param value A dictionary containing the item's data.
|
|
721
|
+
* @param options.index Controls search indexing - null (use defaults), false (disable), or list of field paths to index.
|
|
722
|
+
* @param options.ttl Optional time-to-live in minutes for the item, or null for no expiration.
|
|
721
723
|
* @returns Promise<void>
|
|
722
|
-
|
|
723
|
-
|
|
724
|
+
*
|
|
725
|
+
* @example
|
|
726
|
+
* ```typescript
|
|
727
|
+
* await client.store.putItem(
|
|
728
|
+
* ["documents", "user123"],
|
|
729
|
+
* "item456",
|
|
730
|
+
* { title: "My Document", content: "Hello World" },
|
|
731
|
+
* { ttl: 60 } // expires in 60 minutes
|
|
732
|
+
* );
|
|
733
|
+
* ```
|
|
734
|
+
*/
|
|
735
|
+
async putItem(namespace, key, value, options) {
|
|
724
736
|
namespace.forEach((label) => {
|
|
725
737
|
if (label.includes(".")) {
|
|
726
738
|
throw new Error(`Invalid namespace label '${label}'. Namespace labels cannot contain periods ('.')`);
|
|
@@ -730,6 +742,8 @@ export class StoreClient extends BaseClient {
|
|
|
730
742
|
namespace,
|
|
731
743
|
key,
|
|
732
744
|
value,
|
|
745
|
+
index: options?.index,
|
|
746
|
+
ttl: options?.ttl,
|
|
733
747
|
};
|
|
734
748
|
return this.fetch("/store/items", {
|
|
735
749
|
method: "PUT",
|
|
@@ -741,16 +755,41 @@ export class StoreClient extends BaseClient {
|
|
|
741
755
|
*
|
|
742
756
|
* @param namespace A list of strings representing the namespace path.
|
|
743
757
|
* @param key The unique identifier for the item.
|
|
758
|
+
* @param options.refreshTtl Whether to refresh the TTL on this read operation. If null, uses the store's default behavior.
|
|
744
759
|
* @returns Promise<Item>
|
|
745
|
-
|
|
746
|
-
|
|
760
|
+
*
|
|
761
|
+
* @example
|
|
762
|
+
* ```typescript
|
|
763
|
+
* const item = await client.store.getItem(
|
|
764
|
+
* ["documents", "user123"],
|
|
765
|
+
* "item456",
|
|
766
|
+
* { refreshTtl: true }
|
|
767
|
+
* );
|
|
768
|
+
* console.log(item);
|
|
769
|
+
* // {
|
|
770
|
+
* // namespace: ["documents", "user123"],
|
|
771
|
+
* // key: "item456",
|
|
772
|
+
* // value: { title: "My Document", content: "Hello World" },
|
|
773
|
+
* // createdAt: "2024-07-30T12:00:00Z",
|
|
774
|
+
* // updatedAt: "2024-07-30T12:00:00Z"
|
|
775
|
+
* // }
|
|
776
|
+
* ```
|
|
777
|
+
*/
|
|
778
|
+
async getItem(namespace, key, options) {
|
|
747
779
|
namespace.forEach((label) => {
|
|
748
780
|
if (label.includes(".")) {
|
|
749
781
|
throw new Error(`Invalid namespace label '${label}'. Namespace labels cannot contain periods ('.')`);
|
|
750
782
|
}
|
|
751
783
|
});
|
|
784
|
+
const params = {
|
|
785
|
+
namespace: namespace.join("."),
|
|
786
|
+
key,
|
|
787
|
+
};
|
|
788
|
+
if (options?.refreshTtl !== undefined) {
|
|
789
|
+
params.refresh_ttl = options.refreshTtl;
|
|
790
|
+
}
|
|
752
791
|
const response = await this.fetch("/store/items", {
|
|
753
|
-
params
|
|
792
|
+
params,
|
|
754
793
|
});
|
|
755
794
|
return response
|
|
756
795
|
? {
|
|
@@ -786,7 +825,33 @@ export class StoreClient extends BaseClient {
|
|
|
786
825
|
* @param options.limit Maximum number of items to return (default is 10).
|
|
787
826
|
* @param options.offset Number of items to skip before returning results (default is 0).
|
|
788
827
|
* @param options.query Optional search query.
|
|
828
|
+
* @param options.refreshTtl Whether to refresh the TTL on items returned by this search. If null, uses the store's default behavior.
|
|
789
829
|
* @returns Promise<SearchItemsResponse>
|
|
830
|
+
*
|
|
831
|
+
* @example
|
|
832
|
+
* ```typescript
|
|
833
|
+
* const results = await client.store.searchItems(
|
|
834
|
+
* ["documents"],
|
|
835
|
+
* {
|
|
836
|
+
* filter: { author: "John Doe" },
|
|
837
|
+
* limit: 5,
|
|
838
|
+
* refreshTtl: true
|
|
839
|
+
* }
|
|
840
|
+
* );
|
|
841
|
+
* console.log(results);
|
|
842
|
+
* // {
|
|
843
|
+
* // items: [
|
|
844
|
+
* // {
|
|
845
|
+
* // namespace: ["documents", "user123"],
|
|
846
|
+
* // key: "item789",
|
|
847
|
+
* // value: { title: "Another Document", author: "John Doe" },
|
|
848
|
+
* // createdAt: "2024-07-30T12:00:00Z",
|
|
849
|
+
* // updatedAt: "2024-07-30T12:00:00Z"
|
|
850
|
+
* // },
|
|
851
|
+
* // // ... additional items ...
|
|
852
|
+
* // ]
|
|
853
|
+
* // }
|
|
854
|
+
* ```
|
|
790
855
|
*/
|
|
791
856
|
async searchItems(namespacePrefix, options) {
|
|
792
857
|
const payload = {
|
|
@@ -795,6 +860,7 @@ export class StoreClient extends BaseClient {
|
|
|
795
860
|
limit: options?.limit ?? 10,
|
|
796
861
|
offset: options?.offset ?? 0,
|
|
797
862
|
query: options?.query,
|
|
863
|
+
refresh_ttl: options?.refreshTtl,
|
|
798
864
|
};
|
|
799
865
|
const response = await this.fetch("/store/items/search", {
|
|
800
866
|
method: "POST",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Client } from "./client.js";
|
|
2
|
-
export type { Assistant, AssistantVersion, AssistantGraph, Config, DefaultValues, GraphSchema, Metadata, Run, Thread, ThreadTask, ThreadState, ThreadStatus, Cron, Checkpoint, Interrupt, ListNamespaceResponse, Item, SearchItem, SearchItemsResponse, CronCreateResponse, CronCreateForThreadResponse, } from "./schema.js";
|
|
2
|
+
export type { AssistantBase, Assistant, AssistantVersion, AssistantGraph, Config, DefaultValues, GraphSchema, Metadata, Run, Thread, ThreadTask, ThreadState, ThreadStatus, Cron, Checkpoint, Interrupt, ListNamespaceResponse, Item, SearchItem, SearchItemsResponse, CronCreateResponse, CronCreateForThreadResponse, } from "./schema.js";
|
|
3
3
|
export { overrideFetchImplementation } from "./singletons/fetch.js";
|
|
4
4
|
export type { OnConflictBehavior, Command } from "./types.js";
|
|
5
5
|
export type { StreamMode } from "./types.stream.js";
|
package/dist/schema.d.ts
CHANGED
|
@@ -77,14 +77,14 @@ export interface AssistantBase {
|
|
|
77
77
|
metadata: Metadata;
|
|
78
78
|
/** The version of the assistant. */
|
|
79
79
|
version: number;
|
|
80
|
+
/** The name of the assistant */
|
|
81
|
+
name: string;
|
|
80
82
|
}
|
|
81
83
|
export interface AssistantVersion extends AssistantBase {
|
|
82
84
|
}
|
|
83
85
|
export interface Assistant extends AssistantBase {
|
|
84
86
|
/** The last time the assistant was updated. */
|
|
85
87
|
updated_at: string;
|
|
86
|
-
/** The name of the assistant */
|
|
87
|
-
name: string;
|
|
88
88
|
}
|
|
89
89
|
export interface AssistantGraph {
|
|
90
90
|
nodes: Array<{
|