@convex-dev/agent 0.1.16 → 0.1.18-alpha.0
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/README.md +1 -1
- package/dist/client/createTool.d.ts +5 -5
- package/dist/client/createTool.d.ts.map +1 -1
- package/dist/client/createTool.js.map +1 -1
- package/dist/client/definePlaygroundAPI.d.ts +619 -0
- package/dist/client/definePlaygroundAPI.d.ts.map +1 -0
- package/dist/client/definePlaygroundAPI.js +254 -0
- package/dist/client/definePlaygroundAPI.js.map +1 -0
- package/dist/client/files.js +1 -1
- package/dist/client/files.js.map +1 -1
- package/dist/client/index.d.ts +52 -10
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +49 -69
- package/dist/client/index.js.map +1 -1
- package/dist/client/types.d.ts.map +1 -1
- package/dist/component/messages.d.ts +1 -1
- package/package.json +3 -2
- package/src/client/createTool.ts +14 -12
- package/src/client/definePlaygroundAPI.ts +336 -0
- package/src/client/files.ts +1 -1
- package/src/client/index.ts +143 -117
- package/src/client/types.ts +0 -1
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ workflows.
|
|
|
49
49
|
- [Usage tracking](./docs/usage-tracking.mdx) is easy to set up, enabling usage
|
|
50
50
|
attribution per-provider, per-model, per-user, per-agent, for billing & more.
|
|
51
51
|
- [Rate limiting](./docs/rate-limiting.mdx), powered by the
|
|
52
|
-
[Rate
|
|
52
|
+
[Rate Limiter Component](https://www.convex.dev/components/rate-limiter),
|
|
53
53
|
helps control the rate at which users can interact with agents and keep you
|
|
54
54
|
from exceeding your LLM provider's limits.
|
|
55
55
|
|
|
@@ -2,8 +2,8 @@ import type { Schema, Tool, ToolExecutionOptions, ToolSet } from "ai";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import type { Agent } from "./index.js";
|
|
4
4
|
import type { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
5
|
-
export type ToolCtx<DataModel extends GenericDataModel = GenericDataModel
|
|
6
|
-
agent: Agent
|
|
5
|
+
export type ToolCtx<DataModel extends GenericDataModel = GenericDataModel> = GenericActionCtx<DataModel> & {
|
|
6
|
+
agent: Agent;
|
|
7
7
|
userId?: string;
|
|
8
8
|
threadId?: string;
|
|
9
9
|
messageId?: string;
|
|
@@ -15,7 +15,7 @@ export type ToolCtx<DataModel extends GenericDataModel = GenericDataModel, TOOLS
|
|
|
15
15
|
* but swap parameters for args and handler for execute.
|
|
16
16
|
* @returns A tool to be used with the AI SDK.
|
|
17
17
|
*/
|
|
18
|
-
export declare function createTool<PARAMETERS extends ToolParameters, RESULT>(t: {
|
|
18
|
+
export declare function createTool<PARAMETERS extends ToolParameters, RESULT, Ctx extends ToolCtx = ToolCtx>(t: {
|
|
19
19
|
/**
|
|
20
20
|
An optional description of what the tool does.
|
|
21
21
|
Will be used by the language model to decide whether to use the tool.
|
|
@@ -35,8 +35,8 @@ export declare function createTool<PARAMETERS extends ToolParameters, RESULT>(t:
|
|
|
35
35
|
@args is the input of the tool call.
|
|
36
36
|
@options.abortSignal is a signal that can be used to abort the tool call.
|
|
37
37
|
*/
|
|
38
|
-
handler: (ctx:
|
|
39
|
-
ctx?:
|
|
38
|
+
handler: (ctx: Ctx, args: inferParameters<PARAMETERS>, options: ToolExecutionOptions) => PromiseLike<RESULT>;
|
|
39
|
+
ctx?: Ctx;
|
|
40
40
|
}): Tool<PARAMETERS, RESULT> & {
|
|
41
41
|
execute: (args: inferParameters<PARAMETERS>, options: ToolExecutionOptions) => PromiseLike<RESULT>;
|
|
42
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTool.d.ts","sourceRoot":"","sources":["../../src/client/createTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAEtE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,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,eAAe,CAAC,UAAU,CAAC,EACjC,OAAO,EAAE,oBAAoB,KAC1B,WAAW,CAAC,MAAM,CAAC,CAAC;CAC1B,CAqBA;AAED,wBAAgB,SAAS,CACvB,GAAG,EAAE,OAAO,EACZ,GAAG,QAAQ,EAAE,CAAC,OAAO,GAAG,SAAS,CAAC,EAAE,GACnC,OAAO,CAiBT;AAID,KAAK,cAAc,GAAG,CAAC,CAAC,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AACjD,KAAK,eAAe,CAAC,UAAU,SAAS,cAAc,IAEpD,UAAU,SAAS,MAAM,CAAC,GAAG,CAAC,GAC1B,UAAU,CAAC,OAAO,CAAC,GACnB,UAAU,SAAS,CAAC,CAAC,UAAU,GAC7B,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,GACnB,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTool.js","sourceRoot":"","sources":["../../src/client/createTool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"createTool.js","sourceRoot":"","sources":["../../src/client/createTool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAIxB,CA0BD;IAMC,MAAM,IAAI,GAAG;QACX,YAAY,EAAE,IAAI;QAClB,GAAG,EAAE,CAAC,CAAC,GAAG;QACV,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,UAAU,EAAE,CAAC,CAAC,IAAI;QAClB,KAAK,CAAC,OAAO,CACX,IAAiC,EACjC,OAA6B;YAE7B,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CACb,uDAAuD;oBACrD,qEAAqE;oBACrE,uDAAuD,CAC1D,CAAC;YACJ,CAAC;YACD,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5C,CAAC;KACF,CAAC;IACF,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,GAAY,EACZ,GAAG,QAAiC;IAEpC,MAAM,MAAM,GAAG,EAAa,CAAC;IAC7B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,SAAS;QACX,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACnD,8DAA8D;YAC9D,IAAI,CAAE,IAAY,CAAC,YAAY,EAAE,CAAC;gBAChC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YACtB,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC;gBAC7B,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
import { type GenericDataModel, type GenericQueryCtx, type ApiFromModules, type GenericActionCtx } from "convex/server";
|
|
2
|
+
import { type AgentComponent, type Agent } from "@convex-dev/agent";
|
|
3
|
+
export type PlaygroundAPI = ApiFromModules<{
|
|
4
|
+
playground: ReturnType<typeof definePlaygroundAPI>;
|
|
5
|
+
}>["playground"];
|
|
6
|
+
export type AgentsFn<DataModel extends GenericDataModel> = (ctx: GenericActionCtx<DataModel> | GenericQueryCtx<DataModel>, args: {
|
|
7
|
+
userId: string | undefined;
|
|
8
|
+
threadId: string | undefined;
|
|
9
|
+
}) => Agent[] | Promise<Agent[]>;
|
|
10
|
+
export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(component: AgentComponent, { agents: agentsOrFn, userNameLookup, }: {
|
|
11
|
+
agents: Agent[] | AgentsFn<DataModel>;
|
|
12
|
+
userNameLookup?: (ctx: GenericQueryCtx<DataModel>, userId: string) => string | Promise<string>;
|
|
13
|
+
}): {
|
|
14
|
+
isApiKeyValid: import("convex/server").RegisteredQuery<"public", {
|
|
15
|
+
apiKey: string;
|
|
16
|
+
}, Promise<boolean>>;
|
|
17
|
+
listUsers: import("convex/server").RegisteredQuery<"public", {
|
|
18
|
+
apiKey: string;
|
|
19
|
+
paginationOpts: {
|
|
20
|
+
id?: number | undefined;
|
|
21
|
+
endCursor?: string | null | undefined;
|
|
22
|
+
maximumRowsRead?: number | undefined;
|
|
23
|
+
maximumBytesRead?: number | undefined;
|
|
24
|
+
numItems: number;
|
|
25
|
+
cursor: string | null;
|
|
26
|
+
};
|
|
27
|
+
}, Promise<{
|
|
28
|
+
page: {
|
|
29
|
+
_id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
}[];
|
|
32
|
+
continueCursor: string;
|
|
33
|
+
isDone: boolean;
|
|
34
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null | undefined;
|
|
35
|
+
splitCursor?: string | null | undefined;
|
|
36
|
+
}>>;
|
|
37
|
+
listThreads: import("convex/server").RegisteredQuery<"public", {
|
|
38
|
+
userId?: string | undefined;
|
|
39
|
+
apiKey: string;
|
|
40
|
+
paginationOpts: {
|
|
41
|
+
id?: number | undefined;
|
|
42
|
+
endCursor?: string | null | undefined;
|
|
43
|
+
maximumRowsRead?: number | undefined;
|
|
44
|
+
maximumBytesRead?: number | undefined;
|
|
45
|
+
numItems: number;
|
|
46
|
+
cursor: string | null;
|
|
47
|
+
};
|
|
48
|
+
}, Promise<{
|
|
49
|
+
page: {
|
|
50
|
+
lastAgentName: string | undefined;
|
|
51
|
+
latestMessage: string | undefined;
|
|
52
|
+
lastMessageAt: number;
|
|
53
|
+
_creationTime: number;
|
|
54
|
+
_id: string;
|
|
55
|
+
status: "active" | "archived";
|
|
56
|
+
summary?: string | undefined;
|
|
57
|
+
title?: string | undefined;
|
|
58
|
+
userId?: string | undefined;
|
|
59
|
+
}[];
|
|
60
|
+
continueCursor: string;
|
|
61
|
+
isDone: boolean;
|
|
62
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null | undefined;
|
|
63
|
+
splitCursor?: string | null | undefined;
|
|
64
|
+
}>>;
|
|
65
|
+
listMessages: import("convex/server").RegisteredQuery<"public", {
|
|
66
|
+
threadId: string;
|
|
67
|
+
apiKey: string;
|
|
68
|
+
paginationOpts: {
|
|
69
|
+
id?: number | undefined;
|
|
70
|
+
endCursor?: string | null | undefined;
|
|
71
|
+
maximumRowsRead?: number | undefined;
|
|
72
|
+
maximumBytesRead?: number | undefined;
|
|
73
|
+
numItems: number;
|
|
74
|
+
cursor: string | null;
|
|
75
|
+
};
|
|
76
|
+
}, Promise<{
|
|
77
|
+
continueCursor: string;
|
|
78
|
+
isDone: boolean;
|
|
79
|
+
page: {
|
|
80
|
+
_creationTime: number;
|
|
81
|
+
_id: string;
|
|
82
|
+
agentName?: string | undefined;
|
|
83
|
+
embeddingId?: string | undefined;
|
|
84
|
+
error?: string | undefined;
|
|
85
|
+
fileIds?: string[] | undefined;
|
|
86
|
+
finishReason?: "stop" | "length" | "content-filter" | "tool-calls" | "error" | "other" | "unknown" | undefined;
|
|
87
|
+
id?: string | undefined;
|
|
88
|
+
message?: {
|
|
89
|
+
content: string | ({
|
|
90
|
+
providerOptions?: {
|
|
91
|
+
[x: string]: {
|
|
92
|
+
[x: string]: any;
|
|
93
|
+
};
|
|
94
|
+
} | undefined;
|
|
95
|
+
text: string;
|
|
96
|
+
type: "text";
|
|
97
|
+
} | {
|
|
98
|
+
image: string | ArrayBuffer;
|
|
99
|
+
mimeType?: string | undefined;
|
|
100
|
+
providerOptions?: {
|
|
101
|
+
[x: string]: {
|
|
102
|
+
[x: string]: any;
|
|
103
|
+
};
|
|
104
|
+
} | undefined;
|
|
105
|
+
type: "image";
|
|
106
|
+
} | {
|
|
107
|
+
data: string | ArrayBuffer;
|
|
108
|
+
filename?: string | undefined;
|
|
109
|
+
mimeType: string;
|
|
110
|
+
providerOptions?: {
|
|
111
|
+
[x: string]: {
|
|
112
|
+
[x: string]: any;
|
|
113
|
+
};
|
|
114
|
+
} | undefined;
|
|
115
|
+
type: "file";
|
|
116
|
+
})[];
|
|
117
|
+
providerOptions?: {
|
|
118
|
+
[x: string]: {
|
|
119
|
+
[x: string]: any;
|
|
120
|
+
};
|
|
121
|
+
} | undefined;
|
|
122
|
+
role: "user";
|
|
123
|
+
} | {
|
|
124
|
+
content: string | ({
|
|
125
|
+
providerOptions?: {
|
|
126
|
+
[x: string]: {
|
|
127
|
+
[x: string]: any;
|
|
128
|
+
};
|
|
129
|
+
} | undefined;
|
|
130
|
+
text: string;
|
|
131
|
+
type: "text";
|
|
132
|
+
} | {
|
|
133
|
+
data: string | ArrayBuffer;
|
|
134
|
+
filename?: string | undefined;
|
|
135
|
+
mimeType: string;
|
|
136
|
+
providerOptions?: {
|
|
137
|
+
[x: string]: {
|
|
138
|
+
[x: string]: any;
|
|
139
|
+
};
|
|
140
|
+
} | undefined;
|
|
141
|
+
type: "file";
|
|
142
|
+
} | {
|
|
143
|
+
providerOptions?: {
|
|
144
|
+
[x: string]: {
|
|
145
|
+
[x: string]: any;
|
|
146
|
+
};
|
|
147
|
+
} | undefined;
|
|
148
|
+
signature?: string | undefined;
|
|
149
|
+
text: string;
|
|
150
|
+
type: "reasoning";
|
|
151
|
+
} | {
|
|
152
|
+
data: string;
|
|
153
|
+
providerOptions?: {
|
|
154
|
+
[x: string]: {
|
|
155
|
+
[x: string]: any;
|
|
156
|
+
};
|
|
157
|
+
} | undefined;
|
|
158
|
+
type: "redacted-reasoning";
|
|
159
|
+
} | {
|
|
160
|
+
args: any;
|
|
161
|
+
providerOptions?: {
|
|
162
|
+
[x: string]: {
|
|
163
|
+
[x: string]: any;
|
|
164
|
+
};
|
|
165
|
+
} | undefined;
|
|
166
|
+
toolCallId: string;
|
|
167
|
+
toolName: string;
|
|
168
|
+
type: "tool-call";
|
|
169
|
+
})[];
|
|
170
|
+
providerOptions?: {
|
|
171
|
+
[x: string]: {
|
|
172
|
+
[x: string]: any;
|
|
173
|
+
};
|
|
174
|
+
} | undefined;
|
|
175
|
+
role: "assistant";
|
|
176
|
+
} | {
|
|
177
|
+
content: {
|
|
178
|
+
args?: any;
|
|
179
|
+
experimental_content?: ({
|
|
180
|
+
text: string;
|
|
181
|
+
type: "text";
|
|
182
|
+
} | {
|
|
183
|
+
data: string;
|
|
184
|
+
mimeType?: string | undefined;
|
|
185
|
+
type: "image";
|
|
186
|
+
})[] | undefined;
|
|
187
|
+
isError?: boolean | undefined;
|
|
188
|
+
providerOptions?: {
|
|
189
|
+
[x: string]: {
|
|
190
|
+
[x: string]: any;
|
|
191
|
+
};
|
|
192
|
+
} | undefined;
|
|
193
|
+
result: any;
|
|
194
|
+
toolCallId: string;
|
|
195
|
+
toolName: string;
|
|
196
|
+
type: "tool-result";
|
|
197
|
+
}[];
|
|
198
|
+
providerOptions?: {
|
|
199
|
+
[x: string]: {
|
|
200
|
+
[x: string]: any;
|
|
201
|
+
};
|
|
202
|
+
} | undefined;
|
|
203
|
+
role: "tool";
|
|
204
|
+
} | {
|
|
205
|
+
content: string;
|
|
206
|
+
providerOptions?: {
|
|
207
|
+
[x: string]: {
|
|
208
|
+
[x: string]: any;
|
|
209
|
+
};
|
|
210
|
+
} | undefined;
|
|
211
|
+
role: "system";
|
|
212
|
+
} | undefined;
|
|
213
|
+
model?: string | undefined;
|
|
214
|
+
order: number;
|
|
215
|
+
provider?: string | undefined;
|
|
216
|
+
providerMetadata?: {
|
|
217
|
+
[x: string]: {
|
|
218
|
+
[x: string]: any;
|
|
219
|
+
};
|
|
220
|
+
} | undefined;
|
|
221
|
+
providerOptions?: {
|
|
222
|
+
[x: string]: {
|
|
223
|
+
[x: string]: any;
|
|
224
|
+
};
|
|
225
|
+
} | undefined;
|
|
226
|
+
reasoning?: string | undefined;
|
|
227
|
+
reasoningDetails?: ({
|
|
228
|
+
signature?: string | undefined;
|
|
229
|
+
text: string;
|
|
230
|
+
type: "text";
|
|
231
|
+
} | {
|
|
232
|
+
data: string;
|
|
233
|
+
type: "redacted";
|
|
234
|
+
})[] | undefined;
|
|
235
|
+
sources?: {
|
|
236
|
+
id: string;
|
|
237
|
+
providerOptions?: {
|
|
238
|
+
[x: string]: {
|
|
239
|
+
[x: string]: any;
|
|
240
|
+
};
|
|
241
|
+
} | undefined;
|
|
242
|
+
sourceType: "url";
|
|
243
|
+
title?: string | undefined;
|
|
244
|
+
url: string;
|
|
245
|
+
}[] | undefined;
|
|
246
|
+
status: "pending" | "success" | "failed";
|
|
247
|
+
stepOrder: number;
|
|
248
|
+
text?: string | undefined;
|
|
249
|
+
threadId: string;
|
|
250
|
+
tool: boolean;
|
|
251
|
+
usage?: {
|
|
252
|
+
completionTokens: number;
|
|
253
|
+
promptTokens: number;
|
|
254
|
+
totalTokens: number;
|
|
255
|
+
} | undefined;
|
|
256
|
+
userId?: string | undefined;
|
|
257
|
+
warnings?: ({
|
|
258
|
+
details?: string | undefined;
|
|
259
|
+
setting: string;
|
|
260
|
+
type: "unsupported-setting";
|
|
261
|
+
} | {
|
|
262
|
+
details?: string | undefined;
|
|
263
|
+
tool: any;
|
|
264
|
+
type: "unsupported-tool";
|
|
265
|
+
} | {
|
|
266
|
+
message: string;
|
|
267
|
+
type: "other";
|
|
268
|
+
})[] | undefined;
|
|
269
|
+
}[];
|
|
270
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null | undefined;
|
|
271
|
+
splitCursor?: string | null | undefined;
|
|
272
|
+
}>>;
|
|
273
|
+
listAgents: import("convex/server").RegisteredQuery<"public", {
|
|
274
|
+
userId?: string | undefined;
|
|
275
|
+
threadId?: string | undefined;
|
|
276
|
+
apiKey: string;
|
|
277
|
+
}, Promise<{
|
|
278
|
+
name: string;
|
|
279
|
+
instructions: string | undefined;
|
|
280
|
+
contextOptions: import("@convex-dev/agent").ContextOptions | undefined;
|
|
281
|
+
storageOptions: import("@convex-dev/agent").StorageOptions | undefined;
|
|
282
|
+
maxSteps: number | undefined;
|
|
283
|
+
maxRetries: number | undefined;
|
|
284
|
+
tools: string[];
|
|
285
|
+
}[]>>;
|
|
286
|
+
createThread: import("convex/server").RegisteredMutation<"public", {
|
|
287
|
+
title?: string | undefined;
|
|
288
|
+
summary?: string | undefined;
|
|
289
|
+
agentName?: string | undefined;
|
|
290
|
+
userId: string;
|
|
291
|
+
apiKey: string;
|
|
292
|
+
}, Promise<{
|
|
293
|
+
threadId: string;
|
|
294
|
+
}>>;
|
|
295
|
+
generateText: import("convex/server").RegisteredAction<"public", {
|
|
296
|
+
system?: string | undefined;
|
|
297
|
+
messages?: ({
|
|
298
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
299
|
+
role: "user";
|
|
300
|
+
content: string | ({
|
|
301
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
302
|
+
type: "text";
|
|
303
|
+
text: string;
|
|
304
|
+
} | {
|
|
305
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
306
|
+
mimeType?: string | undefined;
|
|
307
|
+
type: "image";
|
|
308
|
+
image: string | ArrayBuffer;
|
|
309
|
+
} | {
|
|
310
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
311
|
+
filename?: string | undefined;
|
|
312
|
+
type: "file";
|
|
313
|
+
mimeType: string;
|
|
314
|
+
data: string | ArrayBuffer;
|
|
315
|
+
})[];
|
|
316
|
+
} | {
|
|
317
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
318
|
+
role: "assistant";
|
|
319
|
+
content: string | ({
|
|
320
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
321
|
+
type: "text";
|
|
322
|
+
text: string;
|
|
323
|
+
} | {
|
|
324
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
325
|
+
filename?: string | undefined;
|
|
326
|
+
type: "file";
|
|
327
|
+
mimeType: string;
|
|
328
|
+
data: string | ArrayBuffer;
|
|
329
|
+
} | {
|
|
330
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
331
|
+
signature?: string | undefined;
|
|
332
|
+
type: "reasoning";
|
|
333
|
+
text: string;
|
|
334
|
+
} | {
|
|
335
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
336
|
+
type: "redacted-reasoning";
|
|
337
|
+
data: string;
|
|
338
|
+
} | {
|
|
339
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
340
|
+
type: "tool-call";
|
|
341
|
+
toolCallId: string;
|
|
342
|
+
toolName: string;
|
|
343
|
+
args: any;
|
|
344
|
+
})[];
|
|
345
|
+
} | {
|
|
346
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
347
|
+
role: "tool";
|
|
348
|
+
content: {
|
|
349
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
350
|
+
args?: any;
|
|
351
|
+
experimental_content?: ({
|
|
352
|
+
type: "text";
|
|
353
|
+
text: string;
|
|
354
|
+
} | {
|
|
355
|
+
mimeType?: string | undefined;
|
|
356
|
+
type: "image";
|
|
357
|
+
data: string;
|
|
358
|
+
})[] | undefined;
|
|
359
|
+
isError?: boolean | undefined;
|
|
360
|
+
type: "tool-result";
|
|
361
|
+
toolCallId: string;
|
|
362
|
+
toolName: string;
|
|
363
|
+
result: any;
|
|
364
|
+
}[];
|
|
365
|
+
} | {
|
|
366
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
367
|
+
role: "system";
|
|
368
|
+
content: string;
|
|
369
|
+
})[] | undefined;
|
|
370
|
+
prompt?: string | undefined;
|
|
371
|
+
contextOptions?: {
|
|
372
|
+
excludeToolMessages?: boolean | undefined;
|
|
373
|
+
recentMessages?: number | undefined;
|
|
374
|
+
searchOptions?: {
|
|
375
|
+
textSearch?: boolean | undefined;
|
|
376
|
+
vectorSearch?: boolean | undefined;
|
|
377
|
+
vectorScoreThreshold?: number | undefined;
|
|
378
|
+
messageRange?: {
|
|
379
|
+
before: number;
|
|
380
|
+
after: number;
|
|
381
|
+
} | undefined;
|
|
382
|
+
limit: number;
|
|
383
|
+
} | undefined;
|
|
384
|
+
searchOtherThreads?: boolean | undefined;
|
|
385
|
+
} | undefined;
|
|
386
|
+
storageOptions?: {
|
|
387
|
+
saveMessages?: "all" | "none" | "promptAndOutput" | undefined;
|
|
388
|
+
} | undefined;
|
|
389
|
+
userId: string;
|
|
390
|
+
threadId: string;
|
|
391
|
+
agentName: string;
|
|
392
|
+
apiKey: string;
|
|
393
|
+
}, Promise<{
|
|
394
|
+
messageId: string;
|
|
395
|
+
text: string;
|
|
396
|
+
}>>;
|
|
397
|
+
fetchPromptContext: import("convex/server").RegisteredAction<"public", {
|
|
398
|
+
userId?: string | undefined;
|
|
399
|
+
threadId?: string | undefined;
|
|
400
|
+
beforeMessageId?: string | undefined;
|
|
401
|
+
agentName: string;
|
|
402
|
+
messages: ({
|
|
403
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
404
|
+
role: "user";
|
|
405
|
+
content: string | ({
|
|
406
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
407
|
+
type: "text";
|
|
408
|
+
text: string;
|
|
409
|
+
} | {
|
|
410
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
411
|
+
mimeType?: string | undefined;
|
|
412
|
+
type: "image";
|
|
413
|
+
image: string | ArrayBuffer;
|
|
414
|
+
} | {
|
|
415
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
416
|
+
filename?: string | undefined;
|
|
417
|
+
type: "file";
|
|
418
|
+
mimeType: string;
|
|
419
|
+
data: string | ArrayBuffer;
|
|
420
|
+
})[];
|
|
421
|
+
} | {
|
|
422
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
423
|
+
role: "assistant";
|
|
424
|
+
content: string | ({
|
|
425
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
426
|
+
type: "text";
|
|
427
|
+
text: string;
|
|
428
|
+
} | {
|
|
429
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
430
|
+
filename?: string | undefined;
|
|
431
|
+
type: "file";
|
|
432
|
+
mimeType: string;
|
|
433
|
+
data: string | ArrayBuffer;
|
|
434
|
+
} | {
|
|
435
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
436
|
+
signature?: string | undefined;
|
|
437
|
+
type: "reasoning";
|
|
438
|
+
text: string;
|
|
439
|
+
} | {
|
|
440
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
441
|
+
type: "redacted-reasoning";
|
|
442
|
+
data: string;
|
|
443
|
+
} | {
|
|
444
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
445
|
+
type: "tool-call";
|
|
446
|
+
toolCallId: string;
|
|
447
|
+
toolName: string;
|
|
448
|
+
args: any;
|
|
449
|
+
})[];
|
|
450
|
+
} | {
|
|
451
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
452
|
+
role: "tool";
|
|
453
|
+
content: {
|
|
454
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
455
|
+
args?: any;
|
|
456
|
+
experimental_content?: ({
|
|
457
|
+
type: "text";
|
|
458
|
+
text: string;
|
|
459
|
+
} | {
|
|
460
|
+
mimeType?: string | undefined;
|
|
461
|
+
type: "image";
|
|
462
|
+
data: string;
|
|
463
|
+
})[] | undefined;
|
|
464
|
+
isError?: boolean | undefined;
|
|
465
|
+
type: "tool-result";
|
|
466
|
+
toolCallId: string;
|
|
467
|
+
toolName: string;
|
|
468
|
+
result: any;
|
|
469
|
+
}[];
|
|
470
|
+
} | {
|
|
471
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
472
|
+
role: "system";
|
|
473
|
+
content: string;
|
|
474
|
+
})[];
|
|
475
|
+
contextOptions: {
|
|
476
|
+
excludeToolMessages?: boolean | undefined;
|
|
477
|
+
recentMessages?: number | undefined;
|
|
478
|
+
searchOptions?: {
|
|
479
|
+
textSearch?: boolean | undefined;
|
|
480
|
+
vectorSearch?: boolean | undefined;
|
|
481
|
+
vectorScoreThreshold?: number | undefined;
|
|
482
|
+
messageRange?: {
|
|
483
|
+
before: number;
|
|
484
|
+
after: number;
|
|
485
|
+
} | undefined;
|
|
486
|
+
limit: number;
|
|
487
|
+
} | undefined;
|
|
488
|
+
searchOtherThreads?: boolean | undefined;
|
|
489
|
+
};
|
|
490
|
+
apiKey: string;
|
|
491
|
+
}, Promise<{
|
|
492
|
+
id?: string | undefined;
|
|
493
|
+
userId?: string | undefined;
|
|
494
|
+
embeddingId?: string | undefined;
|
|
495
|
+
fileIds?: string[] | undefined;
|
|
496
|
+
error?: string | undefined;
|
|
497
|
+
agentName?: string | undefined;
|
|
498
|
+
model?: string | undefined;
|
|
499
|
+
provider?: string | undefined;
|
|
500
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
501
|
+
message?: {
|
|
502
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
503
|
+
role: "user";
|
|
504
|
+
content: string | ({
|
|
505
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
506
|
+
type: "text";
|
|
507
|
+
text: string;
|
|
508
|
+
} | {
|
|
509
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
510
|
+
mimeType?: string | undefined;
|
|
511
|
+
type: "image";
|
|
512
|
+
image: string | ArrayBuffer;
|
|
513
|
+
} | {
|
|
514
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
515
|
+
filename?: string | undefined;
|
|
516
|
+
type: "file";
|
|
517
|
+
mimeType: string;
|
|
518
|
+
data: string | ArrayBuffer;
|
|
519
|
+
})[];
|
|
520
|
+
} | {
|
|
521
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
522
|
+
role: "assistant";
|
|
523
|
+
content: string | ({
|
|
524
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
525
|
+
type: "text";
|
|
526
|
+
text: string;
|
|
527
|
+
} | {
|
|
528
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
529
|
+
filename?: string | undefined;
|
|
530
|
+
type: "file";
|
|
531
|
+
mimeType: string;
|
|
532
|
+
data: string | ArrayBuffer;
|
|
533
|
+
} | {
|
|
534
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
535
|
+
signature?: string | undefined;
|
|
536
|
+
type: "reasoning";
|
|
537
|
+
text: string;
|
|
538
|
+
} | {
|
|
539
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
540
|
+
type: "redacted-reasoning";
|
|
541
|
+
data: string;
|
|
542
|
+
} | {
|
|
543
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
544
|
+
type: "tool-call";
|
|
545
|
+
toolCallId: string;
|
|
546
|
+
toolName: string;
|
|
547
|
+
args: any;
|
|
548
|
+
})[];
|
|
549
|
+
} | {
|
|
550
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
551
|
+
role: "tool";
|
|
552
|
+
content: {
|
|
553
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
554
|
+
args?: any;
|
|
555
|
+
experimental_content?: ({
|
|
556
|
+
type: "text";
|
|
557
|
+
text: string;
|
|
558
|
+
} | {
|
|
559
|
+
mimeType?: string | undefined;
|
|
560
|
+
type: "image";
|
|
561
|
+
data: string;
|
|
562
|
+
})[] | undefined;
|
|
563
|
+
isError?: boolean | undefined;
|
|
564
|
+
type: "tool-result";
|
|
565
|
+
toolCallId: string;
|
|
566
|
+
toolName: string;
|
|
567
|
+
result: any;
|
|
568
|
+
}[];
|
|
569
|
+
} | {
|
|
570
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
571
|
+
role: "system";
|
|
572
|
+
content: string;
|
|
573
|
+
} | undefined;
|
|
574
|
+
text?: string | undefined;
|
|
575
|
+
reasoning?: string | undefined;
|
|
576
|
+
usage?: {
|
|
577
|
+
promptTokens: number;
|
|
578
|
+
completionTokens: number;
|
|
579
|
+
totalTokens: number;
|
|
580
|
+
} | undefined;
|
|
581
|
+
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
582
|
+
sources?: {
|
|
583
|
+
title?: string | undefined;
|
|
584
|
+
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
585
|
+
id: string;
|
|
586
|
+
sourceType: "url";
|
|
587
|
+
url: string;
|
|
588
|
+
}[] | undefined;
|
|
589
|
+
reasoningDetails?: ({
|
|
590
|
+
signature?: string | undefined;
|
|
591
|
+
type: "text";
|
|
592
|
+
text: string;
|
|
593
|
+
} | {
|
|
594
|
+
type: "redacted";
|
|
595
|
+
data: string;
|
|
596
|
+
})[] | undefined;
|
|
597
|
+
warnings?: ({
|
|
598
|
+
details?: string | undefined;
|
|
599
|
+
type: "unsupported-setting";
|
|
600
|
+
setting: string;
|
|
601
|
+
} | {
|
|
602
|
+
details?: string | undefined;
|
|
603
|
+
type: "unsupported-tool";
|
|
604
|
+
tool: any;
|
|
605
|
+
} | {
|
|
606
|
+
type: "other";
|
|
607
|
+
message: string;
|
|
608
|
+
})[] | undefined;
|
|
609
|
+
finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
|
|
610
|
+
_id: string;
|
|
611
|
+
_creationTime: number;
|
|
612
|
+
status: "pending" | "success" | "failed";
|
|
613
|
+
order: number;
|
|
614
|
+
threadId: string;
|
|
615
|
+
stepOrder: number;
|
|
616
|
+
tool: boolean;
|
|
617
|
+
}[]>>;
|
|
618
|
+
};
|
|
619
|
+
//# sourceMappingURL=definePlaygroundAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definePlaygroundAPI.d.ts","sourceRoot":"","sources":["../../src/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