@langchain/langgraph-sdk 1.3.1 → 1.4.4
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/package.json +5 -5
- package/CHANGELOG.md +0 -281
- package/dist/_virtual/rolldown_runtime.cjs +0 -25
- package/dist/auth/error.cjs +0 -79
- package/dist/auth/error.cjs.map +0 -1
- package/dist/auth/error.d.cts +0 -13
- package/dist/auth/error.d.cts.map +0 -1
- package/dist/auth/error.d.ts +0 -13
- package/dist/auth/error.d.ts.map +0 -1
- package/dist/auth/error.js +0 -78
- package/dist/auth/error.js.map +0 -1
- package/dist/auth/index.cjs +0 -39
- package/dist/auth/index.cjs.map +0 -1
- package/dist/auth/index.d.cts +0 -31
- package/dist/auth/index.d.cts.map +0 -1
- package/dist/auth/index.d.ts +0 -31
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -37
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/types.d.cts +0 -294
- package/dist/auth/types.d.cts.map +0 -1
- package/dist/auth/types.d.ts +0 -294
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/client.cjs +0 -1219
- package/dist/client.cjs.map +0 -1
- package/dist/client.d.cts +0 -803
- package/dist/client.d.cts.map +0 -1
- package/dist/client.d.ts +0 -803
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -1212
- package/dist/client.js.map +0 -1
- package/dist/index.cjs +0 -6
- package/dist/index.d.cts +0 -7
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -4
- package/dist/logging/index.cjs +0 -35
- package/dist/logging/index.cjs.map +0 -1
- package/dist/logging/index.d.cts +0 -47
- package/dist/logging/index.d.cts.map +0 -1
- package/dist/logging/index.d.ts +0 -47
- package/dist/logging/index.d.ts.map +0 -1
- package/dist/logging/index.js +0 -34
- package/dist/logging/index.js.map +0 -1
- package/dist/react/index.cjs +0 -5
- package/dist/react/index.d.cts +0 -4
- package/dist/react/index.d.ts +0 -4
- package/dist/react/index.js +0 -4
- package/dist/react/stream.cjs +0 -18
- package/dist/react/stream.cjs.map +0 -1
- package/dist/react/stream.custom.cjs +0 -129
- package/dist/react/stream.custom.cjs.map +0 -1
- package/dist/react/stream.custom.d.cts +0 -39
- package/dist/react/stream.custom.d.cts.map +0 -1
- package/dist/react/stream.custom.d.ts +0 -39
- package/dist/react/stream.custom.d.ts.map +0 -1
- package/dist/react/stream.custom.js +0 -127
- package/dist/react/stream.custom.js.map +0 -1
- package/dist/react/stream.d.cts +0 -73
- package/dist/react/stream.d.cts.map +0 -1
- package/dist/react/stream.d.ts +0 -73
- package/dist/react/stream.d.ts.map +0 -1
- package/dist/react/stream.js +0 -17
- package/dist/react/stream.js.map +0 -1
- package/dist/react/stream.lgp.cjs +0 -446
- package/dist/react/stream.lgp.cjs.map +0 -1
- package/dist/react/stream.lgp.js +0 -445
- package/dist/react/stream.lgp.js.map +0 -1
- package/dist/react/thread.cjs +0 -22
- package/dist/react/thread.cjs.map +0 -1
- package/dist/react/thread.js +0 -21
- package/dist/react/thread.js.map +0 -1
- package/dist/react/types.d.cts +0 -363
- package/dist/react/types.d.cts.map +0 -1
- package/dist/react/types.d.ts +0 -363
- package/dist/react/types.d.ts.map +0 -1
- package/dist/react-ui/client.cjs +0 -137
- package/dist/react-ui/client.cjs.map +0 -1
- package/dist/react-ui/client.d.cts +0 -90
- package/dist/react-ui/client.d.cts.map +0 -1
- package/dist/react-ui/client.d.ts +0 -90
- package/dist/react-ui/client.d.ts.map +0 -1
- package/dist/react-ui/client.js +0 -134
- package/dist/react-ui/client.js.map +0 -1
- package/dist/react-ui/index.cjs +0 -14
- package/dist/react-ui/index.cjs.map +0 -1
- package/dist/react-ui/index.d.cts +0 -3
- package/dist/react-ui/index.d.ts +0 -3
- package/dist/react-ui/index.js +0 -9
- package/dist/react-ui/index.js.map +0 -1
- package/dist/react-ui/server/index.cjs +0 -5
- package/dist/react-ui/server/index.d.cts +0 -3
- package/dist/react-ui/server/index.d.ts +0 -3
- package/dist/react-ui/server/index.js +0 -4
- package/dist/react-ui/server/server.cjs +0 -57
- package/dist/react-ui/server/server.cjs.map +0 -1
- package/dist/react-ui/server/server.d.cts +0 -55
- package/dist/react-ui/server/server.d.cts.map +0 -1
- package/dist/react-ui/server/server.d.ts +0 -55
- package/dist/react-ui/server/server.d.ts.map +0 -1
- package/dist/react-ui/server/server.js +0 -56
- package/dist/react-ui/server/server.js.map +0 -1
- package/dist/react-ui/types.cjs +0 -38
- package/dist/react-ui/types.cjs.map +0 -1
- package/dist/react-ui/types.d.cts +0 -25
- package/dist/react-ui/types.d.cts.map +0 -1
- package/dist/react-ui/types.d.ts +0 -25
- package/dist/react-ui/types.d.ts.map +0 -1
- package/dist/react-ui/types.js +0 -35
- package/dist/react-ui/types.js.map +0 -1
- package/dist/schema.d.cts +0 -284
- package/dist/schema.d.cts.map +0 -1
- package/dist/schema.d.ts +0 -284
- package/dist/schema.d.ts.map +0 -1
- package/dist/singletons/fetch.cjs +0 -24
- package/dist/singletons/fetch.cjs.map +0 -1
- package/dist/singletons/fetch.d.cts +0 -14
- package/dist/singletons/fetch.d.cts.map +0 -1
- package/dist/singletons/fetch.d.ts +0 -14
- package/dist/singletons/fetch.d.ts.map +0 -1
- package/dist/singletons/fetch.js +0 -22
- package/dist/singletons/fetch.js.map +0 -1
- package/dist/types.d.cts +0 -187
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.ts +0 -187
- package/dist/types.d.ts.map +0 -1
- package/dist/types.messages.d.cts +0 -91
- package/dist/types.messages.d.cts.map +0 -1
- package/dist/types.messages.d.ts +0 -91
- package/dist/types.messages.d.ts.map +0 -1
- package/dist/types.stream.d.cts +0 -235
- package/dist/types.stream.d.cts.map +0 -1
- package/dist/types.stream.d.ts +0 -235
- package/dist/types.stream.d.ts.map +0 -1
- package/dist/ui/branching.cjs +0 -153
- package/dist/ui/branching.cjs.map +0 -1
- package/dist/ui/branching.d.cts +0 -22
- package/dist/ui/branching.d.cts.map +0 -1
- package/dist/ui/branching.d.ts +0 -22
- package/dist/ui/branching.d.ts.map +0 -1
- package/dist/ui/branching.js +0 -152
- package/dist/ui/branching.js.map +0 -1
- package/dist/ui/errors.cjs +0 -15
- package/dist/ui/errors.cjs.map +0 -1
- package/dist/ui/errors.js +0 -14
- package/dist/ui/errors.js.map +0 -1
- package/dist/ui/manager.cjs +0 -182
- package/dist/ui/manager.cjs.map +0 -1
- package/dist/ui/manager.js +0 -182
- package/dist/ui/manager.js.map +0 -1
- package/dist/ui/messages.cjs +0 -70
- package/dist/ui/messages.cjs.map +0 -1
- package/dist/ui/messages.js +0 -68
- package/dist/ui/messages.js.map +0 -1
- package/dist/ui/utils.cjs +0 -14
- package/dist/ui/utils.cjs.map +0 -1
- package/dist/ui/utils.js +0 -12
- package/dist/ui/utils.js.map +0 -1
- package/dist/utils/async_caller.cjs +0 -111
- package/dist/utils/async_caller.cjs.map +0 -1
- package/dist/utils/async_caller.d.cts +0 -53
- package/dist/utils/async_caller.d.cts.map +0 -1
- package/dist/utils/async_caller.d.ts +0 -53
- package/dist/utils/async_caller.d.ts.map +0 -1
- package/dist/utils/async_caller.js +0 -110
- package/dist/utils/async_caller.js.map +0 -1
- package/dist/utils/env.cjs +0 -13
- package/dist/utils/env.cjs.map +0 -1
- package/dist/utils/env.js +0 -12
- package/dist/utils/env.js.map +0 -1
- package/dist/utils/error.cjs +0 -17
- package/dist/utils/error.cjs.map +0 -1
- package/dist/utils/error.js +0 -16
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/signals.cjs +0 -20
- package/dist/utils/signals.cjs.map +0 -1
- package/dist/utils/signals.js +0 -19
- package/dist/utils/signals.js.map +0 -1
- package/dist/utils/sse.cjs +0 -124
- package/dist/utils/sse.cjs.map +0 -1
- package/dist/utils/sse.js +0 -122
- package/dist/utils/sse.js.map +0 -1
- package/dist/utils/stream.cjs +0 -176
- package/dist/utils/stream.cjs.map +0 -1
- package/dist/utils/stream.js +0 -175
- package/dist/utils/stream.js.map +0 -1
package/dist/client.cjs
DELETED
|
@@ -1,1219 +0,0 @@
|
|
|
1
|
-
const require_async_caller = require('./utils/async_caller.cjs');
|
|
2
|
-
const require_env = require('./utils/env.cjs');
|
|
3
|
-
const require_signals = require('./utils/signals.cjs');
|
|
4
|
-
const require_sse = require('./utils/sse.cjs');
|
|
5
|
-
const require_stream = require('./utils/stream.cjs');
|
|
6
|
-
|
|
7
|
-
//#region src/client.ts
|
|
8
|
-
function* iterateHeaders(headers) {
|
|
9
|
-
let iter;
|
|
10
|
-
let shouldClear = false;
|
|
11
|
-
if (headers instanceof Headers) {
|
|
12
|
-
const entries = [];
|
|
13
|
-
headers.forEach((value, name) => {
|
|
14
|
-
entries.push([name, value]);
|
|
15
|
-
});
|
|
16
|
-
iter = entries;
|
|
17
|
-
} else if (Array.isArray(headers)) iter = headers;
|
|
18
|
-
else {
|
|
19
|
-
shouldClear = true;
|
|
20
|
-
iter = Object.entries(headers ?? {});
|
|
21
|
-
}
|
|
22
|
-
for (const item of iter) {
|
|
23
|
-
const name = item[0];
|
|
24
|
-
if (typeof name !== "string") throw new TypeError(`Expected header name to be a string, got ${typeof name}`);
|
|
25
|
-
const values = Array.isArray(item[1]) ? item[1] : [item[1]];
|
|
26
|
-
let didClear = false;
|
|
27
|
-
for (const value of values) {
|
|
28
|
-
if (value === void 0) continue;
|
|
29
|
-
if (shouldClear && !didClear) {
|
|
30
|
-
didClear = true;
|
|
31
|
-
yield [name, null];
|
|
32
|
-
}
|
|
33
|
-
yield [name, value];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function mergeHeaders(...headerObjects) {
|
|
38
|
-
const outputHeaders = new Headers();
|
|
39
|
-
for (const headers of headerObjects) {
|
|
40
|
-
if (!headers) continue;
|
|
41
|
-
for (const [name, value] of iterateHeaders(headers)) if (value === null) outputHeaders.delete(name);
|
|
42
|
-
else outputHeaders.append(name, value);
|
|
43
|
-
}
|
|
44
|
-
const headerEntries = [];
|
|
45
|
-
outputHeaders.forEach((value, name) => {
|
|
46
|
-
headerEntries.push([name, value]);
|
|
47
|
-
});
|
|
48
|
-
return Object.fromEntries(headerEntries);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Get the API key from the environment.
|
|
52
|
-
* Precedence:
|
|
53
|
-
* 1. explicit argument (if string)
|
|
54
|
-
* 2. LANGGRAPH_API_KEY
|
|
55
|
-
* 3. LANGSMITH_API_KEY
|
|
56
|
-
* 4. LANGCHAIN_API_KEY
|
|
57
|
-
*
|
|
58
|
-
* @param apiKey - API key provided as an argument. If null, skips environment lookup. If undefined, tries environment.
|
|
59
|
-
* @returns The API key if found, otherwise undefined
|
|
60
|
-
*/
|
|
61
|
-
function getApiKey(apiKey) {
|
|
62
|
-
if (apiKey === null) return void 0;
|
|
63
|
-
if (apiKey) return apiKey;
|
|
64
|
-
const prefixes = [
|
|
65
|
-
"LANGGRAPH",
|
|
66
|
-
"LANGSMITH",
|
|
67
|
-
"LANGCHAIN"
|
|
68
|
-
];
|
|
69
|
-
for (const prefix of prefixes) {
|
|
70
|
-
const envKey = require_env.getEnvironmentVariable(`${prefix}_API_KEY`);
|
|
71
|
-
if (envKey) return envKey.trim().replace(/^["']|["']$/g, "");
|
|
72
|
-
}
|
|
73
|
-
return void 0;
|
|
74
|
-
}
|
|
75
|
-
const REGEX_RUN_METADATA = /(\/threads\/(?<thread_id>.+))?\/runs\/(?<run_id>.+)/;
|
|
76
|
-
function getRunMetadataFromResponse(response) {
|
|
77
|
-
const contentLocation = response.headers.get("Content-Location");
|
|
78
|
-
if (!contentLocation) return void 0;
|
|
79
|
-
const match = REGEX_RUN_METADATA.exec(contentLocation);
|
|
80
|
-
if (!match?.groups?.run_id) return void 0;
|
|
81
|
-
return {
|
|
82
|
-
run_id: match.groups.run_id,
|
|
83
|
-
thread_id: match.groups.thread_id || void 0
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
var BaseClient = class {
|
|
87
|
-
asyncCaller;
|
|
88
|
-
timeoutMs;
|
|
89
|
-
apiUrl;
|
|
90
|
-
defaultHeaders;
|
|
91
|
-
onRequest;
|
|
92
|
-
constructor(config) {
|
|
93
|
-
const callerOptions = {
|
|
94
|
-
maxRetries: 4,
|
|
95
|
-
maxConcurrency: 4,
|
|
96
|
-
...config?.callerOptions
|
|
97
|
-
};
|
|
98
|
-
let defaultApiUrl = "http://localhost:8123";
|
|
99
|
-
if (!config?.apiUrl && typeof globalThis === "object" && globalThis != null) {
|
|
100
|
-
const fetchSmb = Symbol.for("langgraph_api:fetch");
|
|
101
|
-
const urlSmb = Symbol.for("langgraph_api:url");
|
|
102
|
-
const global = globalThis;
|
|
103
|
-
if (global[fetchSmb]) callerOptions.fetch ??= global[fetchSmb];
|
|
104
|
-
if (global[urlSmb]) defaultApiUrl = global[urlSmb];
|
|
105
|
-
}
|
|
106
|
-
this.asyncCaller = new require_async_caller.AsyncCaller(callerOptions);
|
|
107
|
-
this.timeoutMs = config?.timeoutMs;
|
|
108
|
-
this.apiUrl = config?.apiUrl?.replace(/\/$/, "") || defaultApiUrl;
|
|
109
|
-
this.defaultHeaders = config?.defaultHeaders || {};
|
|
110
|
-
this.onRequest = config?.onRequest;
|
|
111
|
-
const apiKey = getApiKey(config?.apiKey);
|
|
112
|
-
if (apiKey) this.defaultHeaders["x-api-key"] = apiKey;
|
|
113
|
-
}
|
|
114
|
-
prepareFetchOptions(path, options) {
|
|
115
|
-
const mutatedOptions = {
|
|
116
|
-
...options,
|
|
117
|
-
headers: mergeHeaders(this.defaultHeaders, options?.headers)
|
|
118
|
-
};
|
|
119
|
-
if (mutatedOptions.json) {
|
|
120
|
-
mutatedOptions.body = JSON.stringify(mutatedOptions.json);
|
|
121
|
-
mutatedOptions.headers = mergeHeaders(mutatedOptions.headers, { "content-type": "application/json" });
|
|
122
|
-
delete mutatedOptions.json;
|
|
123
|
-
}
|
|
124
|
-
if (mutatedOptions.withResponse) delete mutatedOptions.withResponse;
|
|
125
|
-
let timeoutSignal = null;
|
|
126
|
-
if (typeof options?.timeoutMs !== "undefined") {
|
|
127
|
-
if (options.timeoutMs != null) timeoutSignal = AbortSignal.timeout(options.timeoutMs);
|
|
128
|
-
} else if (this.timeoutMs != null) timeoutSignal = AbortSignal.timeout(this.timeoutMs);
|
|
129
|
-
mutatedOptions.signal = require_signals.mergeSignals(timeoutSignal, mutatedOptions.signal);
|
|
130
|
-
const targetUrl = new URL(`${this.apiUrl}${path}`);
|
|
131
|
-
if (mutatedOptions.params) {
|
|
132
|
-
for (const [key, value] of Object.entries(mutatedOptions.params)) {
|
|
133
|
-
if (value == null) continue;
|
|
134
|
-
const strValue = typeof value === "string" || typeof value === "number" ? value.toString() : JSON.stringify(value);
|
|
135
|
-
targetUrl.searchParams.append(key, strValue);
|
|
136
|
-
}
|
|
137
|
-
delete mutatedOptions.params;
|
|
138
|
-
}
|
|
139
|
-
return [targetUrl, mutatedOptions];
|
|
140
|
-
}
|
|
141
|
-
async fetch(path, options) {
|
|
142
|
-
const [url, init] = this.prepareFetchOptions(path, options);
|
|
143
|
-
let finalInit = init;
|
|
144
|
-
if (this.onRequest) finalInit = await this.onRequest(url, init);
|
|
145
|
-
const response = await this.asyncCaller.fetch(url, finalInit);
|
|
146
|
-
const body = (() => {
|
|
147
|
-
if (response.status === 202 || response.status === 204) return void 0;
|
|
148
|
-
return response.json();
|
|
149
|
-
})();
|
|
150
|
-
if (options?.withResponse) return [await body, response];
|
|
151
|
-
return body;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Protected helper for streaming with automatic retry logic.
|
|
155
|
-
* Handles both initial requests and reconnections with SSE.
|
|
156
|
-
*/
|
|
157
|
-
async *streamWithRetry(config) {
|
|
158
|
-
const makeRequest = async (reconnectParams) => {
|
|
159
|
-
const requestEndpoint = reconnectParams?.reconnectPath || config.endpoint;
|
|
160
|
-
const isReconnect = !!reconnectParams?.lastEventId;
|
|
161
|
-
const method = isReconnect ? "GET" : config.method || "GET";
|
|
162
|
-
const requestHeaders = isReconnect && reconnectParams?.lastEventId ? {
|
|
163
|
-
...config.headers,
|
|
164
|
-
"Last-Event-ID": reconnectParams.lastEventId
|
|
165
|
-
} : config.headers;
|
|
166
|
-
let [url, init] = this.prepareFetchOptions(requestEndpoint, {
|
|
167
|
-
method,
|
|
168
|
-
timeoutMs: null,
|
|
169
|
-
signal: config.signal,
|
|
170
|
-
headers: requestHeaders,
|
|
171
|
-
params: config.params,
|
|
172
|
-
json: isReconnect ? void 0 : config.json
|
|
173
|
-
});
|
|
174
|
-
if (this.onRequest != null) init = await this.onRequest(url, init);
|
|
175
|
-
const response = await this.asyncCaller.fetch(url, init);
|
|
176
|
-
if (!isReconnect && config.onInitialResponse) await config.onInitialResponse(response);
|
|
177
|
-
const stream = (response.body || new ReadableStream({ start: (ctrl) => ctrl.close() })).pipeThrough(require_sse.BytesLineDecoder()).pipeThrough(require_sse.SSEDecoder());
|
|
178
|
-
return {
|
|
179
|
-
response,
|
|
180
|
-
stream
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
yield* require_stream.streamWithRetry(makeRequest, {
|
|
184
|
-
maxRetries: config.maxRetries ?? 5,
|
|
185
|
-
signal: config.signal,
|
|
186
|
-
onReconnect: config.onReconnect
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
var CronsClient = class extends BaseClient {
|
|
191
|
-
/**
|
|
192
|
-
*
|
|
193
|
-
* @param threadId The ID of the thread.
|
|
194
|
-
* @param assistantId Assistant ID to use for this cron job.
|
|
195
|
-
* @param payload Payload for creating a cron job.
|
|
196
|
-
* @returns The created background run.
|
|
197
|
-
*/
|
|
198
|
-
async createForThread(threadId, assistantId, payload) {
|
|
199
|
-
const json = {
|
|
200
|
-
schedule: payload?.schedule,
|
|
201
|
-
input: payload?.input,
|
|
202
|
-
config: payload?.config,
|
|
203
|
-
context: payload?.context,
|
|
204
|
-
metadata: payload?.metadata,
|
|
205
|
-
assistant_id: assistantId,
|
|
206
|
-
interrupt_before: payload?.interruptBefore,
|
|
207
|
-
interrupt_after: payload?.interruptAfter,
|
|
208
|
-
webhook: payload?.webhook,
|
|
209
|
-
multitask_strategy: payload?.multitaskStrategy,
|
|
210
|
-
if_not_exists: payload?.ifNotExists,
|
|
211
|
-
checkpoint_during: payload?.checkpointDuring,
|
|
212
|
-
durability: payload?.durability
|
|
213
|
-
};
|
|
214
|
-
return this.fetch(`/threads/${threadId}/runs/crons`, {
|
|
215
|
-
method: "POST",
|
|
216
|
-
json,
|
|
217
|
-
signal: payload?.signal
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
*
|
|
222
|
-
* @param assistantId Assistant ID to use for this cron job.
|
|
223
|
-
* @param payload Payload for creating a cron job.
|
|
224
|
-
* @returns
|
|
225
|
-
*/
|
|
226
|
-
async create(assistantId, payload) {
|
|
227
|
-
const json = {
|
|
228
|
-
schedule: payload?.schedule,
|
|
229
|
-
input: payload?.input,
|
|
230
|
-
config: payload?.config,
|
|
231
|
-
context: payload?.context,
|
|
232
|
-
metadata: payload?.metadata,
|
|
233
|
-
assistant_id: assistantId,
|
|
234
|
-
interrupt_before: payload?.interruptBefore,
|
|
235
|
-
interrupt_after: payload?.interruptAfter,
|
|
236
|
-
webhook: payload?.webhook,
|
|
237
|
-
multitask_strategy: payload?.multitaskStrategy,
|
|
238
|
-
if_not_exists: payload?.ifNotExists,
|
|
239
|
-
checkpoint_during: payload?.checkpointDuring,
|
|
240
|
-
durability: payload?.durability
|
|
241
|
-
};
|
|
242
|
-
return this.fetch(`/runs/crons`, {
|
|
243
|
-
method: "POST",
|
|
244
|
-
json,
|
|
245
|
-
signal: payload?.signal
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
*
|
|
250
|
-
* @param cronId Cron ID of Cron job to delete.
|
|
251
|
-
*/
|
|
252
|
-
async delete(cronId, options) {
|
|
253
|
-
await this.fetch(`/runs/crons/${cronId}`, {
|
|
254
|
-
method: "DELETE",
|
|
255
|
-
signal: options?.signal
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
*
|
|
260
|
-
* @param query Query options.
|
|
261
|
-
* @returns List of crons.
|
|
262
|
-
*/
|
|
263
|
-
async search(query) {
|
|
264
|
-
return this.fetch("/runs/crons/search", {
|
|
265
|
-
method: "POST",
|
|
266
|
-
json: {
|
|
267
|
-
assistant_id: query?.assistantId ?? void 0,
|
|
268
|
-
thread_id: query?.threadId ?? void 0,
|
|
269
|
-
limit: query?.limit ?? 10,
|
|
270
|
-
offset: query?.offset ?? 0,
|
|
271
|
-
sort_by: query?.sortBy ?? void 0,
|
|
272
|
-
sort_order: query?.sortOrder ?? void 0,
|
|
273
|
-
select: query?.select ?? void 0
|
|
274
|
-
},
|
|
275
|
-
signal: query?.signal
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Count cron jobs matching filters.
|
|
280
|
-
*
|
|
281
|
-
* @param query.assistantId Assistant ID to filter by.
|
|
282
|
-
* @param query.threadId Thread ID to filter by.
|
|
283
|
-
* @returns Number of cron jobs matching the criteria.
|
|
284
|
-
*/
|
|
285
|
-
async count(query) {
|
|
286
|
-
return this.fetch(`/runs/crons/count`, {
|
|
287
|
-
method: "POST",
|
|
288
|
-
json: {
|
|
289
|
-
assistant_id: query?.assistantId ?? void 0,
|
|
290
|
-
thread_id: query?.threadId ?? void 0
|
|
291
|
-
},
|
|
292
|
-
signal: query?.signal
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
var AssistantsClient = class extends BaseClient {
|
|
297
|
-
/**
|
|
298
|
-
* Get an assistant by ID.
|
|
299
|
-
*
|
|
300
|
-
* @param assistantId The ID of the assistant.
|
|
301
|
-
* @returns Assistant
|
|
302
|
-
*/
|
|
303
|
-
async get(assistantId, options) {
|
|
304
|
-
return this.fetch(`/assistants/${assistantId}`, { signal: options?.signal });
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Get the JSON representation of the graph assigned to a runnable
|
|
308
|
-
* @param assistantId The ID of the assistant.
|
|
309
|
-
* @param options.xray Whether to include subgraphs in the serialized graph representation. If an integer value is provided, only subgraphs with a depth less than or equal to the value will be included.
|
|
310
|
-
* @returns Serialized graph
|
|
311
|
-
*/
|
|
312
|
-
async getGraph(assistantId, options) {
|
|
313
|
-
return this.fetch(`/assistants/${assistantId}/graph`, {
|
|
314
|
-
params: { xray: options?.xray },
|
|
315
|
-
signal: options?.signal
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Get the state and config schema of the graph assigned to a runnable
|
|
320
|
-
* @param assistantId The ID of the assistant.
|
|
321
|
-
* @returns Graph schema
|
|
322
|
-
*/
|
|
323
|
-
async getSchemas(assistantId, options) {
|
|
324
|
-
return this.fetch(`/assistants/${assistantId}/schemas`, { signal: options?.signal });
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Get the schemas of an assistant by ID.
|
|
328
|
-
*
|
|
329
|
-
* @param assistantId The ID of the assistant to get the schema of.
|
|
330
|
-
* @param options Additional options for getting subgraphs, such as namespace or recursion extraction.
|
|
331
|
-
* @returns The subgraphs of the assistant.
|
|
332
|
-
*/
|
|
333
|
-
async getSubgraphs(assistantId, options) {
|
|
334
|
-
if (options?.namespace) return this.fetch(`/assistants/${assistantId}/subgraphs/${options.namespace}`, {
|
|
335
|
-
params: { recurse: options?.recurse },
|
|
336
|
-
signal: options?.signal
|
|
337
|
-
});
|
|
338
|
-
return this.fetch(`/assistants/${assistantId}/subgraphs`, {
|
|
339
|
-
params: { recurse: options?.recurse },
|
|
340
|
-
signal: options?.signal
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Create a new assistant.
|
|
345
|
-
* @param payload Payload for creating an assistant.
|
|
346
|
-
* @returns The created assistant.
|
|
347
|
-
*/
|
|
348
|
-
async create(payload) {
|
|
349
|
-
return this.fetch("/assistants", {
|
|
350
|
-
method: "POST",
|
|
351
|
-
json: {
|
|
352
|
-
graph_id: payload.graphId,
|
|
353
|
-
config: payload.config,
|
|
354
|
-
context: payload.context,
|
|
355
|
-
metadata: payload.metadata,
|
|
356
|
-
assistant_id: payload.assistantId,
|
|
357
|
-
if_exists: payload.ifExists,
|
|
358
|
-
name: payload.name,
|
|
359
|
-
description: payload.description
|
|
360
|
-
},
|
|
361
|
-
signal: payload.signal
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Update an assistant.
|
|
366
|
-
* @param assistantId ID of the assistant.
|
|
367
|
-
* @param payload Payload for updating the assistant.
|
|
368
|
-
* @returns The updated assistant.
|
|
369
|
-
*/
|
|
370
|
-
async update(assistantId, payload) {
|
|
371
|
-
return this.fetch(`/assistants/${assistantId}`, {
|
|
372
|
-
method: "PATCH",
|
|
373
|
-
json: {
|
|
374
|
-
graph_id: payload.graphId,
|
|
375
|
-
config: payload.config,
|
|
376
|
-
context: payload.context,
|
|
377
|
-
metadata: payload.metadata,
|
|
378
|
-
name: payload.name,
|
|
379
|
-
description: payload.description
|
|
380
|
-
},
|
|
381
|
-
signal: payload.signal
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* Delete an assistant.
|
|
386
|
-
*
|
|
387
|
-
* @param assistantId ID of the assistant.
|
|
388
|
-
*/
|
|
389
|
-
async delete(assistantId, options) {
|
|
390
|
-
return this.fetch(`/assistants/${assistantId}`, {
|
|
391
|
-
method: "DELETE",
|
|
392
|
-
signal: options?.signal
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
async search(query) {
|
|
396
|
-
const json = {
|
|
397
|
-
graph_id: query?.graphId ?? void 0,
|
|
398
|
-
name: query?.name ?? void 0,
|
|
399
|
-
metadata: query?.metadata ?? void 0,
|
|
400
|
-
limit: query?.limit ?? 10,
|
|
401
|
-
offset: query?.offset ?? 0,
|
|
402
|
-
sort_by: query?.sortBy ?? void 0,
|
|
403
|
-
sort_order: query?.sortOrder ?? void 0,
|
|
404
|
-
select: query?.select ?? void 0
|
|
405
|
-
};
|
|
406
|
-
const [assistants, response] = await this.fetch("/assistants/search", {
|
|
407
|
-
method: "POST",
|
|
408
|
-
json,
|
|
409
|
-
withResponse: true,
|
|
410
|
-
signal: query?.signal
|
|
411
|
-
});
|
|
412
|
-
if (query?.includePagination) {
|
|
413
|
-
const next = response.headers.get("X-Pagination-Next");
|
|
414
|
-
return {
|
|
415
|
-
assistants,
|
|
416
|
-
next
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
return assistants;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Count assistants matching filters.
|
|
423
|
-
*
|
|
424
|
-
* @param query.metadata Metadata to filter by. Exact match for each key/value.
|
|
425
|
-
* @param query.graphId Optional graph id to filter by.
|
|
426
|
-
* @param query.name Optional name to filter by.
|
|
427
|
-
* @returns Number of assistants matching the criteria.
|
|
428
|
-
*/
|
|
429
|
-
async count(query) {
|
|
430
|
-
return this.fetch(`/assistants/count`, {
|
|
431
|
-
method: "POST",
|
|
432
|
-
json: {
|
|
433
|
-
metadata: query?.metadata ?? void 0,
|
|
434
|
-
graph_id: query?.graphId ?? void 0,
|
|
435
|
-
name: query?.name ?? void 0
|
|
436
|
-
},
|
|
437
|
-
signal: query?.signal
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* List all versions of an assistant.
|
|
442
|
-
*
|
|
443
|
-
* @param assistantId ID of the assistant.
|
|
444
|
-
* @returns List of assistant versions.
|
|
445
|
-
*/
|
|
446
|
-
async getVersions(assistantId, payload) {
|
|
447
|
-
return this.fetch(`/assistants/${assistantId}/versions`, {
|
|
448
|
-
method: "POST",
|
|
449
|
-
json: {
|
|
450
|
-
metadata: payload?.metadata ?? void 0,
|
|
451
|
-
limit: payload?.limit ?? 10,
|
|
452
|
-
offset: payload?.offset ?? 0
|
|
453
|
-
},
|
|
454
|
-
signal: payload?.signal
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Change the version of an assistant.
|
|
459
|
-
*
|
|
460
|
-
* @param assistantId ID of the assistant.
|
|
461
|
-
* @param version The version to change to.
|
|
462
|
-
* @returns The updated assistant.
|
|
463
|
-
*/
|
|
464
|
-
async setLatest(assistantId, version, options) {
|
|
465
|
-
return this.fetch(`/assistants/${assistantId}/latest`, {
|
|
466
|
-
method: "POST",
|
|
467
|
-
json: { version },
|
|
468
|
-
signal: options?.signal
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
};
|
|
472
|
-
var ThreadsClient = class extends BaseClient {
|
|
473
|
-
/**
|
|
474
|
-
* Get a thread by ID.
|
|
475
|
-
*
|
|
476
|
-
* @param threadId ID of the thread.
|
|
477
|
-
* @returns The thread.
|
|
478
|
-
*/
|
|
479
|
-
async get(threadId, options) {
|
|
480
|
-
return this.fetch(`/threads/${threadId}`, { signal: options?.signal });
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* Create a new thread.
|
|
484
|
-
*
|
|
485
|
-
* @param payload Payload for creating a thread.
|
|
486
|
-
* @returns The created thread.
|
|
487
|
-
*/
|
|
488
|
-
async create(payload) {
|
|
489
|
-
const ttlPayload = typeof payload?.ttl === "number" ? {
|
|
490
|
-
ttl: payload.ttl,
|
|
491
|
-
strategy: "delete"
|
|
492
|
-
} : payload?.ttl;
|
|
493
|
-
return this.fetch(`/threads`, {
|
|
494
|
-
method: "POST",
|
|
495
|
-
json: {
|
|
496
|
-
metadata: {
|
|
497
|
-
...payload?.metadata,
|
|
498
|
-
graph_id: payload?.graphId
|
|
499
|
-
},
|
|
500
|
-
thread_id: payload?.threadId,
|
|
501
|
-
if_exists: payload?.ifExists,
|
|
502
|
-
supersteps: payload?.supersteps?.map((s) => ({ updates: s.updates.map((u) => ({
|
|
503
|
-
values: u.values,
|
|
504
|
-
command: u.command,
|
|
505
|
-
as_node: u.asNode
|
|
506
|
-
})) })),
|
|
507
|
-
ttl: ttlPayload
|
|
508
|
-
},
|
|
509
|
-
signal: payload?.signal
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Copy an existing thread
|
|
514
|
-
* @param threadId ID of the thread to be copied
|
|
515
|
-
* @returns Newly copied thread
|
|
516
|
-
*/
|
|
517
|
-
async copy(threadId, options) {
|
|
518
|
-
return this.fetch(`/threads/${threadId}/copy`, {
|
|
519
|
-
method: "POST",
|
|
520
|
-
signal: options?.signal
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* Update a thread.
|
|
525
|
-
*
|
|
526
|
-
* @param threadId ID of the thread.
|
|
527
|
-
* @param payload Payload for updating the thread.
|
|
528
|
-
* @returns The updated thread.
|
|
529
|
-
*/
|
|
530
|
-
async update(threadId, payload) {
|
|
531
|
-
const ttlPayload = typeof payload?.ttl === "number" ? {
|
|
532
|
-
ttl: payload.ttl,
|
|
533
|
-
strategy: "delete"
|
|
534
|
-
} : payload?.ttl;
|
|
535
|
-
return this.fetch(`/threads/${threadId}`, {
|
|
536
|
-
method: "PATCH",
|
|
537
|
-
json: {
|
|
538
|
-
metadata: payload?.metadata,
|
|
539
|
-
ttl: ttlPayload
|
|
540
|
-
},
|
|
541
|
-
signal: payload?.signal
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
/**
|
|
545
|
-
* Delete a thread.
|
|
546
|
-
*
|
|
547
|
-
* @param threadId ID of the thread.
|
|
548
|
-
*/
|
|
549
|
-
async delete(threadId, options) {
|
|
550
|
-
return this.fetch(`/threads/${threadId}`, {
|
|
551
|
-
method: "DELETE",
|
|
552
|
-
signal: options?.signal
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* List threads
|
|
557
|
-
*
|
|
558
|
-
* @param query Query options
|
|
559
|
-
* @returns List of threads
|
|
560
|
-
*/
|
|
561
|
-
async search(query) {
|
|
562
|
-
return this.fetch("/threads/search", {
|
|
563
|
-
method: "POST",
|
|
564
|
-
json: {
|
|
565
|
-
metadata: query?.metadata ?? void 0,
|
|
566
|
-
ids: query?.ids ?? void 0,
|
|
567
|
-
limit: query?.limit ?? 10,
|
|
568
|
-
offset: query?.offset ?? 0,
|
|
569
|
-
status: query?.status,
|
|
570
|
-
sort_by: query?.sortBy,
|
|
571
|
-
sort_order: query?.sortOrder,
|
|
572
|
-
select: query?.select ?? void 0,
|
|
573
|
-
values: query?.values ?? void 0
|
|
574
|
-
},
|
|
575
|
-
signal: query?.signal
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* Count threads matching filters.
|
|
580
|
-
*
|
|
581
|
-
* @param query.metadata Thread metadata to filter on.
|
|
582
|
-
* @param query.values State values to filter on.
|
|
583
|
-
* @param query.status Thread status to filter on.
|
|
584
|
-
* @returns Number of threads matching the criteria.
|
|
585
|
-
*/
|
|
586
|
-
async count(query) {
|
|
587
|
-
return this.fetch(`/threads/count`, {
|
|
588
|
-
method: "POST",
|
|
589
|
-
json: {
|
|
590
|
-
metadata: query?.metadata ?? void 0,
|
|
591
|
-
values: query?.values ?? void 0,
|
|
592
|
-
status: query?.status ?? void 0
|
|
593
|
-
},
|
|
594
|
-
signal: query?.signal
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Get state for a thread.
|
|
599
|
-
*
|
|
600
|
-
* @param threadId ID of the thread.
|
|
601
|
-
* @returns Thread state.
|
|
602
|
-
*/
|
|
603
|
-
async getState(threadId, checkpoint, options) {
|
|
604
|
-
if (checkpoint != null) {
|
|
605
|
-
if (typeof checkpoint !== "string") return this.fetch(`/threads/${threadId}/state/checkpoint`, {
|
|
606
|
-
method: "POST",
|
|
607
|
-
json: {
|
|
608
|
-
checkpoint,
|
|
609
|
-
subgraphs: options?.subgraphs
|
|
610
|
-
},
|
|
611
|
-
signal: options?.signal
|
|
612
|
-
});
|
|
613
|
-
return this.fetch(`/threads/${threadId}/state/${checkpoint}`, {
|
|
614
|
-
params: { subgraphs: options?.subgraphs },
|
|
615
|
-
signal: options?.signal
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
return this.fetch(`/threads/${threadId}/state`, {
|
|
619
|
-
params: { subgraphs: options?.subgraphs },
|
|
620
|
-
signal: options?.signal
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* Add state to a thread.
|
|
625
|
-
*
|
|
626
|
-
* @param threadId The ID of the thread.
|
|
627
|
-
* @returns
|
|
628
|
-
*/
|
|
629
|
-
async updateState(threadId, options) {
|
|
630
|
-
return this.fetch(`/threads/${threadId}/state`, {
|
|
631
|
-
method: "POST",
|
|
632
|
-
json: {
|
|
633
|
-
values: options.values,
|
|
634
|
-
checkpoint_id: options.checkpointId,
|
|
635
|
-
checkpoint: options.checkpoint,
|
|
636
|
-
as_node: options?.asNode
|
|
637
|
-
},
|
|
638
|
-
signal: options?.signal
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
/**
|
|
642
|
-
* Patch the metadata of a thread.
|
|
643
|
-
*
|
|
644
|
-
* @param threadIdOrConfig Thread ID or config to patch the state of.
|
|
645
|
-
* @param metadata Metadata to patch the state with.
|
|
646
|
-
*/
|
|
647
|
-
async patchState(threadIdOrConfig, metadata, options) {
|
|
648
|
-
let threadId;
|
|
649
|
-
if (typeof threadIdOrConfig !== "string") {
|
|
650
|
-
if (typeof threadIdOrConfig.configurable?.thread_id !== "string") throw new Error("Thread ID is required when updating state with a config.");
|
|
651
|
-
threadId = threadIdOrConfig.configurable.thread_id;
|
|
652
|
-
} else threadId = threadIdOrConfig;
|
|
653
|
-
return this.fetch(`/threads/${threadId}/state`, {
|
|
654
|
-
method: "PATCH",
|
|
655
|
-
json: { metadata },
|
|
656
|
-
signal: options?.signal
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* Get all past states for a thread.
|
|
661
|
-
*
|
|
662
|
-
* @param threadId ID of the thread.
|
|
663
|
-
* @param options Additional options.
|
|
664
|
-
* @returns List of thread states.
|
|
665
|
-
*/
|
|
666
|
-
async getHistory(threadId, options) {
|
|
667
|
-
return this.fetch(`/threads/${threadId}/history`, {
|
|
668
|
-
method: "POST",
|
|
669
|
-
json: {
|
|
670
|
-
limit: options?.limit ?? 10,
|
|
671
|
-
before: options?.before,
|
|
672
|
-
metadata: options?.metadata,
|
|
673
|
-
checkpoint: options?.checkpoint
|
|
674
|
-
},
|
|
675
|
-
signal: options?.signal
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
async *joinStream(threadId, options) {
|
|
679
|
-
yield* this.streamWithRetry({
|
|
680
|
-
endpoint: `/threads/${threadId}/stream`,
|
|
681
|
-
method: "GET",
|
|
682
|
-
signal: options?.signal,
|
|
683
|
-
headers: options?.lastEventId ? { "Last-Event-ID": options.lastEventId } : void 0,
|
|
684
|
-
params: options?.streamMode ? { stream_mode: options.streamMode } : void 0
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
|
-
var RunsClient = class extends BaseClient {
|
|
689
|
-
/**
|
|
690
|
-
* Create a run and stream the results.
|
|
691
|
-
*
|
|
692
|
-
* @param threadId The ID of the thread.
|
|
693
|
-
* @param assistantId Assistant ID to use for this run.
|
|
694
|
-
* @param payload Payload for creating a run.
|
|
695
|
-
*/
|
|
696
|
-
async *stream(threadId, assistantId, payload) {
|
|
697
|
-
const json = {
|
|
698
|
-
input: payload?.input,
|
|
699
|
-
command: payload?.command,
|
|
700
|
-
config: payload?.config,
|
|
701
|
-
context: payload?.context,
|
|
702
|
-
metadata: payload?.metadata,
|
|
703
|
-
stream_mode: payload?.streamMode,
|
|
704
|
-
stream_subgraphs: payload?.streamSubgraphs,
|
|
705
|
-
stream_resumable: payload?.streamResumable,
|
|
706
|
-
feedback_keys: payload?.feedbackKeys,
|
|
707
|
-
assistant_id: assistantId,
|
|
708
|
-
interrupt_before: payload?.interruptBefore,
|
|
709
|
-
interrupt_after: payload?.interruptAfter,
|
|
710
|
-
checkpoint: payload?.checkpoint,
|
|
711
|
-
checkpoint_id: payload?.checkpointId,
|
|
712
|
-
webhook: payload?.webhook,
|
|
713
|
-
multitask_strategy: payload?.multitaskStrategy,
|
|
714
|
-
on_completion: payload?.onCompletion,
|
|
715
|
-
on_disconnect: payload?.onDisconnect,
|
|
716
|
-
after_seconds: payload?.afterSeconds,
|
|
717
|
-
if_not_exists: payload?.ifNotExists,
|
|
718
|
-
checkpoint_during: payload?.checkpointDuring,
|
|
719
|
-
durability: payload?.durability
|
|
720
|
-
};
|
|
721
|
-
yield* this.streamWithRetry({
|
|
722
|
-
endpoint: threadId == null ? `/runs/stream` : `/threads/${threadId}/runs/stream`,
|
|
723
|
-
method: "POST",
|
|
724
|
-
json,
|
|
725
|
-
signal: payload?.signal,
|
|
726
|
-
onInitialResponse: (response) => {
|
|
727
|
-
const runMetadata = getRunMetadataFromResponse(response);
|
|
728
|
-
if (runMetadata) payload?.onRunCreated?.(runMetadata);
|
|
729
|
-
}
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
/**
|
|
733
|
-
* Create a run.
|
|
734
|
-
*
|
|
735
|
-
* @param threadId The ID of the thread.
|
|
736
|
-
* @param assistantId Assistant ID to use for this run.
|
|
737
|
-
* @param payload Payload for creating a run.
|
|
738
|
-
* @returns The created run.
|
|
739
|
-
*/
|
|
740
|
-
async create(threadId, assistantId, payload) {
|
|
741
|
-
const json = {
|
|
742
|
-
input: payload?.input,
|
|
743
|
-
command: payload?.command,
|
|
744
|
-
config: payload?.config,
|
|
745
|
-
context: payload?.context,
|
|
746
|
-
metadata: payload?.metadata,
|
|
747
|
-
stream_mode: payload?.streamMode,
|
|
748
|
-
stream_subgraphs: payload?.streamSubgraphs,
|
|
749
|
-
stream_resumable: payload?.streamResumable,
|
|
750
|
-
assistant_id: assistantId,
|
|
751
|
-
interrupt_before: payload?.interruptBefore,
|
|
752
|
-
interrupt_after: payload?.interruptAfter,
|
|
753
|
-
webhook: payload?.webhook,
|
|
754
|
-
checkpoint: payload?.checkpoint,
|
|
755
|
-
checkpoint_id: payload?.checkpointId,
|
|
756
|
-
multitask_strategy: payload?.multitaskStrategy,
|
|
757
|
-
after_seconds: payload?.afterSeconds,
|
|
758
|
-
if_not_exists: payload?.ifNotExists,
|
|
759
|
-
checkpoint_during: payload?.checkpointDuring,
|
|
760
|
-
durability: payload?.durability,
|
|
761
|
-
langsmith_tracer: payload?._langsmithTracer ? {
|
|
762
|
-
project_name: payload?._langsmithTracer?.projectName,
|
|
763
|
-
example_id: payload?._langsmithTracer?.exampleId
|
|
764
|
-
} : void 0
|
|
765
|
-
};
|
|
766
|
-
const endpoint = threadId === null ? "/runs" : `/threads/${threadId}/runs`;
|
|
767
|
-
const [run, response] = await this.fetch(endpoint, {
|
|
768
|
-
method: "POST",
|
|
769
|
-
json,
|
|
770
|
-
signal: payload?.signal,
|
|
771
|
-
withResponse: true
|
|
772
|
-
});
|
|
773
|
-
const runMetadata = getRunMetadataFromResponse(response);
|
|
774
|
-
if (runMetadata) payload?.onRunCreated?.(runMetadata);
|
|
775
|
-
return run;
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
* Create a batch of stateless background runs.
|
|
779
|
-
*
|
|
780
|
-
* @param payloads An array of payloads for creating runs.
|
|
781
|
-
* @returns An array of created runs.
|
|
782
|
-
*/
|
|
783
|
-
async createBatch(payloads, options) {
|
|
784
|
-
const filteredPayloads = payloads.map((payload) => ({
|
|
785
|
-
...payload,
|
|
786
|
-
assistant_id: payload.assistantId
|
|
787
|
-
})).map((payload) => {
|
|
788
|
-
return Object.fromEntries(Object.entries(payload).filter(([_, v]) => v !== void 0));
|
|
789
|
-
});
|
|
790
|
-
return this.fetch("/runs/batch", {
|
|
791
|
-
method: "POST",
|
|
792
|
-
json: filteredPayloads,
|
|
793
|
-
signal: options?.signal
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
/**
|
|
797
|
-
* Create a run and wait for it to complete.
|
|
798
|
-
*
|
|
799
|
-
* @param threadId The ID of the thread.
|
|
800
|
-
* @param assistantId Assistant ID to use for this run.
|
|
801
|
-
* @param payload Payload for creating a run.
|
|
802
|
-
* @returns The last values chunk of the thread.
|
|
803
|
-
*/
|
|
804
|
-
async wait(threadId, assistantId, payload) {
|
|
805
|
-
const json = {
|
|
806
|
-
input: payload?.input,
|
|
807
|
-
command: payload?.command,
|
|
808
|
-
config: payload?.config,
|
|
809
|
-
context: payload?.context,
|
|
810
|
-
metadata: payload?.metadata,
|
|
811
|
-
assistant_id: assistantId,
|
|
812
|
-
interrupt_before: payload?.interruptBefore,
|
|
813
|
-
interrupt_after: payload?.interruptAfter,
|
|
814
|
-
checkpoint: payload?.checkpoint,
|
|
815
|
-
checkpoint_id: payload?.checkpointId,
|
|
816
|
-
webhook: payload?.webhook,
|
|
817
|
-
multitask_strategy: payload?.multitaskStrategy,
|
|
818
|
-
on_completion: payload?.onCompletion,
|
|
819
|
-
on_disconnect: payload?.onDisconnect,
|
|
820
|
-
after_seconds: payload?.afterSeconds,
|
|
821
|
-
if_not_exists: payload?.ifNotExists,
|
|
822
|
-
checkpoint_during: payload?.checkpointDuring,
|
|
823
|
-
durability: payload?.durability,
|
|
824
|
-
langsmith_tracer: payload?._langsmithTracer ? {
|
|
825
|
-
project_name: payload?._langsmithTracer?.projectName,
|
|
826
|
-
example_id: payload?._langsmithTracer?.exampleId
|
|
827
|
-
} : void 0
|
|
828
|
-
};
|
|
829
|
-
const endpoint = threadId == null ? `/runs/wait` : `/threads/${threadId}/runs/wait`;
|
|
830
|
-
const [run, response] = await this.fetch(endpoint, {
|
|
831
|
-
method: "POST",
|
|
832
|
-
json,
|
|
833
|
-
timeoutMs: null,
|
|
834
|
-
signal: payload?.signal,
|
|
835
|
-
withResponse: true
|
|
836
|
-
});
|
|
837
|
-
const runMetadata = getRunMetadataFromResponse(response);
|
|
838
|
-
if (runMetadata) payload?.onRunCreated?.(runMetadata);
|
|
839
|
-
const raiseError = payload?.raiseError !== void 0 ? payload.raiseError : true;
|
|
840
|
-
if (raiseError && "__error__" in run && typeof run.__error__ === "object" && run.__error__ && "error" in run.__error__ && "message" in run.__error__) throw new Error(`${run.__error__?.error}: ${run.__error__?.message}`);
|
|
841
|
-
return run;
|
|
842
|
-
}
|
|
843
|
-
/**
|
|
844
|
-
* List all runs for a thread.
|
|
845
|
-
*
|
|
846
|
-
* @param threadId The ID of the thread.
|
|
847
|
-
* @param options Filtering and pagination options.
|
|
848
|
-
* @returns List of runs.
|
|
849
|
-
*/
|
|
850
|
-
async list(threadId, options) {
|
|
851
|
-
return this.fetch(`/threads/${threadId}/runs`, {
|
|
852
|
-
params: {
|
|
853
|
-
limit: options?.limit ?? 10,
|
|
854
|
-
offset: options?.offset ?? 0,
|
|
855
|
-
status: options?.status ?? void 0,
|
|
856
|
-
select: options?.select ?? void 0
|
|
857
|
-
},
|
|
858
|
-
signal: options?.signal
|
|
859
|
-
});
|
|
860
|
-
}
|
|
861
|
-
/**
|
|
862
|
-
* Get a run by ID.
|
|
863
|
-
*
|
|
864
|
-
* @param threadId The ID of the thread.
|
|
865
|
-
* @param runId The ID of the run.
|
|
866
|
-
* @returns The run.
|
|
867
|
-
*/
|
|
868
|
-
async get(threadId, runId, options) {
|
|
869
|
-
return this.fetch(`/threads/${threadId}/runs/${runId}`, { signal: options?.signal });
|
|
870
|
-
}
|
|
871
|
-
/**
|
|
872
|
-
* Cancel a run.
|
|
873
|
-
*
|
|
874
|
-
* @param threadId The ID of the thread.
|
|
875
|
-
* @param runId The ID of the run.
|
|
876
|
-
* @param wait Whether to block when canceling
|
|
877
|
-
* @param action Action to take when cancelling the run. Possible values are `interrupt` or `rollback`. Default is `interrupt`.
|
|
878
|
-
* @returns
|
|
879
|
-
*/
|
|
880
|
-
async cancel(threadId, runId, wait = false, action = "interrupt", options = {}) {
|
|
881
|
-
return this.fetch(`/threads/${threadId}/runs/${runId}/cancel`, {
|
|
882
|
-
method: "POST",
|
|
883
|
-
params: {
|
|
884
|
-
wait: wait ? "1" : "0",
|
|
885
|
-
action
|
|
886
|
-
},
|
|
887
|
-
signal: options?.signal
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
/**
|
|
891
|
-
* Block until a run is done.
|
|
892
|
-
*
|
|
893
|
-
* @param threadId The ID of the thread.
|
|
894
|
-
* @param runId The ID of the run.
|
|
895
|
-
* @returns
|
|
896
|
-
*/
|
|
897
|
-
async join(threadId, runId, options) {
|
|
898
|
-
return this.fetch(`/threads/${threadId}/runs/${runId}/join`, {
|
|
899
|
-
timeoutMs: null,
|
|
900
|
-
signal: options?.signal
|
|
901
|
-
});
|
|
902
|
-
}
|
|
903
|
-
/**
|
|
904
|
-
* Stream output from a run in real-time, until the run is done.
|
|
905
|
-
*
|
|
906
|
-
* @param threadId The ID of the thread. Can be set to `null` | `undefined` for stateless runs.
|
|
907
|
-
* @param runId The ID of the run.
|
|
908
|
-
* @param options Additional options for controlling the stream behavior:
|
|
909
|
-
* - signal: An AbortSignal that can be used to cancel the stream request
|
|
910
|
-
* - lastEventId: The ID of the last event received. Can be used to reconnect to a stream without losing events.
|
|
911
|
-
* - cancelOnDisconnect: When true, automatically cancels the run if the client disconnects from the stream
|
|
912
|
-
* - streamMode: Controls what types of events to receive from the stream (can be a single mode or array of modes)
|
|
913
|
-
* Must be a subset of the stream modes passed when creating the run. Background runs default to having the union of all
|
|
914
|
-
* stream modes enabled.
|
|
915
|
-
* @returns An async generator yielding stream parts.
|
|
916
|
-
*/
|
|
917
|
-
async *joinStream(threadId, runId, options) {
|
|
918
|
-
const opts = typeof options === "object" && options != null && options instanceof AbortSignal ? { signal: options } : options;
|
|
919
|
-
yield* this.streamWithRetry({
|
|
920
|
-
endpoint: threadId != null ? `/threads/${threadId}/runs/${runId}/stream` : `/runs/${runId}/stream`,
|
|
921
|
-
method: "GET",
|
|
922
|
-
signal: opts?.signal,
|
|
923
|
-
headers: opts?.lastEventId ? { "Last-Event-ID": opts.lastEventId } : void 0,
|
|
924
|
-
params: {
|
|
925
|
-
cancel_on_disconnect: opts?.cancelOnDisconnect ? "1" : "0",
|
|
926
|
-
stream_mode: opts?.streamMode
|
|
927
|
-
}
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
|
-
/**
|
|
931
|
-
* Delete a run.
|
|
932
|
-
*
|
|
933
|
-
* @param threadId The ID of the thread.
|
|
934
|
-
* @param runId The ID of the run.
|
|
935
|
-
* @returns
|
|
936
|
-
*/
|
|
937
|
-
async delete(threadId, runId, options) {
|
|
938
|
-
return this.fetch(`/threads/${threadId}/runs/${runId}`, {
|
|
939
|
-
method: "DELETE",
|
|
940
|
-
signal: options?.signal
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
};
|
|
944
|
-
var StoreClient = class extends BaseClient {
|
|
945
|
-
/**
|
|
946
|
-
* Store or update an item.
|
|
947
|
-
*
|
|
948
|
-
* @param namespace A list of strings representing the namespace path.
|
|
949
|
-
* @param key The unique identifier for the item within the namespace.
|
|
950
|
-
* @param value A dictionary containing the item's data.
|
|
951
|
-
* @param options.index Controls search indexing - null (use defaults), false (disable), or list of field paths to index.
|
|
952
|
-
* @param options.ttl Optional time-to-live in minutes for the item, or null for no expiration.
|
|
953
|
-
* @returns Promise<void>
|
|
954
|
-
*
|
|
955
|
-
* @example
|
|
956
|
-
* ```typescript
|
|
957
|
-
* await client.store.putItem(
|
|
958
|
-
* ["documents", "user123"],
|
|
959
|
-
* "item456",
|
|
960
|
-
* { title: "My Document", content: "Hello World" },
|
|
961
|
-
* { ttl: 60 } // expires in 60 minutes
|
|
962
|
-
* );
|
|
963
|
-
* ```
|
|
964
|
-
*/
|
|
965
|
-
async putItem(namespace, key, value, options) {
|
|
966
|
-
namespace.forEach((label) => {
|
|
967
|
-
if (label.includes(".")) throw new Error(`Invalid namespace label '${label}'. Namespace labels cannot contain periods ('.')`);
|
|
968
|
-
});
|
|
969
|
-
const payload = {
|
|
970
|
-
namespace,
|
|
971
|
-
key,
|
|
972
|
-
value,
|
|
973
|
-
index: options?.index,
|
|
974
|
-
ttl: options?.ttl
|
|
975
|
-
};
|
|
976
|
-
return this.fetch("/store/items", {
|
|
977
|
-
method: "PUT",
|
|
978
|
-
json: payload,
|
|
979
|
-
signal: options?.signal
|
|
980
|
-
});
|
|
981
|
-
}
|
|
982
|
-
/**
|
|
983
|
-
* Retrieve a single item.
|
|
984
|
-
*
|
|
985
|
-
* @param namespace A list of strings representing the namespace path.
|
|
986
|
-
* @param key The unique identifier for the item.
|
|
987
|
-
* @param options.refreshTtl Whether to refresh the TTL on this read operation. If null, uses the store's default behavior.
|
|
988
|
-
* @returns Promise<Item>
|
|
989
|
-
*
|
|
990
|
-
* @example
|
|
991
|
-
* ```typescript
|
|
992
|
-
* const item = await client.store.getItem(
|
|
993
|
-
* ["documents", "user123"],
|
|
994
|
-
* "item456",
|
|
995
|
-
* { refreshTtl: true }
|
|
996
|
-
* );
|
|
997
|
-
* console.log(item);
|
|
998
|
-
* // {
|
|
999
|
-
* // namespace: ["documents", "user123"],
|
|
1000
|
-
* // key: "item456",
|
|
1001
|
-
* // value: { title: "My Document", content: "Hello World" },
|
|
1002
|
-
* // createdAt: "2024-07-30T12:00:00Z",
|
|
1003
|
-
* // updatedAt: "2024-07-30T12:00:00Z"
|
|
1004
|
-
* // }
|
|
1005
|
-
* ```
|
|
1006
|
-
*/
|
|
1007
|
-
async getItem(namespace, key, options) {
|
|
1008
|
-
namespace.forEach((label) => {
|
|
1009
|
-
if (label.includes(".")) throw new Error(`Invalid namespace label '${label}'. Namespace labels cannot contain periods ('.')`);
|
|
1010
|
-
});
|
|
1011
|
-
const params = {
|
|
1012
|
-
namespace: namespace.join("."),
|
|
1013
|
-
key
|
|
1014
|
-
};
|
|
1015
|
-
if (options?.refreshTtl !== void 0) params.refresh_ttl = options.refreshTtl;
|
|
1016
|
-
const response = await this.fetch("/store/items", {
|
|
1017
|
-
params,
|
|
1018
|
-
signal: options?.signal
|
|
1019
|
-
});
|
|
1020
|
-
return response ? {
|
|
1021
|
-
...response,
|
|
1022
|
-
createdAt: response.created_at,
|
|
1023
|
-
updatedAt: response.updated_at
|
|
1024
|
-
} : null;
|
|
1025
|
-
}
|
|
1026
|
-
/**
|
|
1027
|
-
* Delete an item.
|
|
1028
|
-
*
|
|
1029
|
-
* @param namespace A list of strings representing the namespace path.
|
|
1030
|
-
* @param key The unique identifier for the item.
|
|
1031
|
-
* @returns Promise<void>
|
|
1032
|
-
*/
|
|
1033
|
-
async deleteItem(namespace, key, options) {
|
|
1034
|
-
namespace.forEach((label) => {
|
|
1035
|
-
if (label.includes(".")) throw new Error(`Invalid namespace label '${label}'. Namespace labels cannot contain periods ('.')`);
|
|
1036
|
-
});
|
|
1037
|
-
return this.fetch("/store/items", {
|
|
1038
|
-
method: "DELETE",
|
|
1039
|
-
json: {
|
|
1040
|
-
namespace,
|
|
1041
|
-
key
|
|
1042
|
-
},
|
|
1043
|
-
signal: options?.signal
|
|
1044
|
-
});
|
|
1045
|
-
}
|
|
1046
|
-
/**
|
|
1047
|
-
* Search for items within a namespace prefix.
|
|
1048
|
-
*
|
|
1049
|
-
* @param namespacePrefix List of strings representing the namespace prefix.
|
|
1050
|
-
* @param options.filter Optional dictionary of key-value pairs to filter results.
|
|
1051
|
-
* @param options.limit Maximum number of items to return (default is 10).
|
|
1052
|
-
* @param options.offset Number of items to skip before returning results (default is 0).
|
|
1053
|
-
* @param options.query Optional search query.
|
|
1054
|
-
* @param options.refreshTtl Whether to refresh the TTL on items returned by this search. If null, uses the store's default behavior.
|
|
1055
|
-
* @returns Promise<SearchItemsResponse>
|
|
1056
|
-
*
|
|
1057
|
-
* @example
|
|
1058
|
-
* ```typescript
|
|
1059
|
-
* const results = await client.store.searchItems(
|
|
1060
|
-
* ["documents"],
|
|
1061
|
-
* {
|
|
1062
|
-
* filter: { author: "John Doe" },
|
|
1063
|
-
* limit: 5,
|
|
1064
|
-
* refreshTtl: true
|
|
1065
|
-
* }
|
|
1066
|
-
* );
|
|
1067
|
-
* console.log(results);
|
|
1068
|
-
* // {
|
|
1069
|
-
* // items: [
|
|
1070
|
-
* // {
|
|
1071
|
-
* // namespace: ["documents", "user123"],
|
|
1072
|
-
* // key: "item789",
|
|
1073
|
-
* // value: { title: "Another Document", author: "John Doe" },
|
|
1074
|
-
* // createdAt: "2024-07-30T12:00:00Z",
|
|
1075
|
-
* // updatedAt: "2024-07-30T12:00:00Z"
|
|
1076
|
-
* // },
|
|
1077
|
-
* // // ... additional items ...
|
|
1078
|
-
* // ]
|
|
1079
|
-
* // }
|
|
1080
|
-
* ```
|
|
1081
|
-
*/
|
|
1082
|
-
async searchItems(namespacePrefix, options) {
|
|
1083
|
-
const payload = {
|
|
1084
|
-
namespace_prefix: namespacePrefix,
|
|
1085
|
-
filter: options?.filter,
|
|
1086
|
-
limit: options?.limit ?? 10,
|
|
1087
|
-
offset: options?.offset ?? 0,
|
|
1088
|
-
query: options?.query,
|
|
1089
|
-
refresh_ttl: options?.refreshTtl
|
|
1090
|
-
};
|
|
1091
|
-
const response = await this.fetch("/store/items/search", {
|
|
1092
|
-
method: "POST",
|
|
1093
|
-
json: payload,
|
|
1094
|
-
signal: options?.signal
|
|
1095
|
-
});
|
|
1096
|
-
return { items: response.items.map((item) => ({
|
|
1097
|
-
...item,
|
|
1098
|
-
createdAt: item.created_at,
|
|
1099
|
-
updatedAt: item.updated_at
|
|
1100
|
-
})) };
|
|
1101
|
-
}
|
|
1102
|
-
/**
|
|
1103
|
-
* List namespaces with optional match conditions.
|
|
1104
|
-
*
|
|
1105
|
-
* @param options.prefix Optional list of strings representing the prefix to filter namespaces.
|
|
1106
|
-
* @param options.suffix Optional list of strings representing the suffix to filter namespaces.
|
|
1107
|
-
* @param options.maxDepth Optional integer specifying the maximum depth of namespaces to return.
|
|
1108
|
-
* @param options.limit Maximum number of namespaces to return (default is 100).
|
|
1109
|
-
* @param options.offset Number of namespaces to skip before returning results (default is 0).
|
|
1110
|
-
* @returns Promise<ListNamespaceResponse>
|
|
1111
|
-
*/
|
|
1112
|
-
async listNamespaces(options) {
|
|
1113
|
-
const payload = {
|
|
1114
|
-
prefix: options?.prefix,
|
|
1115
|
-
suffix: options?.suffix,
|
|
1116
|
-
max_depth: options?.maxDepth,
|
|
1117
|
-
limit: options?.limit ?? 100,
|
|
1118
|
-
offset: options?.offset ?? 0
|
|
1119
|
-
};
|
|
1120
|
-
return this.fetch("/store/namespaces", {
|
|
1121
|
-
method: "POST",
|
|
1122
|
-
json: payload,
|
|
1123
|
-
signal: options?.signal
|
|
1124
|
-
});
|
|
1125
|
-
}
|
|
1126
|
-
};
|
|
1127
|
-
var UiClient = class UiClient extends BaseClient {
|
|
1128
|
-
static promiseCache = {};
|
|
1129
|
-
static getOrCached(key, fn) {
|
|
1130
|
-
if (UiClient.promiseCache[key] != null) return UiClient.promiseCache[key];
|
|
1131
|
-
const promise = fn();
|
|
1132
|
-
UiClient.promiseCache[key] = promise;
|
|
1133
|
-
return promise;
|
|
1134
|
-
}
|
|
1135
|
-
async getComponent(assistantId, agentName) {
|
|
1136
|
-
return UiClient.getOrCached(`${this.apiUrl}-${assistantId}-${agentName}`, async () => {
|
|
1137
|
-
let [url, init] = this.prepareFetchOptions(`/ui/${assistantId}`, {
|
|
1138
|
-
headers: {
|
|
1139
|
-
Accept: "text/html",
|
|
1140
|
-
"Content-Type": "application/json"
|
|
1141
|
-
},
|
|
1142
|
-
method: "POST",
|
|
1143
|
-
json: { name: agentName }
|
|
1144
|
-
});
|
|
1145
|
-
if (this.onRequest != null) init = await this.onRequest(url, init);
|
|
1146
|
-
const response = await this.asyncCaller.fetch(url, init);
|
|
1147
|
-
return response.text();
|
|
1148
|
-
});
|
|
1149
|
-
}
|
|
1150
|
-
};
|
|
1151
|
-
var Client = class {
|
|
1152
|
-
/**
|
|
1153
|
-
* The client for interacting with assistants.
|
|
1154
|
-
*/
|
|
1155
|
-
assistants;
|
|
1156
|
-
/**
|
|
1157
|
-
* The client for interacting with threads.
|
|
1158
|
-
*/
|
|
1159
|
-
threads;
|
|
1160
|
-
/**
|
|
1161
|
-
* The client for interacting with runs.
|
|
1162
|
-
*/
|
|
1163
|
-
runs;
|
|
1164
|
-
/**
|
|
1165
|
-
* The client for interacting with cron runs.
|
|
1166
|
-
*/
|
|
1167
|
-
crons;
|
|
1168
|
-
/**
|
|
1169
|
-
* The client for interacting with the KV store.
|
|
1170
|
-
*/
|
|
1171
|
-
store;
|
|
1172
|
-
/**
|
|
1173
|
-
* The client for interacting with the UI.
|
|
1174
|
-
* @internal Used by LoadExternalComponent and the API might change in the future.
|
|
1175
|
-
*/
|
|
1176
|
-
"~ui";
|
|
1177
|
-
/**
|
|
1178
|
-
* @internal Used to obtain a stable key representing the client.
|
|
1179
|
-
*/
|
|
1180
|
-
"~configHash";
|
|
1181
|
-
constructor(config) {
|
|
1182
|
-
this["~configHash"] = (() => JSON.stringify({
|
|
1183
|
-
apiUrl: config?.apiUrl,
|
|
1184
|
-
apiKey: config?.apiKey,
|
|
1185
|
-
timeoutMs: config?.timeoutMs,
|
|
1186
|
-
defaultHeaders: config?.defaultHeaders,
|
|
1187
|
-
maxConcurrency: config?.callerOptions?.maxConcurrency,
|
|
1188
|
-
maxRetries: config?.callerOptions?.maxRetries,
|
|
1189
|
-
callbacks: {
|
|
1190
|
-
onFailedResponseHook: config?.callerOptions?.onFailedResponseHook != null,
|
|
1191
|
-
onRequest: config?.onRequest != null,
|
|
1192
|
-
fetch: config?.callerOptions?.fetch != null
|
|
1193
|
-
}
|
|
1194
|
-
}))();
|
|
1195
|
-
this.assistants = new AssistantsClient(config);
|
|
1196
|
-
this.threads = new ThreadsClient(config);
|
|
1197
|
-
this.runs = new RunsClient(config);
|
|
1198
|
-
this.crons = new CronsClient(config);
|
|
1199
|
-
this.store = new StoreClient(config);
|
|
1200
|
-
this["~ui"] = new UiClient(config);
|
|
1201
|
-
}
|
|
1202
|
-
};
|
|
1203
|
-
/**
|
|
1204
|
-
* @internal Used to obtain a stable key representing the client.
|
|
1205
|
-
*/
|
|
1206
|
-
function getClientConfigHash(client) {
|
|
1207
|
-
return client["~configHash"];
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
//#endregion
|
|
1211
|
-
exports.AssistantsClient = AssistantsClient;
|
|
1212
|
-
exports.Client = Client;
|
|
1213
|
-
exports.CronsClient = CronsClient;
|
|
1214
|
-
exports.RunsClient = RunsClient;
|
|
1215
|
-
exports.StoreClient = StoreClient;
|
|
1216
|
-
exports.ThreadsClient = ThreadsClient;
|
|
1217
|
-
exports.getApiKey = getApiKey;
|
|
1218
|
-
exports.getClientConfigHash = getClientConfigHash;
|
|
1219
|
-
//# sourceMappingURL=client.cjs.map
|