@convex-dev/agent 0.0.12 → 0.0.14-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 +5 -1
- package/dist/commonjs/client/index.d.ts +62 -31
- package/dist/commonjs/client/index.d.ts.map +1 -1
- package/dist/commonjs/client/index.js +133 -37
- package/dist/commonjs/client/index.js.map +1 -1
- package/dist/commonjs/component/messages.d.ts +398 -64
- package/dist/commonjs/component/messages.d.ts.map +1 -1
- package/dist/commonjs/component/messages.js +10 -18
- package/dist/commonjs/component/messages.js.map +1 -1
- package/dist/commonjs/component/schema.d.ts +442 -176
- package/dist/commonjs/component/schema.d.ts.map +1 -1
- package/dist/commonjs/component/schema.js +8 -1
- package/dist/commonjs/component/schema.js.map +1 -1
- package/dist/commonjs/mapping.d.ts +9 -3
- package/dist/commonjs/mapping.d.ts.map +1 -1
- package/dist/commonjs/mapping.js +49 -20
- package/dist/commonjs/mapping.js.map +1 -1
- package/dist/commonjs/validators.d.ts +1575 -1243
- package/dist/commonjs/validators.d.ts.map +1 -1
- package/dist/commonjs/validators.js +34 -11
- package/dist/commonjs/validators.js.map +1 -1
- package/dist/esm/client/index.d.ts +62 -31
- package/dist/esm/client/index.d.ts.map +1 -1
- package/dist/esm/client/index.js +133 -37
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/component/messages.d.ts +398 -64
- package/dist/esm/component/messages.d.ts.map +1 -1
- package/dist/esm/component/messages.js +10 -18
- package/dist/esm/component/messages.js.map +1 -1
- package/dist/esm/component/schema.d.ts +442 -176
- package/dist/esm/component/schema.d.ts.map +1 -1
- package/dist/esm/component/schema.js +8 -1
- package/dist/esm/component/schema.js.map +1 -1
- package/dist/esm/mapping.d.ts +9 -3
- package/dist/esm/mapping.d.ts.map +1 -1
- package/dist/esm/mapping.js +49 -20
- package/dist/esm/mapping.js.map +1 -1
- package/dist/esm/validators.d.ts +1575 -1243
- package/dist/esm/validators.d.ts.map +1 -1
- package/dist/esm/validators.js +34 -11
- package/dist/esm/validators.js.map +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +177 -47
- package/src/component/_generated/api.d.ts +225 -11
- package/src/component/messages.ts +11 -29
- package/src/component/schema.ts +11 -0
- package/src/mapping.ts +56 -26
- package/src/validators.ts +43 -16
package/README.md
CHANGED
|
@@ -289,8 +289,12 @@ const messages = await ctx.runQuery(
|
|
|
289
289
|
```
|
|
290
290
|
|
|
291
291
|
```ts
|
|
292
|
-
const messages = await agent.saveMessages(ctx, { threadId, userId, messages
|
|
292
|
+
const messages = await agent.saveMessages(ctx, { threadId, userId, messages: [
|
|
293
|
+
{ role: "user", content: "Hello, world!" },
|
|
294
|
+
]});
|
|
293
295
|
```
|
|
296
|
+
Note: you can also pass in message metadata if you want to save usage, etc.
|
|
297
|
+
See the docstrings in [the implementation](./src/client/index.ts#L473).
|
|
294
298
|
|
|
295
299
|
```ts
|
|
296
300
|
const messages = await agent.saveSteps(ctx, { threadId, userId, step });
|
|
@@ -6,7 +6,7 @@ import { z } from "zod";
|
|
|
6
6
|
import { Mounts } from "../component/_generated/api.js";
|
|
7
7
|
import { type VectorDimension } from "../component/vector/tables.js";
|
|
8
8
|
import { type AIMessageWithoutId } from "../mapping.js";
|
|
9
|
-
import { type CallSettings, type ProviderMetadata, type ProviderOptions, type SearchOptions } from "../validators.js";
|
|
9
|
+
import { type CallSettings, MessageWithMetadata, type ProviderMetadata, type ProviderOptions, type SearchOptions, Usage } from "../validators.js";
|
|
10
10
|
import type { OpaqueIds, RunActionCtx, RunMutationCtx, RunQueryCtx, UseApi } from "./types.js";
|
|
11
11
|
import schema from "../component/schema.js";
|
|
12
12
|
export type ThreadDoc = OpaqueIds<{
|
|
@@ -90,6 +90,14 @@ export type GenerationOutputMetadata = {
|
|
|
90
90
|
type CoreMessageMaybeWithId = CoreMessage & {
|
|
91
91
|
id?: string | undefined;
|
|
92
92
|
};
|
|
93
|
+
export type UsageHandler = (ctx: RunActionCtx, args: {
|
|
94
|
+
userId?: string;
|
|
95
|
+
threadId?: string;
|
|
96
|
+
usage: Usage;
|
|
97
|
+
providerMetadata?: ProviderMetadata;
|
|
98
|
+
model: string;
|
|
99
|
+
provider: string;
|
|
100
|
+
}) => Promise<void>;
|
|
93
101
|
export declare class Agent<AgentTools extends ToolSet> {
|
|
94
102
|
component: UseApi<Mounts>;
|
|
95
103
|
options: {
|
|
@@ -150,6 +158,10 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
150
158
|
* This can be overridden at each generate/stream callsite.
|
|
151
159
|
*/
|
|
152
160
|
maxRetries?: number;
|
|
161
|
+
/**
|
|
162
|
+
* The usage handler to use for this agent.
|
|
163
|
+
*/
|
|
164
|
+
usageHandler?: UsageHandler;
|
|
153
165
|
};
|
|
154
166
|
constructor(component: UseApi<Mounts>, options: {
|
|
155
167
|
/**
|
|
@@ -209,6 +221,10 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
209
221
|
* This can be overridden at each generate/stream callsite.
|
|
210
222
|
*/
|
|
211
223
|
maxRetries?: number;
|
|
224
|
+
/**
|
|
225
|
+
* The usage handler to use for this agent.
|
|
226
|
+
*/
|
|
227
|
+
usageHandler?: UsageHandler;
|
|
212
228
|
});
|
|
213
229
|
/**
|
|
214
230
|
* Start a new thread with the agent. This will have a fresh history, though if
|
|
@@ -320,12 +336,6 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
320
336
|
dimension: VectorDimension;
|
|
321
337
|
model: string;
|
|
322
338
|
} | undefined>;
|
|
323
|
-
/**
|
|
324
|
-
* Explicitly save messages associated with the thread (& user if provided)
|
|
325
|
-
* @param ctx The ctx parameter to a mutation or action.
|
|
326
|
-
* @param args The messages and context to save
|
|
327
|
-
* @returns
|
|
328
|
-
*/
|
|
329
339
|
/**
|
|
330
340
|
* Explicitly save messages associated with the thread (& user if provided)
|
|
331
341
|
* @param ctx The ctx parameter to a mutation or action.
|
|
@@ -337,17 +347,16 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
337
347
|
userId?: string;
|
|
338
348
|
messages: CoreMessageMaybeWithId[];
|
|
339
349
|
/**
|
|
340
|
-
*
|
|
341
|
-
*
|
|
350
|
+
* Metadata to save with the messages. Each element corresponds to the
|
|
351
|
+
* message at the same index.
|
|
342
352
|
*/
|
|
353
|
+
metadata?: Omit<MessageWithMetadata, "message">[];
|
|
343
354
|
/**
|
|
344
355
|
* If false, it will "commit" the messages immediately.
|
|
345
356
|
* If true, it will mark them as pending until the final step has finished.
|
|
357
|
+
* Defaults to false.
|
|
346
358
|
*/
|
|
347
359
|
pending?: boolean;
|
|
348
|
-
/**
|
|
349
|
-
* The message that this is responding to.
|
|
350
|
-
*/
|
|
351
360
|
/**
|
|
352
361
|
* The message that this is responding to.
|
|
353
362
|
*/
|
|
@@ -355,21 +364,13 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
355
364
|
/**
|
|
356
365
|
* Whether to mark all pending messages in the thread as failed.
|
|
357
366
|
* This is used to recover from a failure via a retry that wipes the slate clean.
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Whether to mark all pending messages in the thread as failed.
|
|
361
|
-
* This is used to recover from a failure via a retry that wipes the slate clean.
|
|
367
|
+
* Defaults to true.
|
|
362
368
|
*/
|
|
363
369
|
failPendingSteps?: boolean;
|
|
364
370
|
}): Promise<{
|
|
365
371
|
lastMessageId: string;
|
|
366
372
|
messageIds: string[];
|
|
367
373
|
}>;
|
|
368
|
-
/**
|
|
369
|
-
* Explicitly save a "step" created by the AI SDK.
|
|
370
|
-
* @param ctx The ctx argument to a mutation or action.
|
|
371
|
-
* @param args What to save
|
|
372
|
-
*/
|
|
373
374
|
/**
|
|
374
375
|
* Explicitly save a "step" created by the AI SDK.
|
|
375
376
|
* @param ctx The ctx argument to a mutation or action.
|
|
@@ -385,15 +386,17 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
385
386
|
* The step to save, possibly including multiple tool calls.
|
|
386
387
|
*/
|
|
387
388
|
step: StepResult<TOOLS>;
|
|
389
|
+
/**
|
|
390
|
+
* The model used to generate the step.
|
|
391
|
+
* Defaults to the chat model for the Agent.
|
|
392
|
+
*/
|
|
393
|
+
model?: string;
|
|
394
|
+
/**
|
|
395
|
+
* The provider of the model used to generate the step.
|
|
396
|
+
* Defaults to the chat provider for the Agent.
|
|
397
|
+
*/
|
|
398
|
+
provider?: string;
|
|
388
399
|
}): Promise<void>;
|
|
389
|
-
/**
|
|
390
|
-
* Commit or rollback a message that was pending.
|
|
391
|
-
* This is done automatically when saving messages by default.
|
|
392
|
-
* If creating pending messages, you can call this when the full "transaction" is done.
|
|
393
|
-
* @param ctx The ctx argument to your mutation or action.
|
|
394
|
-
* @param args What message to save. Generally the parent message sent into
|
|
395
|
-
* the generateText call.
|
|
396
|
-
*/
|
|
397
400
|
/**
|
|
398
401
|
* Commit or rollback a message that was pending.
|
|
399
402
|
* This is done automatically when saving messages by default.
|
|
@@ -445,10 +448,11 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
445
448
|
threadId?: string;
|
|
446
449
|
}, args: TextArgs<AgentTools, TOOLS, Parameters<typeof streamText<TOOLS, OUTPUT, PARTIAL_OUTPUT>>[0]>): Promise<StreamTextResult<TOOLS, PARTIAL_OUTPUT> & GenerationOutputMetadata>;
|
|
447
450
|
saveMessagesAndFetchContext<T extends {
|
|
451
|
+
id?: string;
|
|
448
452
|
prompt?: string;
|
|
449
453
|
messages?: CoreMessage[] | AIMessageWithoutId[];
|
|
450
454
|
system?: string;
|
|
451
|
-
}>(ctx: RunActionCtx | RunMutationCtx, { userId, threadId, parentMessageId, system, ...args }: {
|
|
455
|
+
}>(ctx: RunActionCtx | RunMutationCtx, { id, userId, threadId, parentMessageId, system, ...args }: {
|
|
452
456
|
userId: string | undefined;
|
|
453
457
|
threadId: string | undefined;
|
|
454
458
|
parentMessageId?: string;
|
|
@@ -486,7 +490,7 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
486
490
|
* for the {@link ContextOptions} and {@link StorageOptions}.
|
|
487
491
|
* @returns The result of the streamObject function.
|
|
488
492
|
*/
|
|
489
|
-
streamObject<T>(ctx:
|
|
493
|
+
streamObject<T>(ctx: RunActionCtx, { userId, threadId }: {
|
|
490
494
|
userId?: string;
|
|
491
495
|
threadId?: string;
|
|
492
496
|
}, args: OurStreamObjectArgs<T>): Promise<StreamObjectResult<DeepPartial<T>, T, never> & GenerationOutputMetadata>;
|
|
@@ -501,9 +505,36 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
501
505
|
threadId: string;
|
|
502
506
|
messageId: string;
|
|
503
507
|
result: GenerateObjectResult<unknown>;
|
|
508
|
+
metadata?: Omit<MessageWithMetadata, "message">;
|
|
504
509
|
}): Promise<void>;
|
|
505
510
|
mergedContextOptions(opts: ContextOptions): ContextOptions;
|
|
506
511
|
searchOptionsWithDefaults(contextOptions: ContextOptions, messages: CoreMessage[]): Promise<SearchOptions>;
|
|
512
|
+
/**
|
|
513
|
+
* Create a mutation that creates a thread so you can call it from a Workflow.
|
|
514
|
+
* e.g.
|
|
515
|
+
* ```ts
|
|
516
|
+
* // in convex/foo.ts
|
|
517
|
+
* export const createThread = weatherAgent.createThreadMutation();
|
|
518
|
+
*
|
|
519
|
+
* const workflow = new WorkflowManager(components.workflow);
|
|
520
|
+
* export const myWorkflow = workflow.define({
|
|
521
|
+
* args: {},
|
|
522
|
+
* handler: async (step) => {
|
|
523
|
+
* const { threadId } = await step.runMutation(internal.foo.createThread);
|
|
524
|
+
* // use the threadId to generate text, object, etc.
|
|
525
|
+
* },
|
|
526
|
+
* });
|
|
527
|
+
* ```
|
|
528
|
+
* @returns A mutation that creates a thread.
|
|
529
|
+
*/
|
|
530
|
+
createThreadMutation(): import("convex/server").RegisteredMutation<"internal", {
|
|
531
|
+
userId?: string | undefined;
|
|
532
|
+
title?: string | undefined;
|
|
533
|
+
summary?: string | undefined;
|
|
534
|
+
parentThreadIds?: string[] | undefined;
|
|
535
|
+
}, Promise<{
|
|
536
|
+
threadId: string;
|
|
537
|
+
}>>;
|
|
507
538
|
/**
|
|
508
539
|
* Create an action out of this agent so you can call it from workflows or other actions
|
|
509
540
|
* without a wrapping function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,SAAS,EACT,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,IAAI,EACJ,UAAU,EACV,oBAAoB,EACpB,OAAO,EACR,MAAM,IAAI,CAAC;AACZ,OAAO,EACL,cAAc,EACd,YAAY,EAEZ,YAAY,EACZ,UAAU,EAEX,MAAM,IAAI,CAAC;AAGZ,OAAO,EAAE,KAAK,EAAK,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,kBAAkB,EAOxB,MAAM,eAAe,CAAC;AAMvB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,aAAa,EAGnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EACZ,cAAc,EACd,WAAW,EACX,MAAM,EACP,MAAM,YAAY,CAAC;AACpB,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAE5C,MAAM,MAAM,SAAS,GAAG,SAAS,CAC/B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,KAA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AG,KAAK,EAAE,cAAc,GAAG,KAAK,EACxE,IAAI,EAAE,QAAQ,CACZ,UAAU,EACV,KAAK,EACL,UAAU,CAAC,OAAO,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAClE,GACA,OAAO,CACR,kBAAkB,CAAC,KAAK,GAAG,UAAU,EAAE,MAAM,CAAC,GAAG,oBAAoB,CACtE,CAAC;IAEF;;;;;;;;;OASG;IACH,UAAU,CAAC,KAAK,SAAS,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,cAAc,GAAG,KAAK,EACtE,IAAI,EAAE,QAAQ,CACZ,UAAU,EACV,KAAK,EACL,UAAU,CAAC,OAAO,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAChE,GACA,OAAO,CACR,gBAAgB,CAAC,KAAK,GAAG,UAAU,EAAE,cAAc,CAAC,GAAG,oBAAoB,CAC5E,CAAC;IACF;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EACd,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC;IAC3D;;;;;;;;;OASG;IACH,cAAc,CACZ,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,oBAAoB,CAAC,CAAC;IACnE;;;;;;;;;OASG;IACH,YAAY,CAAC,CAAC,EACZ,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC3B,OAAO,CACR,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,oBAAoB,CACpE,CAAC;CACH"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { generateObject, generateText, streamObject, streamText, tool, } from "ai";
|
|
2
2
|
import { assert } from "convex-helpers";
|
|
3
|
-
import { internalActionGeneric } from "convex/server";
|
|
3
|
+
import { internalActionGeneric, internalMutationGeneric } from "convex/server";
|
|
4
|
+
import { v } from "convex/values";
|
|
4
5
|
import { validateVectorDimension, } from "../component/vector/tables.js";
|
|
5
|
-
import { deserializeMessage, promptOrMessagesToCoreMessages,
|
|
6
|
-
import { DEFAULT_MESSAGE_RANGE, DEFAULT_RECENT_MESSAGES, extractText, } from "../shared.js";
|
|
6
|
+
import { deserializeMessage, promptOrMessagesToCoreMessages, serializeMessage, serializeNewMessagesInStep, serializeObjectResult, serializeStep, } from "../mapping.js";
|
|
7
|
+
import { DEFAULT_MESSAGE_RANGE, DEFAULT_RECENT_MESSAGES, extractText, isTool, } from "../shared.js";
|
|
7
8
|
import { vSafeObjectArgs, vTextArgs, } from "../validators.js";
|
|
8
9
|
export class Agent {
|
|
9
10
|
component;
|
|
@@ -119,7 +120,7 @@ export class Agent {
|
|
|
119
120
|
async getEmbeddings(messages) {
|
|
120
121
|
let embeddings;
|
|
121
122
|
if (this.options.textEmbedding) {
|
|
122
|
-
const messageTexts = messages.map((m) => extractText(m));
|
|
123
|
+
const messageTexts = messages.map((m) => !isTool(m) && extractText(m));
|
|
123
124
|
// Find the indexes of the messages that have text.
|
|
124
125
|
const textIndexes = messageTexts
|
|
125
126
|
.map((t, i) => (t ? i : undefined))
|
|
@@ -131,6 +132,7 @@ export class Agent {
|
|
|
131
132
|
const textEmbeddings = await this.options.textEmbedding.doEmbed({
|
|
132
133
|
values: messageTexts.filter((t) => !!t),
|
|
133
134
|
});
|
|
135
|
+
// TODO: record usage of embeddings
|
|
134
136
|
// Then assemble the embeddings into a single array with nulls for the messages without text.
|
|
135
137
|
const embeddingsOrNull = Array(messages.length).fill(null);
|
|
136
138
|
textIndexes.forEach((i, j) => {
|
|
@@ -148,12 +150,6 @@ export class Agent {
|
|
|
148
150
|
}
|
|
149
151
|
return embeddings;
|
|
150
152
|
}
|
|
151
|
-
/**
|
|
152
|
-
* Explicitly save messages associated with the thread (& user if provided)
|
|
153
|
-
* @param ctx The ctx parameter to a mutation or action.
|
|
154
|
-
* @param args The messages and context to save
|
|
155
|
-
* @returns
|
|
156
|
-
*/
|
|
157
153
|
/**
|
|
158
154
|
* Explicitly save messages associated with the thread (& user if provided)
|
|
159
155
|
* @param ctx The ctx parameter to a mutation or action.
|
|
@@ -161,13 +157,20 @@ export class Agent {
|
|
|
161
157
|
* @returns
|
|
162
158
|
*/
|
|
163
159
|
async saveMessages(ctx, args) {
|
|
160
|
+
const embeddings = await this.getEmbeddings(args.messages);
|
|
164
161
|
const result = await ctx.runMutation(this.component.messages.addMessages, {
|
|
165
162
|
threadId: args.threadId,
|
|
166
163
|
userId: args.userId,
|
|
167
164
|
agentName: this.options.name,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
messages: args.messages.map((m, i) => ({
|
|
166
|
+
embedding: embeddings?.vectors[i] && {
|
|
167
|
+
model: embeddings.model,
|
|
168
|
+
dimension: embeddings.dimension,
|
|
169
|
+
vector: embeddings.vectors[i],
|
|
170
|
+
},
|
|
171
|
+
...args.metadata?.[i],
|
|
172
|
+
message: serializeMessage(m),
|
|
173
|
+
})),
|
|
171
174
|
failPendingSteps: args.failPendingSteps ?? true,
|
|
172
175
|
pending: args.pending ?? false,
|
|
173
176
|
parentMessageId: args.parentMessageId,
|
|
@@ -177,11 +180,6 @@ export class Agent {
|
|
|
177
180
|
messageIds: result.messages.map((m) => m._id),
|
|
178
181
|
};
|
|
179
182
|
}
|
|
180
|
-
/**
|
|
181
|
-
* Explicitly save a "step" created by the AI SDK.
|
|
182
|
-
* @param ctx The ctx argument to a mutation or action.
|
|
183
|
-
* @param args What to save
|
|
184
|
-
*/
|
|
185
183
|
/**
|
|
186
184
|
* Explicitly save a "step" created by the AI SDK.
|
|
187
185
|
* @param ctx The ctx argument to a mutation or action.
|
|
@@ -189,23 +187,27 @@ export class Agent {
|
|
|
189
187
|
*/
|
|
190
188
|
async saveStep(ctx, args) {
|
|
191
189
|
const step = serializeStep(args.step);
|
|
192
|
-
const messages = serializeNewMessagesInStep(args.step
|
|
190
|
+
const messages = serializeNewMessagesInStep(args.step, {
|
|
191
|
+
provider: args.provider ?? this.options.chat.provider,
|
|
192
|
+
model: args.model ?? this.options.chat.modelId,
|
|
193
|
+
});
|
|
194
|
+
const embeddings = await this.getEmbeddings(messages.map((m) => m.message));
|
|
195
|
+
if (embeddings) {
|
|
196
|
+
const { model, dimension, vectors } = embeddings;
|
|
197
|
+
for (let i = 0; i < messages.length; i++) {
|
|
198
|
+
const vector = vectors[i];
|
|
199
|
+
if (vector) {
|
|
200
|
+
messages[i].embedding = { model, dimension, vector };
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
193
204
|
await ctx.runMutation(this.component.messages.addStep, {
|
|
194
205
|
threadId: args.threadId,
|
|
195
206
|
messageId: args.messageId,
|
|
196
207
|
step: { step, messages },
|
|
197
208
|
failPendingSteps: false,
|
|
198
|
-
embeddings: await this.getEmbeddings(messages.map((m) => m.message)),
|
|
199
209
|
});
|
|
200
210
|
}
|
|
201
|
-
/**
|
|
202
|
-
* Commit or rollback a message that was pending.
|
|
203
|
-
* This is done automatically when saving messages by default.
|
|
204
|
-
* If creating pending messages, you can call this when the full "transaction" is done.
|
|
205
|
-
* @param ctx The ctx argument to your mutation or action.
|
|
206
|
-
* @param args What message to save. Generally the parent message sent into
|
|
207
|
-
* the generateText call.
|
|
208
|
-
*/
|
|
209
211
|
/**
|
|
210
212
|
* Commit or rollback a message that was pending.
|
|
211
213
|
* This is done automatically when saving messages by default.
|
|
@@ -246,13 +248,14 @@ export class Agent {
|
|
|
246
248
|
const tools = wrapTools(toolCtx, this.options.tools, args.tools);
|
|
247
249
|
const saveOutputMessages = args.saveOutputMessages ??
|
|
248
250
|
this.options.storageOptions?.saveOutputMessages;
|
|
251
|
+
const model = aiArgs.model ?? this.options.chat;
|
|
249
252
|
try {
|
|
250
253
|
const result = (await generateText({
|
|
251
254
|
// Can be overridden
|
|
252
|
-
model: this.options.chat,
|
|
253
255
|
maxSteps: this.options.maxSteps,
|
|
254
256
|
maxRetries: this.options.maxRetries,
|
|
255
257
|
...aiArgs,
|
|
258
|
+
model,
|
|
256
259
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
257
260
|
toolChoice: args.toolChoice,
|
|
258
261
|
tools,
|
|
@@ -264,6 +267,16 @@ export class Agent {
|
|
|
264
267
|
step,
|
|
265
268
|
});
|
|
266
269
|
}
|
|
270
|
+
if (this.options.usageHandler && step.usage) {
|
|
271
|
+
await this.options.usageHandler(ctx, {
|
|
272
|
+
userId,
|
|
273
|
+
threadId,
|
|
274
|
+
model: model.modelId,
|
|
275
|
+
provider: model.provider,
|
|
276
|
+
usage: step.usage,
|
|
277
|
+
providerMetadata: step.providerMetadata,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
267
280
|
return args.onStepFinish?.(step);
|
|
268
281
|
},
|
|
269
282
|
}));
|
|
@@ -299,12 +312,13 @@ export class Agent {
|
|
|
299
312
|
const tools = wrapTools(toolCtx, this.options.tools, args.tools);
|
|
300
313
|
const saveOutputMessages = args.saveOutputMessages ??
|
|
301
314
|
this.options.storageOptions?.saveOutputMessages;
|
|
315
|
+
const model = aiArgs.model ?? this.options.chat;
|
|
302
316
|
const result = streamText({
|
|
303
317
|
// Can be overridden
|
|
304
|
-
model: this.options.chat,
|
|
305
318
|
maxSteps: this.options.maxSteps,
|
|
306
319
|
maxRetries: this.options.maxRetries,
|
|
307
320
|
...aiArgs,
|
|
321
|
+
model,
|
|
308
322
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
309
323
|
toolChoice: args.toolChoice,
|
|
310
324
|
tools,
|
|
@@ -332,13 +346,23 @@ export class Agent {
|
|
|
332
346
|
step,
|
|
333
347
|
});
|
|
334
348
|
}
|
|
349
|
+
if (this.options.usageHandler && step.usage) {
|
|
350
|
+
await this.options.usageHandler(ctx, {
|
|
351
|
+
userId,
|
|
352
|
+
threadId,
|
|
353
|
+
model: model.modelId,
|
|
354
|
+
provider: model.provider,
|
|
355
|
+
usage: step.usage,
|
|
356
|
+
providerMetadata: step.providerMetadata,
|
|
357
|
+
});
|
|
358
|
+
}
|
|
335
359
|
return args.onStepFinish?.(step);
|
|
336
360
|
},
|
|
337
361
|
});
|
|
338
362
|
result.messageId = messageId;
|
|
339
363
|
return result;
|
|
340
364
|
}
|
|
341
|
-
async saveMessagesAndFetchContext(ctx, { userId, threadId, parentMessageId, system, ...args }) {
|
|
365
|
+
async saveMessagesAndFetchContext(ctx, { id, userId, threadId, parentMessageId, system, ...args }) {
|
|
342
366
|
const saveAny = args.saveAnyInputMessages ??
|
|
343
367
|
this.options.storageOptions?.saveAnyInputMessages;
|
|
344
368
|
const saveAll = args.saveAllInputMessages ??
|
|
@@ -353,10 +377,12 @@ export class Agent {
|
|
|
353
377
|
});
|
|
354
378
|
let messageId;
|
|
355
379
|
if (threadId && saveAny !== false) {
|
|
380
|
+
const coreMessages = saveAll ? messages : messages.slice(-1);
|
|
356
381
|
const saved = await this.saveMessages(ctx, {
|
|
357
382
|
threadId,
|
|
358
383
|
userId,
|
|
359
|
-
messages:
|
|
384
|
+
messages: coreMessages,
|
|
385
|
+
metadata: coreMessages.length === 1 ? [{ id }] : undefined,
|
|
360
386
|
pending: true,
|
|
361
387
|
// We should just fail if you pass in an ID for the message, fail those children
|
|
362
388
|
// failPendingSteps: true,
|
|
@@ -388,20 +414,31 @@ export class Agent {
|
|
|
388
414
|
*/
|
|
389
415
|
async generateObject(ctx, { userId, threadId }, args) {
|
|
390
416
|
const { args: aiArgs, messageId } = await this.saveMessagesAndFetchContext(ctx, { ...args, userId, threadId });
|
|
417
|
+
const model = aiArgs.model ?? this.options.chat;
|
|
391
418
|
const saveOutputMessages = args.saveOutputMessages ??
|
|
392
419
|
this.options.storageOptions?.saveOutputMessages;
|
|
393
420
|
try {
|
|
394
421
|
const result = (await generateObject({
|
|
395
422
|
// Can be overridden
|
|
396
|
-
model: this.options.chat,
|
|
397
423
|
maxRetries: this.options.maxRetries,
|
|
398
424
|
...aiArgs,
|
|
425
|
+
model,
|
|
399
426
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
400
427
|
}));
|
|
401
428
|
if (threadId && messageId && saveOutputMessages !== false) {
|
|
402
429
|
await this.saveObject(ctx, { threadId, messageId, result });
|
|
403
430
|
}
|
|
404
431
|
result.messageId = messageId;
|
|
432
|
+
if (this.options.usageHandler && result.usage) {
|
|
433
|
+
await this.options.usageHandler(ctx, {
|
|
434
|
+
userId,
|
|
435
|
+
threadId,
|
|
436
|
+
model: model.modelId,
|
|
437
|
+
provider: model.provider,
|
|
438
|
+
usage: result.usage,
|
|
439
|
+
providerMetadata: result.providerMetadata,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
405
442
|
return result;
|
|
406
443
|
}
|
|
407
444
|
catch (error) {
|
|
@@ -429,14 +466,15 @@ export class Agent {
|
|
|
429
466
|
async streamObject(ctx, { userId, threadId }, args) {
|
|
430
467
|
// TODO: unify all this shared code between all the generate* and stream* functions
|
|
431
468
|
const { args: aiArgs, messageId } = await this.saveMessagesAndFetchContext(ctx, { ...args, userId, threadId });
|
|
469
|
+
const model = aiArgs.model ?? this.options.chat;
|
|
432
470
|
const saveOutputMessages = args.saveOutputMessages ??
|
|
433
471
|
this.options.storageOptions?.saveOutputMessages;
|
|
434
472
|
const stream = streamObject({
|
|
435
473
|
// Can be overridden
|
|
436
|
-
model: this.options.chat,
|
|
437
474
|
maxRetries: this.options.maxRetries,
|
|
438
475
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
439
476
|
...aiArgs,
|
|
477
|
+
model,
|
|
440
478
|
onError: async (error) => {
|
|
441
479
|
console.error("onError", error);
|
|
442
480
|
return args.onError?.(error);
|
|
@@ -460,6 +498,16 @@ export class Agent {
|
|
|
460
498
|
},
|
|
461
499
|
});
|
|
462
500
|
}
|
|
501
|
+
if (this.options.usageHandler && result.usage) {
|
|
502
|
+
await this.options.usageHandler(ctx, {
|
|
503
|
+
userId,
|
|
504
|
+
threadId,
|
|
505
|
+
model: model.modelId,
|
|
506
|
+
provider: model.provider,
|
|
507
|
+
usage: result.usage,
|
|
508
|
+
providerMetadata: result.providerMetadata,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
463
511
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
464
512
|
return args.onFinish?.(result);
|
|
465
513
|
},
|
|
@@ -475,13 +523,28 @@ export class Agent {
|
|
|
475
523
|
* @param args The arguments to the saveObject function.
|
|
476
524
|
*/
|
|
477
525
|
async saveObject(ctx, args) {
|
|
478
|
-
const step = serializeObjectResult(args.result
|
|
526
|
+
const { step, messages: withoutEmbed } = serializeObjectResult(args.result, {
|
|
527
|
+
model: this.options.chat.modelId,
|
|
528
|
+
provider: this.options.chat.provider,
|
|
529
|
+
});
|
|
530
|
+
const embeddings = await this.getEmbeddings([withoutEmbed[0].message]);
|
|
531
|
+
const messages = embeddings?.vectors[0]
|
|
532
|
+
? [
|
|
533
|
+
{
|
|
534
|
+
...withoutEmbed[0],
|
|
535
|
+
embedding: {
|
|
536
|
+
dimension: embeddings.dimension,
|
|
537
|
+
model: embeddings.model,
|
|
538
|
+
vector: embeddings.vectors[0],
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
]
|
|
542
|
+
: withoutEmbed;
|
|
479
543
|
await ctx.runMutation(this.component.messages.addStep, {
|
|
480
544
|
threadId: args.threadId,
|
|
481
545
|
messageId: args.messageId,
|
|
482
546
|
failPendingSteps: false,
|
|
483
|
-
|
|
484
|
-
step,
|
|
547
|
+
step: { step, messages },
|
|
485
548
|
});
|
|
486
549
|
}
|
|
487
550
|
mergedContextOptions(opts) {
|
|
@@ -516,10 +579,43 @@ export class Agent {
|
|
|
516
579
|
search.vector = (await this.options.textEmbedding.doEmbed({
|
|
517
580
|
values: [text],
|
|
518
581
|
})).embeddings[0];
|
|
582
|
+
// TODO: record usage of embeddings
|
|
519
583
|
search.vectorModel = this.options.textEmbedding.modelId;
|
|
520
584
|
}
|
|
521
585
|
return search;
|
|
522
586
|
}
|
|
587
|
+
/**
|
|
588
|
+
* Create a mutation that creates a thread so you can call it from a Workflow.
|
|
589
|
+
* e.g.
|
|
590
|
+
* ```ts
|
|
591
|
+
* // in convex/foo.ts
|
|
592
|
+
* export const createThread = weatherAgent.createThreadMutation();
|
|
593
|
+
*
|
|
594
|
+
* const workflow = new WorkflowManager(components.workflow);
|
|
595
|
+
* export const myWorkflow = workflow.define({
|
|
596
|
+
* args: {},
|
|
597
|
+
* handler: async (step) => {
|
|
598
|
+
* const { threadId } = await step.runMutation(internal.foo.createThread);
|
|
599
|
+
* // use the threadId to generate text, object, etc.
|
|
600
|
+
* },
|
|
601
|
+
* });
|
|
602
|
+
* ```
|
|
603
|
+
* @returns A mutation that creates a thread.
|
|
604
|
+
*/
|
|
605
|
+
createThreadMutation() {
|
|
606
|
+
return internalMutationGeneric({
|
|
607
|
+
args: {
|
|
608
|
+
userId: v.optional(v.string()),
|
|
609
|
+
parentThreadIds: v.optional(v.array(v.string())),
|
|
610
|
+
title: v.optional(v.string()),
|
|
611
|
+
summary: v.optional(v.string()),
|
|
612
|
+
},
|
|
613
|
+
handler: async (ctx, args) => {
|
|
614
|
+
const { threadId } = await this.createThread(ctx, args);
|
|
615
|
+
return { threadId };
|
|
616
|
+
},
|
|
617
|
+
});
|
|
618
|
+
}
|
|
523
619
|
/**
|
|
524
620
|
* Create an action out of this agent so you can call it from workflows or other actions
|
|
525
621
|
* without a wrapping function.
|