@langchain/langgraph-sdk 0.0.1 → 0.0.3
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 +8 -6
- package/dist/client.mjs +9 -5
- package/dist/schema.d.ts +11 -4
- package/dist/types.d.mts +1 -0
- package/package.json +1 -1
package/dist/client.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Assistant, AssistantGraph, Config, DefaultValues, GraphSchema, Metadata, Run, Thread, ThreadState, Cron } from "./schema.js";
|
|
2
2
|
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.mjs";
|
|
3
|
-
import { RunsCreatePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent, CronsCreatePayload } from "./types.mjs";
|
|
3
|
+
import { RunsCreatePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent, CronsCreatePayload, OnConflictBehavior } from "./types.mjs";
|
|
4
4
|
interface ClientConfig {
|
|
5
5
|
apiUrl?: string;
|
|
6
6
|
callerOptions?: AsyncCallerParams;
|
|
@@ -22,7 +22,7 @@ declare class BaseClient {
|
|
|
22
22
|
params?: Record<string, unknown>;
|
|
23
23
|
}): Promise<T>;
|
|
24
24
|
}
|
|
25
|
-
declare class CronsClient extends BaseClient {
|
|
25
|
+
export declare class CronsClient extends BaseClient {
|
|
26
26
|
/**
|
|
27
27
|
*
|
|
28
28
|
* @param threadId The ID of the thread.
|
|
@@ -55,7 +55,7 @@ declare class CronsClient extends BaseClient {
|
|
|
55
55
|
offset?: number;
|
|
56
56
|
}): Promise<Cron[]>;
|
|
57
57
|
}
|
|
58
|
-
declare class AssistantsClient extends BaseClient {
|
|
58
|
+
export declare class AssistantsClient extends BaseClient {
|
|
59
59
|
/**
|
|
60
60
|
* Get an assistant by ID.
|
|
61
61
|
*
|
|
@@ -114,7 +114,7 @@ declare class AssistantsClient extends BaseClient {
|
|
|
114
114
|
offset?: number;
|
|
115
115
|
}): Promise<Assistant[]>;
|
|
116
116
|
}
|
|
117
|
-
declare class ThreadsClient extends BaseClient {
|
|
117
|
+
export declare class ThreadsClient extends BaseClient {
|
|
118
118
|
/**
|
|
119
119
|
* Get a thread by ID.
|
|
120
120
|
*
|
|
@@ -133,6 +133,8 @@ declare class ThreadsClient extends BaseClient {
|
|
|
133
133
|
* Metadata for the thread.
|
|
134
134
|
*/
|
|
135
135
|
metadata?: Metadata;
|
|
136
|
+
threadId?: string;
|
|
137
|
+
ifExists?: OnConflictBehavior;
|
|
136
138
|
}): Promise<Thread>;
|
|
137
139
|
/**
|
|
138
140
|
* Update a thread.
|
|
@@ -191,7 +193,7 @@ declare class ThreadsClient extends BaseClient {
|
|
|
191
193
|
values: ValuesType;
|
|
192
194
|
checkpointId?: string;
|
|
193
195
|
asNode?: string;
|
|
194
|
-
}): Promise<
|
|
196
|
+
}): Promise<Pick<Config, "configurable">>;
|
|
195
197
|
/**
|
|
196
198
|
* Patch the metadata of a thread.
|
|
197
199
|
*
|
|
@@ -212,7 +214,7 @@ declare class ThreadsClient extends BaseClient {
|
|
|
212
214
|
metadata?: Metadata;
|
|
213
215
|
}): Promise<ThreadState<ValuesType>[]>;
|
|
214
216
|
}
|
|
215
|
-
declare class RunsClient extends BaseClient {
|
|
217
|
+
export declare class RunsClient extends BaseClient {
|
|
216
218
|
stream(threadId: null, assistantId: string, payload?: Omit<RunsStreamPayload, "multitaskStrategy">): AsyncGenerator<{
|
|
217
219
|
event: StreamEvent;
|
|
218
220
|
data: any;
|
package/dist/client.mjs
CHANGED
|
@@ -71,7 +71,7 @@ class BaseClient {
|
|
|
71
71
|
return response.json();
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
class CronsClient extends BaseClient {
|
|
74
|
+
export class CronsClient extends BaseClient {
|
|
75
75
|
/**
|
|
76
76
|
*
|
|
77
77
|
* @param threadId The ID of the thread.
|
|
@@ -143,7 +143,7 @@ class CronsClient extends BaseClient {
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
class AssistantsClient extends BaseClient {
|
|
146
|
+
export class AssistantsClient extends BaseClient {
|
|
147
147
|
/**
|
|
148
148
|
* Get an assistant by ID.
|
|
149
149
|
*
|
|
@@ -227,7 +227,7 @@ class AssistantsClient extends BaseClient {
|
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
class ThreadsClient extends BaseClient {
|
|
230
|
+
export class ThreadsClient extends BaseClient {
|
|
231
231
|
/**
|
|
232
232
|
* Get a thread by ID.
|
|
233
233
|
*
|
|
@@ -246,7 +246,11 @@ class ThreadsClient extends BaseClient {
|
|
|
246
246
|
async create(payload) {
|
|
247
247
|
return this.fetch(`/threads`, {
|
|
248
248
|
method: "POST",
|
|
249
|
-
json: {
|
|
249
|
+
json: {
|
|
250
|
+
metadata: payload?.metadata,
|
|
251
|
+
thread_id: payload?.threadId,
|
|
252
|
+
if_exists: payload?.ifExists,
|
|
253
|
+
},
|
|
250
254
|
});
|
|
251
255
|
}
|
|
252
256
|
/**
|
|
@@ -355,7 +359,7 @@ class ThreadsClient extends BaseClient {
|
|
|
355
359
|
});
|
|
356
360
|
}
|
|
357
361
|
}
|
|
358
|
-
class RunsClient extends BaseClient {
|
|
362
|
+
export class RunsClient extends BaseClient {
|
|
359
363
|
/**
|
|
360
364
|
* Create a run and stream the results.
|
|
361
365
|
*
|
package/dist/schema.d.ts
CHANGED
|
@@ -32,13 +32,20 @@ export interface GraphSchema {
|
|
|
32
32
|
*/
|
|
33
33
|
graph_id: string;
|
|
34
34
|
/**
|
|
35
|
-
* The schema for the graph state
|
|
35
|
+
* The schema for the graph state.
|
|
36
|
+
* Missing if unable to generate JSON schema from graph.
|
|
36
37
|
*/
|
|
37
|
-
|
|
38
|
+
input_schema?: JSONSchema7;
|
|
38
39
|
/**
|
|
39
|
-
* The schema for the graph
|
|
40
|
+
* The schema for the graph state.
|
|
41
|
+
* Missing if unable to generate JSON schema from graph.
|
|
40
42
|
*/
|
|
41
|
-
|
|
43
|
+
state_schema?: JSONSchema7;
|
|
44
|
+
/**
|
|
45
|
+
* The schema for the graph config.
|
|
46
|
+
* Missing if unable to generate JSON schema from graph.
|
|
47
|
+
*/
|
|
48
|
+
config_schema?: JSONSchema7;
|
|
42
49
|
}
|
|
43
50
|
export type Metadata = Optional<Record<string, unknown>>;
|
|
44
51
|
export interface Assistant {
|
package/dist/types.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Config, Metadata } from "./schema.js";
|
|
2
2
|
export type StreamMode = "values" | "messages" | "updates" | "events" | "debug";
|
|
3
3
|
export type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";
|
|
4
|
+
export type OnConflictBehavior = "raise" | "do_nothing";
|
|
4
5
|
export type StreamEvent = "events" | "metadata" | "debug" | "updates" | "values" | "messages/partial" | "messages/metadata" | "messages/complete" | (string & {});
|
|
5
6
|
interface RunsInvokePayload {
|
|
6
7
|
/**
|