librechat-data-provider 0.7.4 → 0.7.7
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/check_updates.sh +1 -0
- 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/react-query/package.json +1 -1
- package/package.json +6 -6
- package/react-query/package.json +1 -1
- package/server-rollup.config.js +3 -3
- package/specs/actions.spec.ts +700 -36
- package/specs/azure.spec.ts +8 -5
- package/specs/filetypes.spec.ts +1 -7
- package/specs/mcp.spec.ts +52 -0
- package/specs/openapiSpecs.ts +127 -0
- package/specs/utils.spec.ts +129 -0
- package/src/actions.ts +311 -101
- package/src/api-endpoints.ts +70 -13
- package/src/artifacts.ts +3104 -0
- package/src/azure.ts +40 -33
- package/src/bedrock.ts +227 -0
- package/src/config.ts +344 -78
- package/src/createPayload.ts +3 -1
- package/src/data-service.ts +353 -90
- package/src/file-config.ts +13 -2
- package/src/generate.ts +31 -2
- package/src/index.ts +12 -4
- package/src/keys.ts +17 -0
- package/src/mcp.ts +87 -0
- package/src/models.ts +1 -1
- package/src/parsers.ts +118 -60
- package/src/react-query/react-query-service.ts +54 -115
- package/src/request.ts +31 -7
- package/src/roles.ts +91 -2
- package/src/schemas.ts +513 -340
- package/src/types/agents.ts +276 -0
- package/src/types/assistants.ts +181 -27
- package/src/types/files.ts +6 -0
- package/src/types/mutations.ts +170 -7
- package/src/types/queries.ts +43 -21
- package/src/types/runs.ts +23 -0
- package/src/types.ts +132 -67
- package/src/utils.ts +44 -0
- package/src/zod.spec.ts +526 -0
- package/src/zod.ts +86 -0
- package/tsconfig.json +1 -2
- package/specs/parsers.spec.ts +0 -48
- package/src/sse.js +0 -242
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
+
import { StepTypes, ContentTypes, ToolCallTypes } from './runs';
|
|
3
|
+
import type { FunctionToolCall } from './assistants';
|
|
4
|
+
import type { TAttachment } from 'src/schemas';
|
|
5
|
+
|
|
6
|
+
export namespace Agents {
|
|
7
|
+
export type MessageType = 'human' | 'ai' | 'generic' | 'system' | 'function' | 'tool' | 'remove';
|
|
8
|
+
|
|
9
|
+
export type ImageDetail = 'auto' | 'low' | 'high';
|
|
10
|
+
|
|
11
|
+
export type ReasoningContentText = {
|
|
12
|
+
type: ContentTypes.THINK;
|
|
13
|
+
think: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type MessageContentText = {
|
|
17
|
+
type: ContentTypes.TEXT;
|
|
18
|
+
text: string;
|
|
19
|
+
tool_call_ids?: string[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type MessageContentImageUrl = {
|
|
23
|
+
type: ContentTypes.IMAGE_URL;
|
|
24
|
+
image_url: string | { url: string; detail?: ImageDetail };
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type MessageContentComplex =
|
|
28
|
+
| ReasoningContentText
|
|
29
|
+
| MessageContentText
|
|
30
|
+
| MessageContentImageUrl
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
| (Record<string, any> & { type?: ContentTypes | string })
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
+
| (Record<string, any> & { type?: never });
|
|
35
|
+
|
|
36
|
+
export type MessageContent = string | MessageContentComplex[];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A call to a tool.
|
|
40
|
+
*/
|
|
41
|
+
export type ToolCall = {
|
|
42
|
+
/** Type ("tool_call") according to Assistants Tool Call Structure */
|
|
43
|
+
type: ToolCallTypes.TOOL_CALL;
|
|
44
|
+
/** The name of the tool to be called */
|
|
45
|
+
name: string;
|
|
46
|
+
|
|
47
|
+
/** The arguments to the tool call */
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
+
args?: string | Record<string, any>;
|
|
50
|
+
|
|
51
|
+
/** If provided, an identifier associated with the tool call */
|
|
52
|
+
id?: string;
|
|
53
|
+
/** If provided, the output of the tool call */
|
|
54
|
+
output?: string;
|
|
55
|
+
/** Auth URL */
|
|
56
|
+
auth?: string;
|
|
57
|
+
/** Expiration time */
|
|
58
|
+
expires_at?: number;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type ToolEndEvent = {
|
|
62
|
+
/** The Step Id of the Tool Call */
|
|
63
|
+
id: string;
|
|
64
|
+
/** The Completed Tool Call */
|
|
65
|
+
tool_call?: ToolCall;
|
|
66
|
+
/** The content index of the tool call */
|
|
67
|
+
index: number;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type ToolCallContent = {
|
|
71
|
+
type: ContentTypes.TOOL_CALL;
|
|
72
|
+
tool_call?: ToolCall;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A chunk of a tool call (e.g., as part of a stream).
|
|
77
|
+
* When merging ToolCallChunks (e.g., via AIMessageChunk.__add__),
|
|
78
|
+
* all string attributes are concatenated. Chunks are only merged if their
|
|
79
|
+
* values of `index` are equal and not None.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* const leftChunks = [
|
|
84
|
+
* {
|
|
85
|
+
* name: "foo",
|
|
86
|
+
* args: '{"a":',
|
|
87
|
+
* index: 0
|
|
88
|
+
* }
|
|
89
|
+
* ];
|
|
90
|
+
*
|
|
91
|
+
* const leftAIMessageChunk = new AIMessageChunk({
|
|
92
|
+
* content: "",
|
|
93
|
+
* tool_call_chunks: leftChunks
|
|
94
|
+
* });
|
|
95
|
+
*
|
|
96
|
+
* const rightChunks = [
|
|
97
|
+
* {
|
|
98
|
+
* name: undefined,
|
|
99
|
+
* args: '1}',
|
|
100
|
+
* index: 0
|
|
101
|
+
* }
|
|
102
|
+
* ];
|
|
103
|
+
*
|
|
104
|
+
* const rightAIMessageChunk = new AIMessageChunk({
|
|
105
|
+
* content: "",
|
|
106
|
+
* tool_call_chunks: rightChunks
|
|
107
|
+
* });
|
|
108
|
+
*
|
|
109
|
+
* const result = leftAIMessageChunk.concat(rightAIMessageChunk);
|
|
110
|
+
* // result.tool_call_chunks is equal to:
|
|
111
|
+
* // [
|
|
112
|
+
* // {
|
|
113
|
+
* // name: "foo",
|
|
114
|
+
* // args: '{"a":1}'
|
|
115
|
+
* // index: 0
|
|
116
|
+
* // }
|
|
117
|
+
* // ]
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @property {string} [name] - If provided, a substring of the name of the tool to be called
|
|
121
|
+
* @property {string} [args] - If provided, a JSON substring of the arguments to the tool call
|
|
122
|
+
* @property {string} [id] - If provided, a substring of an identifier for the tool call
|
|
123
|
+
* @property {number} [index] - If provided, the index of the tool call in a sequence
|
|
124
|
+
*/
|
|
125
|
+
export type ToolCallChunk = {
|
|
126
|
+
name?: string;
|
|
127
|
+
|
|
128
|
+
args?: string;
|
|
129
|
+
|
|
130
|
+
id?: string;
|
|
131
|
+
|
|
132
|
+
index?: number;
|
|
133
|
+
|
|
134
|
+
type?: 'tool_call_chunk';
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/** Event names are of the format: on_[runnable_type]_(start|stream|end).
|
|
138
|
+
|
|
139
|
+
Runnable types are one of:
|
|
140
|
+
|
|
141
|
+
llm - used by non chat models
|
|
142
|
+
chat_model - used by chat models
|
|
143
|
+
prompt -- e.g., ChatPromptTemplate
|
|
144
|
+
tool -- LangChain tools
|
|
145
|
+
chain - most Runnables are of this type
|
|
146
|
+
Further, the events are categorized as one of:
|
|
147
|
+
|
|
148
|
+
start - when the runnable starts
|
|
149
|
+
stream - when the runnable is streaming
|
|
150
|
+
end - when the runnable ends
|
|
151
|
+
start, stream and end are associated with slightly different data payload.
|
|
152
|
+
|
|
153
|
+
Please see the documentation for EventData for more details. */
|
|
154
|
+
export type EventName = string;
|
|
155
|
+
export type RunStep = {
|
|
156
|
+
type: StepTypes;
|
|
157
|
+
id: string; // #new
|
|
158
|
+
runId?: string; // #new
|
|
159
|
+
index: number; // #new
|
|
160
|
+
stepIndex?: number; // #new
|
|
161
|
+
stepDetails: StepDetails;
|
|
162
|
+
usage: null | {
|
|
163
|
+
// Define usage structure if it's ever non-null
|
|
164
|
+
// prompt_tokens: number; // #new
|
|
165
|
+
// completion_tokens: number; // #new
|
|
166
|
+
// total_tokens: number; // #new
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Represents a run step delta i.e. any changed fields on a run step during
|
|
171
|
+
* streaming.
|
|
172
|
+
*/
|
|
173
|
+
export interface RunStepDeltaEvent {
|
|
174
|
+
/**
|
|
175
|
+
* The identifier of the run step, which can be referenced in API endpoints.
|
|
176
|
+
*/
|
|
177
|
+
id: string;
|
|
178
|
+
/**
|
|
179
|
+
* The delta containing the fields that have changed on the run step.
|
|
180
|
+
*/
|
|
181
|
+
delta: ToolCallDelta;
|
|
182
|
+
}
|
|
183
|
+
export type StepDetails = MessageCreationDetails | ToolCallsDetails;
|
|
184
|
+
export type MessageCreationDetails = {
|
|
185
|
+
type: StepTypes.MESSAGE_CREATION;
|
|
186
|
+
message_creation: {
|
|
187
|
+
message_id: string;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
export type ToolCallsDetails = {
|
|
191
|
+
type: StepTypes.TOOL_CALLS;
|
|
192
|
+
tool_calls: AgentToolCall[];
|
|
193
|
+
};
|
|
194
|
+
export type ToolCallDelta = {
|
|
195
|
+
type: StepTypes.TOOL_CALLS | string;
|
|
196
|
+
tool_calls?: ToolCallChunk[];
|
|
197
|
+
auth?: string;
|
|
198
|
+
expires_at?: number;
|
|
199
|
+
};
|
|
200
|
+
export type AgentToolCall = FunctionToolCall | ToolCall;
|
|
201
|
+
export interface ExtendedMessageContent {
|
|
202
|
+
type?: string;
|
|
203
|
+
text?: string;
|
|
204
|
+
input?: string;
|
|
205
|
+
index?: number;
|
|
206
|
+
id?: string;
|
|
207
|
+
name?: string;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Represents a message delta i.e. any changed fields on a message during
|
|
211
|
+
* streaming.
|
|
212
|
+
*/
|
|
213
|
+
export interface MessageDeltaEvent {
|
|
214
|
+
/**
|
|
215
|
+
* The identifier of the message, which can be referenced in API endpoints.
|
|
216
|
+
*/
|
|
217
|
+
id: string;
|
|
218
|
+
/**
|
|
219
|
+
* The delta containing the fields that have changed on the Message.
|
|
220
|
+
*/
|
|
221
|
+
delta: MessageDelta;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* The delta containing the fields that have changed on the Message.
|
|
225
|
+
*/
|
|
226
|
+
export interface MessageDelta {
|
|
227
|
+
/**
|
|
228
|
+
* The content of the message in array of text and/or images.
|
|
229
|
+
*/
|
|
230
|
+
content?: Agents.MessageContentComplex[];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Represents a reasoning delta i.e. any changed fields on a message during
|
|
235
|
+
* streaming.
|
|
236
|
+
*/
|
|
237
|
+
export interface ReasoningDeltaEvent {
|
|
238
|
+
/**
|
|
239
|
+
* The identifier of the message, which can be referenced in API endpoints.
|
|
240
|
+
*/
|
|
241
|
+
id: string;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* The delta containing the fields that have changed.
|
|
245
|
+
*/
|
|
246
|
+
delta: ReasoningDelta;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* The reasoning delta containing the fields that have changed on the Message.
|
|
251
|
+
*/
|
|
252
|
+
export interface ReasoningDelta {
|
|
253
|
+
/**
|
|
254
|
+
* The content of the message in array of text and/or images.
|
|
255
|
+
*/
|
|
256
|
+
content?: MessageContentComplex[];
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export type ReasoningDeltaUpdate = { type: ContentTypes.THINK; think: string };
|
|
260
|
+
export type ContentType =
|
|
261
|
+
| ContentTypes.THINK
|
|
262
|
+
| ContentTypes.TEXT
|
|
263
|
+
| ContentTypes.IMAGE_URL
|
|
264
|
+
| string;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export type ToolCallResult = {
|
|
268
|
+
user: string;
|
|
269
|
+
toolId: string;
|
|
270
|
+
result?: unknown;
|
|
271
|
+
messageId: string;
|
|
272
|
+
partIndex?: number;
|
|
273
|
+
blockIndex?: number;
|
|
274
|
+
conversationId: string;
|
|
275
|
+
attachments?: TAttachment[];
|
|
276
|
+
};
|
package/src/types/assistants.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
-
import type { AssistantsEndpoint } from 'src/schemas';
|
|
2
|
+
import type { AssistantsEndpoint, AgentProvider } from 'src/schemas';
|
|
3
|
+
import type { ContentTypes } from './runs';
|
|
4
|
+
import type { Agents } from './agents';
|
|
3
5
|
import type { TFile } from './files';
|
|
6
|
+
import { ArtifactModes } from 'src/artifacts';
|
|
4
7
|
|
|
5
8
|
export type Schema = OpenAPIV3.SchemaObject & { description?: string };
|
|
6
9
|
export type Reference = OpenAPIV3.ReferenceObject & { description?: string };
|
|
@@ -13,6 +16,7 @@ export type Metadata = {
|
|
|
13
16
|
};
|
|
14
17
|
|
|
15
18
|
export enum Tools {
|
|
19
|
+
execute_code = 'execute_code',
|
|
16
20
|
code_interpreter = 'code_interpreter',
|
|
17
21
|
file_search = 'file_search',
|
|
18
22
|
retrieval = 'retrieval',
|
|
@@ -21,6 +25,7 @@ export enum Tools {
|
|
|
21
25
|
|
|
22
26
|
export enum EToolResources {
|
|
23
27
|
code_interpreter = 'code_interpreter',
|
|
28
|
+
execute_code = 'execute_code',
|
|
24
29
|
file_search = 'file_search',
|
|
25
30
|
}
|
|
26
31
|
|
|
@@ -34,6 +39,8 @@ export type FunctionTool = {
|
|
|
34
39
|
description: string;
|
|
35
40
|
name: string;
|
|
36
41
|
parameters: Record<string, unknown>;
|
|
42
|
+
strict?: boolean;
|
|
43
|
+
additionalProperties?: boolean; // must be false if strict is true https://platform.openai.com/docs/guides/structured-outputs/some-type-specific-keywords-are-not-yet-supported
|
|
37
44
|
};
|
|
38
45
|
};
|
|
39
46
|
|
|
@@ -66,17 +73,20 @@ export interface FileSearchResource {
|
|
|
66
73
|
vector_store_ids?: Array<string>;
|
|
67
74
|
}
|
|
68
75
|
|
|
76
|
+
/* Assistant types */
|
|
77
|
+
|
|
69
78
|
export type Assistant = {
|
|
70
79
|
id: string;
|
|
71
80
|
created_at: number;
|
|
72
81
|
description: string | null;
|
|
73
|
-
file_ids
|
|
82
|
+
file_ids?: string[];
|
|
74
83
|
instructions: string | null;
|
|
84
|
+
conversation_starters?: string[];
|
|
75
85
|
metadata: Metadata | null;
|
|
76
86
|
model: string;
|
|
77
87
|
name: string | null;
|
|
78
88
|
object: string;
|
|
79
|
-
tools
|
|
89
|
+
tools?: FunctionTool[];
|
|
80
90
|
tool_resources?: ToolResources;
|
|
81
91
|
};
|
|
82
92
|
|
|
@@ -87,11 +97,13 @@ export type AssistantCreateParams = {
|
|
|
87
97
|
description?: string | null;
|
|
88
98
|
file_ids?: string[];
|
|
89
99
|
instructions?: string | null;
|
|
100
|
+
conversation_starters?: string[];
|
|
90
101
|
metadata?: Metadata | null;
|
|
91
102
|
name?: string | null;
|
|
92
103
|
tools?: Array<FunctionTool | string>;
|
|
93
104
|
endpoint: AssistantsEndpoint;
|
|
94
105
|
version: number | string;
|
|
106
|
+
append_current_datetime?: boolean;
|
|
95
107
|
};
|
|
96
108
|
|
|
97
109
|
export type AssistantUpdateParams = {
|
|
@@ -99,11 +111,13 @@ export type AssistantUpdateParams = {
|
|
|
99
111
|
description?: string | null;
|
|
100
112
|
file_ids?: string[];
|
|
101
113
|
instructions?: string | null;
|
|
114
|
+
conversation_starters?: string[] | null;
|
|
102
115
|
metadata?: Metadata | null;
|
|
103
116
|
name?: string | null;
|
|
104
117
|
tools?: Array<FunctionTool | string>;
|
|
105
118
|
tool_resources?: ToolResources;
|
|
106
119
|
endpoint: AssistantsEndpoint;
|
|
120
|
+
append_current_datetime?: boolean;
|
|
107
121
|
};
|
|
108
122
|
|
|
109
123
|
export type AssistantListParams = {
|
|
@@ -133,6 +147,138 @@ export type File = {
|
|
|
133
147
|
purpose: 'fine-tune' | 'fine-tune-results' | 'assistants' | 'assistants_output';
|
|
134
148
|
};
|
|
135
149
|
|
|
150
|
+
/* Agent types */
|
|
151
|
+
|
|
152
|
+
export type AgentParameterValue = number | null;
|
|
153
|
+
|
|
154
|
+
export type AgentModelParameters = {
|
|
155
|
+
model?: string;
|
|
156
|
+
temperature: AgentParameterValue;
|
|
157
|
+
max_context_tokens: AgentParameterValue;
|
|
158
|
+
max_output_tokens: AgentParameterValue;
|
|
159
|
+
top_p: AgentParameterValue;
|
|
160
|
+
frequency_penalty: AgentParameterValue;
|
|
161
|
+
presence_penalty: AgentParameterValue;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export interface AgentToolResources {
|
|
165
|
+
execute_code?: ExecuteCodeResource;
|
|
166
|
+
file_search?: AgentFileSearchResource;
|
|
167
|
+
}
|
|
168
|
+
export interface ExecuteCodeResource {
|
|
169
|
+
/**
|
|
170
|
+
* A list of file IDs made available to the `execute_code` tool.
|
|
171
|
+
* There can be a maximum of 20 files associated with the tool.
|
|
172
|
+
*/
|
|
173
|
+
file_ids?: Array<string>;
|
|
174
|
+
/**
|
|
175
|
+
* A list of files already fetched.
|
|
176
|
+
*/
|
|
177
|
+
files?: Array<TFile>;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface AgentFileSearchResource {
|
|
181
|
+
/**
|
|
182
|
+
* The ID of the vector store attached to this agent. There
|
|
183
|
+
* can be a maximum of 1 vector store attached to the agent.
|
|
184
|
+
*/
|
|
185
|
+
vector_store_ids?: Array<string>;
|
|
186
|
+
/**
|
|
187
|
+
* A list of file IDs made available to the `file_search` tool.
|
|
188
|
+
* To be used before vector stores are implemented.
|
|
189
|
+
*/
|
|
190
|
+
file_ids?: Array<string>;
|
|
191
|
+
/**
|
|
192
|
+
* A list of files already fetched.
|
|
193
|
+
*/
|
|
194
|
+
files?: Array<TFile>;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export type Agent = {
|
|
198
|
+
id: string;
|
|
199
|
+
name: string | null;
|
|
200
|
+
author?: string | null;
|
|
201
|
+
/** The original custom endpoint name, lowercased */
|
|
202
|
+
endpoint?: string | null;
|
|
203
|
+
authorName?: string | null;
|
|
204
|
+
description: string | null;
|
|
205
|
+
created_at: number;
|
|
206
|
+
avatar: AgentAvatar | null;
|
|
207
|
+
instructions: string | null;
|
|
208
|
+
additional_instructions?: string | null;
|
|
209
|
+
tools?: string[];
|
|
210
|
+
projectIds?: string[];
|
|
211
|
+
tool_kwargs?: Record<string, unknown>;
|
|
212
|
+
metadata?: Record<string, unknown>;
|
|
213
|
+
provider: AgentProvider;
|
|
214
|
+
model: string | null;
|
|
215
|
+
model_parameters: AgentModelParameters;
|
|
216
|
+
conversation_starters?: string[];
|
|
217
|
+
isCollaborative?: boolean;
|
|
218
|
+
tool_resources?: AgentToolResources;
|
|
219
|
+
agent_ids?: string[];
|
|
220
|
+
end_after_tools?: boolean;
|
|
221
|
+
hide_sequential_outputs?: boolean;
|
|
222
|
+
artifacts?: ArtifactModes;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
export type TAgentsMap = Record<string, Agent | undefined>;
|
|
226
|
+
|
|
227
|
+
export type AgentCreateParams = {
|
|
228
|
+
name?: string | null;
|
|
229
|
+
description?: string | null;
|
|
230
|
+
avatar?: AgentAvatar | null;
|
|
231
|
+
file_ids?: string[];
|
|
232
|
+
instructions?: string | null;
|
|
233
|
+
tools?: Array<FunctionTool | string>;
|
|
234
|
+
provider: AgentProvider;
|
|
235
|
+
model: string | null;
|
|
236
|
+
model_parameters: AgentModelParameters;
|
|
237
|
+
} & Pick<Agent, 'agent_ids' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts'>;
|
|
238
|
+
|
|
239
|
+
export type AgentUpdateParams = {
|
|
240
|
+
name?: string | null;
|
|
241
|
+
description?: string | null;
|
|
242
|
+
avatar?: AgentAvatar | null;
|
|
243
|
+
file_ids?: string[];
|
|
244
|
+
instructions?: string | null;
|
|
245
|
+
tools?: Array<FunctionTool | string>;
|
|
246
|
+
tool_resources?: ToolResources;
|
|
247
|
+
provider?: AgentProvider;
|
|
248
|
+
model?: string | null;
|
|
249
|
+
model_parameters?: AgentModelParameters;
|
|
250
|
+
projectIds?: string[];
|
|
251
|
+
removeProjectIds?: string[];
|
|
252
|
+
isCollaborative?: boolean;
|
|
253
|
+
} & Pick<Agent, 'agent_ids' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts'>;
|
|
254
|
+
|
|
255
|
+
export type AgentListParams = {
|
|
256
|
+
limit?: number;
|
|
257
|
+
before?: string | null;
|
|
258
|
+
after?: string | null;
|
|
259
|
+
order?: 'asc' | 'desc';
|
|
260
|
+
provider?: AgentProvider;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export type AgentListResponse = {
|
|
264
|
+
object: string;
|
|
265
|
+
data: Agent[];
|
|
266
|
+
first_id: string;
|
|
267
|
+
last_id: string;
|
|
268
|
+
has_more: boolean;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export type AgentFile = {
|
|
272
|
+
file_id: string;
|
|
273
|
+
id?: string;
|
|
274
|
+
temp_file_id?: string;
|
|
275
|
+
bytes: number;
|
|
276
|
+
created_at: number;
|
|
277
|
+
filename: string;
|
|
278
|
+
object: string;
|
|
279
|
+
purpose: 'fine-tune' | 'fine-tune-results' | 'agents' | 'agents_output';
|
|
280
|
+
};
|
|
281
|
+
|
|
136
282
|
/**
|
|
137
283
|
* Details of the Code Interpreter tool call the run step was involved in.
|
|
138
284
|
* Includes the tool call ID, the code interpreter definition, and the type of tool call.
|
|
@@ -245,25 +391,6 @@ export enum AnnotationTypes {
|
|
|
245
391
|
FILE_PATH = 'file_path',
|
|
246
392
|
}
|
|
247
393
|
|
|
248
|
-
export enum ContentTypes {
|
|
249
|
-
TEXT = 'text',
|
|
250
|
-
TOOL_CALL = 'tool_call',
|
|
251
|
-
IMAGE_FILE = 'image_file',
|
|
252
|
-
ERROR = 'error',
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
export enum StepTypes {
|
|
256
|
-
TOOL_CALLS = 'tool_calls',
|
|
257
|
-
MESSAGE_CREATION = 'message_creation',
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export enum ToolCallTypes {
|
|
261
|
-
FUNCTION = 'function',
|
|
262
|
-
RETRIEVAL = 'retrieval',
|
|
263
|
-
FILE_SEARCH = 'file_search',
|
|
264
|
-
CODE_INTERPRETER = 'code_interpreter',
|
|
265
|
-
}
|
|
266
|
-
|
|
267
394
|
export enum StepStatus {
|
|
268
395
|
IN_PROGRESS = 'in_progress',
|
|
269
396
|
CANCELLED = 'cancelled',
|
|
@@ -295,6 +422,8 @@ export type PartMetadata = {
|
|
|
295
422
|
asset_pointer?: string;
|
|
296
423
|
status?: string;
|
|
297
424
|
action?: boolean;
|
|
425
|
+
auth?: string;
|
|
426
|
+
expires_at?: number;
|
|
298
427
|
};
|
|
299
428
|
|
|
300
429
|
export type ContentPart = (
|
|
@@ -302,6 +431,7 @@ export type ContentPart = (
|
|
|
302
431
|
| RetrievalToolCall
|
|
303
432
|
| FileSearchToolCall
|
|
304
433
|
| FunctionToolCall
|
|
434
|
+
| Agents.AgentToolCall
|
|
305
435
|
| ImageFile
|
|
306
436
|
| Text
|
|
307
437
|
) &
|
|
@@ -309,13 +439,21 @@ export type ContentPart = (
|
|
|
309
439
|
|
|
310
440
|
export type TMessageContentParts =
|
|
311
441
|
| { type: ContentTypes.ERROR; text: Text & PartMetadata }
|
|
312
|
-
| { type: ContentTypes.
|
|
442
|
+
| { type: ContentTypes.THINK; think: string | (Text & PartMetadata) }
|
|
443
|
+
| { type: ContentTypes.TEXT; text: string | (Text & PartMetadata); tool_call_ids?: string[] }
|
|
313
444
|
| {
|
|
314
445
|
type: ContentTypes.TOOL_CALL;
|
|
315
|
-
tool_call: (
|
|
446
|
+
tool_call: (
|
|
447
|
+
| CodeToolCall
|
|
448
|
+
| RetrievalToolCall
|
|
449
|
+
| FileSearchToolCall
|
|
450
|
+
| FunctionToolCall
|
|
451
|
+
| Agents.AgentToolCall
|
|
452
|
+
) &
|
|
316
453
|
PartMetadata;
|
|
317
454
|
}
|
|
318
|
-
| { type: ContentTypes.IMAGE_FILE; image_file: ImageFile & PartMetadata }
|
|
455
|
+
| { type: ContentTypes.IMAGE_FILE; image_file: ImageFile & PartMetadata }
|
|
456
|
+
| Agents.MessageContentImageUrl;
|
|
319
457
|
|
|
320
458
|
export type StreamContentData = TMessageContentParts & {
|
|
321
459
|
/** The index of the current content part */
|
|
@@ -375,14 +513,21 @@ export type ActionMetadata = {
|
|
|
375
513
|
oauth_client_secret?: string;
|
|
376
514
|
};
|
|
377
515
|
|
|
516
|
+
export type ActionMetadataRuntime = ActionMetadata & {
|
|
517
|
+
oauth_access_token?: string;
|
|
518
|
+
oauth_refresh_token?: string;
|
|
519
|
+
oauth_token_expires_at?: Date;
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
/* Assistant types */
|
|
523
|
+
|
|
378
524
|
export type Action = {
|
|
379
525
|
action_id: string;
|
|
380
|
-
assistant_id: string;
|
|
381
526
|
type?: string;
|
|
382
527
|
settings?: Record<string, unknown>;
|
|
383
528
|
metadata: ActionMetadata;
|
|
384
529
|
version: number | string;
|
|
385
|
-
};
|
|
530
|
+
} & ({ assistant_id: string; agent_id?: never } | { assistant_id?: never; agent_id: string });
|
|
386
531
|
|
|
387
532
|
export type AssistantAvatar = {
|
|
388
533
|
filepath: string;
|
|
@@ -392,12 +537,21 @@ export type AssistantAvatar = {
|
|
|
392
537
|
export type AssistantDocument = {
|
|
393
538
|
user: string;
|
|
394
539
|
assistant_id: string;
|
|
540
|
+
conversation_starters?: string[];
|
|
395
541
|
avatar?: AssistantAvatar;
|
|
396
542
|
access_level?: number;
|
|
397
543
|
file_ids?: string[];
|
|
398
544
|
actions?: string[];
|
|
399
545
|
createdAt?: Date;
|
|
400
546
|
updatedAt?: Date;
|
|
547
|
+
append_current_datetime?: boolean;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
/* Agent types */
|
|
551
|
+
|
|
552
|
+
export type AgentAvatar = {
|
|
553
|
+
filepath: string;
|
|
554
|
+
source: string;
|
|
401
555
|
};
|
|
402
556
|
|
|
403
557
|
export enum FilePurpose {
|
package/src/types/files.ts
CHANGED
|
@@ -7,6 +7,7 @@ export enum FileSources {
|
|
|
7
7
|
openai = 'openai',
|
|
8
8
|
s3 = 's3',
|
|
9
9
|
vectordb = 'vectordb',
|
|
10
|
+
execute_code = 'execute_code',
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const checkOpenAIStorage = (source: string) =>
|
|
@@ -15,13 +16,16 @@ export const checkOpenAIStorage = (source: string) =>
|
|
|
15
16
|
export enum FileContext {
|
|
16
17
|
avatar = 'avatar',
|
|
17
18
|
unknown = 'unknown',
|
|
19
|
+
agents = 'agents',
|
|
18
20
|
assistants = 'assistants',
|
|
21
|
+
execute_code = 'execute_code',
|
|
19
22
|
image_generation = 'image_generation',
|
|
20
23
|
assistants_output = 'assistants_output',
|
|
21
24
|
message_attachment = 'message_attachment',
|
|
22
25
|
filename = 'filename',
|
|
23
26
|
updatedAt = 'updatedAt',
|
|
24
27
|
source = 'source',
|
|
28
|
+
filterSource = 'filterSource',
|
|
25
29
|
context = 'context',
|
|
26
30
|
bytes = 'bytes',
|
|
27
31
|
}
|
|
@@ -65,6 +69,7 @@ export type TFile = {
|
|
|
65
69
|
height?: number;
|
|
66
70
|
expiresAt?: string | Date;
|
|
67
71
|
preview?: string;
|
|
72
|
+
metadata?: { fileIdentifier?: string };
|
|
68
73
|
createdAt?: string | Date;
|
|
69
74
|
updatedAt?: string | Date;
|
|
70
75
|
};
|
|
@@ -127,6 +132,7 @@ export type BatchFile = {
|
|
|
127
132
|
|
|
128
133
|
export type DeleteFilesBody = {
|
|
129
134
|
files: BatchFile[];
|
|
135
|
+
agent_id?: string;
|
|
130
136
|
assistant_id?: string;
|
|
131
137
|
tool_resource?: EToolResources;
|
|
132
138
|
};
|