@convex-dev/agent 0.0.15-alpha.1 → 0.0.16
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 +24 -0
- package/dist/commonjs/client/index.d.ts +225 -53
- package/dist/commonjs/client/index.d.ts.map +1 -1
- package/dist/commonjs/client/index.js +75 -31
- package/dist/commonjs/client/index.js.map +1 -1
- package/dist/commonjs/component/messages.d.ts +5 -6
- package/dist/commonjs/component/messages.d.ts.map +1 -1
- package/dist/commonjs/component/messages.js +1 -6
- package/dist/commonjs/component/messages.js.map +1 -1
- package/dist/commonjs/component/schema.d.ts +10 -10
- package/dist/commonjs/component/schema.d.ts.map +1 -1
- package/dist/commonjs/component/schema.js +1 -2
- package/dist/commonjs/component/schema.js.map +1 -1
- package/dist/esm/client/index.d.ts +225 -53
- package/dist/esm/client/index.d.ts.map +1 -1
- package/dist/esm/client/index.js +75 -31
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/component/messages.d.ts +5 -6
- package/dist/esm/component/messages.d.ts.map +1 -1
- package/dist/esm/component/messages.js +1 -6
- package/dist/esm/component/messages.js.map +1 -1
- package/dist/esm/component/schema.d.ts +10 -10
- package/dist/esm/component/schema.d.ts.map +1 -1
- package/dist/esm/component/schema.js +1 -2
- package/dist/esm/component/schema.js.map +1 -1
- package/package.json +3 -2
- package/src/client/index.test.ts +68 -0
- package/src/client/index.ts +141 -86
- package/src/component/_generated/api.d.ts +0 -1
- package/src/component/messages.ts +1 -8
- package/src/component/schema.ts +1 -2
|
@@ -226,21 +226,21 @@ export declare const schema: import("convex/server").SchemaDefinition<{
|
|
|
226
226
|
}>;
|
|
227
227
|
threads: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
228
228
|
userId?: string | undefined;
|
|
229
|
-
defaultSystemPrompt?: string | undefined;
|
|
230
229
|
title?: string | undefined;
|
|
231
230
|
summary?: string | undefined;
|
|
231
|
+
defaultSystemPrompt?: string | undefined;
|
|
232
232
|
parentThreadIds?: import("convex/values").GenericId<"threads">[] | undefined;
|
|
233
233
|
order?: number | undefined;
|
|
234
234
|
status: "active" | "archived";
|
|
235
235
|
}, {
|
|
236
236
|
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
237
|
-
defaultSystemPrompt: import("convex/values").VString<string | undefined, "optional">;
|
|
238
237
|
title: import("convex/values").VString<string | undefined, "optional">;
|
|
239
238
|
summary: import("convex/values").VString<string | undefined, "optional">;
|
|
240
239
|
status: import("convex/values").VUnion<"active" | "archived", [import("convex/values").VLiteral<"active", "required">, import("convex/values").VLiteral<"archived", "required">], "required", never>;
|
|
240
|
+
defaultSystemPrompt: import("convex/values").VString<string | undefined, "optional">;
|
|
241
241
|
parentThreadIds: import("convex/values").VArray<import("convex/values").GenericId<"threads">[] | undefined, import("convex/values").VId<import("convex/values").GenericId<"threads">, "required">, "optional">;
|
|
242
242
|
order: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
243
|
-
}, "required", "status" | "userId" | "
|
|
243
|
+
}, "required", "status" | "userId" | "title" | "summary" | "defaultSystemPrompt" | "parentThreadIds" | "order">, {
|
|
244
244
|
userId: ["userId", "_creationTime"];
|
|
245
245
|
}, {}, {}>;
|
|
246
246
|
messages: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
@@ -2281,14 +2281,14 @@ export declare const vv: {
|
|
|
2281
2281
|
_id: import("convex/values").GenericId<"threads">;
|
|
2282
2282
|
_creationTime: number;
|
|
2283
2283
|
userId?: string | undefined;
|
|
2284
|
-
defaultSystemPrompt?: string | undefined;
|
|
2285
2284
|
title?: string | undefined;
|
|
2286
2285
|
summary?: string | undefined;
|
|
2286
|
+
defaultSystemPrompt?: string | undefined;
|
|
2287
2287
|
parentThreadIds?: import("convex/values").GenericId<"threads">[] | undefined;
|
|
2288
2288
|
order?: number | undefined;
|
|
2289
2289
|
status: "active" | "archived";
|
|
2290
2290
|
};
|
|
2291
|
-
fieldPaths: ("status" | "userId" | "
|
|
2291
|
+
fieldPaths: ("status" | "userId" | "title" | "summary" | "defaultSystemPrompt" | "parentThreadIds" | "order" | "_creationTime") | "_id";
|
|
2292
2292
|
indexes: {
|
|
2293
2293
|
userId: ["userId", "_creationTime"];
|
|
2294
2294
|
by_id: ["_id"];
|
|
@@ -2915,14 +2915,14 @@ export declare const vv: {
|
|
|
2915
2915
|
_id: import("convex/values").GenericId<"threads">;
|
|
2916
2916
|
_creationTime: number;
|
|
2917
2917
|
userId?: string | undefined;
|
|
2918
|
-
defaultSystemPrompt?: string | undefined;
|
|
2919
2918
|
title?: string | undefined;
|
|
2920
2919
|
summary?: string | undefined;
|
|
2920
|
+
defaultSystemPrompt?: string | undefined;
|
|
2921
2921
|
parentThreadIds?: import("convex/values").GenericId<"threads">[] | undefined;
|
|
2922
2922
|
order?: number | undefined;
|
|
2923
2923
|
status: "active" | "archived";
|
|
2924
2924
|
};
|
|
2925
|
-
fieldPaths: ("status" | "userId" | "
|
|
2925
|
+
fieldPaths: ("status" | "userId" | "title" | "summary" | "defaultSystemPrompt" | "parentThreadIds" | "order" | "_creationTime") | "_id";
|
|
2926
2926
|
indexes: {
|
|
2927
2927
|
userId: ["userId", "_creationTime"];
|
|
2928
2928
|
by_id: ["_id"];
|
|
@@ -3770,21 +3770,21 @@ export declare const vv: {
|
|
|
3770
3770
|
}>;
|
|
3771
3771
|
threads: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
3772
3772
|
userId?: string | undefined;
|
|
3773
|
-
defaultSystemPrompt?: string | undefined;
|
|
3774
3773
|
title?: string | undefined;
|
|
3775
3774
|
summary?: string | undefined;
|
|
3775
|
+
defaultSystemPrompt?: string | undefined;
|
|
3776
3776
|
parentThreadIds?: import("convex/values").GenericId<"threads">[] | undefined;
|
|
3777
3777
|
order?: number | undefined;
|
|
3778
3778
|
status: "active" | "archived";
|
|
3779
3779
|
}, {
|
|
3780
3780
|
userId: import("convex/values").VString<string | undefined, "optional">;
|
|
3781
|
-
defaultSystemPrompt: import("convex/values").VString<string | undefined, "optional">;
|
|
3782
3781
|
title: import("convex/values").VString<string | undefined, "optional">;
|
|
3783
3782
|
summary: import("convex/values").VString<string | undefined, "optional">;
|
|
3784
3783
|
status: import("convex/values").VUnion<"active" | "archived", [import("convex/values").VLiteral<"active", "required">, import("convex/values").VLiteral<"archived", "required">], "required", never>;
|
|
3784
|
+
defaultSystemPrompt: import("convex/values").VString<string | undefined, "optional">;
|
|
3785
3785
|
parentThreadIds: import("convex/values").VArray<import("convex/values").GenericId<"threads">[] | undefined, import("convex/values").VId<import("convex/values").GenericId<"threads">, "required">, "optional">;
|
|
3786
3786
|
order: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
3787
|
-
}, "required", "status" | "userId" | "
|
|
3787
|
+
}, "required", "status" | "userId" | "title" | "summary" | "defaultSystemPrompt" | "parentThreadIds" | "order">, {
|
|
3788
3788
|
userId: ["userId", "_creationTime"];
|
|
3789
3789
|
}, {}, {}>;
|
|
3790
3790
|
messages: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/schema.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gMAIg+K,eAAgB,qEAAqE,CAAC,mJAAkJ,aAAc,+MAA+M,eAAe;;mFAA0W,GAAG,gDAAwB,WAAW,2BAA0B,WAAY;;;CAJz1M,CAAC;AACjC,OAAO,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;AAEnB,eAAe,MAAM,CAAC"}
|
|
@@ -6,12 +6,11 @@ import vectorTables, { vVectorId } from "./vector/tables.js";
|
|
|
6
6
|
export const schema = defineSchema({
|
|
7
7
|
threads: defineTable({
|
|
8
8
|
userId: v.optional(v.string()), // Unset for anonymous
|
|
9
|
-
// TODO: is this bubbling up in continue?
|
|
10
|
-
defaultSystemPrompt: v.optional(v.string()),
|
|
11
9
|
title: v.optional(v.string()),
|
|
12
10
|
summary: v.optional(v.string()),
|
|
13
11
|
status: vThreadStatus,
|
|
14
12
|
// DEPRECATED
|
|
13
|
+
defaultSystemPrompt: v.optional(v.string()),
|
|
15
14
|
parentThreadIds: v.optional(v.array(v.id("threads"))),
|
|
16
15
|
order: /*DEPRECATED*/ v.optional(v.number()),
|
|
17
16
|
}).index("userId", ["userId"]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EACL,aAAa,EACb,QAAQ,EACR,cAAc,EACd,KAAK,EACL,MAAM,EACN,OAAO,EACP,2BAA2B,EAC3B,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE7D,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC;IACjC,OAAO,EAAE,WAAW,CAAC;QACnB,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,sBAAsB;QACtD,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EACL,aAAa,EACb,QAAQ,EACR,cAAc,EACd,KAAK,EACL,MAAM,EACN,OAAO,EACP,2BAA2B,EAC3B,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;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EAAE,CAAC;QAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;KACnC,CAAC;SACC,KAAK,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,CAAC;SAC/B,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;SAC3B,KAAK,CAAC,aAAa,EAAE,CAAC,aAAa,CAAC,CAAC;IAExC,KAAK,EAAE,WAAW,CAAC;QACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;KACrB,CAAC;SACC,KAAK,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;SACvB,KAAK,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,CAAC;IAClC,GAAG,YAAY;CAChB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AACjC,OAAO,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;AAEnB,eAAe,MAAM,CAAC"}
|
|
@@ -3,7 +3,7 @@ import type { CoreMessage, DeepPartial, GenerateObjectResult, GenerateTextResult
|
|
|
3
3
|
import { generateObject, generateText, streamObject, streamText } from "ai";
|
|
4
4
|
import { Infer } from "convex/values";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import {
|
|
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
9
|
import { type CallSettings, MessageWithMetadata, type ProviderMetadata, type ProviderOptions, type SearchOptions, type Usage } from "../validators.js";
|
|
@@ -102,7 +102,7 @@ export type UsageHandler = (ctx: RunActionCtx, args: {
|
|
|
102
102
|
provider: string;
|
|
103
103
|
}) => void | Promise<void>;
|
|
104
104
|
export declare class Agent<AgentTools extends ToolSet> {
|
|
105
|
-
component: UseApi<
|
|
105
|
+
component: UseApi<Mounts>;
|
|
106
106
|
options: {
|
|
107
107
|
/**
|
|
108
108
|
* The name for the agent. This will be attributed on each message
|
|
@@ -166,7 +166,7 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
166
166
|
*/
|
|
167
167
|
usageHandler?: UsageHandler;
|
|
168
168
|
};
|
|
169
|
-
constructor(component: UseApi<
|
|
169
|
+
constructor(component: UseApi<Mounts>, options: {
|
|
170
170
|
/**
|
|
171
171
|
* The name for the agent. This will be attributed on each message
|
|
172
172
|
* created by this agent.
|
|
@@ -463,7 +463,7 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
463
463
|
* The tools to use for this thread. Overrides any tools passed in the agent constructor.
|
|
464
464
|
*/
|
|
465
465
|
tools?: ToolSet;
|
|
466
|
-
}, args: TextArgs<AgentTools, TOOLS, OUTPUT, OUTPUT_PARTIAL
|
|
466
|
+
}, args: TextArgs<AgentTools, TOOLS, OUTPUT, OUTPUT_PARTIAL>, options?: Options): Promise<GenerateTextResult<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT> & GenerationOutputMetadata>;
|
|
467
467
|
/**
|
|
468
468
|
* This behaves like {@link streamText} from the "ai" package except that
|
|
469
469
|
* it add context based on the userId and threadId and saves the input and
|
|
@@ -486,19 +486,16 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
486
486
|
threadId?: string;
|
|
487
487
|
usageHandler?: UsageHandler;
|
|
488
488
|
tools?: ToolSet;
|
|
489
|
-
}, args: StreamingTextArgs<AgentTools, TOOLS, OUTPUT, PARTIAL_OUTPUT
|
|
489
|
+
}, args: StreamingTextArgs<AgentTools, TOOLS, OUTPUT, PARTIAL_OUTPUT>, options?: Options): Promise<StreamTextResult<TOOLS extends undefined ? AgentTools : TOOLS, PARTIAL_OUTPUT> & GenerationOutputMetadata>;
|
|
490
490
|
saveMessagesAndFetchContext<T extends {
|
|
491
491
|
id?: string;
|
|
492
492
|
prompt?: string;
|
|
493
493
|
messages?: CoreMessage[] | AIMessageWithoutId[];
|
|
494
494
|
system?: string;
|
|
495
|
-
}>(ctx: RunActionCtx | RunMutationCtx,
|
|
495
|
+
}>(ctx: RunActionCtx | RunMutationCtx, args: T, { userId, threadId, parentMessageId, contextOptions, storageOptions, }: {
|
|
496
496
|
userId: string | undefined;
|
|
497
497
|
threadId: string | undefined;
|
|
498
|
-
|
|
499
|
-
contextOptions?: ContextOptions;
|
|
500
|
-
storageOptions?: StorageOptions;
|
|
501
|
-
} & T): Promise<{
|
|
498
|
+
} & Options): Promise<{
|
|
502
499
|
args: T;
|
|
503
500
|
messageId: string | undefined;
|
|
504
501
|
}>;
|
|
@@ -518,7 +515,7 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
518
515
|
userId?: string;
|
|
519
516
|
threadId?: string;
|
|
520
517
|
usageHandler?: UsageHandler;
|
|
521
|
-
}, args: OurObjectArgs<T
|
|
518
|
+
}, args: OurObjectArgs<T>, options?: Options): Promise<GenerateObjectResult<T> & GenerationOutputMetadata>;
|
|
522
519
|
/**
|
|
523
520
|
* This behaves like {@link streamObject} from the "ai" package except that
|
|
524
521
|
* it add context based on the userId and threadId and saves the input and
|
|
@@ -535,7 +532,7 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
535
532
|
userId?: string;
|
|
536
533
|
threadId?: string;
|
|
537
534
|
usageHandler?: UsageHandler;
|
|
538
|
-
}, args: OurStreamObjectArgs<T
|
|
535
|
+
}, args: OurStreamObjectArgs<T>, options?: Options): Promise<StreamObjectResult<DeepPartial<T>, T, never> & GenerationOutputMetadata>;
|
|
539
536
|
/**
|
|
540
537
|
* Manually save the result of a generateObject call to the thread.
|
|
541
538
|
* This happens automatically when using {@link generateObject} or {@link streamObject}
|
|
@@ -586,6 +583,7 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
586
583
|
asTextAction(spec?: {
|
|
587
584
|
contextOptions?: ContextOptions;
|
|
588
585
|
maxSteps?: number;
|
|
586
|
+
storageOptions?: StorageOptions;
|
|
589
587
|
}): import("convex/server").RegisteredAction<"internal", {
|
|
590
588
|
userId?: string | undefined;
|
|
591
589
|
threadId?: string | undefined;
|
|
@@ -720,6 +718,9 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
720
718
|
*/
|
|
721
719
|
asObjectAction<T>(spec: OurObjectArgs<T> & {
|
|
722
720
|
maxSteps?: number;
|
|
721
|
+
}, options?: {
|
|
722
|
+
contextOptions?: ContextOptions;
|
|
723
|
+
storageOptions?: StorageOptions;
|
|
723
724
|
}): import("convex/server").RegisteredAction<"internal", {
|
|
724
725
|
userId?: string | undefined;
|
|
725
726
|
threadId?: string | undefined;
|
|
@@ -840,6 +841,194 @@ export declare class Agent<AgentTools extends ToolSet> {
|
|
|
840
841
|
} | undefined;
|
|
841
842
|
}, Promise<T>>;
|
|
842
843
|
}
|
|
844
|
+
export declare function filterOutOrphanedToolMessages(docs: MessageDoc[]): {
|
|
845
|
+
_id: string;
|
|
846
|
+
_creationTime: number;
|
|
847
|
+
id?: string | undefined;
|
|
848
|
+
userId?: string | undefined;
|
|
849
|
+
parentMessageId?: string | undefined;
|
|
850
|
+
stepId?: string | undefined;
|
|
851
|
+
agentName?: string | undefined;
|
|
852
|
+
message?: {
|
|
853
|
+
providerOptions?: {
|
|
854
|
+
[x: string]: any;
|
|
855
|
+
} | undefined;
|
|
856
|
+
experimental_providerMetadata?: {
|
|
857
|
+
[x: string]: any;
|
|
858
|
+
} | undefined;
|
|
859
|
+
role: "user";
|
|
860
|
+
content: string | ({
|
|
861
|
+
providerOptions?: {
|
|
862
|
+
[x: string]: any;
|
|
863
|
+
} | undefined;
|
|
864
|
+
experimental_providerMetadata?: {
|
|
865
|
+
[x: string]: any;
|
|
866
|
+
} | undefined;
|
|
867
|
+
type: "text";
|
|
868
|
+
text: string;
|
|
869
|
+
} | {
|
|
870
|
+
providerOptions?: {
|
|
871
|
+
[x: string]: any;
|
|
872
|
+
} | undefined;
|
|
873
|
+
experimental_providerMetadata?: {
|
|
874
|
+
[x: string]: any;
|
|
875
|
+
} | undefined;
|
|
876
|
+
mimeType?: string | undefined;
|
|
877
|
+
type: "image";
|
|
878
|
+
image: string | ArrayBuffer;
|
|
879
|
+
} | {
|
|
880
|
+
providerOptions?: {
|
|
881
|
+
[x: string]: any;
|
|
882
|
+
} | undefined;
|
|
883
|
+
experimental_providerMetadata?: {
|
|
884
|
+
[x: string]: any;
|
|
885
|
+
} | undefined;
|
|
886
|
+
type: "file";
|
|
887
|
+
mimeType: string;
|
|
888
|
+
data: string | ArrayBuffer;
|
|
889
|
+
})[];
|
|
890
|
+
} | {
|
|
891
|
+
providerOptions?: {
|
|
892
|
+
[x: string]: any;
|
|
893
|
+
} | undefined;
|
|
894
|
+
experimental_providerMetadata?: {
|
|
895
|
+
[x: string]: any;
|
|
896
|
+
} | undefined;
|
|
897
|
+
role: "assistant";
|
|
898
|
+
content: string | ({
|
|
899
|
+
providerOptions?: {
|
|
900
|
+
[x: string]: any;
|
|
901
|
+
} | undefined;
|
|
902
|
+
experimental_providerMetadata?: {
|
|
903
|
+
[x: string]: any;
|
|
904
|
+
} | undefined;
|
|
905
|
+
type: "text";
|
|
906
|
+
text: string;
|
|
907
|
+
} | {
|
|
908
|
+
providerOptions?: {
|
|
909
|
+
[x: string]: any;
|
|
910
|
+
} | undefined;
|
|
911
|
+
experimental_providerMetadata?: {
|
|
912
|
+
[x: string]: any;
|
|
913
|
+
} | undefined;
|
|
914
|
+
type: "file";
|
|
915
|
+
mimeType: string;
|
|
916
|
+
data: string | ArrayBuffer;
|
|
917
|
+
} | {
|
|
918
|
+
providerOptions?: {
|
|
919
|
+
[x: string]: any;
|
|
920
|
+
} | undefined;
|
|
921
|
+
experimental_providerMetadata?: {
|
|
922
|
+
[x: string]: any;
|
|
923
|
+
} | undefined;
|
|
924
|
+
type: "reasoning";
|
|
925
|
+
text: string;
|
|
926
|
+
} | {
|
|
927
|
+
providerOptions?: {
|
|
928
|
+
[x: string]: any;
|
|
929
|
+
} | undefined;
|
|
930
|
+
experimental_providerMetadata?: {
|
|
931
|
+
[x: string]: any;
|
|
932
|
+
} | undefined;
|
|
933
|
+
type: "redacted-reasoning";
|
|
934
|
+
data: string;
|
|
935
|
+
} | {
|
|
936
|
+
providerOptions?: {
|
|
937
|
+
[x: string]: any;
|
|
938
|
+
} | undefined;
|
|
939
|
+
experimental_providerMetadata?: {
|
|
940
|
+
[x: string]: any;
|
|
941
|
+
} | undefined;
|
|
942
|
+
type: "tool-call";
|
|
943
|
+
toolCallId: string;
|
|
944
|
+
toolName: string;
|
|
945
|
+
args: any;
|
|
946
|
+
})[];
|
|
947
|
+
} | {
|
|
948
|
+
providerOptions?: {
|
|
949
|
+
[x: string]: any;
|
|
950
|
+
} | undefined;
|
|
951
|
+
experimental_providerMetadata?: {
|
|
952
|
+
[x: string]: any;
|
|
953
|
+
} | undefined;
|
|
954
|
+
role: "tool";
|
|
955
|
+
content: {
|
|
956
|
+
providerOptions?: {
|
|
957
|
+
[x: string]: any;
|
|
958
|
+
} | undefined;
|
|
959
|
+
experimental_providerMetadata?: {
|
|
960
|
+
[x: string]: any;
|
|
961
|
+
} | undefined;
|
|
962
|
+
args?: any;
|
|
963
|
+
experimental_content?: ({
|
|
964
|
+
type: "text";
|
|
965
|
+
text: string;
|
|
966
|
+
} | {
|
|
967
|
+
mimeType?: string | undefined;
|
|
968
|
+
type: "image";
|
|
969
|
+
data: string;
|
|
970
|
+
})[] | undefined;
|
|
971
|
+
isError?: boolean | undefined;
|
|
972
|
+
type: "tool-result";
|
|
973
|
+
toolCallId: string;
|
|
974
|
+
toolName: string;
|
|
975
|
+
result: any;
|
|
976
|
+
}[];
|
|
977
|
+
} | {
|
|
978
|
+
providerOptions?: {
|
|
979
|
+
[x: string]: any;
|
|
980
|
+
} | undefined;
|
|
981
|
+
experimental_providerMetadata?: {
|
|
982
|
+
[x: string]: any;
|
|
983
|
+
} | undefined;
|
|
984
|
+
role: "system";
|
|
985
|
+
content: string;
|
|
986
|
+
} | undefined;
|
|
987
|
+
text?: string | undefined;
|
|
988
|
+
reasoning?: string | undefined;
|
|
989
|
+
error?: string | undefined;
|
|
990
|
+
model?: string | undefined;
|
|
991
|
+
provider?: string | undefined;
|
|
992
|
+
embeddingId?: string | undefined;
|
|
993
|
+
usage?: {
|
|
994
|
+
promptTokens: number;
|
|
995
|
+
completionTokens: number;
|
|
996
|
+
totalTokens: number;
|
|
997
|
+
} | undefined;
|
|
998
|
+
finishReason?: "length" | "error" | "stop" | "content-filter" | "tool-calls" | "other" | "unknown" | undefined;
|
|
999
|
+
providerMetadata?: {
|
|
1000
|
+
[x: string]: any;
|
|
1001
|
+
} | undefined;
|
|
1002
|
+
sources?: {
|
|
1003
|
+
title?: string | undefined;
|
|
1004
|
+
providerMetadata?: {
|
|
1005
|
+
[x: string]: {
|
|
1006
|
+
[x: string]: any;
|
|
1007
|
+
};
|
|
1008
|
+
} | undefined;
|
|
1009
|
+
id: string;
|
|
1010
|
+
sourceType: "url";
|
|
1011
|
+
url: string;
|
|
1012
|
+
}[] | undefined;
|
|
1013
|
+
warnings?: ({
|
|
1014
|
+
details?: string | undefined;
|
|
1015
|
+
type: "unsupported-setting";
|
|
1016
|
+
setting: string;
|
|
1017
|
+
} | {
|
|
1018
|
+
details?: string | undefined;
|
|
1019
|
+
type: "unsupported-tool";
|
|
1020
|
+
tool: any;
|
|
1021
|
+
} | {
|
|
1022
|
+
type: "other";
|
|
1023
|
+
message: string;
|
|
1024
|
+
})[] | undefined;
|
|
1025
|
+
fileId?: string | undefined;
|
|
1026
|
+
status: "pending" | "success" | "failed";
|
|
1027
|
+
order: number;
|
|
1028
|
+
threadId: string;
|
|
1029
|
+
tool: boolean;
|
|
1030
|
+
stepOrder: number;
|
|
1031
|
+
}[];
|
|
843
1032
|
export type ToolCtx = RunActionCtx & {
|
|
844
1033
|
userId?: string;
|
|
845
1034
|
threadId?: string;
|
|
@@ -879,22 +1068,7 @@ export declare function createTool<PARAMETERS extends ToolParameters, RESULT>(t:
|
|
|
879
1068
|
}): Tool<PARAMETERS, RESULT> & {
|
|
880
1069
|
execute: (args: inferParameters<PARAMETERS>, options: ToolExecutionOptions) => PromiseLike<RESULT>;
|
|
881
1070
|
};
|
|
882
|
-
type
|
|
883
|
-
/**
|
|
884
|
-
* The model to use for the tool calls. This will override the model specified
|
|
885
|
-
* in the Agent constructor.
|
|
886
|
-
*/
|
|
887
|
-
model?: LanguageModelV1;
|
|
888
|
-
/**
|
|
889
|
-
* The tools to use for the tool calls. This will override tools specified
|
|
890
|
-
* in the Agent constructor or createThread / continueThread.
|
|
891
|
-
*/
|
|
892
|
-
tools?: TOOLS;
|
|
893
|
-
/**
|
|
894
|
-
* The tool choice to use for the tool calls. This must be one of the tools
|
|
895
|
-
* specified in the tools array. e.g. {toolName: "getWeather", type: "tool"}
|
|
896
|
-
*/
|
|
897
|
-
toolChoice?: ToolChoice<TOOLS extends undefined ? AgentTools : TOOLS>;
|
|
1071
|
+
type Options = {
|
|
898
1072
|
/**
|
|
899
1073
|
* The parent message id to use for the tool calls.
|
|
900
1074
|
*/
|
|
@@ -907,8 +1081,8 @@ type TextArgs<AgentTools extends ToolSet, TOOLS extends ToolSet | undefined = un
|
|
|
907
1081
|
* The storage options to use for saving the input and output messages to the thread.
|
|
908
1082
|
*/
|
|
909
1083
|
storageOptions?: StorageOptions;
|
|
910
|
-
}
|
|
911
|
-
type
|
|
1084
|
+
};
|
|
1085
|
+
type TextArgs<AgentTools extends ToolSet, TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, OUTPUT_PARTIAL = never> = Omit<Parameters<typeof generateText<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT, OUTPUT_PARTIAL>>[0], "toolChoice" | "tools" | "model"> & {
|
|
912
1086
|
/**
|
|
913
1087
|
* The model to use for the tool calls. This will override the model specified
|
|
914
1088
|
* in the Agent constructor.
|
|
@@ -924,18 +1098,24 @@ type StreamingTextArgs<AgentTools extends ToolSet, TOOLS extends ToolSet | undef
|
|
|
924
1098
|
* specified in the tools array. e.g. {toolName: "getWeather", type: "tool"}
|
|
925
1099
|
*/
|
|
926
1100
|
toolChoice?: ToolChoice<TOOLS extends undefined ? AgentTools : TOOLS>;
|
|
1101
|
+
} & ContextOptions & // DEPRECATED: pass them in the subsequent parameter instead
|
|
1102
|
+
StorageOptions;
|
|
1103
|
+
type StreamingTextArgs<AgentTools extends ToolSet, TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, OUTPUT_PARTIAL = never> = Omit<Parameters<typeof streamText<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT, OUTPUT_PARTIAL>>[0], "toolChoice" | "tools" | "model"> & {
|
|
927
1104
|
/**
|
|
928
|
-
* The
|
|
1105
|
+
* The model to use for the tool calls. This will override the model specified
|
|
1106
|
+
* in the Agent constructor.
|
|
929
1107
|
*/
|
|
930
|
-
|
|
1108
|
+
model?: LanguageModelV1;
|
|
931
1109
|
/**
|
|
932
|
-
* The
|
|
1110
|
+
* The tools to use for the tool calls. This will override tools specified
|
|
1111
|
+
* in the Agent constructor or createThread / continueThread.
|
|
933
1112
|
*/
|
|
934
|
-
|
|
1113
|
+
tools?: TOOLS;
|
|
935
1114
|
/**
|
|
936
|
-
* The
|
|
1115
|
+
* The tool choice to use for the tool calls. This must be one of the tools
|
|
1116
|
+
* specified in the tools array. e.g. {toolName: "getWeather", type: "tool"}
|
|
937
1117
|
*/
|
|
938
|
-
|
|
1118
|
+
toolChoice?: ToolChoice<TOOLS extends undefined ? AgentTools : TOOLS>;
|
|
939
1119
|
} & ContextOptions & StorageOptions;
|
|
940
1120
|
type BaseGenerateObjectOptions = StorageOptions & ContextOptions & CallSettings & {
|
|
941
1121
|
/**
|
|
@@ -963,18 +1143,6 @@ type BaseGenerateObjectOptions = StorageOptions & ContextOptions & CallSettings
|
|
|
963
1143
|
experimental_telemetry?: TelemetrySettings;
|
|
964
1144
|
providerOptions?: ProviderOptions;
|
|
965
1145
|
experimental_providerMetadata?: ProviderMetadata;
|
|
966
|
-
/**
|
|
967
|
-
* The parent message id to use for the object generation.
|
|
968
|
-
*/
|
|
969
|
-
parentMessageId?: string;
|
|
970
|
-
/**
|
|
971
|
-
* The context options to use for passing in message history to the LLM.
|
|
972
|
-
*/
|
|
973
|
-
contextOptions?: ContextOptions;
|
|
974
|
-
/**
|
|
975
|
-
* The storage options to use for saving the input and output messages to the thread.
|
|
976
|
-
*/
|
|
977
|
-
storageOptions?: StorageOptions;
|
|
978
1146
|
};
|
|
979
1147
|
type GenerateObjectObjectOptions<T extends Record<string, unknown>> = BaseGenerateObjectOptions & {
|
|
980
1148
|
output?: "object";
|
|
@@ -1006,6 +1174,10 @@ type OurStreamObjectArgs<T> = StreamObjectArgs<T> & Pick<Parameters<typeof strea
|
|
|
1006
1174
|
type ThreadOutputMetadata = GenerationOutputMetadata & {
|
|
1007
1175
|
messageId: string;
|
|
1008
1176
|
};
|
|
1177
|
+
/**
|
|
1178
|
+
* The interface for a thread returned from {@link createThread} or {@link continueThread}.
|
|
1179
|
+
* This is contextual to a thread and/or user.
|
|
1180
|
+
*/
|
|
1009
1181
|
interface Thread<DefaultTools extends ToolSet> {
|
|
1010
1182
|
/**
|
|
1011
1183
|
* The target threadId, from the startThread or continueThread initializers.
|
|
@@ -1021,7 +1193,7 @@ interface Thread<DefaultTools extends ToolSet> {
|
|
|
1021
1193
|
* for the {@link ContextOptions} and {@link StorageOptions}.
|
|
1022
1194
|
* @returns The result of the generateText function.
|
|
1023
1195
|
*/
|
|
1024
|
-
generateText<TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, OUTPUT_PARTIAL = never>(args: TextArgs<TOOLS extends undefined ? DefaultTools : TOOLS, TOOLS, OUTPUT, OUTPUT_PARTIAL
|
|
1196
|
+
generateText<TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, OUTPUT_PARTIAL = never>(args: TextArgs<TOOLS extends undefined ? DefaultTools : TOOLS, TOOLS, OUTPUT, OUTPUT_PARTIAL>, options?: Options): Promise<GenerateTextResult<TOOLS extends undefined ? DefaultTools : TOOLS, OUTPUT> & ThreadOutputMetadata>;
|
|
1025
1197
|
/**
|
|
1026
1198
|
* This behaves like {@link streamText} from the "ai" package except that
|
|
1027
1199
|
* it add context based on the userId and threadId and saves the input and
|
|
@@ -1032,7 +1204,7 @@ interface Thread<DefaultTools extends ToolSet> {
|
|
|
1032
1204
|
* for the {@link ContextOptions} and {@link StorageOptions}.
|
|
1033
1205
|
* @returns The result of the streamText function.
|
|
1034
1206
|
*/
|
|
1035
|
-
streamText<TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, PARTIAL_OUTPUT = never>(args: StreamingTextArgs<TOOLS extends undefined ? DefaultTools : TOOLS, TOOLS, OUTPUT, PARTIAL_OUTPUT
|
|
1207
|
+
streamText<TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, PARTIAL_OUTPUT = never>(args: StreamingTextArgs<TOOLS extends undefined ? DefaultTools : TOOLS, TOOLS, OUTPUT, PARTIAL_OUTPUT>, options?: Options): Promise<StreamTextResult<TOOLS extends undefined ? DefaultTools : TOOLS, PARTIAL_OUTPUT> & ThreadOutputMetadata>;
|
|
1036
1208
|
/**
|
|
1037
1209
|
* This behaves like {@link generateObject} from the "ai" package except that
|
|
1038
1210
|
* it add context based on the userId and threadId and saves the input and
|
|
@@ -1043,7 +1215,7 @@ interface Thread<DefaultTools extends ToolSet> {
|
|
|
1043
1215
|
* for the {@link ContextOptions} and {@link StorageOptions}.
|
|
1044
1216
|
* @returns The result of the generateObject function.
|
|
1045
1217
|
*/
|
|
1046
|
-
generateObject<T>(args: OurObjectArgs<T
|
|
1218
|
+
generateObject<T>(args: OurObjectArgs<T>, options?: Options): Promise<GenerateObjectResult<T> & ThreadOutputMetadata>;
|
|
1047
1219
|
/**
|
|
1048
1220
|
* This behaves like {@link generateObject} from the "ai" package except that
|
|
1049
1221
|
* it add context based on the userId and threadId and saves the input and
|
|
@@ -1054,7 +1226,7 @@ interface Thread<DefaultTools extends ToolSet> {
|
|
|
1054
1226
|
* for the {@link ContextOptions} and {@link StorageOptions}.
|
|
1055
1227
|
* @returns The result of the generateObject function.
|
|
1056
1228
|
*/
|
|
1057
|
-
generateObject(args: GenerateObjectNoSchemaOptions): Promise<GenerateObjectResult<JSONValue> & ThreadOutputMetadata>;
|
|
1229
|
+
generateObject(args: GenerateObjectNoSchemaOptions, options?: Options): Promise<GenerateObjectResult<JSONValue> & ThreadOutputMetadata>;
|
|
1058
1230
|
/**
|
|
1059
1231
|
* This behaves like {@link streamObject} from the "ai" package except that
|
|
1060
1232
|
* it add context based on the userId and threadId and saves the input and
|
|
@@ -1065,6 +1237,6 @@ interface Thread<DefaultTools extends ToolSet> {
|
|
|
1065
1237
|
* for the {@link ContextOptions} and {@link StorageOptions}.
|
|
1066
1238
|
* @returns The result of the streamObject function.
|
|
1067
1239
|
*/
|
|
1068
|
-
streamObject<T>(args: OurStreamObjectArgs<T
|
|
1240
|
+
streamObject<T>(args: OurStreamObjectArgs<T>, options?: Options): Promise<StreamObjectResult<DeepPartial<T>, T, never> & ThreadOutputMetadata>;
|
|
1069
1241
|
}
|
|
1070
1242
|
//# sourceMappingURL=index.d.ts.map
|