@langchain/langgraph-sdk 0.0.1-rc.6 → 0.0.1-rc.8

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 CHANGED
@@ -56,7 +56,7 @@ declare class AssistantsClient extends BaseClient {
56
56
  * @param payload Payload for updating the assistant.
57
57
  * @returns The updated assistant.
58
58
  */
59
- upsert(assistantId: string, payload: {
59
+ update(assistantId: string, payload: {
60
60
  graphId: string;
61
61
  config?: Config;
62
62
  metadata?: Metadata;
@@ -99,7 +99,7 @@ declare class ThreadsClient extends BaseClient {
99
99
  * @param payload Payload for updating the thread.
100
100
  * @returns The updated thread.
101
101
  */
102
- upsert(threadId: string, payload?: {
102
+ update(threadId: string, payload?: {
103
103
  /**
104
104
  * Metadata for the thread.
105
105
  */
@@ -168,6 +168,7 @@ declare class ThreadsClient extends BaseClient {
168
168
  getHistory<ValuesType = DefaultValues>(threadId: string, options?: {
169
169
  limit?: number;
170
170
  before?: Config;
171
+ metadata?: Metadata;
171
172
  }): Promise<ThreadState<ValuesType>[]>;
172
173
  }
173
174
  declare class RunsClient extends BaseClient {
package/dist/client.mjs CHANGED
@@ -105,9 +105,9 @@ class AssistantsClient extends BaseClient {
105
105
  * @param payload Payload for updating the assistant.
106
106
  * @returns The updated assistant.
107
107
  */
108
- async upsert(assistantId, payload) {
108
+ async update(assistantId, payload) {
109
109
  return this.fetch(`/assistants/${assistantId}`, {
110
- method: "PUT",
110
+ method: "PATCH",
111
111
  json: {
112
112
  graph_id: payload.graphId,
113
113
  config: payload.config,
@@ -160,9 +160,9 @@ class ThreadsClient extends BaseClient {
160
160
  * @param payload Payload for updating the thread.
161
161
  * @returns The updated thread.
162
162
  */
163
- async upsert(threadId, payload) {
163
+ async update(threadId, payload) {
164
164
  return this.fetch(`/threads/${threadId}`, {
165
- method: "PUT",
165
+ method: "PATCH",
166
166
  json: { metadata: payload?.metadata },
167
167
  });
168
168
  }
@@ -259,9 +259,11 @@ class ThreadsClient extends BaseClient {
259
259
  */
260
260
  async getHistory(threadId, options) {
261
261
  return this.fetch(`/threads/${threadId}/history`, {
262
- params: {
262
+ method: "POST",
263
+ json: {
263
264
  limit: options?.limit ?? 10,
264
265
  before: options?.before,
266
+ metadata: options?.metadata,
265
267
  },
266
268
  });
267
269
  }
package/dist/schema.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { JSONSchema7 } from "json-schema";
1
2
  type Optional<T> = T | null | undefined;
2
3
  export interface Config {
3
4
  /**
@@ -14,7 +15,14 @@ export interface Config {
14
15
  * Runtime values for attributes previously made configurable on this Runnable.
15
16
  */
16
17
  configurable: {
18
+ /**
19
+ * ID of the thread
20
+ */
17
21
  thread_id?: string;
22
+ /**
23
+ * Timestamp of the state checkpoint
24
+ */
25
+ thread_ts?: string;
18
26
  [key: string]: unknown;
19
27
  };
20
28
  }
@@ -26,11 +34,11 @@ export interface GraphSchema {
26
34
  /**
27
35
  * The schema for the graph state
28
36
  */
29
- state_schema: Record<string, unknown>;
37
+ state_schema: JSONSchema7;
30
38
  /**
31
39
  * The schema for the graph config
32
40
  */
33
- config_schema: Record<string, unknown>;
41
+ config_schema: JSONSchema7;
34
42
  }
35
43
  export type Metadata = Optional<Record<string, unknown>>;
36
44
  export interface Assistant {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-sdk",
3
- "version": "0.0.1-rc.6",
3
+ "version": "0.0.1-rc.8",
4
4
  "description": "Client library for interacting with the LangGraph API",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@1.22.19",
@@ -9,11 +9,14 @@
9
9
  "build": "yarn clean && yarn build:esm && yarn build:cjs && node scripts/create-entrypoints.js",
10
10
  "build:esm": "rm -f src/package.json && tsc --outDir dist/ && rm -rf dist/tests dist/**/tests",
11
11
  "build:cjs": "echo '{}' > src/package.json && tsc --outDir dist-cjs/ -p tsconfig.cjs.json && node scripts/move-cjs-to-dist.js && rm -r dist-cjs src/package.json",
12
- "prepublish": "yarn run build"
12
+ "prepublish": "yarn run build",
13
+ "format": "prettier --write src",
14
+ "lint": "prettier --check src && tsc --noEmit"
13
15
  },
14
16
  "main": "index.js",
15
17
  "license": "MIT",
16
18
  "dependencies": {
19
+ "@types/json-schema": "^7.0.15",
17
20
  "eventsource-parser": "^1.1.2",
18
21
  "p-queue": "^6.6.2",
19
22
  "p-retry": "4",
@@ -23,6 +26,7 @@
23
26
  "@tsconfig/recommended": "^1.0.2",
24
27
  "@types/node": "^20.12.12",
25
28
  "@types/uuid": "^9.0.1",
29
+ "prettier": "^3.2.5",
26
30
  "typescript": "^5.4.5"
27
31
  },
28
32
  "exports": {