librechat-data-provider 0.7.3 → 0.7.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/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 +3 -3
- package/react-query/package.json +1 -1
- package/specs/actions.spec.ts +276 -1
- package/specs/openapiSpecs.ts +127 -0
- package/src/actions.ts +108 -25
- package/src/api-endpoints.ts +36 -2
- package/src/artifacts.ts +3104 -0
- package/src/bedrock.ts +147 -0
- package/src/config.ts +185 -23
- package/src/data-service.ts +247 -78
- package/src/file-config.ts +4 -1
- package/src/generate.ts +30 -1
- package/src/index.ts +5 -0
- package/src/keys.ts +11 -0
- package/src/parsers.ts +85 -27
- package/src/react-query/react-query-service.ts +25 -0
- package/src/request.ts +3 -0
- package/src/roles.ts +59 -2
- package/src/schemas.ts +361 -173
- package/src/types/agents.ts +220 -0
- package/src/types/assistants.ts +150 -27
- package/src/types/files.ts +5 -0
- package/src/types/mutations.ts +75 -0
- package/src/types/queries.ts +6 -2
- package/src/types/runs.ts +22 -0
- package/src/types.ts +59 -3
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
+
import { StepTypes, ContentTypes, ToolCallTypes } from './runs';
|
|
3
|
+
import type { FunctionToolCall } from './assistants';
|
|
4
|
+
|
|
5
|
+
export namespace Agents {
|
|
6
|
+
export type MessageType = 'human' | 'ai' | 'generic' | 'system' | 'function' | 'tool' | 'remove';
|
|
7
|
+
|
|
8
|
+
export type ImageDetail = 'auto' | 'low' | 'high';
|
|
9
|
+
|
|
10
|
+
export type MessageContentText = {
|
|
11
|
+
type: ContentTypes.TEXT;
|
|
12
|
+
text: string;
|
|
13
|
+
tool_call_ids?: string[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type MessageContentImageUrl = {
|
|
17
|
+
type: ContentTypes.IMAGE_URL;
|
|
18
|
+
image_url: string | { url: string; detail?: ImageDetail };
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type MessageContentComplex =
|
|
22
|
+
| MessageContentText
|
|
23
|
+
| MessageContentImageUrl
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
| (Record<string, any> & { type?: ContentTypes | string })
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
| (Record<string, any> & { type?: never });
|
|
28
|
+
|
|
29
|
+
export type MessageContent = string | MessageContentComplex[];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A call to a tool.
|
|
33
|
+
*/
|
|
34
|
+
export type ToolCall = {
|
|
35
|
+
/** Type ("tool_call") according to Assistants Tool Call Structure */
|
|
36
|
+
type: ToolCallTypes.TOOL_CALL;
|
|
37
|
+
/** The name of the tool to be called */
|
|
38
|
+
name: string;
|
|
39
|
+
|
|
40
|
+
/** The arguments to the tool call */
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
+
args?: string | Record<string, any>;
|
|
43
|
+
|
|
44
|
+
/** If provided, an identifier associated with the tool call */
|
|
45
|
+
id?: string;
|
|
46
|
+
/** If provided, the output of the tool call */
|
|
47
|
+
output?: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type ToolEndEvent = {
|
|
51
|
+
/** The Step Id of the Tool Call */
|
|
52
|
+
id: string;
|
|
53
|
+
/** The Completed Tool Call */
|
|
54
|
+
tool_call?: ToolCall;
|
|
55
|
+
/** The content index of the tool call */
|
|
56
|
+
index: number;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type ToolCallContent = {
|
|
60
|
+
type: ContentTypes.TOOL_CALL;
|
|
61
|
+
tool_call?: ToolCall;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A chunk of a tool call (e.g., as part of a stream).
|
|
66
|
+
* When merging ToolCallChunks (e.g., via AIMessageChunk.__add__),
|
|
67
|
+
* all string attributes are concatenated. Chunks are only merged if their
|
|
68
|
+
* values of `index` are equal and not None.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const leftChunks = [
|
|
73
|
+
* {
|
|
74
|
+
* name: "foo",
|
|
75
|
+
* args: '{"a":',
|
|
76
|
+
* index: 0
|
|
77
|
+
* }
|
|
78
|
+
* ];
|
|
79
|
+
*
|
|
80
|
+
* const leftAIMessageChunk = new AIMessageChunk({
|
|
81
|
+
* content: "",
|
|
82
|
+
* tool_call_chunks: leftChunks
|
|
83
|
+
* });
|
|
84
|
+
*
|
|
85
|
+
* const rightChunks = [
|
|
86
|
+
* {
|
|
87
|
+
* name: undefined,
|
|
88
|
+
* args: '1}',
|
|
89
|
+
* index: 0
|
|
90
|
+
* }
|
|
91
|
+
* ];
|
|
92
|
+
*
|
|
93
|
+
* const rightAIMessageChunk = new AIMessageChunk({
|
|
94
|
+
* content: "",
|
|
95
|
+
* tool_call_chunks: rightChunks
|
|
96
|
+
* });
|
|
97
|
+
*
|
|
98
|
+
* const result = leftAIMessageChunk.concat(rightAIMessageChunk);
|
|
99
|
+
* // result.tool_call_chunks is equal to:
|
|
100
|
+
* // [
|
|
101
|
+
* // {
|
|
102
|
+
* // name: "foo",
|
|
103
|
+
* // args: '{"a":1}'
|
|
104
|
+
* // index: 0
|
|
105
|
+
* // }
|
|
106
|
+
* // ]
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @property {string} [name] - If provided, a substring of the name of the tool to be called
|
|
110
|
+
* @property {string} [args] - If provided, a JSON substring of the arguments to the tool call
|
|
111
|
+
* @property {string} [id] - If provided, a substring of an identifier for the tool call
|
|
112
|
+
* @property {number} [index] - If provided, the index of the tool call in a sequence
|
|
113
|
+
*/
|
|
114
|
+
export type ToolCallChunk = {
|
|
115
|
+
name?: string;
|
|
116
|
+
|
|
117
|
+
args?: string;
|
|
118
|
+
|
|
119
|
+
id?: string;
|
|
120
|
+
|
|
121
|
+
index?: number;
|
|
122
|
+
|
|
123
|
+
type?: 'tool_call_chunk';
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/** Event names are of the format: on_[runnable_type]_(start|stream|end).
|
|
127
|
+
|
|
128
|
+
Runnable types are one of:
|
|
129
|
+
|
|
130
|
+
llm - used by non chat models
|
|
131
|
+
chat_model - used by chat models
|
|
132
|
+
prompt -- e.g., ChatPromptTemplate
|
|
133
|
+
tool -- LangChain tools
|
|
134
|
+
chain - most Runnables are of this type
|
|
135
|
+
Further, the events are categorized as one of:
|
|
136
|
+
|
|
137
|
+
start - when the runnable starts
|
|
138
|
+
stream - when the runnable is streaming
|
|
139
|
+
end - when the runnable ends
|
|
140
|
+
start, stream and end are associated with slightly different data payload.
|
|
141
|
+
|
|
142
|
+
Please see the documentation for EventData for more details. */
|
|
143
|
+
export type EventName = string;
|
|
144
|
+
export type RunStep = {
|
|
145
|
+
type: StepTypes;
|
|
146
|
+
id: string; // #new
|
|
147
|
+
runId?: string; // #new
|
|
148
|
+
index: number; // #new
|
|
149
|
+
stepIndex?: number; // #new
|
|
150
|
+
stepDetails: StepDetails;
|
|
151
|
+
usage: null | {
|
|
152
|
+
// Define usage structure if it's ever non-null
|
|
153
|
+
// prompt_tokens: number; // #new
|
|
154
|
+
// completion_tokens: number; // #new
|
|
155
|
+
// total_tokens: number; // #new
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Represents a run step delta i.e. any changed fields on a run step during
|
|
160
|
+
* streaming.
|
|
161
|
+
*/
|
|
162
|
+
export interface RunStepDeltaEvent {
|
|
163
|
+
/**
|
|
164
|
+
* The identifier of the run step, which can be referenced in API endpoints.
|
|
165
|
+
*/
|
|
166
|
+
id: string;
|
|
167
|
+
/**
|
|
168
|
+
* The delta containing the fields that have changed on the run step.
|
|
169
|
+
*/
|
|
170
|
+
delta: ToolCallDelta;
|
|
171
|
+
}
|
|
172
|
+
export type StepDetails = MessageCreationDetails | ToolCallsDetails;
|
|
173
|
+
export type MessageCreationDetails = {
|
|
174
|
+
type: StepTypes.MESSAGE_CREATION;
|
|
175
|
+
message_creation: {
|
|
176
|
+
message_id: string;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
export type ToolCallsDetails = {
|
|
180
|
+
type: StepTypes.TOOL_CALLS;
|
|
181
|
+
tool_calls: AgentToolCall[];
|
|
182
|
+
};
|
|
183
|
+
export type ToolCallDelta = {
|
|
184
|
+
type: StepTypes.TOOL_CALLS | string;
|
|
185
|
+
tool_calls?: ToolCallChunk[];
|
|
186
|
+
};
|
|
187
|
+
export type AgentToolCall = FunctionToolCall | ToolCall;
|
|
188
|
+
export interface ExtendedMessageContent {
|
|
189
|
+
type?: string;
|
|
190
|
+
text?: string;
|
|
191
|
+
input?: string;
|
|
192
|
+
index?: number;
|
|
193
|
+
id?: string;
|
|
194
|
+
name?: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Represents a message delta i.e. any changed fields on a message during
|
|
198
|
+
* streaming.
|
|
199
|
+
*/
|
|
200
|
+
export interface MessageDeltaEvent {
|
|
201
|
+
/**
|
|
202
|
+
* The identifier of the message, which can be referenced in API endpoints.
|
|
203
|
+
*/
|
|
204
|
+
id: string;
|
|
205
|
+
/**
|
|
206
|
+
* The delta containing the fields that have changed on the Message.
|
|
207
|
+
*/
|
|
208
|
+
delta: MessageDelta;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The delta containing the fields that have changed on the Message.
|
|
212
|
+
*/
|
|
213
|
+
export interface MessageDelta {
|
|
214
|
+
/**
|
|
215
|
+
* The content of the message in array of text and/or images.
|
|
216
|
+
*/
|
|
217
|
+
content?: MessageContentComplex[];
|
|
218
|
+
}
|
|
219
|
+
export type ContentType = ContentTypes.TEXT | ContentTypes.IMAGE_URL | string;
|
|
220
|
+
}
|
package/src/types/assistants.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
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';
|
|
4
6
|
|
|
5
7
|
export type Schema = OpenAPIV3.SchemaObject & { description?: string };
|
|
@@ -13,6 +15,7 @@ export type Metadata = {
|
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export enum Tools {
|
|
18
|
+
execute_code = 'execute_code',
|
|
16
19
|
code_interpreter = 'code_interpreter',
|
|
17
20
|
file_search = 'file_search',
|
|
18
21
|
retrieval = 'retrieval',
|
|
@@ -21,6 +24,7 @@ export enum Tools {
|
|
|
21
24
|
|
|
22
25
|
export enum EToolResources {
|
|
23
26
|
code_interpreter = 'code_interpreter',
|
|
27
|
+
execute_code = 'execute_code',
|
|
24
28
|
file_search = 'file_search',
|
|
25
29
|
}
|
|
26
30
|
|
|
@@ -66,17 +70,20 @@ export interface FileSearchResource {
|
|
|
66
70
|
vector_store_ids?: Array<string>;
|
|
67
71
|
}
|
|
68
72
|
|
|
73
|
+
/* Assistant types */
|
|
74
|
+
|
|
69
75
|
export type Assistant = {
|
|
70
76
|
id: string;
|
|
71
77
|
created_at: number;
|
|
72
78
|
description: string | null;
|
|
73
|
-
file_ids
|
|
79
|
+
file_ids?: string[];
|
|
74
80
|
instructions: string | null;
|
|
81
|
+
conversation_starters?: string[];
|
|
75
82
|
metadata: Metadata | null;
|
|
76
83
|
model: string;
|
|
77
84
|
name: string | null;
|
|
78
85
|
object: string;
|
|
79
|
-
tools
|
|
86
|
+
tools?: FunctionTool[];
|
|
80
87
|
tool_resources?: ToolResources;
|
|
81
88
|
};
|
|
82
89
|
|
|
@@ -87,6 +94,7 @@ export type AssistantCreateParams = {
|
|
|
87
94
|
description?: string | null;
|
|
88
95
|
file_ids?: string[];
|
|
89
96
|
instructions?: string | null;
|
|
97
|
+
conversation_starters?: string[];
|
|
90
98
|
metadata?: Metadata | null;
|
|
91
99
|
name?: string | null;
|
|
92
100
|
tools?: Array<FunctionTool | string>;
|
|
@@ -99,6 +107,7 @@ export type AssistantUpdateParams = {
|
|
|
99
107
|
description?: string | null;
|
|
100
108
|
file_ids?: string[];
|
|
101
109
|
instructions?: string | null;
|
|
110
|
+
conversation_starters?: string[] | null;
|
|
102
111
|
metadata?: Metadata | null;
|
|
103
112
|
name?: string | null;
|
|
104
113
|
tools?: Array<FunctionTool | string>;
|
|
@@ -133,6 +142,122 @@ export type File = {
|
|
|
133
142
|
purpose: 'fine-tune' | 'fine-tune-results' | 'assistants' | 'assistants_output';
|
|
134
143
|
};
|
|
135
144
|
|
|
145
|
+
/* Agent types */
|
|
146
|
+
|
|
147
|
+
export type AgentParameterValue = number | null;
|
|
148
|
+
|
|
149
|
+
export type AgentModelParameters = {
|
|
150
|
+
temperature: AgentParameterValue;
|
|
151
|
+
max_context_tokens: AgentParameterValue;
|
|
152
|
+
max_output_tokens: AgentParameterValue;
|
|
153
|
+
top_p: AgentParameterValue;
|
|
154
|
+
frequency_penalty: AgentParameterValue;
|
|
155
|
+
presence_penalty: AgentParameterValue;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export interface AgentToolResources {
|
|
159
|
+
execute_code?: ExecuteCodeResource;
|
|
160
|
+
file_search?: AgentFileSearchResource;
|
|
161
|
+
}
|
|
162
|
+
export interface ExecuteCodeResource {
|
|
163
|
+
/**
|
|
164
|
+
* A list of file IDs made available to the `execute_code` tool.
|
|
165
|
+
* There can be a maximum of 20 files associated with the tool.
|
|
166
|
+
*/
|
|
167
|
+
file_ids?: Array<string>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface AgentFileSearchResource {
|
|
171
|
+
/**
|
|
172
|
+
* The ID of the vector store attached to this agent. There
|
|
173
|
+
* can be a maximum of 1 vector store attached to the agent.
|
|
174
|
+
*/
|
|
175
|
+
vector_store_ids?: Array<string>;
|
|
176
|
+
/**
|
|
177
|
+
* A list of file IDs made available to the `file_search` tool.
|
|
178
|
+
* To be used before vector stores are implemented.
|
|
179
|
+
*/
|
|
180
|
+
file_ids?: Array<string>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export type Agent = {
|
|
184
|
+
id: string;
|
|
185
|
+
name: string | null;
|
|
186
|
+
author?: string | null;
|
|
187
|
+
authorName?: string | null;
|
|
188
|
+
description: string | null;
|
|
189
|
+
created_at: number;
|
|
190
|
+
avatar: AgentAvatar | null;
|
|
191
|
+
instructions: string | null;
|
|
192
|
+
tools?: string[];
|
|
193
|
+
projectIds?: string[];
|
|
194
|
+
tool_kwargs?: Record<string, unknown>;
|
|
195
|
+
metadata?: Record<string, unknown>;
|
|
196
|
+
provider: AgentProvider;
|
|
197
|
+
model: string | null;
|
|
198
|
+
model_parameters: AgentModelParameters;
|
|
199
|
+
conversation_starters?: string[];
|
|
200
|
+
isCollaborative?: boolean;
|
|
201
|
+
tool_resources?: AgentToolResources;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export type TAgentsMap = Record<string, Agent | undefined>;
|
|
205
|
+
|
|
206
|
+
export type AgentCreateParams = {
|
|
207
|
+
name?: string | null;
|
|
208
|
+
description?: string | null;
|
|
209
|
+
avatar?: AgentAvatar | null;
|
|
210
|
+
file_ids?: string[];
|
|
211
|
+
instructions?: string | null;
|
|
212
|
+
tools?: Array<FunctionTool | string>;
|
|
213
|
+
provider: AgentProvider;
|
|
214
|
+
model: string | null;
|
|
215
|
+
model_parameters: AgentModelParameters;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export type AgentUpdateParams = {
|
|
219
|
+
name?: string | null;
|
|
220
|
+
description?: string | null;
|
|
221
|
+
avatar?: AgentAvatar | null;
|
|
222
|
+
file_ids?: string[];
|
|
223
|
+
instructions?: string | null;
|
|
224
|
+
tools?: Array<FunctionTool | string>;
|
|
225
|
+
tool_resources?: ToolResources;
|
|
226
|
+
provider?: AgentProvider;
|
|
227
|
+
model?: string | null;
|
|
228
|
+
model_parameters?: AgentModelParameters;
|
|
229
|
+
projectIds?: string[];
|
|
230
|
+
removeProjectIds?: string[];
|
|
231
|
+
isCollaborative?: boolean;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export type AgentListParams = {
|
|
235
|
+
limit?: number;
|
|
236
|
+
before?: string | null;
|
|
237
|
+
after?: string | null;
|
|
238
|
+
order?: 'asc' | 'desc';
|
|
239
|
+
provider?: AgentProvider;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export type AgentListResponse = {
|
|
243
|
+
object: string;
|
|
244
|
+
data: Agent[];
|
|
245
|
+
first_id: string;
|
|
246
|
+
last_id: string;
|
|
247
|
+
has_more: boolean;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
export type AgentFile = {
|
|
251
|
+
file_id: string;
|
|
252
|
+
id?: string;
|
|
253
|
+
temp_file_id?: string;
|
|
254
|
+
bytes: number;
|
|
255
|
+
created_at: number;
|
|
256
|
+
filename: string;
|
|
257
|
+
object: string;
|
|
258
|
+
purpose: 'fine-tune' | 'fine-tune-results' | 'agents' | 'agents_output';
|
|
259
|
+
};
|
|
260
|
+
|
|
136
261
|
/**
|
|
137
262
|
* Details of the Code Interpreter tool call the run step was involved in.
|
|
138
263
|
* Includes the tool call ID, the code interpreter definition, and the type of tool call.
|
|
@@ -245,25 +370,6 @@ export enum AnnotationTypes {
|
|
|
245
370
|
FILE_PATH = 'file_path',
|
|
246
371
|
}
|
|
247
372
|
|
|
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
373
|
export enum StepStatus {
|
|
268
374
|
IN_PROGRESS = 'in_progress',
|
|
269
375
|
CANCELLED = 'cancelled',
|
|
@@ -302,6 +408,7 @@ export type ContentPart = (
|
|
|
302
408
|
| RetrievalToolCall
|
|
303
409
|
| FileSearchToolCall
|
|
304
410
|
| FunctionToolCall
|
|
411
|
+
| Agents.AgentToolCall
|
|
305
412
|
| ImageFile
|
|
306
413
|
| Text
|
|
307
414
|
) &
|
|
@@ -309,13 +416,20 @@ export type ContentPart = (
|
|
|
309
416
|
|
|
310
417
|
export type TMessageContentParts =
|
|
311
418
|
| { type: ContentTypes.ERROR; text: Text & PartMetadata }
|
|
312
|
-
| { type: ContentTypes.TEXT; text: Text & PartMetadata }
|
|
419
|
+
| { type: ContentTypes.TEXT; text: string | (Text & PartMetadata); tool_call_ids?: string[] }
|
|
313
420
|
| {
|
|
314
421
|
type: ContentTypes.TOOL_CALL;
|
|
315
|
-
tool_call: (
|
|
422
|
+
tool_call: (
|
|
423
|
+
| CodeToolCall
|
|
424
|
+
| RetrievalToolCall
|
|
425
|
+
| FileSearchToolCall
|
|
426
|
+
| FunctionToolCall
|
|
427
|
+
| Agents.AgentToolCall
|
|
428
|
+
) &
|
|
316
429
|
PartMetadata;
|
|
317
430
|
}
|
|
318
|
-
| { type: ContentTypes.IMAGE_FILE; image_file: ImageFile & PartMetadata }
|
|
431
|
+
| { type: ContentTypes.IMAGE_FILE; image_file: ImageFile & PartMetadata }
|
|
432
|
+
| Agents.MessageContentImageUrl;
|
|
319
433
|
|
|
320
434
|
export type StreamContentData = TMessageContentParts & {
|
|
321
435
|
/** The index of the current content part */
|
|
@@ -375,14 +489,15 @@ export type ActionMetadata = {
|
|
|
375
489
|
oauth_client_secret?: string;
|
|
376
490
|
};
|
|
377
491
|
|
|
492
|
+
/* Assistant types */
|
|
493
|
+
|
|
378
494
|
export type Action = {
|
|
379
495
|
action_id: string;
|
|
380
|
-
assistant_id: string;
|
|
381
496
|
type?: string;
|
|
382
497
|
settings?: Record<string, unknown>;
|
|
383
498
|
metadata: ActionMetadata;
|
|
384
499
|
version: number | string;
|
|
385
|
-
};
|
|
500
|
+
} & ({ assistant_id: string; agent_id?: never } | { assistant_id?: never; agent_id: string });
|
|
386
501
|
|
|
387
502
|
export type AssistantAvatar = {
|
|
388
503
|
filepath: string;
|
|
@@ -392,6 +507,7 @@ export type AssistantAvatar = {
|
|
|
392
507
|
export type AssistantDocument = {
|
|
393
508
|
user: string;
|
|
394
509
|
assistant_id: string;
|
|
510
|
+
conversation_starters?: string[];
|
|
395
511
|
avatar?: AssistantAvatar;
|
|
396
512
|
access_level?: number;
|
|
397
513
|
file_ids?: string[];
|
|
@@ -400,6 +516,13 @@ export type AssistantDocument = {
|
|
|
400
516
|
updatedAt?: Date;
|
|
401
517
|
};
|
|
402
518
|
|
|
519
|
+
/* Agent types */
|
|
520
|
+
|
|
521
|
+
export type AgentAvatar = {
|
|
522
|
+
filepath: string;
|
|
523
|
+
source: string;
|
|
524
|
+
};
|
|
525
|
+
|
|
403
526
|
export enum FilePurpose {
|
|
404
527
|
Vision = 'vision',
|
|
405
528
|
FineTune = 'fine-tune',
|
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
|
}
|
|
@@ -127,6 +131,7 @@ export type BatchFile = {
|
|
|
127
131
|
|
|
128
132
|
export type DeleteFilesBody = {
|
|
129
133
|
files: BatchFile[];
|
|
134
|
+
agent_id?: string;
|
|
130
135
|
assistant_id?: string;
|
|
131
136
|
tool_resource?: EToolResources;
|
|
132
137
|
};
|
package/src/types/mutations.ts
CHANGED
|
@@ -8,6 +8,9 @@ import {
|
|
|
8
8
|
FunctionTool,
|
|
9
9
|
AssistantDocument,
|
|
10
10
|
Action,
|
|
11
|
+
Agent,
|
|
12
|
+
AgentCreateParams,
|
|
13
|
+
AgentUpdateParams,
|
|
11
14
|
} from './assistants';
|
|
12
15
|
|
|
13
16
|
export type MutationOptions<
|
|
@@ -41,6 +44,8 @@ export type DeletePresetOptions = MutationOptions<PresetDeleteResponse, types.TP
|
|
|
41
44
|
|
|
42
45
|
export type LogoutOptions = MutationOptions<unknown, undefined>;
|
|
43
46
|
|
|
47
|
+
/* Assistant mutations */
|
|
48
|
+
|
|
44
49
|
export type AssistantAvatarVariables = {
|
|
45
50
|
assistant_id: string;
|
|
46
51
|
model: string;
|
|
@@ -94,6 +99,51 @@ export type DeleteActionVariables = {
|
|
|
94
99
|
|
|
95
100
|
export type DeleteActionOptions = MutationOptions<void, DeleteActionVariables>;
|
|
96
101
|
|
|
102
|
+
/* Agent mutations */
|
|
103
|
+
|
|
104
|
+
export type AgentAvatarVariables = {
|
|
105
|
+
agent_id: string;
|
|
106
|
+
formData: FormData;
|
|
107
|
+
postCreation?: boolean;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type UpdateAgentActionVariables = {
|
|
111
|
+
agent_id: string;
|
|
112
|
+
action_id?: string;
|
|
113
|
+
metadata: ActionMetadata;
|
|
114
|
+
functions: FunctionTool[];
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type UploadAgentAvatarOptions = MutationOptions<Agent, AgentAvatarVariables>;
|
|
118
|
+
|
|
119
|
+
export type CreateAgentMutationOptions = MutationOptions<Agent, AgentCreateParams>;
|
|
120
|
+
|
|
121
|
+
export type UpdateAgentVariables = {
|
|
122
|
+
agent_id: string;
|
|
123
|
+
data: AgentUpdateParams;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export type UpdateAgentMutationOptions = MutationOptions<Agent, UpdateAgentVariables>;
|
|
127
|
+
|
|
128
|
+
export type DeleteAgentBody = {
|
|
129
|
+
agent_id: string;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export type DeleteAgentMutationOptions = MutationOptions<void, Pick<DeleteAgentBody, 'agent_id'>>;
|
|
133
|
+
|
|
134
|
+
export type UpdateAgentActionResponse = [Agent, Action];
|
|
135
|
+
export type UpdateAgentActionOptions = MutationOptions<
|
|
136
|
+
UpdateAgentActionResponse,
|
|
137
|
+
UpdateAgentActionVariables
|
|
138
|
+
>;
|
|
139
|
+
|
|
140
|
+
export type DeleteAgentActionVariables = {
|
|
141
|
+
agent_id: string;
|
|
142
|
+
action_id: string;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export type DeleteAgentActionOptions = MutationOptions<void, DeleteAgentActionVariables>;
|
|
146
|
+
|
|
97
147
|
export type DeleteConversationOptions = MutationOptions<
|
|
98
148
|
types.TDeleteConversationResponse,
|
|
99
149
|
types.TDeleteConversationRequest
|
|
@@ -105,10 +155,22 @@ export type CreateSharedLinkOptions = MutationOptions<
|
|
|
105
155
|
types.TSharedLink,
|
|
106
156
|
Partial<types.TSharedLink>
|
|
107
157
|
>;
|
|
158
|
+
|
|
159
|
+
export type updateTagsInConvoOptions = MutationOptions<
|
|
160
|
+
types.TTagConversationResponse,
|
|
161
|
+
types.TTagConversationRequest
|
|
162
|
+
>;
|
|
163
|
+
|
|
108
164
|
export type UpdateSharedLinkOptions = MutationOptions<
|
|
109
165
|
types.TSharedLink,
|
|
110
166
|
Partial<types.TSharedLink>
|
|
111
167
|
>;
|
|
168
|
+
|
|
169
|
+
export type ArchiveConvoOptions = MutationOptions<
|
|
170
|
+
types.TArchiveConversationResponse,
|
|
171
|
+
types.TArchiveConversationRequest
|
|
172
|
+
>;
|
|
173
|
+
|
|
112
174
|
export type DeleteSharedLinkOptions = MutationOptions<types.TSharedLink, { shareId: string }>;
|
|
113
175
|
|
|
114
176
|
export type TUpdatePromptContext =
|
|
@@ -173,3 +235,16 @@ export type UpdatePromptPermOptions = MutationOptions<
|
|
|
173
235
|
unknown,
|
|
174
236
|
types.TError
|
|
175
237
|
>;
|
|
238
|
+
|
|
239
|
+
export type UpdateConversationTagOptions = MutationOptions<
|
|
240
|
+
types.TConversationTag,
|
|
241
|
+
types.TConversationTagRequest
|
|
242
|
+
>;
|
|
243
|
+
export type DeleteConversationTagOptions = MutationOptions<types.TConversationTag, string>;
|
|
244
|
+
|
|
245
|
+
export type AcceptTermsMutationOptions = MutationOptions<
|
|
246
|
+
types.TAcceptTermsResponse,
|
|
247
|
+
void,
|
|
248
|
+
unknown,
|
|
249
|
+
void
|
|
250
|
+
>;
|
package/src/types/queries.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { InfiniteData } from '@tanstack/react-query';
|
|
2
|
-
import type { TMessage, TConversation, TSharedLink } from '../schemas';
|
|
3
2
|
import type * as t from '../types';
|
|
3
|
+
import type { TMessage, TConversation, TSharedLink, TConversationTag } from '../schemas';
|
|
4
|
+
|
|
4
5
|
export type Conversation = {
|
|
5
6
|
id: string;
|
|
6
7
|
createdAt: number;
|
|
@@ -15,9 +16,10 @@ export type ConversationListParams = {
|
|
|
15
16
|
before?: string | null;
|
|
16
17
|
after?: string | null;
|
|
17
18
|
order?: 'asc' | 'desc';
|
|
18
|
-
pageNumber: string;
|
|
19
|
+
pageNumber: string;
|
|
19
20
|
conversationId?: string;
|
|
20
21
|
isArchived?: boolean;
|
|
22
|
+
tags?: string[];
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
// Type for the response from the conversation list API
|
|
@@ -68,3 +70,5 @@ export type AllPromptGroupsFilterRequest = {
|
|
|
68
70
|
};
|
|
69
71
|
|
|
70
72
|
export type AllPromptGroupsResponse = t.TPromptGroup[];
|
|
73
|
+
|
|
74
|
+
export type ConversationTagsResponse = TConversationTag[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export enum ContentTypes {
|
|
2
|
+
TEXT = 'text',
|
|
3
|
+
TEXT_DELTA = 'text_delta',
|
|
4
|
+
TOOL_CALL = 'tool_call',
|
|
5
|
+
IMAGE_FILE = 'image_file',
|
|
6
|
+
IMAGE_URL = 'image_url',
|
|
7
|
+
ERROR = 'error',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export enum StepTypes {
|
|
11
|
+
TOOL_CALLS = 'tool_calls',
|
|
12
|
+
MESSAGE_CREATION = 'message_creation',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export enum ToolCallTypes {
|
|
16
|
+
FUNCTION = 'function',
|
|
17
|
+
RETRIEVAL = 'retrieval',
|
|
18
|
+
FILE_SEARCH = 'file_search',
|
|
19
|
+
CODE_INTERPRETER = 'code_interpreter',
|
|
20
|
+
/* Agents Tool Call */
|
|
21
|
+
TOOL_CALL = 'tool_call',
|
|
22
|
+
}
|