@langchain/langgraph-sdk 0.1.9 → 1.0.0
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/CHANGELOG.md +12 -0
- package/dist/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/auth/error.cjs +76 -86
- package/dist/auth/error.cjs.map +1 -0
- package/dist/auth/error.d.cts +13 -0
- package/dist/auth/error.d.cts.map +1 -0
- package/dist/auth/error.d.ts +12 -8
- package/dist/auth/error.d.ts.map +1 -0
- package/dist/auth/error.js +76 -83
- package/dist/auth/error.js.map +1 -0
- package/dist/auth/index.cjs +36 -44
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +31 -0
- package/dist/auth/index.d.cts.map +1 -0
- package/dist/auth/index.d.ts +20 -15
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +35 -39
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/types.d.cts +294 -0
- package/dist/auth/types.d.cts.map +1 -0
- package/dist/auth/types.d.ts +162 -165
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/client.cjs +1108 -1294
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +688 -0
- package/dist/client.d.cts.map +1 -0
- package/dist/client.d.ts +647 -639
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1099 -1281
- package/dist/client.js.map +1 -0
- package/dist/index.cjs +6 -8
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +4 -2
- package/dist/logging/index.cjs +30 -31
- package/dist/logging/index.cjs.map +1 -0
- package/dist/logging/index.d.cts +47 -0
- package/dist/logging/index.d.cts.map +1 -0
- package/dist/logging/index.d.ts +20 -16
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +31 -29
- package/dist/logging/index.js.map +1 -0
- package/dist/react/index.cjs +5 -7
- package/dist/react/index.d.cts +4 -0
- package/dist/react/index.d.ts +4 -3
- package/dist/react/index.js +4 -2
- package/dist/react/stream.cjs +14 -15
- package/dist/react/stream.cjs.map +1 -0
- package/dist/react/stream.custom.cjs +126 -145
- package/dist/react/stream.custom.cjs.map +1 -0
- package/dist/react/stream.custom.d.cts +39 -0
- package/dist/react/stream.custom.d.cts.map +1 -0
- package/dist/react/stream.custom.d.ts +35 -37
- package/dist/react/stream.custom.d.ts.map +1 -0
- package/dist/react/stream.custom.js +122 -137
- package/dist/react/stream.custom.js.map +1 -0
- package/dist/react/stream.d.cts +73 -0
- package/dist/react/stream.d.cts.map +1 -0
- package/dist/react/stream.d.ts +21 -15
- package/dist/react/stream.d.ts.map +1 -0
- package/dist/react/stream.js +12 -11
- package/dist/react/stream.js.map +1 -0
- package/dist/react/stream.lgp.cjs +438 -495
- package/dist/react/stream.lgp.cjs.map +1 -0
- package/dist/react/stream.lgp.js +433 -487
- package/dist/react/stream.lgp.js.map +1 -0
- package/dist/react/thread.cjs +18 -15
- package/dist/react/thread.cjs.map +1 -0
- package/dist/react/thread.js +19 -13
- package/dist/react/thread.js.map +1 -0
- package/dist/react/types.d.cts +355 -0
- package/dist/react/types.d.cts.map +1 -0
- package/dist/react/types.d.ts +333 -329
- package/dist/react/types.d.ts.map +1 -0
- package/dist/react-ui/client.cjs +123 -184
- package/dist/react-ui/client.cjs.map +1 -0
- package/dist/react-ui/client.d.cts +90 -0
- package/dist/react-ui/client.d.cts.map +1 -0
- package/dist/react-ui/client.d.ts +67 -51
- package/dist/react-ui/client.d.ts.map +1 -0
- package/dist/react-ui/client.js +118 -143
- package/dist/react-ui/client.js.map +1 -0
- package/dist/react-ui/index.cjs +14 -13
- package/dist/react-ui/index.cjs.map +1 -0
- package/dist/react-ui/index.d.cts +3 -0
- package/dist/react-ui/index.d.ts +3 -2
- package/dist/react-ui/index.js +8 -3
- package/dist/react-ui/index.js.map +1 -0
- package/dist/react-ui/server/index.cjs +5 -7
- package/dist/react-ui/server/index.d.cts +3 -0
- package/dist/react-ui/server/index.d.ts +3 -2
- package/dist/react-ui/server/index.js +4 -2
- package/dist/react-ui/server/server.cjs +53 -44
- package/dist/react-ui/server/server.cjs.map +1 -0
- package/dist/react-ui/server/server.d.cts +55 -0
- package/dist/react-ui/server/server.d.cts.map +1 -0
- package/dist/react-ui/server/server.d.ts +43 -39
- package/dist/react-ui/server/server.d.ts.map +1 -0
- package/dist/react-ui/server/server.js +54 -42
- package/dist/react-ui/server/server.js.map +1 -0
- package/dist/react-ui/types.cjs +32 -36
- package/dist/react-ui/types.cjs.map +1 -0
- package/dist/react-ui/types.d.cts +25 -0
- package/dist/react-ui/types.d.cts.map +1 -0
- package/dist/react-ui/types.d.ts +23 -19
- package/dist/react-ui/types.d.ts.map +1 -0
- package/dist/react-ui/types.js +32 -34
- package/dist/react-ui/types.js.map +1 -0
- package/dist/schema.d.cts +277 -0
- package/dist/schema.d.cts.map +1 -0
- package/dist/schema.d.ts +249 -242
- package/dist/schema.d.ts.map +1 -0
- package/dist/singletons/fetch.cjs +16 -20
- package/dist/singletons/fetch.cjs.map +1 -0
- package/dist/singletons/fetch.d.cts +14 -0
- package/dist/singletons/fetch.d.cts.map +1 -0
- package/dist/singletons/fetch.d.ts +5 -2
- package/dist/singletons/fetch.d.ts.map +1 -0
- package/dist/singletons/fetch.js +16 -17
- package/dist/singletons/fetch.js.map +1 -0
- package/dist/types.d.cts +187 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.ts +178 -173
- package/dist/types.d.ts.map +1 -0
- package/dist/types.messages.d.cts +91 -0
- package/dist/types.messages.d.cts.map +1 -0
- package/dist/types.messages.d.ts +71 -66
- package/dist/types.messages.d.ts.map +1 -0
- package/dist/types.stream.d.cts +235 -0
- package/dist/types.stream.d.cts.map +1 -0
- package/dist/types.stream.d.ts +149 -142
- package/dist/types.stream.d.ts.map +1 -0
- package/dist/ui/branching.cjs +145 -141
- package/dist/ui/branching.cjs.map +1 -0
- package/dist/ui/branching.d.cts +22 -0
- package/dist/ui/branching.d.cts.map +1 -0
- package/dist/ui/branching.d.ts +17 -30
- package/dist/ui/branching.d.ts.map +1 -0
- package/dist/ui/branching.js +147 -139
- package/dist/ui/branching.js.map +1 -0
- package/dist/ui/errors.cjs +14 -12
- package/dist/ui/errors.cjs.map +1 -0
- package/dist/ui/errors.js +14 -9
- package/dist/ui/errors.js.map +1 -0
- package/dist/ui/manager.cjs +156 -232
- package/dist/ui/manager.cjs.map +1 -0
- package/dist/ui/manager.js +156 -228
- package/dist/ui/manager.js.map +1 -0
- package/dist/ui/messages.cjs +55 -69
- package/dist/ui/messages.cjs.map +1 -0
- package/dist/ui/messages.js +55 -66
- package/dist/ui/messages.js.map +1 -0
- package/dist/ui/utils.cjs +10 -10
- package/dist/ui/utils.cjs.map +1 -0
- package/dist/ui/utils.js +10 -8
- package/dist/ui/utils.js.map +1 -0
- package/dist/utils/async_caller.cjs +103 -185
- package/dist/utils/async_caller.cjs.map +1 -0
- package/dist/utils/async_caller.d.cts +53 -0
- package/dist/utils/async_caller.d.cts.map +1 -0
- package/dist/utils/async_caller.d.ts +36 -31
- package/dist/utils/async_caller.d.ts.map +1 -0
- package/dist/utils/async_caller.js +101 -177
- package/dist/utils/async_caller.js.map +1 -0
- package/dist/utils/env.cjs +11 -13
- package/dist/utils/env.cjs.map +1 -0
- package/dist/utils/env.js +11 -11
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/signals.cjs +18 -19
- package/dist/utils/signals.cjs.map +1 -0
- package/dist/utils/signals.js +18 -17
- package/dist/utils/signals.js.map +1 -0
- package/dist/utils/sse.cjs +110 -140
- package/dist/utils/sse.cjs.map +1 -0
- package/dist/utils/sse.js +110 -138
- package/dist/utils/sse.js.map +1 -0
- package/dist/utils/stream.cjs +90 -114
- package/dist/utils/stream.cjs.map +1 -0
- package/dist/utils/stream.js +90 -111
- package/dist/utils/stream.js.map +1 -0
- package/package.json +72 -80
- package/auth.cjs +0 -1
- package/auth.d.cts +0 -1
- package/auth.d.ts +0 -1
- package/auth.js +0 -1
- package/client.cjs +0 -1
- package/client.d.cts +0 -1
- package/client.d.ts +0 -1
- package/client.js +0 -1
- package/dist/auth/types.cjs +0 -2
- package/dist/auth/types.js +0 -1
- package/dist/react/stream.lgp.d.ts +0 -7
- package/dist/react/thread.d.ts +0 -4
- package/dist/react/types.cjs +0 -2
- package/dist/react/types.js +0 -1
- package/dist/schema.cjs +0 -2
- package/dist/schema.js +0 -1
- package/dist/types.cjs +0 -2
- package/dist/types.js +0 -1
- package/dist/types.messages.cjs +0 -2
- package/dist/types.messages.js +0 -1
- package/dist/types.stream.cjs +0 -2
- package/dist/types.stream.js +0 -1
- package/dist/ui/branching.test.cjs +0 -370
- package/dist/ui/branching.test.d.ts +0 -1
- package/dist/ui/branching.test.js +0 -368
- package/dist/ui/errors.d.ts +0 -12
- package/dist/ui/manager.d.ts +0 -87
- package/dist/ui/messages.d.ts +0 -18
- package/dist/ui/utils.d.ts +0 -2
- package/dist/utils/env.d.ts +0 -1
- package/dist/utils/signals.d.ts +0 -1
- package/dist/utils/sse.d.ts +0 -8
- package/dist/utils/stream.d.ts +0 -13
- package/index.cjs +0 -1
- package/index.d.cts +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/logging.cjs +0 -1
- package/logging.d.cts +0 -1
- package/logging.d.ts +0 -1
- package/logging.js +0 -1
- package/react-ui/server.cjs +0 -1
- package/react-ui/server.d.cts +0 -1
- package/react-ui/server.d.ts +0 -1
- package/react-ui/server.js +0 -1
- package/react-ui.cjs +0 -1
- package/react-ui.d.cts +0 -1
- package/react-ui.d.ts +0 -1
- package/react-ui.js +0 -1
- package/react.cjs +0 -1
- package/react.d.cts +0 -1
- package/react.d.ts +0 -1
- package/react.js +0 -1
package/dist/schema.d.ts
CHANGED
|
@@ -1,270 +1,277 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { JSONSchema7 } from "json-schema";
|
|
2
|
+
|
|
3
|
+
//#region src/schema.d.ts
|
|
2
4
|
type Optional<T> = T | null | undefined;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
type RunStatus = "pending" | "running" | "error" | "success" | "timeout" | "interrupted";
|
|
6
|
+
type ThreadStatus = "idle" | "busy" | "interrupted" | "error";
|
|
5
7
|
type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
type CancelAction = "interrupt" | "rollback";
|
|
9
|
+
type Config = {
|
|
10
|
+
/**
|
|
11
|
+
* Tags for this call and any sub-calls (eg. a Chain calling an LLM).
|
|
12
|
+
* You can use these to filter calls.
|
|
13
|
+
*/
|
|
14
|
+
tags?: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Maximum number of times a call can recurse.
|
|
17
|
+
* If not provided, defaults to 25.
|
|
18
|
+
*/
|
|
19
|
+
recursion_limit?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Runtime values for attributes previously made configurable on this Runnable.
|
|
22
|
+
*/
|
|
23
|
+
configurable?: {
|
|
8
24
|
/**
|
|
9
|
-
*
|
|
10
|
-
* You can use these to filter calls.
|
|
25
|
+
* ID of the thread
|
|
11
26
|
*/
|
|
12
|
-
|
|
27
|
+
thread_id?: Optional<string>;
|
|
13
28
|
/**
|
|
14
|
-
*
|
|
15
|
-
* If not provided, defaults to 25.
|
|
29
|
+
* Timestamp of the state checkpoint
|
|
16
30
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
configurable?: {
|
|
22
|
-
/**
|
|
23
|
-
* ID of the thread
|
|
24
|
-
*/
|
|
25
|
-
thread_id?: Optional<string>;
|
|
26
|
-
/**
|
|
27
|
-
* Timestamp of the state checkpoint
|
|
28
|
-
*/
|
|
29
|
-
checkpoint_id?: Optional<string>;
|
|
30
|
-
[key: string]: unknown;
|
|
31
|
-
};
|
|
31
|
+
checkpoint_id?: Optional<string>;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
};
|
|
32
34
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
35
|
+
interface GraphSchema {
|
|
36
|
+
/**
|
|
37
|
+
* The ID of the graph.
|
|
38
|
+
*/
|
|
39
|
+
graph_id: string;
|
|
40
|
+
/**
|
|
41
|
+
* The schema for the input state.
|
|
42
|
+
* Missing if unable to generate JSON schema from graph.
|
|
43
|
+
*/
|
|
44
|
+
input_schema?: JSONSchema7 | null | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* The schema for the output state.
|
|
47
|
+
* Missing if unable to generate JSON schema from graph.
|
|
48
|
+
*/
|
|
49
|
+
output_schema?: JSONSchema7 | null | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* The schema for the graph state.
|
|
52
|
+
* Missing if unable to generate JSON schema from graph.
|
|
53
|
+
*/
|
|
54
|
+
state_schema?: JSONSchema7 | null | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* The schema for the graph config.
|
|
57
|
+
* Missing if unable to generate JSON schema from graph.
|
|
58
|
+
*/
|
|
59
|
+
config_schema?: JSONSchema7 | null | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* The schema for the graph context.
|
|
62
|
+
* Missing if unable to generate JSON schema from graph.
|
|
63
|
+
*/
|
|
64
|
+
context_schema?: JSONSchema7 | null | undefined;
|
|
63
65
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
type Subgraphs = Record<string, GraphSchema>;
|
|
67
|
+
type Metadata = Optional<{
|
|
68
|
+
source?: "input" | "loop" | "update" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
|
|
69
|
+
step?: number;
|
|
70
|
+
writes?: Record<string, unknown> | null;
|
|
71
|
+
parents?: Record<string, string>;
|
|
72
|
+
[key: string]: unknown;
|
|
71
73
|
}>;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
74
|
+
interface AssistantBase {
|
|
75
|
+
/** The ID of the assistant. */
|
|
76
|
+
assistant_id: string;
|
|
77
|
+
/** The ID of the graph. */
|
|
78
|
+
graph_id: string;
|
|
79
|
+
/** The assistant config. */
|
|
80
|
+
config: Config;
|
|
81
|
+
/** The assistant context. */
|
|
82
|
+
context: unknown;
|
|
83
|
+
/** The time the assistant was created. */
|
|
84
|
+
created_at: string;
|
|
85
|
+
/** The assistant metadata. */
|
|
86
|
+
metadata: Metadata;
|
|
87
|
+
/** The version of the assistant. */
|
|
88
|
+
version: number;
|
|
89
|
+
/** The name of the assistant */
|
|
90
|
+
name: string;
|
|
91
|
+
/** The description of the assistant */
|
|
92
|
+
description?: string;
|
|
91
93
|
}
|
|
92
|
-
|
|
94
|
+
interface AssistantVersion extends AssistantBase {}
|
|
95
|
+
interface Assistant extends AssistantBase {
|
|
96
|
+
/** The last time the assistant was updated. */
|
|
97
|
+
updated_at: string;
|
|
93
98
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
data?: string;
|
|
109
|
-
conditional?: boolean;
|
|
110
|
-
}>;
|
|
99
|
+
interface AssistantGraph {
|
|
100
|
+
nodes: Array<{
|
|
101
|
+
id: string | number;
|
|
102
|
+
name?: string;
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
104
|
+
data?: Record<string, any> | string;
|
|
105
|
+
metadata?: unknown;
|
|
106
|
+
}>;
|
|
107
|
+
edges: Array<{
|
|
108
|
+
source: string;
|
|
109
|
+
target: string;
|
|
110
|
+
data?: string;
|
|
111
|
+
conditional?: boolean;
|
|
112
|
+
}>;
|
|
111
113
|
}
|
|
112
114
|
/**
|
|
113
115
|
* An interrupt thrown inside a thread.
|
|
114
116
|
*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
117
|
+
interface Interrupt<TValue = unknown> {
|
|
118
|
+
/**
|
|
119
|
+
* The ID of the interrupt.
|
|
120
|
+
*/
|
|
121
|
+
id?: string;
|
|
122
|
+
/**
|
|
123
|
+
* The value of the interrupt.
|
|
124
|
+
*/
|
|
125
|
+
value?: TValue;
|
|
126
|
+
/**
|
|
127
|
+
* Will be deprecated in the future.
|
|
128
|
+
* @deprecated Will be removed in the future.
|
|
129
|
+
*/
|
|
130
|
+
when?: "during" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
|
|
131
|
+
/**
|
|
132
|
+
* Whether the interrupt can be resumed.
|
|
133
|
+
* @deprecated Will be removed in the future.
|
|
134
|
+
*/
|
|
135
|
+
resumable?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* The namespace of the interrupt.
|
|
138
|
+
* @deprecated Replaced by `interrupt_id`
|
|
139
|
+
*/
|
|
140
|
+
ns?: string[];
|
|
139
141
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
142
|
+
interface Thread<ValuesType = DefaultValues> {
|
|
143
|
+
/** The ID of the thread. */
|
|
144
|
+
thread_id: string;
|
|
145
|
+
/** The time the thread was created. */
|
|
146
|
+
created_at: string;
|
|
147
|
+
/** The last time the thread was updated. */
|
|
148
|
+
updated_at: string;
|
|
149
|
+
/** The thread metadata. */
|
|
150
|
+
metadata: Metadata;
|
|
151
|
+
/** The status of the thread */
|
|
152
|
+
status: ThreadStatus;
|
|
153
|
+
/** The current state of the thread. */
|
|
154
|
+
values: ValuesType;
|
|
155
|
+
/** Interrupts which were thrown in this thread */
|
|
156
|
+
interrupts: Record<string, Array<Interrupt>>;
|
|
155
157
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
158
|
+
interface Cron {
|
|
159
|
+
/** The ID of the cron */
|
|
160
|
+
cron_id: string;
|
|
161
|
+
/** The ID of the assistant */
|
|
162
|
+
assistant_id: string;
|
|
163
|
+
/** The ID of the thread */
|
|
164
|
+
thread_id: Optional<string>;
|
|
165
|
+
/** The end date to stop running the cron. */
|
|
166
|
+
end_time: Optional<string>;
|
|
167
|
+
/** The schedule to run, cron format. */
|
|
168
|
+
schedule: string;
|
|
169
|
+
/** The time the cron was created. */
|
|
170
|
+
created_at: string;
|
|
171
|
+
/** The last time the cron was updated. */
|
|
172
|
+
updated_at: string;
|
|
173
|
+
/** The run payload to use for creating new run. */
|
|
174
|
+
payload: Record<string, unknown>;
|
|
175
|
+
/** The user ID of the cron */
|
|
176
|
+
user_id: Optional<string>;
|
|
177
|
+
/** The next run date of the cron */
|
|
178
|
+
next_run_date: Optional<string>;
|
|
179
|
+
/** The metadata of the cron */
|
|
180
|
+
metadata: Record<string, unknown>;
|
|
179
181
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
182
|
+
type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;
|
|
183
|
+
interface ThreadState<ValuesType = DefaultValues> {
|
|
184
|
+
/** The state values */
|
|
185
|
+
values: ValuesType;
|
|
186
|
+
/** The next nodes to execute. If empty, the thread is done until new input is received */
|
|
187
|
+
next: string[];
|
|
188
|
+
/** Checkpoint of the thread state */
|
|
189
|
+
checkpoint: Checkpoint;
|
|
190
|
+
/** Metadata for this state */
|
|
191
|
+
metadata: Metadata;
|
|
192
|
+
/** Time of state creation */
|
|
193
|
+
created_at: Optional<string>;
|
|
194
|
+
/** The parent checkpoint. If missing, this is the root checkpoint */
|
|
195
|
+
parent_checkpoint: Optional<Checkpoint>;
|
|
196
|
+
/** Tasks to execute in this step. If already attempted, may contain an error */
|
|
197
|
+
tasks: Array<ThreadTask>;
|
|
196
198
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
199
|
+
interface ThreadTask {
|
|
200
|
+
id: string;
|
|
201
|
+
name: string;
|
|
202
|
+
result?: unknown;
|
|
203
|
+
error: Optional<string>;
|
|
204
|
+
interrupts: Array<Interrupt>;
|
|
205
|
+
checkpoint: Optional<Checkpoint>;
|
|
206
|
+
state: Optional<ThreadState>;
|
|
205
207
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
208
|
+
interface Run {
|
|
209
|
+
/** The ID of the run */
|
|
210
|
+
run_id: string;
|
|
211
|
+
/** The ID of the thread */
|
|
212
|
+
thread_id: string;
|
|
213
|
+
/** The assistant that wwas used for this run */
|
|
214
|
+
assistant_id: string;
|
|
215
|
+
/** The time the run was created */
|
|
216
|
+
created_at: string;
|
|
217
|
+
/** The last time the run was updated */
|
|
218
|
+
updated_at: string;
|
|
219
|
+
/** The status of the run. */
|
|
220
|
+
status: RunStatus;
|
|
221
|
+
/** Run metadata */
|
|
222
|
+
metadata: Metadata;
|
|
223
|
+
/** Strategy to handle concurrent runs on the same thread */
|
|
224
|
+
multitask_strategy: Optional<MultitaskStrategy>;
|
|
223
225
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
type Checkpoint = {
|
|
227
|
+
thread_id: string;
|
|
228
|
+
checkpoint_ns: string;
|
|
229
|
+
checkpoint_id: Optional<string>;
|
|
230
|
+
checkpoint_map: Optional<Record<string, unknown>>;
|
|
229
231
|
};
|
|
230
|
-
|
|
231
|
-
|
|
232
|
+
interface ListNamespaceResponse {
|
|
233
|
+
namespaces: string[][];
|
|
232
234
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
235
|
+
interface Item {
|
|
236
|
+
namespace: string[];
|
|
237
|
+
key: string;
|
|
238
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
239
|
+
value: Record<string, any>;
|
|
240
|
+
createdAt: string;
|
|
241
|
+
updatedAt: string;
|
|
239
242
|
}
|
|
240
|
-
|
|
241
|
-
|
|
243
|
+
interface SearchItem extends Item {
|
|
244
|
+
score?: number;
|
|
242
245
|
}
|
|
243
|
-
|
|
244
|
-
|
|
246
|
+
interface SearchItemsResponse {
|
|
247
|
+
items: SearchItem[];
|
|
245
248
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
249
|
+
interface CronCreateResponse {
|
|
250
|
+
cron_id: string;
|
|
251
|
+
assistant_id: string;
|
|
252
|
+
thread_id: string | undefined;
|
|
253
|
+
user_id: string;
|
|
254
|
+
payload: Record<string, unknown>;
|
|
255
|
+
schedule: string;
|
|
256
|
+
next_run_date: string;
|
|
257
|
+
end_time: string | undefined;
|
|
258
|
+
created_at: string;
|
|
259
|
+
updated_at: string;
|
|
260
|
+
metadata: Metadata;
|
|
258
261
|
}
|
|
259
|
-
|
|
260
|
-
|
|
262
|
+
interface CronCreateForThreadResponse extends Omit<CronCreateResponse, "thread_id"> {
|
|
263
|
+
thread_id: string;
|
|
261
264
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
265
|
+
type AssistantSortBy = "assistant_id" | "graph_id" | "name" | "created_at" | "updated_at";
|
|
266
|
+
type ThreadSortBy = "thread_id" | "status" | "created_at" | "updated_at";
|
|
267
|
+
type CronSortBy = "cron_id" | "assistant_id" | "thread_id" | "created_at" | "updated_at" | "next_run_date";
|
|
268
|
+
type SortOrder = "asc" | "desc";
|
|
269
|
+
// Select field aliases for client-side typing of `select` parameters.
|
|
270
|
+
// These mirror the server's allowed field sets.
|
|
271
|
+
type AssistantSelectField = "assistant_id" | "graph_id" | "name" | "description" | "config" | "context" | "created_at" | "updated_at" | "metadata" | "version";
|
|
272
|
+
type ThreadSelectField = "thread_id" | "created_at" | "updated_at" | "metadata" | "config" | "context" | "status" | "values" | "interrupts";
|
|
273
|
+
type RunSelectField = "run_id" | "thread_id" | "assistant_id" | "created_at" | "updated_at" | "status" | "metadata" | "kwargs" | "multitask_strategy";
|
|
274
|
+
type CronSelectField = "cron_id" | "assistant_id" | "thread_id" | "end_time" | "schedule" | "created_at" | "updated_at" | "user_id" | "payload" | "next_run_date" | "metadata" | "now";
|
|
275
|
+
//#endregion
|
|
276
|
+
export { Assistant, AssistantBase, AssistantGraph, AssistantSelectField, AssistantSortBy, AssistantVersion, CancelAction, Checkpoint, Config, Cron, CronCreateForThreadResponse, CronCreateResponse, CronSelectField, CronSortBy, DefaultValues, GraphSchema, Interrupt, Item, ListNamespaceResponse, Metadata, Run, RunSelectField, RunStatus, SearchItem, SearchItemsResponse, SortOrder, Subgraphs, Thread, ThreadSelectField, ThreadSortBy, ThreadState, ThreadStatus, ThreadTask };
|
|
277
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":["JSONSchema7","Optional","T","RunStatus","ThreadStatus","MultitaskStrategy","CancelAction","Config","GraphSchema","Subgraphs","Record","Metadata","AssistantBase","AssistantVersion","Assistant","AssistantGraph","Array","Interrupt","TValue","Thread","DefaultValues","ValuesType","Cron","ThreadState","Checkpoint","ThreadTask","Run","ListNamespaceResponse","Item","SearchItem","SearchItemsResponse","CronCreateResponse","CronCreateForThreadResponse","Omit","AssistantSortBy","ThreadSortBy","CronSortBy","SortOrder","AssistantSelectField","ThreadSelectField","RunSelectField","CronSelectField"],"sources":["../src/schema.d.ts"],"sourcesContent":["import type { JSONSchema7 } from \"json-schema\";\ntype Optional<T> = T | null | undefined;\nexport type RunStatus = \"pending\" | \"running\" | \"error\" | \"success\" | \"timeout\" | \"interrupted\";\nexport type ThreadStatus = \"idle\" | \"busy\" | \"interrupted\" | \"error\";\ntype MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type CancelAction = \"interrupt\" | \"rollback\";\nexport type Config = {\n /**\n * Tags for this call and any sub-calls (eg. a Chain calling an LLM).\n * You can use these to filter calls.\n */\n tags?: string[];\n /**\n * Maximum number of times a call can recurse.\n * If not provided, defaults to 25.\n */\n recursion_limit?: number;\n /**\n * Runtime values for attributes previously made configurable on this Runnable.\n */\n configurable?: {\n /**\n * ID of the thread\n */\n thread_id?: Optional<string>;\n /**\n * Timestamp of the state checkpoint\n */\n checkpoint_id?: Optional<string>;\n [key: string]: unknown;\n };\n};\nexport interface GraphSchema {\n /**\n * The ID of the graph.\n */\n graph_id: string;\n /**\n * The schema for the input state.\n * Missing if unable to generate JSON schema from graph.\n */\n input_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the output state.\n * Missing if unable to generate JSON schema from graph.\n */\n output_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph state.\n * Missing if unable to generate JSON schema from graph.\n */\n state_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph config.\n * Missing if unable to generate JSON schema from graph.\n */\n config_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph context.\n * Missing if unable to generate JSON schema from graph.\n */\n context_schema?: JSONSchema7 | null | undefined;\n}\nexport type Subgraphs = Record<string, GraphSchema>;\nexport type Metadata = Optional<{\n source?: \"input\" | \"loop\" | \"update\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\n step?: number;\n writes?: Record<string, unknown> | null;\n parents?: Record<string, string>;\n [key: string]: unknown;\n}>;\nexport interface AssistantBase {\n /** The ID of the assistant. */\n assistant_id: string;\n /** The ID of the graph. */\n graph_id: string;\n /** The assistant config. */\n config: Config;\n /** The assistant context. */\n context: unknown;\n /** The time the assistant was created. */\n created_at: string;\n /** The assistant metadata. */\n metadata: Metadata;\n /** The version of the assistant. */\n version: number;\n /** The name of the assistant */\n name: string;\n /** The description of the assistant */\n description?: string;\n}\nexport interface AssistantVersion extends AssistantBase {\n}\nexport interface Assistant extends AssistantBase {\n /** The last time the assistant was updated. */\n updated_at: string;\n}\nexport interface AssistantGraph {\n nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>;\n edges: Array<{\n source: string;\n target: string;\n data?: string;\n conditional?: boolean;\n }>;\n}\n/**\n * An interrupt thrown inside a thread.\n */\nexport interface Interrupt<TValue = unknown> {\n /**\n * The ID of the interrupt.\n */\n id?: string;\n /**\n * The value of the interrupt.\n */\n value?: TValue;\n /**\n * Will be deprecated in the future.\n * @deprecated Will be removed in the future.\n */\n when?: \"during\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\n /**\n * Whether the interrupt can be resumed.\n * @deprecated Will be removed in the future.\n */\n resumable?: boolean;\n /**\n * The namespace of the interrupt.\n * @deprecated Replaced by `interrupt_id`\n */\n ns?: string[];\n}\nexport interface Thread<ValuesType = DefaultValues> {\n /** The ID of the thread. */\n thread_id: string;\n /** The time the thread was created. */\n created_at: string;\n /** The last time the thread was updated. */\n updated_at: string;\n /** The thread metadata. */\n metadata: Metadata;\n /** The status of the thread */\n status: ThreadStatus;\n /** The current state of the thread. */\n values: ValuesType;\n /** Interrupts which were thrown in this thread */\n interrupts: Record<string, Array<Interrupt>>;\n}\nexport interface Cron {\n /** The ID of the cron */\n cron_id: string;\n /** The ID of the assistant */\n assistant_id: string;\n /** The ID of the thread */\n thread_id: Optional<string>;\n /** The end date to stop running the cron. */\n end_time: Optional<string>;\n /** The schedule to run, cron format. */\n schedule: string;\n /** The time the cron was created. */\n created_at: string;\n /** The last time the cron was updated. */\n updated_at: string;\n /** The run payload to use for creating new run. */\n payload: Record<string, unknown>;\n /** The user ID of the cron */\n user_id: Optional<string>;\n /** The next run date of the cron */\n next_run_date: Optional<string>;\n /** The metadata of the cron */\n metadata: Record<string, unknown>;\n}\nexport type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;\nexport interface ThreadState<ValuesType = DefaultValues> {\n /** The state values */\n values: ValuesType;\n /** The next nodes to execute. If empty, the thread is done until new input is received */\n next: string[];\n /** Checkpoint of the thread state */\n checkpoint: Checkpoint;\n /** Metadata for this state */\n metadata: Metadata;\n /** Time of state creation */\n created_at: Optional<string>;\n /** The parent checkpoint. If missing, this is the root checkpoint */\n parent_checkpoint: Optional<Checkpoint>;\n /** Tasks to execute in this step. If already attempted, may contain an error */\n tasks: Array<ThreadTask>;\n}\nexport interface ThreadTask {\n id: string;\n name: string;\n result?: unknown;\n error: Optional<string>;\n interrupts: Array<Interrupt>;\n checkpoint: Optional<Checkpoint>;\n state: Optional<ThreadState>;\n}\nexport interface Run {\n /** The ID of the run */\n run_id: string;\n /** The ID of the thread */\n thread_id: string;\n /** The assistant that wwas used for this run */\n assistant_id: string;\n /** The time the run was created */\n created_at: string;\n /** The last time the run was updated */\n updated_at: string;\n /** The status of the run. */\n status: RunStatus;\n /** Run metadata */\n metadata: Metadata;\n /** Strategy to handle concurrent runs on the same thread */\n multitask_strategy: Optional<MultitaskStrategy>;\n}\nexport type Checkpoint = {\n thread_id: string;\n checkpoint_ns: string;\n checkpoint_id: Optional<string>;\n checkpoint_map: Optional<Record<string, unknown>>;\n};\nexport interface ListNamespaceResponse {\n namespaces: string[][];\n}\nexport interface Item {\n namespace: string[];\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: Record<string, any>;\n createdAt: string;\n updatedAt: string;\n}\nexport interface SearchItem extends Item {\n score?: number;\n}\nexport interface SearchItemsResponse {\n items: SearchItem[];\n}\nexport interface CronCreateResponse {\n cron_id: string;\n assistant_id: string;\n thread_id: string | undefined;\n user_id: string;\n payload: Record<string, unknown>;\n schedule: string;\n next_run_date: string;\n end_time: string | undefined;\n created_at: string;\n updated_at: string;\n metadata: Metadata;\n}\nexport interface CronCreateForThreadResponse extends Omit<CronCreateResponse, \"thread_id\"> {\n thread_id: string;\n}\nexport type AssistantSortBy = \"assistant_id\" | \"graph_id\" | \"name\" | \"created_at\" | \"updated_at\";\nexport type ThreadSortBy = \"thread_id\" | \"status\" | \"created_at\" | \"updated_at\";\nexport type CronSortBy = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"created_at\" | \"updated_at\" | \"next_run_date\";\nexport type SortOrder = \"asc\" | \"desc\";\n// Select field aliases for client-side typing of `select` parameters.\n// These mirror the server's allowed field sets.\nexport type AssistantSelectField = \"assistant_id\" | \"graph_id\" | \"name\" | \"description\" | \"config\" | \"context\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"version\";\nexport type ThreadSelectField = \"thread_id\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"config\" | \"context\" | \"status\" | \"values\" | \"interrupts\";\nexport type RunSelectField = \"run_id\" | \"thread_id\" | \"assistant_id\" | \"created_at\" | \"updated_at\" | \"status\" | \"metadata\" | \"kwargs\" | \"multitask_strategy\";\nexport type CronSelectField = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"end_time\" | \"schedule\" | \"created_at\" | \"updated_at\" | \"user_id\" | \"payload\" | \"next_run_date\" | \"metadata\" | \"now\";\nexport {};\n"],"mappings":"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"}
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports._getFetchImplementation = exports.overrideFetchImplementation = void 0;
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
-
// Wrap the default fetch call due to issues with illegal invocations
|
|
6
|
-
// in some environments:
|
|
7
|
-
// https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err
|
|
8
|
-
// @ts-expect-error Broad typing to support a range of fetch implementations
|
|
1
|
+
|
|
2
|
+
//#region src/singletons/fetch.ts
|
|
9
3
|
const DEFAULT_FETCH_IMPLEMENTATION = (...args) => fetch(...args);
|
|
10
4
|
const LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for("lg:fetch_implementation");
|
|
11
5
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const overrideFetchImplementation = (fetch) => {
|
|
18
|
-
|
|
6
|
+
* Overrides the fetch implementation used for LangSmith calls.
|
|
7
|
+
* You should use this if you need to use an implementation of fetch
|
|
8
|
+
* other than the default global (e.g. for dealing with proxies).
|
|
9
|
+
* @param fetch The new fetch function to use.
|
|
10
|
+
*/
|
|
11
|
+
const overrideFetchImplementation = (fetch$1) => {
|
|
12
|
+
globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch$1;
|
|
19
13
|
};
|
|
20
|
-
exports.overrideFetchImplementation = overrideFetchImplementation;
|
|
21
14
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
24
17
|
const _getFetchImplementation = () => {
|
|
25
|
-
|
|
26
|
-
DEFAULT_FETCH_IMPLEMENTATION);
|
|
18
|
+
return globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ?? DEFAULT_FETCH_IMPLEMENTATION;
|
|
27
19
|
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
28
22
|
exports._getFetchImplementation = _getFetchImplementation;
|
|
23
|
+
exports.overrideFetchImplementation = overrideFetchImplementation;
|
|
24
|
+
//# sourceMappingURL=fetch.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.cjs","names":["fetch","_getFetchImplementation: () => (...args: any[]) => any"],"sources":["../../src/singletons/fetch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n// Wrap the default fetch call due to issues with illegal invocations\n// in some environments:\n// https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err\n// @ts-expect-error Broad typing to support a range of fetch implementations\nconst DEFAULT_FETCH_IMPLEMENTATION = (...args: any[]) => fetch(...args);\n\nconst LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for(\n \"lg:fetch_implementation\"\n);\n\n/**\n * Overrides the fetch implementation used for LangSmith calls.\n * You should use this if you need to use an implementation of fetch\n * other than the default global (e.g. for dealing with proxies).\n * @param fetch The new fetch function to use.\n */\nexport const overrideFetchImplementation = (fetch: (...args: any[]) => any) => {\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch;\n};\n\n/**\n * @internal\n */\nexport const _getFetchImplementation: () => (...args: any[]) => any = () => {\n return (\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ??\n DEFAULT_FETCH_IMPLEMENTATION\n );\n};\n"],"mappings":";;AAKA,MAAM,gCAAgC,GAAG,SAAgB,MAAM,GAAG;AAElE,MAAM,qCAAqC,OAAO,IAChD;;;;;;;AASF,MAAa,+BAA+B,YAAmC;AAC7E,CAAC,WAAmB,sCAAsCA;;;;;AAM5D,MAAaC,gCAA+D;AAC1E,QACG,WAAmB,uCACpB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/singletons/fetch.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Overrides the fetch implementation used for LangSmith calls.
|
|
4
|
+
* You should use this if you need to use an implementation of fetch
|
|
5
|
+
* other than the default global (e.g. for dealing with proxies).
|
|
6
|
+
* @param fetch The new fetch function to use.
|
|
7
|
+
*/
|
|
8
|
+
declare const overrideFetchImplementation: (fetch: (...args: any[]) => any) => void;
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
//#endregion
|
|
13
|
+
export { overrideFetchImplementation };
|
|
14
|
+
//# sourceMappingURL=fetch.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.cts","names":["overrideFetchImplementation","_getFetchImplementation"],"sources":["../../src/singletons/fetch.d.ts"],"sourcesContent":["/**\n * Overrides the fetch implementation used for LangSmith calls.\n * You should use this if you need to use an implementation of fetch\n * other than the default global (e.g. for dealing with proxies).\n * @param fetch The new fetch function to use.\n */\nexport declare const overrideFetchImplementation: (fetch: (...args: any[]) => any) => void;\n/**\n * @internal\n */\nexport declare const _getFetchImplementation: () => (...args: any[]) => any;\n"],"mappings":";;AAMA;;;;;cAAqBA"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
//#region src/singletons/fetch.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Overrides the fetch implementation used for LangSmith calls.
|
|
3
4
|
* You should use this if you need to use an implementation of fetch
|
|
4
5
|
* other than the default global (e.g. for dealing with proxies).
|
|
5
6
|
* @param fetch The new fetch function to use.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
declare const overrideFetchImplementation: (fetch: (...args: any[]) => any) => void;
|
|
8
9
|
/**
|
|
9
10
|
* @internal
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
+
//#endregion
|
|
13
|
+
export { overrideFetchImplementation };
|
|
14
|
+
//# sourceMappingURL=fetch.d.ts.map
|