librechat-data-provider 0.8.402 → 0.8.404
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/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react-query/index.es.js +1 -1
- package/dist/react-query/index.es.js.map +1 -1
- package/dist/types/accessPermissions.d.ts +744 -0
- package/dist/types/actions.d.ts +118 -0
- package/dist/types/api-endpoints.d.ts +150 -0
- package/dist/types/artifacts.d.ts +97 -0
- package/dist/types/azure.d.ts +22 -0
- package/dist/types/bedrock.d.ts +1220 -0
- package/dist/types/config.d.ts +14849 -0
- package/dist/types/config.spec.d.ts +1 -0
- package/dist/types/createPayload.d.ts +5 -0
- package/dist/types/data-service.d.ts +287 -0
- package/dist/types/feedback.d.ts +36 -0
- package/dist/types/file-config.d.ts +263 -0
- package/dist/types/file-config.spec.d.ts +1 -0
- package/dist/types/generate.d.ts +597 -0
- package/dist/types/headers-helpers.d.ts +2 -0
- package/{src/index.ts → dist/types/index.d.ts} +0 -15
- package/dist/types/keys.d.ts +92 -0
- package/dist/types/mcp.d.ts +2760 -0
- package/dist/types/messages.d.ts +10 -0
- package/dist/types/models.d.ts +1547 -0
- package/dist/types/parameterSettings.d.ts +69 -0
- package/dist/types/parsers.d.ts +110 -0
- package/dist/types/permissions.d.ts +522 -0
- package/dist/types/react-query/react-query-service.d.ts +85 -0
- package/dist/types/request.d.ts +25 -0
- package/dist/types/roles.d.ts +554 -0
- package/dist/types/roles.spec.d.ts +1 -0
- package/dist/types/schemas.d.ts +5110 -0
- package/dist/types/schemas.spec.d.ts +1 -0
- package/dist/types/types/agents.d.ts +433 -0
- package/dist/types/types/assistants.d.ts +547 -0
- package/dist/types/types/files.d.ts +172 -0
- package/dist/types/types/graph.d.ts +135 -0
- package/{src/types/mcpServers.ts → dist/types/types/mcpServers.d.ts} +12 -18
- package/dist/types/types/mutations.d.ts +209 -0
- package/dist/types/types/queries.d.ts +169 -0
- package/dist/types/types/runs.d.ts +36 -0
- package/dist/types/types/web.d.ts +520 -0
- package/dist/types/types.d.ts +503 -0
- package/dist/types/utils.d.ts +12 -0
- package/package.json +5 -1
- package/babel.config.js +0 -4
- package/check_updates.sh +0 -52
- package/jest.config.js +0 -19
- package/react-query/package-lock.json +0 -292
- package/react-query/package.json +0 -10
- package/rollup.config.js +0 -74
- package/server-rollup.config.js +0 -40
- package/specs/actions.spec.ts +0 -2533
- package/specs/api-endpoints-subdir.spec.ts +0 -140
- package/specs/api-endpoints.spec.ts +0 -74
- package/specs/azure.spec.ts +0 -844
- package/specs/bedrock.spec.ts +0 -862
- package/specs/filetypes.spec.ts +0 -175
- package/specs/generate.spec.ts +0 -770
- package/specs/headers-helpers.spec.ts +0 -24
- package/specs/mcp.spec.ts +0 -147
- package/specs/openapiSpecs.ts +0 -524
- package/specs/parsers.spec.ts +0 -601
- package/specs/request-interceptor.spec.ts +0 -304
- package/specs/utils.spec.ts +0 -196
- package/src/accessPermissions.ts +0 -346
- package/src/actions.ts +0 -813
- package/src/api-endpoints.ts +0 -440
- package/src/artifacts.ts +0 -3104
- package/src/azure.ts +0 -328
- package/src/bedrock.ts +0 -425
- package/src/config.spec.ts +0 -315
- package/src/config.ts +0 -2006
- package/src/createPayload.ts +0 -46
- package/src/data-service.ts +0 -1087
- package/src/feedback.ts +0 -141
- package/src/file-config.spec.ts +0 -1248
- package/src/file-config.ts +0 -764
- package/src/generate.ts +0 -634
- package/src/headers-helpers.ts +0 -13
- package/src/keys.ts +0 -99
- package/src/mcp.ts +0 -271
- package/src/messages.ts +0 -50
- package/src/models.ts +0 -69
- package/src/parameterSettings.ts +0 -1111
- package/src/parsers.ts +0 -563
- package/src/permissions.ts +0 -188
- package/src/react-query/react-query-service.ts +0 -566
- package/src/request.ts +0 -171
- package/src/roles.spec.ts +0 -132
- package/src/roles.ts +0 -225
- package/src/schemas.spec.ts +0 -355
- package/src/schemas.ts +0 -1234
- package/src/types/agents.ts +0 -470
- package/src/types/assistants.ts +0 -654
- package/src/types/files.ts +0 -191
- package/src/types/graph.ts +0 -145
- package/src/types/mutations.ts +0 -422
- package/src/types/queries.ts +0 -208
- package/src/types/runs.ts +0 -40
- package/src/types/web.ts +0 -588
- package/src/types.ts +0 -676
- package/src/utils.ts +0 -85
- package/tsconfig.json +0 -28
- package/tsconfig.spec.json +0 -10
- /package/{src/react-query/index.ts → dist/types/react-query/index.d.ts} +0 -0
- /package/{src/types/index.ts → dist/types/types/index.d.ts} +0 -0
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { AssistantsEndpoint, AgentProvider } from 'src/schemas';
|
|
3
|
+
import type { Agents, GraphEdge } from './agents';
|
|
4
|
+
import type { ContentTypes } from './runs';
|
|
5
|
+
import type { TFile } from './files';
|
|
6
|
+
import { ArtifactModes } from 'src/artifacts';
|
|
7
|
+
export type Schema = OpenAPIV3.SchemaObject & {
|
|
8
|
+
description?: string;
|
|
9
|
+
};
|
|
10
|
+
export type Reference = OpenAPIV3.ReferenceObject & {
|
|
11
|
+
description?: string;
|
|
12
|
+
};
|
|
13
|
+
export type Metadata = {
|
|
14
|
+
avatar?: string;
|
|
15
|
+
author?: string;
|
|
16
|
+
} & {
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
export declare enum Tools {
|
|
20
|
+
execute_code = "execute_code",
|
|
21
|
+
code_interpreter = "code_interpreter",
|
|
22
|
+
file_search = "file_search",
|
|
23
|
+
web_search = "web_search",
|
|
24
|
+
retrieval = "retrieval",
|
|
25
|
+
function = "function",
|
|
26
|
+
memory = "memory",
|
|
27
|
+
ui_resources = "ui_resources"
|
|
28
|
+
}
|
|
29
|
+
export declare enum EToolResources {
|
|
30
|
+
code_interpreter = "code_interpreter",
|
|
31
|
+
execute_code = "execute_code",
|
|
32
|
+
file_search = "file_search",
|
|
33
|
+
image_edit = "image_edit",
|
|
34
|
+
context = "context",
|
|
35
|
+
ocr = "ocr"
|
|
36
|
+
}
|
|
37
|
+
export type Tool = {
|
|
38
|
+
[type: string]: Tools;
|
|
39
|
+
};
|
|
40
|
+
export type FunctionTool = {
|
|
41
|
+
type: Tools;
|
|
42
|
+
function?: {
|
|
43
|
+
description: string;
|
|
44
|
+
name: string;
|
|
45
|
+
parameters: Record<string, unknown>;
|
|
46
|
+
strict?: boolean;
|
|
47
|
+
additionalProperties?: boolean;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* A set of resources that are used by the assistant's tools. The resources are
|
|
52
|
+
* specific to the type of tool. For example, the `code_interpreter` tool requires
|
|
53
|
+
* a list of file IDs, while the `file_search` tool requires a list of vector store
|
|
54
|
+
* IDs.
|
|
55
|
+
*/
|
|
56
|
+
export interface ToolResources {
|
|
57
|
+
code_interpreter?: CodeInterpreterResource;
|
|
58
|
+
file_search?: FileSearchResource;
|
|
59
|
+
}
|
|
60
|
+
export interface CodeInterpreterResource {
|
|
61
|
+
/**
|
|
62
|
+
* A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
|
|
63
|
+
* available to the `code_interpreter`` tool. There can be a maximum of 20 files
|
|
64
|
+
* associated with the tool.
|
|
65
|
+
*/
|
|
66
|
+
file_ids?: Array<string>;
|
|
67
|
+
}
|
|
68
|
+
export interface FileSearchResource {
|
|
69
|
+
/**
|
|
70
|
+
* The ID of the
|
|
71
|
+
* [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
|
|
72
|
+
* attached to this assistant. There can be a maximum of 1 vector store attached to
|
|
73
|
+
* the assistant.
|
|
74
|
+
*/
|
|
75
|
+
vector_store_ids?: Array<string>;
|
|
76
|
+
}
|
|
77
|
+
export type Assistant = {
|
|
78
|
+
id: string;
|
|
79
|
+
created_at: number;
|
|
80
|
+
description: string | null;
|
|
81
|
+
file_ids?: string[];
|
|
82
|
+
instructions: string | null;
|
|
83
|
+
conversation_starters?: string[];
|
|
84
|
+
metadata: Metadata | null;
|
|
85
|
+
model: string;
|
|
86
|
+
name: string | null;
|
|
87
|
+
object: string;
|
|
88
|
+
tools?: FunctionTool[];
|
|
89
|
+
tool_resources?: ToolResources;
|
|
90
|
+
};
|
|
91
|
+
export type TAssistantsMap = Record<AssistantsEndpoint, Record<string, Assistant>>;
|
|
92
|
+
export type AssistantCreateParams = {
|
|
93
|
+
model: string;
|
|
94
|
+
description?: string | null;
|
|
95
|
+
file_ids?: string[];
|
|
96
|
+
instructions?: string | null;
|
|
97
|
+
conversation_starters?: string[];
|
|
98
|
+
metadata?: Metadata | null;
|
|
99
|
+
name?: string | null;
|
|
100
|
+
tools?: Array<FunctionTool | string>;
|
|
101
|
+
endpoint: AssistantsEndpoint;
|
|
102
|
+
version: number | string;
|
|
103
|
+
append_current_datetime?: boolean;
|
|
104
|
+
};
|
|
105
|
+
export type AssistantUpdateParams = {
|
|
106
|
+
model?: string;
|
|
107
|
+
description?: string | null;
|
|
108
|
+
file_ids?: string[];
|
|
109
|
+
instructions?: string | null;
|
|
110
|
+
conversation_starters?: string[] | null;
|
|
111
|
+
metadata?: Metadata | null;
|
|
112
|
+
name?: string | null;
|
|
113
|
+
tools?: Array<FunctionTool | string>;
|
|
114
|
+
tool_resources?: ToolResources;
|
|
115
|
+
endpoint: AssistantsEndpoint;
|
|
116
|
+
append_current_datetime?: boolean;
|
|
117
|
+
};
|
|
118
|
+
export type AssistantListParams = {
|
|
119
|
+
limit?: number;
|
|
120
|
+
before?: string | null;
|
|
121
|
+
after?: string | null;
|
|
122
|
+
order?: 'asc' | 'desc';
|
|
123
|
+
endpoint: AssistantsEndpoint;
|
|
124
|
+
};
|
|
125
|
+
export type AssistantListResponse = {
|
|
126
|
+
object: string;
|
|
127
|
+
data: Assistant[];
|
|
128
|
+
first_id: string;
|
|
129
|
+
last_id: string;
|
|
130
|
+
has_more: boolean;
|
|
131
|
+
};
|
|
132
|
+
export type File = {
|
|
133
|
+
file_id: string;
|
|
134
|
+
id?: string;
|
|
135
|
+
temp_file_id?: string;
|
|
136
|
+
bytes: number;
|
|
137
|
+
created_at: number;
|
|
138
|
+
filename: string;
|
|
139
|
+
object: string;
|
|
140
|
+
purpose: 'fine-tune' | 'fine-tune-results' | 'assistants' | 'assistants_output';
|
|
141
|
+
};
|
|
142
|
+
export type AgentParameterValue = number | string | null;
|
|
143
|
+
export type AgentModelParameters = {
|
|
144
|
+
model?: string;
|
|
145
|
+
temperature: AgentParameterValue;
|
|
146
|
+
maxContextTokens: AgentParameterValue;
|
|
147
|
+
max_context_tokens: AgentParameterValue;
|
|
148
|
+
max_output_tokens: AgentParameterValue;
|
|
149
|
+
top_p: AgentParameterValue;
|
|
150
|
+
frequency_penalty: AgentParameterValue;
|
|
151
|
+
presence_penalty: AgentParameterValue;
|
|
152
|
+
useResponsesApi?: boolean;
|
|
153
|
+
};
|
|
154
|
+
export interface AgentBaseResource {
|
|
155
|
+
/**
|
|
156
|
+
* A list of file IDs made available to the tool.
|
|
157
|
+
*/
|
|
158
|
+
file_ids?: Array<string>;
|
|
159
|
+
/**
|
|
160
|
+
* A list of files already fetched.
|
|
161
|
+
*/
|
|
162
|
+
files?: Array<TFile>;
|
|
163
|
+
}
|
|
164
|
+
export interface AgentToolResources {
|
|
165
|
+
[EToolResources.image_edit]?: AgentBaseResource;
|
|
166
|
+
[EToolResources.execute_code]?: ExecuteCodeResource;
|
|
167
|
+
[EToolResources.file_search]?: AgentFileResource;
|
|
168
|
+
[EToolResources.context]?: AgentBaseResource;
|
|
169
|
+
/** @deprecated Use context instead */
|
|
170
|
+
[EToolResources.ocr]?: AgentBaseResource;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* A resource for the execute_code tool.
|
|
174
|
+
* Contains file IDs made available to the tool (max 20 files) and already fetched files.
|
|
175
|
+
*/
|
|
176
|
+
export type ExecuteCodeResource = AgentBaseResource;
|
|
177
|
+
export interface AgentFileResource extends AgentBaseResource {
|
|
178
|
+
/**
|
|
179
|
+
* The ID of the vector store attached to this agent. There
|
|
180
|
+
* can be a maximum of 1 vector store attached to the agent.
|
|
181
|
+
*/
|
|
182
|
+
vector_store_ids?: Array<string>;
|
|
183
|
+
}
|
|
184
|
+
export type SupportContact = {
|
|
185
|
+
name?: string;
|
|
186
|
+
email?: string;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Specifies who can invoke a tool.
|
|
190
|
+
* - 'direct': LLM can call directly
|
|
191
|
+
* - 'code_execution': Only callable via programmatic tool calling (PTC)
|
|
192
|
+
*/
|
|
193
|
+
export type AllowedCaller = 'direct' | 'code_execution';
|
|
194
|
+
/**
|
|
195
|
+
* Per-tool configuration options stored at the agent level.
|
|
196
|
+
* Keyed by tool_id (e.g., "search_mcp_github").
|
|
197
|
+
*/
|
|
198
|
+
export type ToolOptions = {
|
|
199
|
+
/**
|
|
200
|
+
* If true, the tool uses deferred loading (discoverable via tool search).
|
|
201
|
+
* @default false
|
|
202
|
+
*/
|
|
203
|
+
defer_loading?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Specifies who can invoke this tool.
|
|
206
|
+
* - 'direct': LLM can call directly (default behavior)
|
|
207
|
+
* - 'code_execution': Only callable via PTC sandbox
|
|
208
|
+
* @default ['direct']
|
|
209
|
+
*/
|
|
210
|
+
allowed_callers?: AllowedCaller[];
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Map of tool_id to its configuration options.
|
|
214
|
+
* Used to customize tool behavior per agent.
|
|
215
|
+
*/
|
|
216
|
+
export type AgentToolOptions = Record<string, ToolOptions>;
|
|
217
|
+
export type Agent = {
|
|
218
|
+
_id?: string;
|
|
219
|
+
id: string;
|
|
220
|
+
name: string | null;
|
|
221
|
+
author?: string | null;
|
|
222
|
+
/** The original custom endpoint name, lowercased */
|
|
223
|
+
endpoint?: string | null;
|
|
224
|
+
authorName?: string | null;
|
|
225
|
+
description: string | null;
|
|
226
|
+
created_at: number;
|
|
227
|
+
avatar: AgentAvatar | null;
|
|
228
|
+
instructions?: string | null;
|
|
229
|
+
additional_instructions?: string | null;
|
|
230
|
+
tools?: string[];
|
|
231
|
+
tool_kwargs?: Record<string, unknown>;
|
|
232
|
+
metadata?: Record<string, unknown>;
|
|
233
|
+
provider: AgentProvider;
|
|
234
|
+
model: string | null;
|
|
235
|
+
model_parameters: AgentModelParameters;
|
|
236
|
+
conversation_starters?: string[];
|
|
237
|
+
tool_resources?: AgentToolResources;
|
|
238
|
+
/** @deprecated Use edges instead */
|
|
239
|
+
agent_ids?: string[];
|
|
240
|
+
edges?: GraphEdge[];
|
|
241
|
+
end_after_tools?: boolean;
|
|
242
|
+
hide_sequential_outputs?: boolean;
|
|
243
|
+
artifacts?: ArtifactModes;
|
|
244
|
+
recursion_limit?: number;
|
|
245
|
+
isPublic?: boolean;
|
|
246
|
+
version?: number;
|
|
247
|
+
category?: string;
|
|
248
|
+
support_contact?: SupportContact;
|
|
249
|
+
/** Per-tool configuration options (deferred loading, allowed callers, etc.) */
|
|
250
|
+
tool_options?: AgentToolOptions;
|
|
251
|
+
};
|
|
252
|
+
export type TAgentsMap = Record<string, Agent | undefined>;
|
|
253
|
+
export type AgentCreateParams = {
|
|
254
|
+
name?: string | null;
|
|
255
|
+
description?: string | null;
|
|
256
|
+
avatar?: AgentAvatar | null;
|
|
257
|
+
file_ids?: string[];
|
|
258
|
+
instructions?: string | null;
|
|
259
|
+
tools?: Array<FunctionTool | string>;
|
|
260
|
+
provider: AgentProvider;
|
|
261
|
+
model: string | null;
|
|
262
|
+
model_parameters: AgentModelParameters;
|
|
263
|
+
} & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options'>;
|
|
264
|
+
export type AgentUpdateParams = {
|
|
265
|
+
name?: string | null;
|
|
266
|
+
description?: string | null;
|
|
267
|
+
avatar?: AgentAvatar | null;
|
|
268
|
+
file_ids?: string[];
|
|
269
|
+
instructions?: string | null;
|
|
270
|
+
tools?: Array<FunctionTool | string>;
|
|
271
|
+
tool_resources?: ToolResources;
|
|
272
|
+
provider?: AgentProvider;
|
|
273
|
+
model?: string | null;
|
|
274
|
+
model_parameters?: AgentModelParameters;
|
|
275
|
+
} & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options'>;
|
|
276
|
+
export type AgentListParams = {
|
|
277
|
+
limit?: number;
|
|
278
|
+
requiredPermission: number;
|
|
279
|
+
category?: string;
|
|
280
|
+
search?: string;
|
|
281
|
+
cursor?: string;
|
|
282
|
+
promoted?: 0 | 1;
|
|
283
|
+
};
|
|
284
|
+
export type AgentListResponse = {
|
|
285
|
+
object: string;
|
|
286
|
+
data: Agent[];
|
|
287
|
+
first_id: string;
|
|
288
|
+
last_id: string;
|
|
289
|
+
has_more: boolean;
|
|
290
|
+
after?: string;
|
|
291
|
+
};
|
|
292
|
+
export type AgentFile = {
|
|
293
|
+
file_id: string;
|
|
294
|
+
id?: string;
|
|
295
|
+
temp_file_id?: string;
|
|
296
|
+
bytes: number;
|
|
297
|
+
created_at: number;
|
|
298
|
+
filename: string;
|
|
299
|
+
object: string;
|
|
300
|
+
purpose: 'fine-tune' | 'fine-tune-results' | 'agents' | 'agents_output';
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* Details of the Code Interpreter tool call the run step was involved in.
|
|
304
|
+
* Includes the tool call ID, the code interpreter definition, and the type of tool call.
|
|
305
|
+
*/
|
|
306
|
+
export type CodeToolCall = {
|
|
307
|
+
id: string;
|
|
308
|
+
code_interpreter: {
|
|
309
|
+
input: string;
|
|
310
|
+
outputs: Array<Record<string, unknown>>;
|
|
311
|
+
};
|
|
312
|
+
type: 'code_interpreter';
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Details of a Function tool call the run step was involved in.
|
|
316
|
+
* Includes the tool call ID, the function definition, and the type of tool call.
|
|
317
|
+
*/
|
|
318
|
+
export type FunctionToolCall = {
|
|
319
|
+
id: string;
|
|
320
|
+
function: {
|
|
321
|
+
arguments: string;
|
|
322
|
+
name: string;
|
|
323
|
+
output: string | null;
|
|
324
|
+
};
|
|
325
|
+
type: 'function';
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Details of a Retrieval tool call the run step was involved in.
|
|
329
|
+
* Includes the tool call ID and the type of tool call.
|
|
330
|
+
*/
|
|
331
|
+
export type RetrievalToolCall = {
|
|
332
|
+
id: string;
|
|
333
|
+
retrieval: unknown;
|
|
334
|
+
type: 'retrieval';
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Details of a Retrieval tool call the run step was involved in.
|
|
338
|
+
* Includes the tool call ID and the type of tool call.
|
|
339
|
+
*/
|
|
340
|
+
export type FileSearchToolCall = {
|
|
341
|
+
id: string;
|
|
342
|
+
file_search: unknown;
|
|
343
|
+
type: 'file_search';
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* Details of the tool calls involved in a run step.
|
|
347
|
+
* Can be associated with one of three types of tools: `code_interpreter`, `retrieval`, or `function`.
|
|
348
|
+
*/
|
|
349
|
+
export type ToolCallsStepDetails = {
|
|
350
|
+
tool_calls: Array<CodeToolCall | RetrievalToolCall | FileSearchToolCall | FunctionToolCall>;
|
|
351
|
+
type: 'tool_calls';
|
|
352
|
+
};
|
|
353
|
+
export type ImageFile = TFile & {
|
|
354
|
+
/**
|
|
355
|
+
* The [File](https://platform.openai.com/docs/api-reference/files) ID of the image
|
|
356
|
+
* in the message content.
|
|
357
|
+
*/
|
|
358
|
+
file_id: string;
|
|
359
|
+
filename: string;
|
|
360
|
+
filepath: string;
|
|
361
|
+
height: number;
|
|
362
|
+
width: number;
|
|
363
|
+
/**
|
|
364
|
+
* Prompt used to generate the image if applicable.
|
|
365
|
+
*/
|
|
366
|
+
prompt?: string;
|
|
367
|
+
/**
|
|
368
|
+
* Additional metadata used to generate or about the image/tool_call.
|
|
369
|
+
*/
|
|
370
|
+
metadata?: Record<string, unknown>;
|
|
371
|
+
};
|
|
372
|
+
export type FileCitation = {
|
|
373
|
+
end_index: number;
|
|
374
|
+
file_citation: FileCitationDetails;
|
|
375
|
+
start_index: number;
|
|
376
|
+
text: string;
|
|
377
|
+
type: 'file_citation';
|
|
378
|
+
};
|
|
379
|
+
export type FileCitationDetails = {
|
|
380
|
+
file_id: string;
|
|
381
|
+
quote: string;
|
|
382
|
+
};
|
|
383
|
+
export type FilePath = {
|
|
384
|
+
end_index: number;
|
|
385
|
+
file_path: FilePathDetails;
|
|
386
|
+
start_index: number;
|
|
387
|
+
text: string;
|
|
388
|
+
type: 'file_path';
|
|
389
|
+
};
|
|
390
|
+
export type FilePathDetails = {
|
|
391
|
+
file_id: string;
|
|
392
|
+
};
|
|
393
|
+
export type Text = {
|
|
394
|
+
annotations?: Array<FileCitation | FilePath>;
|
|
395
|
+
value: string;
|
|
396
|
+
};
|
|
397
|
+
export declare enum AnnotationTypes {
|
|
398
|
+
FILE_CITATION = "file_citation",
|
|
399
|
+
FILE_PATH = "file_path"
|
|
400
|
+
}
|
|
401
|
+
export declare enum StepStatus {
|
|
402
|
+
IN_PROGRESS = "in_progress",
|
|
403
|
+
CANCELLED = "cancelled",
|
|
404
|
+
FAILED = "failed",
|
|
405
|
+
COMPLETED = "completed",
|
|
406
|
+
EXPIRED = "expired"
|
|
407
|
+
}
|
|
408
|
+
export declare enum MessageContentTypes {
|
|
409
|
+
TEXT = "text",
|
|
410
|
+
IMAGE_FILE = "image_file"
|
|
411
|
+
}
|
|
412
|
+
export declare enum RunStatus {
|
|
413
|
+
QUEUED = "queued",
|
|
414
|
+
IN_PROGRESS = "in_progress",
|
|
415
|
+
REQUIRES_ACTION = "requires_action",
|
|
416
|
+
CANCELLING = "cancelling",
|
|
417
|
+
CANCELLED = "cancelled",
|
|
418
|
+
FAILED = "failed",
|
|
419
|
+
COMPLETED = "completed",
|
|
420
|
+
EXPIRED = "expired"
|
|
421
|
+
}
|
|
422
|
+
export type PartMetadata = {
|
|
423
|
+
progress?: number;
|
|
424
|
+
asset_pointer?: string;
|
|
425
|
+
status?: string;
|
|
426
|
+
action?: boolean;
|
|
427
|
+
auth?: string;
|
|
428
|
+
expires_at?: number;
|
|
429
|
+
/** Index indicating parallel sibling content (same stepIndex in multi-agent runs) */
|
|
430
|
+
siblingIndex?: number;
|
|
431
|
+
/** Agent ID for parallel agent rendering - identifies which agent produced this content */
|
|
432
|
+
agentId?: string;
|
|
433
|
+
/** Group ID for parallel content - parts with same groupId are displayed in columns */
|
|
434
|
+
groupId?: number;
|
|
435
|
+
};
|
|
436
|
+
/** Metadata for parallel content rendering - subset of PartMetadata */
|
|
437
|
+
export type ContentMetadata = Pick<PartMetadata, 'agentId' | 'groupId'>;
|
|
438
|
+
export type ContentPart = (CodeToolCall | RetrievalToolCall | FileSearchToolCall | FunctionToolCall | Agents.AgentToolCall | ImageFile | Text) & PartMetadata;
|
|
439
|
+
export type TextData = (Text & PartMetadata) | undefined;
|
|
440
|
+
export type SummaryContentPart = {
|
|
441
|
+
type: ContentTypes.SUMMARY;
|
|
442
|
+
content?: Array<{
|
|
443
|
+
type: ContentTypes.TEXT;
|
|
444
|
+
text: string;
|
|
445
|
+
}>;
|
|
446
|
+
tokenCount?: number;
|
|
447
|
+
summarizing?: boolean;
|
|
448
|
+
summaryVersion?: number;
|
|
449
|
+
model?: string;
|
|
450
|
+
provider?: string;
|
|
451
|
+
createdAt?: string;
|
|
452
|
+
boundary?: {
|
|
453
|
+
messageId: string;
|
|
454
|
+
contentIndex: number;
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
export type TMessageContentParts = ({
|
|
458
|
+
type: ContentTypes.ERROR;
|
|
459
|
+
text?: string | TextData;
|
|
460
|
+
error?: string;
|
|
461
|
+
} & ContentMetadata) | ({
|
|
462
|
+
type: ContentTypes.THINK;
|
|
463
|
+
think?: string | TextData;
|
|
464
|
+
} & ContentMetadata) | ({
|
|
465
|
+
type: ContentTypes.TEXT;
|
|
466
|
+
text?: string | TextData;
|
|
467
|
+
tool_call_ids?: string[];
|
|
468
|
+
} & ContentMetadata) | ({
|
|
469
|
+
type: ContentTypes.TOOL_CALL;
|
|
470
|
+
tool_call: (CodeToolCall | RetrievalToolCall | FileSearchToolCall | FunctionToolCall | Agents.AgentToolCall) & PartMetadata;
|
|
471
|
+
} & ContentMetadata) | ({
|
|
472
|
+
type: ContentTypes.IMAGE_FILE;
|
|
473
|
+
image_file: ImageFile & PartMetadata;
|
|
474
|
+
} & ContentMetadata) | (SummaryContentPart & ContentMetadata) | (Agents.AgentUpdate & ContentMetadata) | (Agents.MessageContentImageUrl & ContentMetadata) | (Agents.MessageContentVideoUrl & ContentMetadata) | (Agents.MessageContentInputAudio & ContentMetadata);
|
|
475
|
+
export type StreamContentData = TMessageContentParts & {
|
|
476
|
+
/** The index of the current content part */
|
|
477
|
+
index: number;
|
|
478
|
+
/** The current text content was already served but edited to replace elements therein */
|
|
479
|
+
edited?: boolean;
|
|
480
|
+
};
|
|
481
|
+
export type TContentData = StreamContentData & {
|
|
482
|
+
messageId: string;
|
|
483
|
+
conversationId: string;
|
|
484
|
+
userMessageId: string;
|
|
485
|
+
thread_id: string;
|
|
486
|
+
stream?: boolean;
|
|
487
|
+
};
|
|
488
|
+
export declare const actionDelimiter = "_action_";
|
|
489
|
+
export declare const actionDomainSeparator = "---";
|
|
490
|
+
export declare const hostImageIdSuffix = "_host_copy";
|
|
491
|
+
export declare const hostImageNamePrefix = "host_copy_";
|
|
492
|
+
export type AssistantAvatar = {
|
|
493
|
+
filepath: string;
|
|
494
|
+
source: string;
|
|
495
|
+
};
|
|
496
|
+
export type AssistantDocument = {
|
|
497
|
+
user: string;
|
|
498
|
+
assistant_id: string;
|
|
499
|
+
conversation_starters?: string[];
|
|
500
|
+
avatar?: AssistantAvatar;
|
|
501
|
+
access_level?: number;
|
|
502
|
+
file_ids?: string[];
|
|
503
|
+
actions?: string[];
|
|
504
|
+
createdAt?: Date;
|
|
505
|
+
updatedAt?: Date;
|
|
506
|
+
append_current_datetime?: boolean;
|
|
507
|
+
};
|
|
508
|
+
export type AgentAvatar = {
|
|
509
|
+
filepath: string;
|
|
510
|
+
source: string;
|
|
511
|
+
};
|
|
512
|
+
export declare enum FilePurpose {
|
|
513
|
+
Vision = "vision",
|
|
514
|
+
FineTune = "fine-tune",
|
|
515
|
+
FineTuneResults = "fine-tune-results",
|
|
516
|
+
Assistants = "assistants",
|
|
517
|
+
AssistantsOutput = "assistants_output"
|
|
518
|
+
}
|
|
519
|
+
export declare const defaultOrderQuery: {
|
|
520
|
+
order: 'desc';
|
|
521
|
+
limit: 100;
|
|
522
|
+
};
|
|
523
|
+
export declare enum AssistantStreamEvents {
|
|
524
|
+
ThreadCreated = "thread.created",
|
|
525
|
+
ThreadRunCreated = "thread.run.created",
|
|
526
|
+
ThreadRunQueued = "thread.run.queued",
|
|
527
|
+
ThreadRunInProgress = "thread.run.in_progress",
|
|
528
|
+
ThreadRunRequiresAction = "thread.run.requires_action",
|
|
529
|
+
ThreadRunCompleted = "thread.run.completed",
|
|
530
|
+
ThreadRunFailed = "thread.run.failed",
|
|
531
|
+
ThreadRunCancelling = "thread.run.cancelling",
|
|
532
|
+
ThreadRunCancelled = "thread.run.cancelled",
|
|
533
|
+
ThreadRunExpired = "thread.run.expired",
|
|
534
|
+
ThreadRunStepCreated = "thread.run.step.created",
|
|
535
|
+
ThreadRunStepInProgress = "thread.run.step.in_progress",
|
|
536
|
+
ThreadRunStepCompleted = "thread.run.step.completed",
|
|
537
|
+
ThreadRunStepFailed = "thread.run.step.failed",
|
|
538
|
+
ThreadRunStepCancelled = "thread.run.step.cancelled",
|
|
539
|
+
ThreadRunStepExpired = "thread.run.step.expired",
|
|
540
|
+
ThreadRunStepDelta = "thread.run.step.delta",
|
|
541
|
+
ThreadMessageCreated = "thread.message.created",
|
|
542
|
+
ThreadMessageInProgress = "thread.message.in_progress",
|
|
543
|
+
ThreadMessageCompleted = "thread.message.completed",
|
|
544
|
+
ThreadMessageIncomplete = "thread.message.incomplete",
|
|
545
|
+
ThreadMessageDelta = "thread.message.delta",
|
|
546
|
+
ErrorEvent = "error"
|
|
547
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { EToolResources } from './assistants';
|
|
2
|
+
export declare enum FileSources {
|
|
3
|
+
local = "local",
|
|
4
|
+
firebase = "firebase",
|
|
5
|
+
azure = "azure",
|
|
6
|
+
azure_blob = "azure_blob",
|
|
7
|
+
openai = "openai",
|
|
8
|
+
s3 = "s3",
|
|
9
|
+
vectordb = "vectordb",
|
|
10
|
+
execute_code = "execute_code",
|
|
11
|
+
mistral_ocr = "mistral_ocr",
|
|
12
|
+
azure_mistral_ocr = "azure_mistral_ocr",
|
|
13
|
+
vertexai_mistral_ocr = "vertexai_mistral_ocr",
|
|
14
|
+
text = "text",
|
|
15
|
+
document_parser = "document_parser"
|
|
16
|
+
}
|
|
17
|
+
export declare const checkOpenAIStorage: (source: string) => boolean;
|
|
18
|
+
export declare enum FileContext {
|
|
19
|
+
avatar = "avatar",
|
|
20
|
+
unknown = "unknown",
|
|
21
|
+
agents = "agents",
|
|
22
|
+
assistants = "assistants",
|
|
23
|
+
execute_code = "execute_code",
|
|
24
|
+
image_generation = "image_generation",
|
|
25
|
+
assistants_output = "assistants_output",
|
|
26
|
+
message_attachment = "message_attachment",
|
|
27
|
+
filename = "filename",
|
|
28
|
+
updatedAt = "updatedAt",
|
|
29
|
+
source = "source",
|
|
30
|
+
filterSource = "filterSource",
|
|
31
|
+
context = "context",
|
|
32
|
+
bytes = "bytes"
|
|
33
|
+
}
|
|
34
|
+
export type EndpointFileConfig = {
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
fileLimit?: number;
|
|
37
|
+
fileSizeLimit?: number;
|
|
38
|
+
totalSizeLimit?: number;
|
|
39
|
+
supportedMimeTypes?: RegExp[];
|
|
40
|
+
};
|
|
41
|
+
export type FileConfig = {
|
|
42
|
+
endpoints: {
|
|
43
|
+
[key: string]: EndpointFileConfig;
|
|
44
|
+
};
|
|
45
|
+
fileTokenLimit?: number;
|
|
46
|
+
serverFileSizeLimit?: number;
|
|
47
|
+
avatarSizeLimit?: number;
|
|
48
|
+
clientImageResize?: {
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
maxWidth?: number;
|
|
51
|
+
maxHeight?: number;
|
|
52
|
+
quality?: number;
|
|
53
|
+
};
|
|
54
|
+
ocr?: {
|
|
55
|
+
supportedMimeTypes?: RegExp[];
|
|
56
|
+
};
|
|
57
|
+
text?: {
|
|
58
|
+
supportedMimeTypes?: RegExp[];
|
|
59
|
+
};
|
|
60
|
+
stt?: {
|
|
61
|
+
supportedMimeTypes?: RegExp[];
|
|
62
|
+
};
|
|
63
|
+
checkType?: (fileType: string, supportedTypes: RegExp[]) => boolean;
|
|
64
|
+
};
|
|
65
|
+
export type FileConfigInput = {
|
|
66
|
+
endpoints?: {
|
|
67
|
+
[key: string]: EndpointFileConfig;
|
|
68
|
+
};
|
|
69
|
+
serverFileSizeLimit?: number;
|
|
70
|
+
avatarSizeLimit?: number;
|
|
71
|
+
clientImageResize?: {
|
|
72
|
+
enabled?: boolean;
|
|
73
|
+
maxWidth?: number;
|
|
74
|
+
maxHeight?: number;
|
|
75
|
+
quality?: number;
|
|
76
|
+
};
|
|
77
|
+
ocr?: {
|
|
78
|
+
supportedMimeTypes?: string[];
|
|
79
|
+
};
|
|
80
|
+
text?: {
|
|
81
|
+
supportedMimeTypes?: string[];
|
|
82
|
+
};
|
|
83
|
+
stt?: {
|
|
84
|
+
supportedMimeTypes?: string[];
|
|
85
|
+
};
|
|
86
|
+
checkType?: (fileType: string, supportedTypes: RegExp[]) => boolean;
|
|
87
|
+
};
|
|
88
|
+
export type TFile = {
|
|
89
|
+
_id?: string;
|
|
90
|
+
__v?: number;
|
|
91
|
+
user: string;
|
|
92
|
+
conversationId?: string;
|
|
93
|
+
message?: string;
|
|
94
|
+
file_id: string;
|
|
95
|
+
temp_file_id?: string;
|
|
96
|
+
bytes: number;
|
|
97
|
+
embedded: boolean;
|
|
98
|
+
filename: string;
|
|
99
|
+
filepath: string;
|
|
100
|
+
object: 'file';
|
|
101
|
+
type: string;
|
|
102
|
+
usage: number;
|
|
103
|
+
context?: FileContext;
|
|
104
|
+
source?: FileSources;
|
|
105
|
+
filterSource?: FileSources;
|
|
106
|
+
width?: number;
|
|
107
|
+
height?: number;
|
|
108
|
+
expiresAt?: string | Date;
|
|
109
|
+
preview?: string;
|
|
110
|
+
metadata?: {
|
|
111
|
+
fileIdentifier?: string;
|
|
112
|
+
};
|
|
113
|
+
createdAt?: string | Date;
|
|
114
|
+
updatedAt?: string | Date;
|
|
115
|
+
};
|
|
116
|
+
export type TFileUpload = TFile & {
|
|
117
|
+
temp_file_id: string;
|
|
118
|
+
};
|
|
119
|
+
export type AvatarUploadResponse = {
|
|
120
|
+
url: string;
|
|
121
|
+
};
|
|
122
|
+
export type SpeechToTextResponse = {
|
|
123
|
+
text: string;
|
|
124
|
+
};
|
|
125
|
+
export type VoiceResponse = string[];
|
|
126
|
+
export type UploadMutationOptions = {
|
|
127
|
+
onSuccess?: (data: TFileUpload, variables: FormData, context?: unknown) => void;
|
|
128
|
+
onMutate?: (variables: FormData) => void | Promise<unknown>;
|
|
129
|
+
onError?: (error: unknown, variables: FormData, context?: unknown) => void;
|
|
130
|
+
};
|
|
131
|
+
export type UploadAvatarOptions = {
|
|
132
|
+
onSuccess?: (data: AvatarUploadResponse, variables: FormData, context?: unknown) => void;
|
|
133
|
+
onMutate?: (variables: FormData) => void | Promise<unknown>;
|
|
134
|
+
onError?: (error: unknown, variables: FormData, context?: unknown) => void;
|
|
135
|
+
};
|
|
136
|
+
export type SpeechToTextOptions = {
|
|
137
|
+
onSuccess?: (data: SpeechToTextResponse, variables: FormData, context?: unknown) => void;
|
|
138
|
+
onMutate?: (variables: FormData) => void | Promise<unknown>;
|
|
139
|
+
onError?: (error: unknown, variables: FormData, context?: unknown) => void;
|
|
140
|
+
};
|
|
141
|
+
export type TextToSpeechOptions = {
|
|
142
|
+
onSuccess?: (data: ArrayBuffer, variables: FormData, context?: unknown) => void;
|
|
143
|
+
onMutate?: (variables: FormData) => void | Promise<unknown>;
|
|
144
|
+
onError?: (error: unknown, variables: FormData, context?: unknown) => void;
|
|
145
|
+
};
|
|
146
|
+
export type VoiceOptions = {
|
|
147
|
+
onSuccess?: (data: VoiceResponse, variables: unknown, context?: unknown) => void;
|
|
148
|
+
onMutate?: () => void | Promise<unknown>;
|
|
149
|
+
onError?: (error: unknown, variables: unknown, context?: unknown) => void;
|
|
150
|
+
};
|
|
151
|
+
export type DeleteFilesResponse = {
|
|
152
|
+
message: string;
|
|
153
|
+
result: Record<string, unknown>;
|
|
154
|
+
};
|
|
155
|
+
export type BatchFile = {
|
|
156
|
+
file_id: string;
|
|
157
|
+
filepath: string;
|
|
158
|
+
embedded: boolean;
|
|
159
|
+
source: FileSources;
|
|
160
|
+
temp_file_id?: string;
|
|
161
|
+
};
|
|
162
|
+
export type DeleteFilesBody = {
|
|
163
|
+
files: BatchFile[];
|
|
164
|
+
agent_id?: string;
|
|
165
|
+
assistant_id?: string;
|
|
166
|
+
tool_resource?: EToolResources;
|
|
167
|
+
};
|
|
168
|
+
export type DeleteMutationOptions = {
|
|
169
|
+
onSuccess?: (data: DeleteFilesResponse, variables: DeleteFilesBody, context?: unknown) => void;
|
|
170
|
+
onMutate?: (variables: DeleteFilesBody) => void | Promise<unknown>;
|
|
171
|
+
onError?: (error: unknown, variables: DeleteFilesBody, context?: unknown) => void;
|
|
172
|
+
};
|