@langchain/langgraph-sdk 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/auth/error.cjs +79 -0
- 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 +13 -0
- package/dist/auth/error.d.ts.map +1 -0
- package/dist/auth/error.js +78 -0
- package/dist/auth/error.js.map +1 -0
- package/dist/auth/index.cjs +39 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +29 -0
- package/dist/auth/index.d.cts.map +1 -0
- package/dist/auth/index.d.ts +29 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +37 -0
- 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 +294 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/client.cjs +1210 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +799 -0
- package/dist/client.d.cts.map +1 -0
- package/dist/client.d.ts +799 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1203 -0
- package/dist/client.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4 -0
- package/dist/logging/index.cjs +35 -0
- package/dist/logging/index.cjs.map +1 -0
- package/dist/logging/index.d.cts +46 -0
- package/dist/logging/index.d.cts.map +1 -0
- package/dist/logging/index.d.ts +46 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +34 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/react/index.cjs +5 -0
- package/dist/react/index.d.cts +5 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/index.js +4 -0
- package/dist/react/stream.cjs +18 -0
- package/dist/react/stream.cjs.map +1 -0
- package/dist/react/stream.custom.cjs +135 -0
- package/dist/react/stream.custom.cjs.map +1 -0
- package/dist/react/stream.custom.d.cts +40 -0
- package/dist/react/stream.custom.d.cts.map +1 -0
- package/dist/react/stream.custom.d.ts +40 -0
- package/dist/react/stream.custom.d.ts.map +1 -0
- package/dist/react/stream.custom.js +133 -0
- package/dist/react/stream.custom.js.map +1 -0
- package/dist/react/stream.d.cts +155 -0
- package/dist/react/stream.d.cts.map +1 -0
- package/dist/react/stream.d.ts +155 -0
- package/dist/react/stream.d.ts.map +1 -0
- package/dist/react/stream.js +17 -0
- package/dist/react/stream.js.map +1 -0
- package/dist/react/stream.lgp.cjs +448 -0
- package/dist/react/stream.lgp.cjs.map +1 -0
- package/dist/react/stream.lgp.js +447 -0
- package/dist/react/stream.lgp.js.map +1 -0
- package/dist/react/thread.cjs +21 -0
- package/dist/react/thread.cjs.map +1 -0
- package/dist/react/thread.js +20 -0
- package/dist/react/thread.js.map +1 -0
- package/dist/react/types.d.cts +152 -0
- package/dist/react/types.d.cts.map +1 -0
- package/dist/react/types.d.ts +152 -0
- package/dist/react/types.d.ts.map +1 -0
- package/dist/react-ui/client.cjs +138 -0
- package/dist/react-ui/client.cjs.map +1 -0
- package/dist/react-ui/client.d.cts +73 -0
- package/dist/react-ui/client.d.cts.map +1 -0
- package/dist/react-ui/client.d.ts +73 -0
- package/dist/react-ui/client.d.ts.map +1 -0
- package/dist/react-ui/client.js +132 -0
- package/dist/react-ui/client.js.map +1 -0
- package/dist/react-ui/index.cjs +14 -0
- 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 -0
- package/dist/react-ui/index.js +9 -0
- package/dist/react-ui/index.js.map +1 -0
- package/dist/react-ui/server/index.cjs +5 -0
- package/dist/react-ui/server/index.d.cts +3 -0
- package/dist/react-ui/server/index.d.ts +3 -0
- package/dist/react-ui/server/index.js +4 -0
- package/dist/react-ui/server/server.cjs +57 -0
- 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 +55 -0
- package/dist/react-ui/server/server.d.ts.map +1 -0
- package/dist/react-ui/server/server.js +56 -0
- package/dist/react-ui/server/server.js.map +1 -0
- package/dist/react-ui/types.cjs +38 -0
- 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 +25 -0
- package/dist/react-ui/types.d.ts.map +1 -0
- package/dist/react-ui/types.js +35 -0
- package/dist/react-ui/types.js.map +1 -0
- package/dist/schema.d.cts +284 -0
- package/dist/schema.d.cts.map +1 -0
- package/dist/schema.d.ts +284 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/singletons/fetch.cjs +24 -0
- 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 +14 -0
- package/dist/singletons/fetch.d.ts.map +1 -0
- package/dist/singletons/fetch.js +22 -0
- 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 +187 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.messages.d.cts +264 -0
- package/dist/types.messages.d.cts.map +1 -0
- package/dist/types.messages.d.ts +264 -0
- package/dist/types.messages.d.ts.map +1 -0
- package/dist/types.stream.d.cts +233 -0
- package/dist/types.stream.d.cts.map +1 -0
- package/dist/types.stream.d.ts +233 -0
- package/dist/types.stream.d.ts.map +1 -0
- package/dist/types.template.d.cts +19 -0
- package/dist/types.template.d.cts.map +1 -0
- package/dist/types.template.d.ts +19 -0
- package/dist/types.template.d.ts.map +1 -0
- package/dist/ui/branching.cjs +153 -0
- package/dist/ui/branching.cjs.map +1 -0
- package/dist/ui/branching.d.cts +19 -0
- package/dist/ui/branching.d.cts.map +1 -0
- package/dist/ui/branching.d.ts +19 -0
- package/dist/ui/branching.d.ts.map +1 -0
- package/dist/ui/branching.js +152 -0
- package/dist/ui/branching.js.map +1 -0
- package/dist/ui/errors.cjs +15 -0
- package/dist/ui/errors.cjs.map +1 -0
- package/dist/ui/errors.js +14 -0
- package/dist/ui/errors.js.map +1 -0
- package/dist/ui/manager.cjs +188 -0
- package/dist/ui/manager.cjs.map +1 -0
- package/dist/ui/manager.js +188 -0
- package/dist/ui/manager.js.map +1 -0
- package/dist/ui/messages.cjs +70 -0
- package/dist/ui/messages.cjs.map +1 -0
- package/dist/ui/messages.js +68 -0
- package/dist/ui/messages.js.map +1 -0
- package/dist/ui/types.d.cts +420 -0
- package/dist/ui/types.d.cts.map +1 -0
- package/dist/ui/types.d.ts +420 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/utils.cjs +13 -0
- package/dist/ui/utils.cjs.map +1 -0
- package/dist/ui/utils.js +11 -0
- package/dist/ui/utils.js.map +1 -0
- package/dist/utils/async_caller.cjs +119 -0
- package/dist/utils/async_caller.cjs.map +1 -0
- package/dist/utils/async_caller.d.cts +51 -0
- package/dist/utils/async_caller.d.cts.map +1 -0
- package/dist/utils/async_caller.d.ts +51 -0
- package/dist/utils/async_caller.d.ts.map +1 -0
- package/dist/utils/async_caller.js +116 -0
- package/dist/utils/async_caller.js.map +1 -0
- package/dist/utils/env.cjs +13 -0
- package/dist/utils/env.cjs.map +1 -0
- package/dist/utils/env.js +12 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/error.cjs +17 -0
- package/dist/utils/error.cjs.map +1 -0
- package/dist/utils/error.js +16 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/signals.cjs +20 -0
- package/dist/utils/signals.cjs.map +1 -0
- package/dist/utils/signals.js +19 -0
- package/dist/utils/signals.js.map +1 -0
- package/dist/utils/sse.cjs +124 -0
- package/dist/utils/sse.cjs.map +1 -0
- package/dist/utils/sse.js +122 -0
- package/dist/utils/sse.js.map +1 -0
- package/dist/utils/stream.cjs +174 -0
- package/dist/utils/stream.cjs.map +1 -0
- package/dist/utils/stream.js +173 -0
- package/dist/utils/stream.js.map +1 -0
- package/dist/utils/tools.cjs +52 -0
- package/dist/utils/tools.cjs.map +1 -0
- package/dist/utils/tools.js +51 -0
- package/dist/utils/tools.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
import { Assistant, AssistantGraph, AssistantSelectField, AssistantSortBy, AssistantVersion, AssistantsSearchResponse, CancelAction, Checkpoint, Config, Cron, CronCreateForThreadResponse, CronCreateResponse, CronSelectField, CronSortBy, DefaultValues, GraphSchema, Item, ListNamespaceResponse, Metadata, Run, RunSelectField, RunStatus, SearchItemsResponse, SortOrder, Subgraphs, Thread, ThreadSelectField, ThreadSortBy, ThreadState, ThreadStatus, ThreadValuesFilter } from "./schema.cjs";
|
|
2
|
+
import { StreamMode, ThreadStreamMode, TypedAsyncGenerator } from "./types.stream.cjs";
|
|
3
|
+
import { Command, CronsCreatePayload, OnConflictBehavior, RunsCreatePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent } from "./types.cjs";
|
|
4
|
+
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.cjs";
|
|
5
|
+
|
|
6
|
+
//#region src/client.d.ts
|
|
7
|
+
type HeaderValue = string | undefined | null;
|
|
8
|
+
/**
|
|
9
|
+
* Get the API key from the environment.
|
|
10
|
+
* Precedence:
|
|
11
|
+
* 1. explicit argument (if string)
|
|
12
|
+
* 2. LANGGRAPH_API_KEY
|
|
13
|
+
* 3. LANGSMITH_API_KEY
|
|
14
|
+
* 4. LANGCHAIN_API_KEY
|
|
15
|
+
*
|
|
16
|
+
* @param apiKey - API key provided as an argument. If null, skips environment lookup. If undefined, tries environment.
|
|
17
|
+
* @returns The API key if found, otherwise undefined
|
|
18
|
+
*/
|
|
19
|
+
declare function getApiKey(apiKey?: string | null): string | undefined;
|
|
20
|
+
type RequestHook = (url: URL, init: RequestInit) => Promise<RequestInit> | RequestInit;
|
|
21
|
+
interface ClientConfig {
|
|
22
|
+
apiUrl?: string;
|
|
23
|
+
/**
|
|
24
|
+
* API key for authentication.
|
|
25
|
+
* - If a string is provided, that key will be used
|
|
26
|
+
* - If undefined (default), the key will be auto-loaded from environment variables (LANGGRAPH_API_KEY, LANGSMITH_API_KEY, or LANGCHAIN_API_KEY)
|
|
27
|
+
* - If null, no API key will be set (skips auto-loading)
|
|
28
|
+
*/
|
|
29
|
+
apiKey?: string | null;
|
|
30
|
+
callerOptions?: AsyncCallerParams;
|
|
31
|
+
timeoutMs?: number;
|
|
32
|
+
defaultHeaders?: Record<string, HeaderValue>;
|
|
33
|
+
onRequest?: RequestHook;
|
|
34
|
+
}
|
|
35
|
+
declare class BaseClient {
|
|
36
|
+
protected asyncCaller: AsyncCaller;
|
|
37
|
+
protected timeoutMs: number | undefined;
|
|
38
|
+
protected apiUrl: string;
|
|
39
|
+
protected defaultHeaders: Record<string, HeaderValue>;
|
|
40
|
+
protected onRequest?: RequestHook;
|
|
41
|
+
constructor(config?: ClientConfig);
|
|
42
|
+
protected prepareFetchOptions(path: string, options?: RequestInit & {
|
|
43
|
+
json?: unknown;
|
|
44
|
+
params?: Record<string, unknown>;
|
|
45
|
+
timeoutMs?: number | null;
|
|
46
|
+
withResponse?: boolean;
|
|
47
|
+
}): [url: URL, init: RequestInit];
|
|
48
|
+
protected fetch<T>(path: string, options: RequestInit & {
|
|
49
|
+
json?: unknown;
|
|
50
|
+
params?: Record<string, unknown>;
|
|
51
|
+
timeoutMs?: number | null;
|
|
52
|
+
signal: AbortSignal | undefined;
|
|
53
|
+
withResponse: true;
|
|
54
|
+
}): Promise<[T, Response]>;
|
|
55
|
+
protected fetch<T>(path: string, options?: RequestInit & {
|
|
56
|
+
json?: unknown;
|
|
57
|
+
params?: Record<string, unknown>;
|
|
58
|
+
timeoutMs?: number | null;
|
|
59
|
+
signal: AbortSignal | undefined;
|
|
60
|
+
withResponse?: false;
|
|
61
|
+
}): Promise<T>;
|
|
62
|
+
/**
|
|
63
|
+
* Protected helper for streaming with automatic retry logic.
|
|
64
|
+
* Handles both initial requests and reconnections with SSE.
|
|
65
|
+
*/
|
|
66
|
+
protected streamWithRetry<T extends {
|
|
67
|
+
id?: string;
|
|
68
|
+
event: string;
|
|
69
|
+
data: unknown;
|
|
70
|
+
}>(config: {
|
|
71
|
+
endpoint: string;
|
|
72
|
+
method?: string;
|
|
73
|
+
signal?: AbortSignal;
|
|
74
|
+
headers?: Record<string, string>;
|
|
75
|
+
params?: Record<string, unknown>;
|
|
76
|
+
json?: unknown;
|
|
77
|
+
maxRetries?: number;
|
|
78
|
+
onReconnect?: (options: {
|
|
79
|
+
attempt: number;
|
|
80
|
+
lastEventId?: string;
|
|
81
|
+
cause: unknown;
|
|
82
|
+
}) => void;
|
|
83
|
+
onInitialResponse?: (response: Response) => void | Promise<void>;
|
|
84
|
+
}): AsyncGenerator<T>;
|
|
85
|
+
}
|
|
86
|
+
declare class CronsClient extends BaseClient {
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param threadId The ID of the thread.
|
|
90
|
+
* @param assistantId Assistant ID to use for this cron job.
|
|
91
|
+
* @param payload Payload for creating a cron job.
|
|
92
|
+
* @returns The created background run.
|
|
93
|
+
*/
|
|
94
|
+
createForThread(threadId: string, assistantId: string, payload?: CronsCreatePayload): Promise<CronCreateForThreadResponse>;
|
|
95
|
+
/**
|
|
96
|
+
*
|
|
97
|
+
* @param assistantId Assistant ID to use for this cron job.
|
|
98
|
+
* @param payload Payload for creating a cron job.
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
create(assistantId: string, payload?: CronsCreatePayload): Promise<CronCreateResponse>;
|
|
102
|
+
/**
|
|
103
|
+
*
|
|
104
|
+
* @param cronId Cron ID of Cron job to delete.
|
|
105
|
+
*/
|
|
106
|
+
delete(cronId: string, options?: {
|
|
107
|
+
signal?: AbortSignal;
|
|
108
|
+
}): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param query Query options.
|
|
112
|
+
* @returns List of crons.
|
|
113
|
+
*/
|
|
114
|
+
search(query?: {
|
|
115
|
+
assistantId?: string;
|
|
116
|
+
threadId?: string;
|
|
117
|
+
limit?: number;
|
|
118
|
+
offset?: number;
|
|
119
|
+
sortBy?: CronSortBy;
|
|
120
|
+
sortOrder?: SortOrder;
|
|
121
|
+
select?: CronSelectField[];
|
|
122
|
+
signal?: AbortSignal;
|
|
123
|
+
}): Promise<Cron[]>;
|
|
124
|
+
/**
|
|
125
|
+
* Count cron jobs matching filters.
|
|
126
|
+
*
|
|
127
|
+
* @param query.assistantId Assistant ID to filter by.
|
|
128
|
+
* @param query.threadId Thread ID to filter by.
|
|
129
|
+
* @returns Number of cron jobs matching the criteria.
|
|
130
|
+
*/
|
|
131
|
+
count(query?: {
|
|
132
|
+
assistantId?: string;
|
|
133
|
+
threadId?: string;
|
|
134
|
+
signal?: AbortSignal;
|
|
135
|
+
}): Promise<number>;
|
|
136
|
+
}
|
|
137
|
+
declare class AssistantsClient extends BaseClient {
|
|
138
|
+
/**
|
|
139
|
+
* Get an assistant by ID.
|
|
140
|
+
*
|
|
141
|
+
* @param assistantId The ID of the assistant.
|
|
142
|
+
* @returns Assistant
|
|
143
|
+
*/
|
|
144
|
+
get(assistantId: string, options?: {
|
|
145
|
+
signal?: AbortSignal;
|
|
146
|
+
}): Promise<Assistant>;
|
|
147
|
+
/**
|
|
148
|
+
* Get the JSON representation of the graph assigned to a runnable
|
|
149
|
+
* @param assistantId The ID of the assistant.
|
|
150
|
+
* @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.
|
|
151
|
+
* @returns Serialized graph
|
|
152
|
+
*/
|
|
153
|
+
getGraph(assistantId: string, options?: {
|
|
154
|
+
xray?: boolean | number;
|
|
155
|
+
signal?: AbortSignal;
|
|
156
|
+
}): Promise<AssistantGraph>;
|
|
157
|
+
/**
|
|
158
|
+
* Get the state and config schema of the graph assigned to a runnable
|
|
159
|
+
* @param assistantId The ID of the assistant.
|
|
160
|
+
* @returns Graph schema
|
|
161
|
+
*/
|
|
162
|
+
getSchemas(assistantId: string, options?: {
|
|
163
|
+
signal?: AbortSignal;
|
|
164
|
+
}): Promise<GraphSchema>;
|
|
165
|
+
/**
|
|
166
|
+
* Get the schemas of an assistant by ID.
|
|
167
|
+
*
|
|
168
|
+
* @param assistantId The ID of the assistant to get the schema of.
|
|
169
|
+
* @param options Additional options for getting subgraphs, such as namespace or recursion extraction.
|
|
170
|
+
* @returns The subgraphs of the assistant.
|
|
171
|
+
*/
|
|
172
|
+
getSubgraphs(assistantId: string, options?: {
|
|
173
|
+
namespace?: string;
|
|
174
|
+
recurse?: boolean;
|
|
175
|
+
signal?: AbortSignal;
|
|
176
|
+
}): Promise<Subgraphs>;
|
|
177
|
+
/**
|
|
178
|
+
* Create a new assistant.
|
|
179
|
+
* @param payload Payload for creating an assistant.
|
|
180
|
+
* @returns The created assistant.
|
|
181
|
+
*/
|
|
182
|
+
create(payload: {
|
|
183
|
+
graphId: string;
|
|
184
|
+
config?: Config;
|
|
185
|
+
context?: unknown;
|
|
186
|
+
metadata?: Metadata;
|
|
187
|
+
assistantId?: string;
|
|
188
|
+
ifExists?: OnConflictBehavior;
|
|
189
|
+
name?: string;
|
|
190
|
+
description?: string;
|
|
191
|
+
signal?: AbortSignal;
|
|
192
|
+
}): Promise<Assistant>;
|
|
193
|
+
/**
|
|
194
|
+
* Update an assistant.
|
|
195
|
+
* @param assistantId ID of the assistant.
|
|
196
|
+
* @param payload Payload for updating the assistant.
|
|
197
|
+
* @returns The updated assistant.
|
|
198
|
+
*/
|
|
199
|
+
update(assistantId: string, payload: {
|
|
200
|
+
graphId?: string;
|
|
201
|
+
config?: Config;
|
|
202
|
+
context?: unknown;
|
|
203
|
+
metadata?: Metadata;
|
|
204
|
+
name?: string;
|
|
205
|
+
description?: string;
|
|
206
|
+
signal?: AbortSignal;
|
|
207
|
+
}): Promise<Assistant>;
|
|
208
|
+
/**
|
|
209
|
+
* Delete an assistant.
|
|
210
|
+
*
|
|
211
|
+
* @param assistantId ID of the assistant.
|
|
212
|
+
*/
|
|
213
|
+
delete(assistantId: string, options?: {
|
|
214
|
+
signal?: AbortSignal;
|
|
215
|
+
}): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* List assistants.
|
|
218
|
+
* @param query Query options.
|
|
219
|
+
* @returns List of assistants or, when includePagination is true, a mapping with the assistants and next cursor.
|
|
220
|
+
*/
|
|
221
|
+
search(query: {
|
|
222
|
+
graphId?: string;
|
|
223
|
+
name?: string;
|
|
224
|
+
metadata?: Metadata;
|
|
225
|
+
limit?: number;
|
|
226
|
+
offset?: number;
|
|
227
|
+
sortBy?: AssistantSortBy;
|
|
228
|
+
sortOrder?: SortOrder;
|
|
229
|
+
select?: AssistantSelectField[];
|
|
230
|
+
includePagination: true;
|
|
231
|
+
signal?: AbortSignal;
|
|
232
|
+
}): Promise<AssistantsSearchResponse>;
|
|
233
|
+
search(query?: {
|
|
234
|
+
graphId?: string;
|
|
235
|
+
name?: string;
|
|
236
|
+
metadata?: Metadata;
|
|
237
|
+
limit?: number;
|
|
238
|
+
offset?: number;
|
|
239
|
+
sortBy?: AssistantSortBy;
|
|
240
|
+
sortOrder?: SortOrder;
|
|
241
|
+
select?: AssistantSelectField[];
|
|
242
|
+
includePagination?: false;
|
|
243
|
+
signal?: AbortSignal;
|
|
244
|
+
}): Promise<Assistant[]>;
|
|
245
|
+
/**
|
|
246
|
+
* Count assistants matching filters.
|
|
247
|
+
*
|
|
248
|
+
* @param query.metadata Metadata to filter by. Exact match for each key/value.
|
|
249
|
+
* @param query.graphId Optional graph id to filter by.
|
|
250
|
+
* @param query.name Optional name to filter by.
|
|
251
|
+
* @returns Number of assistants matching the criteria.
|
|
252
|
+
*/
|
|
253
|
+
count(query?: {
|
|
254
|
+
metadata?: Metadata;
|
|
255
|
+
graphId?: string;
|
|
256
|
+
name?: string;
|
|
257
|
+
signal?: AbortSignal;
|
|
258
|
+
}): Promise<number>;
|
|
259
|
+
/**
|
|
260
|
+
* List all versions of an assistant.
|
|
261
|
+
*
|
|
262
|
+
* @param assistantId ID of the assistant.
|
|
263
|
+
* @returns List of assistant versions.
|
|
264
|
+
*/
|
|
265
|
+
getVersions(assistantId: string, payload?: {
|
|
266
|
+
metadata?: Metadata;
|
|
267
|
+
limit?: number;
|
|
268
|
+
offset?: number;
|
|
269
|
+
signal?: AbortSignal;
|
|
270
|
+
}): Promise<AssistantVersion[]>;
|
|
271
|
+
/**
|
|
272
|
+
* Change the version of an assistant.
|
|
273
|
+
*
|
|
274
|
+
* @param assistantId ID of the assistant.
|
|
275
|
+
* @param version The version to change to.
|
|
276
|
+
* @returns The updated assistant.
|
|
277
|
+
*/
|
|
278
|
+
setLatest(assistantId: string, version: number, options?: {
|
|
279
|
+
signal?: AbortSignal;
|
|
280
|
+
}): Promise<Assistant>;
|
|
281
|
+
}
|
|
282
|
+
declare class ThreadsClient<TStateType = DefaultValues, TUpdateType = TStateType> extends BaseClient {
|
|
283
|
+
/**
|
|
284
|
+
* Get a thread by ID.
|
|
285
|
+
*
|
|
286
|
+
* @param threadId ID of the thread.
|
|
287
|
+
* @returns The thread.
|
|
288
|
+
*/
|
|
289
|
+
get<ValuesType = TStateType>(threadId: string, options?: {
|
|
290
|
+
signal?: AbortSignal;
|
|
291
|
+
}): Promise<Thread<ValuesType>>;
|
|
292
|
+
/**
|
|
293
|
+
* Create a new thread.
|
|
294
|
+
*
|
|
295
|
+
* @param payload Payload for creating a thread.
|
|
296
|
+
* @returns The created thread.
|
|
297
|
+
*/
|
|
298
|
+
create(payload?: {
|
|
299
|
+
/**
|
|
300
|
+
* Metadata for the thread.
|
|
301
|
+
*/
|
|
302
|
+
metadata?: Metadata;
|
|
303
|
+
/**
|
|
304
|
+
* ID of the thread to create.
|
|
305
|
+
*
|
|
306
|
+
* If not provided, a random UUID will be generated.
|
|
307
|
+
*/
|
|
308
|
+
threadId?: string;
|
|
309
|
+
/**
|
|
310
|
+
* How to handle duplicate creation.
|
|
311
|
+
*
|
|
312
|
+
* @default "raise"
|
|
313
|
+
*/
|
|
314
|
+
ifExists?: OnConflictBehavior;
|
|
315
|
+
/**
|
|
316
|
+
* Graph ID to associate with the thread.
|
|
317
|
+
*/
|
|
318
|
+
graphId?: string;
|
|
319
|
+
/**
|
|
320
|
+
* Apply a list of supersteps when creating a thread, each containing a sequence of updates.
|
|
321
|
+
*
|
|
322
|
+
* Used for copying a thread between deployments.
|
|
323
|
+
*/
|
|
324
|
+
supersteps?: Array<{
|
|
325
|
+
updates: Array<{
|
|
326
|
+
values: unknown;
|
|
327
|
+
command?: Command;
|
|
328
|
+
asNode: string;
|
|
329
|
+
}>;
|
|
330
|
+
}>;
|
|
331
|
+
/**
|
|
332
|
+
* Optional time-to-live in minutes for the thread.
|
|
333
|
+
* If a number is provided, it is treated as minutes and defaults to strategy "delete".
|
|
334
|
+
* You may also provide an object { ttl: number, strategy?: "delete" }.
|
|
335
|
+
*/
|
|
336
|
+
ttl?: number | {
|
|
337
|
+
ttl: number;
|
|
338
|
+
strategy?: "delete";
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* Signal to abort the request.
|
|
342
|
+
*/
|
|
343
|
+
signal?: AbortSignal;
|
|
344
|
+
}): Promise<Thread<TStateType>>;
|
|
345
|
+
/**
|
|
346
|
+
* Copy an existing thread
|
|
347
|
+
* @param threadId ID of the thread to be copied
|
|
348
|
+
* @returns Newly copied thread
|
|
349
|
+
*/
|
|
350
|
+
copy(threadId: string, options?: {
|
|
351
|
+
signal?: AbortSignal;
|
|
352
|
+
}): Promise<Thread<TStateType>>;
|
|
353
|
+
/**
|
|
354
|
+
* Update a thread.
|
|
355
|
+
*
|
|
356
|
+
* @param threadId ID of the thread.
|
|
357
|
+
* @param payload Payload for updating the thread.
|
|
358
|
+
* @returns The updated thread.
|
|
359
|
+
*/
|
|
360
|
+
update(threadId: string, payload?: {
|
|
361
|
+
/**
|
|
362
|
+
* Metadata for the thread.
|
|
363
|
+
*/
|
|
364
|
+
metadata?: Metadata;
|
|
365
|
+
/**
|
|
366
|
+
* Optional time-to-live in minutes for the thread.
|
|
367
|
+
* If a number is provided, it is treated as minutes and defaults to strategy "delete".
|
|
368
|
+
* You may also provide an object { ttl: number, strategy?: "delete" }.
|
|
369
|
+
*/
|
|
370
|
+
ttl?: number | {
|
|
371
|
+
ttl: number;
|
|
372
|
+
strategy?: "delete";
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Signal to abort the request.
|
|
376
|
+
*/
|
|
377
|
+
signal?: AbortSignal;
|
|
378
|
+
}): Promise<Thread>;
|
|
379
|
+
/**
|
|
380
|
+
* Delete a thread.
|
|
381
|
+
*
|
|
382
|
+
* @param threadId ID of the thread.
|
|
383
|
+
*/
|
|
384
|
+
delete(threadId: string, options?: {
|
|
385
|
+
signal?: AbortSignal;
|
|
386
|
+
}): Promise<void>;
|
|
387
|
+
/**
|
|
388
|
+
* List threads
|
|
389
|
+
*
|
|
390
|
+
* @param query Query options
|
|
391
|
+
* @returns List of threads
|
|
392
|
+
*/
|
|
393
|
+
search<ValuesType = TStateType>(query?: {
|
|
394
|
+
/**
|
|
395
|
+
* Metadata to filter threads by.
|
|
396
|
+
*/
|
|
397
|
+
metadata?: Metadata;
|
|
398
|
+
/**
|
|
399
|
+
* Filter by specific thread IDs.
|
|
400
|
+
*/
|
|
401
|
+
ids?: string[];
|
|
402
|
+
/**
|
|
403
|
+
* Maximum number of threads to return.
|
|
404
|
+
* Defaults to 10
|
|
405
|
+
*/
|
|
406
|
+
limit?: number;
|
|
407
|
+
/**
|
|
408
|
+
* Offset to start from.
|
|
409
|
+
*/
|
|
410
|
+
offset?: number;
|
|
411
|
+
/**
|
|
412
|
+
* Thread status to filter on.
|
|
413
|
+
*/
|
|
414
|
+
status?: ThreadStatus;
|
|
415
|
+
/**
|
|
416
|
+
* Sort by.
|
|
417
|
+
*/
|
|
418
|
+
sortBy?: ThreadSortBy;
|
|
419
|
+
/**
|
|
420
|
+
* Sort order.
|
|
421
|
+
* Must be one of 'asc' or 'desc'.
|
|
422
|
+
*/
|
|
423
|
+
sortOrder?: SortOrder;
|
|
424
|
+
/**
|
|
425
|
+
* Array of fields to select.
|
|
426
|
+
* Elements or array must be one of 'thread_id, 'created_at', 'updated_at', 'metadata', 'config', 'context', 'status', 'values', or 'interrupts'.
|
|
427
|
+
*/
|
|
428
|
+
select?: ThreadSelectField[];
|
|
429
|
+
/**
|
|
430
|
+
* Values to filter threads by.
|
|
431
|
+
*/
|
|
432
|
+
values?: ThreadValuesFilter;
|
|
433
|
+
/**
|
|
434
|
+
* Signal to abort the request.
|
|
435
|
+
*/
|
|
436
|
+
signal?: AbortSignal;
|
|
437
|
+
}): Promise<Thread<ValuesType>[]>;
|
|
438
|
+
/**
|
|
439
|
+
* Count threads matching filters.
|
|
440
|
+
*
|
|
441
|
+
* @param query.metadata Thread metadata to filter on.
|
|
442
|
+
* @param query.values State values to filter on.
|
|
443
|
+
* @param query.status Thread status to filter on.
|
|
444
|
+
* @returns Number of threads matching the criteria.
|
|
445
|
+
*/
|
|
446
|
+
count<ValuesType = TStateType>(query?: {
|
|
447
|
+
metadata?: Metadata;
|
|
448
|
+
values?: ValuesType;
|
|
449
|
+
status?: ThreadStatus;
|
|
450
|
+
signal?: AbortSignal;
|
|
451
|
+
}): Promise<number>;
|
|
452
|
+
/**
|
|
453
|
+
* Get state for a thread.
|
|
454
|
+
*
|
|
455
|
+
* @param threadId ID of the thread.
|
|
456
|
+
* @returns Thread state.
|
|
457
|
+
*/
|
|
458
|
+
getState<ValuesType = TStateType>(threadId: string, checkpoint?: Checkpoint | string, options?: {
|
|
459
|
+
subgraphs?: boolean;
|
|
460
|
+
signal?: AbortSignal;
|
|
461
|
+
}): Promise<ThreadState<ValuesType>>;
|
|
462
|
+
/**
|
|
463
|
+
* Add state to a thread.
|
|
464
|
+
*
|
|
465
|
+
* @param threadId The ID of the thread.
|
|
466
|
+
* @returns
|
|
467
|
+
*/
|
|
468
|
+
updateState<ValuesType = TUpdateType>(threadId: string, options: {
|
|
469
|
+
values: ValuesType;
|
|
470
|
+
checkpoint?: Checkpoint;
|
|
471
|
+
checkpointId?: string;
|
|
472
|
+
asNode?: string;
|
|
473
|
+
signal?: AbortSignal;
|
|
474
|
+
}): Promise<Pick<Config, "configurable">>;
|
|
475
|
+
/**
|
|
476
|
+
* Patch the metadata of a thread.
|
|
477
|
+
*
|
|
478
|
+
* @param threadIdOrConfig Thread ID or config to patch the state of.
|
|
479
|
+
* @param metadata Metadata to patch the state with.
|
|
480
|
+
*/
|
|
481
|
+
patchState(threadIdOrConfig: string | Config, metadata: Metadata, options?: {
|
|
482
|
+
signal?: AbortSignal;
|
|
483
|
+
}): Promise<void>;
|
|
484
|
+
/**
|
|
485
|
+
* Get all past states for a thread.
|
|
486
|
+
*
|
|
487
|
+
* @param threadId ID of the thread.
|
|
488
|
+
* @param options Additional options.
|
|
489
|
+
* @returns List of thread states.
|
|
490
|
+
*/
|
|
491
|
+
getHistory<ValuesType = TStateType>(threadId: string, options?: {
|
|
492
|
+
limit?: number;
|
|
493
|
+
before?: Config;
|
|
494
|
+
checkpoint?: Partial<Omit<Checkpoint, "thread_id">>;
|
|
495
|
+
metadata?: Metadata;
|
|
496
|
+
signal?: AbortSignal;
|
|
497
|
+
}): Promise<ThreadState<ValuesType>[]>;
|
|
498
|
+
joinStream(threadId: string, options?: {
|
|
499
|
+
lastEventId?: string;
|
|
500
|
+
streamMode?: ThreadStreamMode | ThreadStreamMode[];
|
|
501
|
+
signal?: AbortSignal;
|
|
502
|
+
}): AsyncGenerator<{
|
|
503
|
+
id?: string;
|
|
504
|
+
event: StreamEvent;
|
|
505
|
+
data: any;
|
|
506
|
+
}>;
|
|
507
|
+
}
|
|
508
|
+
declare class RunsClient<TStateType = DefaultValues, TUpdateType = TStateType, TCustomEventType = unknown> extends BaseClient {
|
|
509
|
+
stream<TStreamMode extends StreamMode | StreamMode[] = StreamMode, TSubgraphs extends boolean = false>(threadId: null, assistantId: string, payload?: Omit<RunsStreamPayload<TStreamMode, TSubgraphs>, "multitaskStrategy" | "onCompletion">): TypedAsyncGenerator<TStreamMode, TSubgraphs, TStateType, TUpdateType, TCustomEventType>;
|
|
510
|
+
stream<TStreamMode extends StreamMode | StreamMode[] = StreamMode, TSubgraphs extends boolean = false>(threadId: string, assistantId: string, payload?: RunsStreamPayload<TStreamMode, TSubgraphs>): TypedAsyncGenerator<TStreamMode, TSubgraphs, TStateType, TUpdateType, TCustomEventType>;
|
|
511
|
+
/**
|
|
512
|
+
* Create a run.
|
|
513
|
+
*
|
|
514
|
+
* @param threadId The ID of the thread.
|
|
515
|
+
* @param assistantId Assistant ID to use for this run.
|
|
516
|
+
* @param payload Payload for creating a run.
|
|
517
|
+
* @returns The created run.
|
|
518
|
+
*/
|
|
519
|
+
create(threadId: string | null, assistantId: string, payload?: RunsCreatePayload): Promise<Run>;
|
|
520
|
+
/**
|
|
521
|
+
* Create a batch of stateless background runs.
|
|
522
|
+
*
|
|
523
|
+
* @param payloads An array of payloads for creating runs.
|
|
524
|
+
* @returns An array of created runs.
|
|
525
|
+
*/
|
|
526
|
+
createBatch(payloads: (Omit<RunsCreatePayload, "signal"> & {
|
|
527
|
+
assistantId: string;
|
|
528
|
+
})[], options?: {
|
|
529
|
+
signal?: AbortSignal;
|
|
530
|
+
}): Promise<Run[]>;
|
|
531
|
+
wait(threadId: null, assistantId: string, payload?: Omit<RunsWaitPayload, "multitaskStrategy" | "onCompletion">): Promise<ThreadState["values"]>;
|
|
532
|
+
wait(threadId: string, assistantId: string, payload?: RunsWaitPayload): Promise<ThreadState["values"]>;
|
|
533
|
+
/**
|
|
534
|
+
* List all runs for a thread.
|
|
535
|
+
*
|
|
536
|
+
* @param threadId The ID of the thread.
|
|
537
|
+
* @param options Filtering and pagination options.
|
|
538
|
+
* @returns List of runs.
|
|
539
|
+
*/
|
|
540
|
+
list(threadId: string, options?: {
|
|
541
|
+
/**
|
|
542
|
+
* Maximum number of runs to return.
|
|
543
|
+
* Defaults to 10
|
|
544
|
+
*/
|
|
545
|
+
limit?: number;
|
|
546
|
+
/**
|
|
547
|
+
* Offset to start from.
|
|
548
|
+
* Defaults to 0.
|
|
549
|
+
*/
|
|
550
|
+
offset?: number;
|
|
551
|
+
/**
|
|
552
|
+
* Status of the run to filter by.
|
|
553
|
+
*/
|
|
554
|
+
status?: RunStatus;
|
|
555
|
+
select?: RunSelectField[];
|
|
556
|
+
/**
|
|
557
|
+
* Signal to abort the request.
|
|
558
|
+
*/
|
|
559
|
+
signal?: AbortSignal;
|
|
560
|
+
}): Promise<Run[]>;
|
|
561
|
+
/**
|
|
562
|
+
* Get a run by ID.
|
|
563
|
+
*
|
|
564
|
+
* @param threadId The ID of the thread.
|
|
565
|
+
* @param runId The ID of the run.
|
|
566
|
+
* @returns The run.
|
|
567
|
+
*/
|
|
568
|
+
get(threadId: string, runId: string, options?: {
|
|
569
|
+
signal?: AbortSignal;
|
|
570
|
+
}): Promise<Run>;
|
|
571
|
+
/**
|
|
572
|
+
* Cancel a run.
|
|
573
|
+
*
|
|
574
|
+
* @param threadId The ID of the thread.
|
|
575
|
+
* @param runId The ID of the run.
|
|
576
|
+
* @param wait Whether to block when canceling
|
|
577
|
+
* @param action Action to take when cancelling the run. Possible values are `interrupt` or `rollback`. Default is `interrupt`.
|
|
578
|
+
* @returns
|
|
579
|
+
*/
|
|
580
|
+
cancel(threadId: string, runId: string, wait?: boolean, action?: CancelAction, options?: {
|
|
581
|
+
signal?: AbortSignal;
|
|
582
|
+
}): Promise<void>;
|
|
583
|
+
/**
|
|
584
|
+
* Block until a run is done.
|
|
585
|
+
*
|
|
586
|
+
* @param threadId The ID of the thread.
|
|
587
|
+
* @param runId The ID of the run.
|
|
588
|
+
* @returns
|
|
589
|
+
*/
|
|
590
|
+
join(threadId: string, runId: string, options?: {
|
|
591
|
+
signal?: AbortSignal;
|
|
592
|
+
}): Promise<TStateType>;
|
|
593
|
+
/**
|
|
594
|
+
* Stream output from a run in real-time, until the run is done.
|
|
595
|
+
*
|
|
596
|
+
* @param threadId The ID of the thread. Can be set to `null` | `undefined` for stateless runs.
|
|
597
|
+
* @param runId The ID of the run.
|
|
598
|
+
* @param options Additional options for controlling the stream behavior:
|
|
599
|
+
* - signal: An AbortSignal that can be used to cancel the stream request
|
|
600
|
+
* - lastEventId: The ID of the last event received. Can be used to reconnect to a stream without losing events.
|
|
601
|
+
* - cancelOnDisconnect: When true, automatically cancels the run if the client disconnects from the stream
|
|
602
|
+
* - streamMode: Controls what types of events to receive from the stream (can be a single mode or array of modes)
|
|
603
|
+
* Must be a subset of the stream modes passed when creating the run. Background runs default to having the union of all
|
|
604
|
+
* stream modes enabled.
|
|
605
|
+
* @returns An async generator yielding stream parts.
|
|
606
|
+
*/
|
|
607
|
+
joinStream(threadId: string | undefined | null, runId: string, options?: {
|
|
608
|
+
signal?: AbortSignal;
|
|
609
|
+
cancelOnDisconnect?: boolean;
|
|
610
|
+
lastEventId?: string;
|
|
611
|
+
streamMode?: StreamMode | StreamMode[];
|
|
612
|
+
} | AbortSignal): AsyncGenerator<{
|
|
613
|
+
id?: string;
|
|
614
|
+
event: StreamEvent;
|
|
615
|
+
data: any;
|
|
616
|
+
}>;
|
|
617
|
+
/**
|
|
618
|
+
* Delete a run.
|
|
619
|
+
*
|
|
620
|
+
* @param threadId The ID of the thread.
|
|
621
|
+
* @param runId The ID of the run.
|
|
622
|
+
* @returns
|
|
623
|
+
*/
|
|
624
|
+
delete(threadId: string, runId: string, options?: {
|
|
625
|
+
signal?: AbortSignal;
|
|
626
|
+
}): Promise<void>;
|
|
627
|
+
}
|
|
628
|
+
declare class StoreClient extends BaseClient {
|
|
629
|
+
/**
|
|
630
|
+
* Store or update an item.
|
|
631
|
+
*
|
|
632
|
+
* @param namespace A list of strings representing the namespace path.
|
|
633
|
+
* @param key The unique identifier for the item within the namespace.
|
|
634
|
+
* @param value A dictionary containing the item's data.
|
|
635
|
+
* @param options.index Controls search indexing - null (use defaults), false (disable), or list of field paths to index.
|
|
636
|
+
* @param options.ttl Optional time-to-live in minutes for the item, or null for no expiration.
|
|
637
|
+
* @returns Promise<void>
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```typescript
|
|
641
|
+
* await client.store.putItem(
|
|
642
|
+
* ["documents", "user123"],
|
|
643
|
+
* "item456",
|
|
644
|
+
* { title: "My Document", content: "Hello World" },
|
|
645
|
+
* { ttl: 60 } // expires in 60 minutes
|
|
646
|
+
* );
|
|
647
|
+
* ```
|
|
648
|
+
*/
|
|
649
|
+
putItem(namespace: string[], key: string, value: Record<string, unknown>, options?: {
|
|
650
|
+
index?: false | string[] | null;
|
|
651
|
+
ttl?: number | null;
|
|
652
|
+
signal?: AbortSignal;
|
|
653
|
+
}): Promise<void>;
|
|
654
|
+
/**
|
|
655
|
+
* Retrieve a single item.
|
|
656
|
+
*
|
|
657
|
+
* @param namespace A list of strings representing the namespace path.
|
|
658
|
+
* @param key The unique identifier for the item.
|
|
659
|
+
* @param options.refreshTtl Whether to refresh the TTL on this read operation. If null, uses the store's default behavior.
|
|
660
|
+
* @returns Promise<Item>
|
|
661
|
+
*
|
|
662
|
+
* @example
|
|
663
|
+
* ```typescript
|
|
664
|
+
* const item = await client.store.getItem(
|
|
665
|
+
* ["documents", "user123"],
|
|
666
|
+
* "item456",
|
|
667
|
+
* { refreshTtl: true }
|
|
668
|
+
* );
|
|
669
|
+
* console.log(item);
|
|
670
|
+
* // {
|
|
671
|
+
* // namespace: ["documents", "user123"],
|
|
672
|
+
* // key: "item456",
|
|
673
|
+
* // value: { title: "My Document", content: "Hello World" },
|
|
674
|
+
* // createdAt: "2024-07-30T12:00:00Z",
|
|
675
|
+
* // updatedAt: "2024-07-30T12:00:00Z"
|
|
676
|
+
* // }
|
|
677
|
+
* ```
|
|
678
|
+
*/
|
|
679
|
+
getItem(namespace: string[], key: string, options?: {
|
|
680
|
+
refreshTtl?: boolean | null;
|
|
681
|
+
signal?: AbortSignal;
|
|
682
|
+
}): Promise<Item | null>;
|
|
683
|
+
/**
|
|
684
|
+
* Delete an item.
|
|
685
|
+
*
|
|
686
|
+
* @param namespace A list of strings representing the namespace path.
|
|
687
|
+
* @param key The unique identifier for the item.
|
|
688
|
+
* @returns Promise<void>
|
|
689
|
+
*/
|
|
690
|
+
deleteItem(namespace: string[], key: string, options?: {
|
|
691
|
+
signal?: AbortSignal;
|
|
692
|
+
}): Promise<void>;
|
|
693
|
+
/**
|
|
694
|
+
* Search for items within a namespace prefix.
|
|
695
|
+
*
|
|
696
|
+
* @param namespacePrefix List of strings representing the namespace prefix.
|
|
697
|
+
* @param options.filter Optional dictionary of key-value pairs to filter results.
|
|
698
|
+
* @param options.limit Maximum number of items to return (default is 10).
|
|
699
|
+
* @param options.offset Number of items to skip before returning results (default is 0).
|
|
700
|
+
* @param options.query Optional search query.
|
|
701
|
+
* @param options.refreshTtl Whether to refresh the TTL on items returned by this search. If null, uses the store's default behavior.
|
|
702
|
+
* @returns Promise<SearchItemsResponse>
|
|
703
|
+
*
|
|
704
|
+
* @example
|
|
705
|
+
* ```typescript
|
|
706
|
+
* const results = await client.store.searchItems(
|
|
707
|
+
* ["documents"],
|
|
708
|
+
* {
|
|
709
|
+
* filter: { author: "John Doe" },
|
|
710
|
+
* limit: 5,
|
|
711
|
+
* refreshTtl: true
|
|
712
|
+
* }
|
|
713
|
+
* );
|
|
714
|
+
* console.log(results);
|
|
715
|
+
* // {
|
|
716
|
+
* // items: [
|
|
717
|
+
* // {
|
|
718
|
+
* // namespace: ["documents", "user123"],
|
|
719
|
+
* // key: "item789",
|
|
720
|
+
* // value: { title: "Another Document", author: "John Doe" },
|
|
721
|
+
* // createdAt: "2024-07-30T12:00:00Z",
|
|
722
|
+
* // updatedAt: "2024-07-30T12:00:00Z"
|
|
723
|
+
* // },
|
|
724
|
+
* // // ... additional items ...
|
|
725
|
+
* // ]
|
|
726
|
+
* // }
|
|
727
|
+
* ```
|
|
728
|
+
*/
|
|
729
|
+
searchItems(namespacePrefix: string[], options?: {
|
|
730
|
+
filter?: Record<string, unknown>;
|
|
731
|
+
limit?: number;
|
|
732
|
+
offset?: number;
|
|
733
|
+
query?: string;
|
|
734
|
+
refreshTtl?: boolean | null;
|
|
735
|
+
signal?: AbortSignal;
|
|
736
|
+
}): Promise<SearchItemsResponse>;
|
|
737
|
+
/**
|
|
738
|
+
* List namespaces with optional match conditions.
|
|
739
|
+
*
|
|
740
|
+
* @param options.prefix Optional list of strings representing the prefix to filter namespaces.
|
|
741
|
+
* @param options.suffix Optional list of strings representing the suffix to filter namespaces.
|
|
742
|
+
* @param options.maxDepth Optional integer specifying the maximum depth of namespaces to return.
|
|
743
|
+
* @param options.limit Maximum number of namespaces to return (default is 100).
|
|
744
|
+
* @param options.offset Number of namespaces to skip before returning results (default is 0).
|
|
745
|
+
* @returns Promise<ListNamespaceResponse>
|
|
746
|
+
*/
|
|
747
|
+
listNamespaces(options?: {
|
|
748
|
+
prefix?: string[];
|
|
749
|
+
suffix?: string[];
|
|
750
|
+
maxDepth?: number;
|
|
751
|
+
limit?: number;
|
|
752
|
+
offset?: number;
|
|
753
|
+
signal?: AbortSignal;
|
|
754
|
+
}): Promise<ListNamespaceResponse>;
|
|
755
|
+
}
|
|
756
|
+
declare class UiClient extends BaseClient {
|
|
757
|
+
private static promiseCache;
|
|
758
|
+
private static getOrCached;
|
|
759
|
+
getComponent(assistantId: string, agentName: string): Promise<string>;
|
|
760
|
+
}
|
|
761
|
+
declare class Client<TStateType = DefaultValues, TUpdateType = TStateType, TCustomEventType = unknown> {
|
|
762
|
+
/**
|
|
763
|
+
* The client for interacting with assistants.
|
|
764
|
+
*/
|
|
765
|
+
assistants: AssistantsClient;
|
|
766
|
+
/**
|
|
767
|
+
* The client for interacting with threads.
|
|
768
|
+
*/
|
|
769
|
+
threads: ThreadsClient<TStateType, TUpdateType>;
|
|
770
|
+
/**
|
|
771
|
+
* The client for interacting with runs.
|
|
772
|
+
*/
|
|
773
|
+
runs: RunsClient<TStateType, TUpdateType, TCustomEventType>;
|
|
774
|
+
/**
|
|
775
|
+
* The client for interacting with cron runs.
|
|
776
|
+
*/
|
|
777
|
+
crons: CronsClient;
|
|
778
|
+
/**
|
|
779
|
+
* The client for interacting with the KV store.
|
|
780
|
+
*/
|
|
781
|
+
store: StoreClient;
|
|
782
|
+
/**
|
|
783
|
+
* The client for interacting with the UI.
|
|
784
|
+
* @internal Used by LoadExternalComponent and the API might change in the future.
|
|
785
|
+
*/
|
|
786
|
+
"~ui": UiClient;
|
|
787
|
+
/**
|
|
788
|
+
* @internal Used to obtain a stable key representing the client.
|
|
789
|
+
*/
|
|
790
|
+
private "~configHash";
|
|
791
|
+
constructor(config?: ClientConfig);
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* @internal Used to obtain a stable key representing the client.
|
|
795
|
+
*/
|
|
796
|
+
declare function getClientConfigHash(client: Client): string | undefined;
|
|
797
|
+
//#endregion
|
|
798
|
+
export { AssistantsClient, Client, ClientConfig, CronsClient, RequestHook, RunsClient, StoreClient, ThreadsClient, getApiKey, getClientConfigHash };
|
|
799
|
+
//# sourceMappingURL=client.d.cts.map
|