@langchain/langgraph-sdk 0.0.1-rc.13 → 0.0.1-rc.14
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/README.md +17 -1
- package/dist/utils/async_caller.d.mts +7 -0
- package/dist/utils/async_caller.mjs +9 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -45,4 +45,20 @@ const streamResponse = client.runs.stream(
|
|
|
45
45
|
for await (const chunk of streamResponse) {
|
|
46
46
|
console.log(chunk);
|
|
47
47
|
}
|
|
48
|
-
```
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Documentation
|
|
51
|
+
|
|
52
|
+
To generate documentation, run the following commands:
|
|
53
|
+
|
|
54
|
+
1. Generate docs.
|
|
55
|
+
|
|
56
|
+
yarn typedoc
|
|
57
|
+
|
|
58
|
+
1. Consolidate doc files into one markdown file.
|
|
59
|
+
|
|
60
|
+
npx concat-md --decrease-title-levels --ignore=js_ts_sdk_ref.md --start-title-level-at 2 docs > docs/js_ts_sdk_ref.md
|
|
61
|
+
|
|
62
|
+
1. Copy `js_ts_sdk_ref.md` to MkDocs directory.
|
|
63
|
+
|
|
64
|
+
cp docs/js_ts_sdk_ref.md ../../docs/docs/cloud/reference/sdk/js_ts_sdk_ref.md
|
|
@@ -11,6 +11,12 @@ export interface AsyncCallerParams {
|
|
|
11
11
|
*/
|
|
12
12
|
maxRetries?: number;
|
|
13
13
|
onFailedResponseHook?: ResponseCallback;
|
|
14
|
+
/**
|
|
15
|
+
* Specify a custom fetch implementation.
|
|
16
|
+
*
|
|
17
|
+
* By default we expect the `fetch` is available in the global scope.
|
|
18
|
+
*/
|
|
19
|
+
fetch?: typeof fetch;
|
|
14
20
|
}
|
|
15
21
|
export interface AsyncCallerCallOptions {
|
|
16
22
|
signal?: AbortSignal;
|
|
@@ -33,6 +39,7 @@ export declare class AsyncCaller {
|
|
|
33
39
|
protected maxRetries: AsyncCallerParams["maxRetries"];
|
|
34
40
|
private queue;
|
|
35
41
|
private onFailedResponseHook?;
|
|
42
|
+
private customFetch?;
|
|
36
43
|
constructor(params: AsyncCallerParams);
|
|
37
44
|
call<A extends any[], T extends (...args: A) => Promise<any>>(callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;
|
|
38
45
|
callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(options: AsyncCallerCallOptions, callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;
|
|
@@ -99,6 +99,12 @@ export class AsyncCaller {
|
|
|
99
99
|
writable: true,
|
|
100
100
|
value: void 0
|
|
101
101
|
});
|
|
102
|
+
Object.defineProperty(this, "customFetch", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
configurable: true,
|
|
105
|
+
writable: true,
|
|
106
|
+
value: void 0
|
|
107
|
+
});
|
|
102
108
|
this.maxConcurrency = params.maxConcurrency ?? Infinity;
|
|
103
109
|
this.maxRetries = params.maxRetries ?? 4;
|
|
104
110
|
if ("default" in PQueueMod) {
|
|
@@ -112,6 +118,7 @@ export class AsyncCaller {
|
|
|
112
118
|
this.queue = new PQueueMod({ concurrency: this.maxConcurrency });
|
|
113
119
|
}
|
|
114
120
|
this.onFailedResponseHook = params?.onFailedResponseHook;
|
|
121
|
+
this.customFetch = params.fetch;
|
|
115
122
|
}
|
|
116
123
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
117
124
|
call(callable, ...args) {
|
|
@@ -175,6 +182,7 @@ export class AsyncCaller {
|
|
|
175
182
|
return this.call(callable, ...args);
|
|
176
183
|
}
|
|
177
184
|
fetch(...args) {
|
|
178
|
-
|
|
185
|
+
const fetchFn = this.customFetch ?? fetch;
|
|
186
|
+
return this.call(() => fetchFn(...args).then((res) => (res.ok ? res : Promise.reject(res))));
|
|
179
187
|
}
|
|
180
188
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph-sdk",
|
|
3
|
-
"version": "0.0.1-rc.
|
|
3
|
+
"version": "0.0.1-rc.14",
|
|
4
4
|
"description": "Client library for interacting with the LangGraph API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "yarn@1.22.19",
|
|
@@ -26,7 +26,10 @@
|
|
|
26
26
|
"@tsconfig/recommended": "^1.0.2",
|
|
27
27
|
"@types/node": "^20.12.12",
|
|
28
28
|
"@types/uuid": "^9.0.1",
|
|
29
|
+
"concat-md": "^0.5.1",
|
|
29
30
|
"prettier": "^3.2.5",
|
|
31
|
+
"typedoc": "^0.26.1",
|
|
32
|
+
"typedoc-plugin-markdown": "^4.1.0",
|
|
30
33
|
"typescript": "^5.4.5"
|
|
31
34
|
},
|
|
32
35
|
"exports": {
|