@langchain/langgraph-sdk 0.0.1-rc.8 → 0.0.1-rc.9
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.d.mts +4 -5
- package/dist/client.mjs +11 -20
- package/dist/schema.d.ts +2 -2
- package/package.json +1 -1
package/dist/client.d.mts
CHANGED
|
@@ -138,17 +138,16 @@ declare class ThreadsClient extends BaseClient {
|
|
|
138
138
|
* @param threadId ID of the thread.
|
|
139
139
|
* @returns Thread state.
|
|
140
140
|
*/
|
|
141
|
-
getState<ValuesType = DefaultValues>(threadId: string): Promise<ThreadState<ValuesType>>;
|
|
141
|
+
getState<ValuesType = DefaultValues>(threadId: string, checkpointId?: string): Promise<ThreadState<ValuesType>>;
|
|
142
142
|
/**
|
|
143
143
|
* Add state to a thread.
|
|
144
144
|
*
|
|
145
|
-
* @param
|
|
146
|
-
* @param values The state update
|
|
147
|
-
* @param options Additional options.
|
|
145
|
+
* @param threadId The ID of the thread.
|
|
148
146
|
* @returns
|
|
149
147
|
*/
|
|
150
|
-
updateState<ValuesType = DefaultValues>(
|
|
148
|
+
updateState<ValuesType = DefaultValues>(threadId: string, options: {
|
|
151
149
|
values: ValuesType;
|
|
150
|
+
checkpointId?: string;
|
|
152
151
|
asNode?: string;
|
|
153
152
|
}): Promise<void>;
|
|
154
153
|
/**
|
package/dist/client.mjs
CHANGED
|
@@ -198,34 +198,25 @@ class ThreadsClient extends BaseClient {
|
|
|
198
198
|
* @param threadId ID of the thread.
|
|
199
199
|
* @returns Thread state.
|
|
200
200
|
*/
|
|
201
|
-
async getState(threadId) {
|
|
202
|
-
return this.fetch(
|
|
201
|
+
async getState(threadId, checkpointId) {
|
|
202
|
+
return this.fetch(checkpointId != null
|
|
203
|
+
? `/threads/${threadId}/state/${checkpointId}`
|
|
204
|
+
: `/threads/${threadId}/state`);
|
|
203
205
|
}
|
|
204
206
|
/**
|
|
205
207
|
* Add state to a thread.
|
|
206
208
|
*
|
|
207
|
-
* @param
|
|
208
|
-
* @param values The state update
|
|
209
|
-
* @param options Additional options.
|
|
209
|
+
* @param threadId The ID of the thread.
|
|
210
210
|
* @returns
|
|
211
211
|
*/
|
|
212
|
-
async updateState(
|
|
213
|
-
let config = undefined;
|
|
214
|
-
let threadId;
|
|
215
|
-
if (typeof threadIdOrConfig !== "string") {
|
|
216
|
-
config = threadIdOrConfig;
|
|
217
|
-
if (typeof config.configurable?.thread_id !== "string") {
|
|
218
|
-
throw new Error("Thread ID is required when updating state with a config.");
|
|
219
|
-
}
|
|
220
|
-
threadId = config.configurable.thread_id;
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
config = undefined;
|
|
224
|
-
threadId = threadIdOrConfig;
|
|
225
|
-
}
|
|
212
|
+
async updateState(threadId, options) {
|
|
226
213
|
return this.fetch(`/threads/${threadId}/state`, {
|
|
227
214
|
method: "POST",
|
|
228
|
-
json: {
|
|
215
|
+
json: {
|
|
216
|
+
values: options.values,
|
|
217
|
+
checkpoint_id: options.checkpointId,
|
|
218
|
+
as_node: options?.asNode,
|
|
219
|
+
},
|
|
229
220
|
});
|
|
230
221
|
}
|
|
231
222
|
/**
|
package/dist/schema.d.ts
CHANGED
|
@@ -60,10 +60,10 @@ export type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;
|
|
|
60
60
|
export interface ThreadState<ValuesType = DefaultValues> {
|
|
61
61
|
values: ValuesType;
|
|
62
62
|
next: string[];
|
|
63
|
-
|
|
63
|
+
checkpoint_id: string;
|
|
64
64
|
metadata: Metadata;
|
|
65
65
|
created_at: Optional<string>;
|
|
66
|
-
|
|
66
|
+
parent_checkpoint_id: Optional<string>;
|
|
67
67
|
}
|
|
68
68
|
export interface Run {
|
|
69
69
|
run_id: string;
|