@convex-dev/agent 0.1.1-alpha.0 → 0.1.2-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.
Files changed (131) hide show
  1. package/README.md +9 -3
  2. package/dist/commonjs/client/createTool.d.ts +49 -0
  3. package/dist/commonjs/client/createTool.d.ts.map +1 -0
  4. package/dist/commonjs/client/createTool.js +45 -0
  5. package/dist/commonjs/client/createTool.js.map +1 -0
  6. package/dist/commonjs/client/index.d.ts +101 -322
  7. package/dist/commonjs/client/index.d.ts.map +1 -1
  8. package/dist/commonjs/client/index.js +142 -194
  9. package/dist/commonjs/client/index.js.map +1 -1
  10. package/dist/commonjs/client/streaming.d.ts +54 -0
  11. package/dist/commonjs/client/streaming.d.ts.map +1 -0
  12. package/dist/commonjs/client/streaming.js +121 -0
  13. package/dist/commonjs/client/streaming.js.map +1 -0
  14. package/dist/commonjs/client/types.d.ts +290 -2
  15. package/dist/commonjs/client/types.d.ts.map +1 -1
  16. package/dist/commonjs/component/messages.d.ts +109 -143
  17. package/dist/commonjs/component/messages.d.ts.map +1 -1
  18. package/dist/commonjs/component/messages.js +15 -14
  19. package/dist/commonjs/component/messages.js.map +1 -1
  20. package/dist/commonjs/component/schema.d.ts +1026 -52
  21. package/dist/commonjs/component/schema.d.ts.map +1 -1
  22. package/dist/commonjs/component/schema.js +39 -1
  23. package/dist/commonjs/component/schema.js.map +1 -1
  24. package/dist/commonjs/component/streams.d.ts +191 -0
  25. package/dist/commonjs/component/streams.d.ts.map +1 -0
  26. package/dist/commonjs/component/streams.js +169 -0
  27. package/dist/commonjs/component/streams.js.map +1 -0
  28. package/dist/commonjs/component/threads.d.ts +1 -1
  29. package/dist/commonjs/component/threads.js +3 -3
  30. package/dist/commonjs/component/threads.js.map +1 -1
  31. package/dist/commonjs/component/users.js +2 -2
  32. package/dist/commonjs/component/users.js.map +1 -1
  33. package/dist/commonjs/component/vector/index.d.ts +8 -8
  34. package/dist/commonjs/component/vector/index.d.ts.map +1 -1
  35. package/dist/commonjs/component/vector/tables.d.ts +5 -5
  36. package/dist/commonjs/component/vector/tables.d.ts.map +1 -1
  37. package/dist/commonjs/component/vector/tables.js +1 -1
  38. package/dist/commonjs/component/vector/tables.js.map +1 -1
  39. package/dist/commonjs/mapping.d.ts.map +1 -1
  40. package/dist/commonjs/mapping.js +3 -1
  41. package/dist/commonjs/mapping.js.map +1 -1
  42. package/dist/commonjs/react/index.d.ts +99 -0
  43. package/dist/commonjs/react/index.d.ts.map +1 -1
  44. package/dist/commonjs/react/index.js +505 -1
  45. package/dist/commonjs/react/index.js.map +1 -1
  46. package/dist/commonjs/react/toUIMessages.d.ts +8 -0
  47. package/dist/commonjs/react/toUIMessages.d.ts.map +1 -0
  48. package/dist/commonjs/react/toUIMessages.js +134 -0
  49. package/dist/commonjs/react/toUIMessages.js.map +1 -0
  50. package/dist/commonjs/validators.d.ts +513 -11
  51. package/dist/commonjs/validators.d.ts.map +1 -1
  52. package/dist/commonjs/validators.js +49 -2
  53. package/dist/commonjs/validators.js.map +1 -1
  54. package/dist/esm/client/createTool.d.ts +49 -0
  55. package/dist/esm/client/createTool.d.ts.map +1 -0
  56. package/dist/esm/client/createTool.js +45 -0
  57. package/dist/esm/client/createTool.js.map +1 -0
  58. package/dist/esm/client/index.d.ts +101 -322
  59. package/dist/esm/client/index.d.ts.map +1 -1
  60. package/dist/esm/client/index.js +142 -194
  61. package/dist/esm/client/index.js.map +1 -1
  62. package/dist/esm/client/streaming.d.ts +54 -0
  63. package/dist/esm/client/streaming.d.ts.map +1 -0
  64. package/dist/esm/client/streaming.js +121 -0
  65. package/dist/esm/client/streaming.js.map +1 -0
  66. package/dist/esm/client/types.d.ts +290 -2
  67. package/dist/esm/client/types.d.ts.map +1 -1
  68. package/dist/esm/component/messages.d.ts +109 -143
  69. package/dist/esm/component/messages.d.ts.map +1 -1
  70. package/dist/esm/component/messages.js +15 -14
  71. package/dist/esm/component/messages.js.map +1 -1
  72. package/dist/esm/component/schema.d.ts +1026 -52
  73. package/dist/esm/component/schema.d.ts.map +1 -1
  74. package/dist/esm/component/schema.js +39 -1
  75. package/dist/esm/component/schema.js.map +1 -1
  76. package/dist/esm/component/streams.d.ts +191 -0
  77. package/dist/esm/component/streams.d.ts.map +1 -0
  78. package/dist/esm/component/streams.js +169 -0
  79. package/dist/esm/component/streams.js.map +1 -0
  80. package/dist/esm/component/threads.d.ts +1 -1
  81. package/dist/esm/component/threads.js +3 -3
  82. package/dist/esm/component/threads.js.map +1 -1
  83. package/dist/esm/component/users.js +2 -2
  84. package/dist/esm/component/users.js.map +1 -1
  85. package/dist/esm/component/vector/index.d.ts +8 -8
  86. package/dist/esm/component/vector/index.d.ts.map +1 -1
  87. package/dist/esm/component/vector/tables.d.ts +5 -5
  88. package/dist/esm/component/vector/tables.d.ts.map +1 -1
  89. package/dist/esm/component/vector/tables.js +1 -1
  90. package/dist/esm/component/vector/tables.js.map +1 -1
  91. package/dist/esm/mapping.d.ts.map +1 -1
  92. package/dist/esm/mapping.js +3 -1
  93. package/dist/esm/mapping.js.map +1 -1
  94. package/dist/esm/react/index.d.ts +99 -0
  95. package/dist/esm/react/index.d.ts.map +1 -1
  96. package/dist/esm/react/index.js +505 -1
  97. package/dist/esm/react/index.js.map +1 -1
  98. package/dist/esm/react/toUIMessages.d.ts +8 -0
  99. package/dist/esm/react/toUIMessages.d.ts.map +1 -0
  100. package/dist/esm/react/toUIMessages.js +134 -0
  101. package/dist/esm/react/toUIMessages.js.map +1 -0
  102. package/dist/esm/validators.d.ts +513 -11
  103. package/dist/esm/validators.d.ts.map +1 -1
  104. package/dist/esm/validators.js +49 -2
  105. package/dist/esm/validators.js.map +1 -1
  106. package/package.json +6 -2
  107. package/src/client/createTool.ts +108 -0
  108. package/src/client/index.ts +270 -689
  109. package/src/client/streaming.ts +166 -0
  110. package/src/client/types.ts +430 -5
  111. package/src/component/_generated/api.d.ts +367 -190
  112. package/src/component/messages.ts +15 -14
  113. package/src/component/schema.ts +46 -0
  114. package/src/component/streams.ts +206 -0
  115. package/src/component/threads.ts +3 -3
  116. package/src/component/users.ts +2 -2
  117. package/src/component/vector/tables.ts +1 -1
  118. package/src/mapping.ts +3 -1
  119. package/src/react/index.ts +687 -1
  120. package/src/react/toUIMessages.ts +153 -0
  121. package/src/validators.test.ts +18 -0
  122. package/src/validators.ts +72 -2
  123. package/dist/commonjs/deltaStreaming.d.ts +0 -2
  124. package/dist/commonjs/deltaStreaming.d.ts.map +0 -1
  125. package/dist/commonjs/deltaStreaming.js +0 -2
  126. package/dist/commonjs/deltaStreaming.js.map +0 -1
  127. package/dist/esm/deltaStreaming.d.ts +0 -2
  128. package/dist/esm/deltaStreaming.d.ts.map +0 -1
  129. package/dist/esm/deltaStreaming.js +0 -2
  130. package/dist/esm/deltaStreaming.js.map +0 -1
  131. package/src/deltaStreaming.ts +0 -1
@@ -0,0 +1,121 @@
1
+ import { smoothStream } from "ai";
2
+ export const DEFAULT_STREAMING_OPTIONS = {
3
+ chunking: "word",
4
+ throttleMs: 250,
5
+ };
6
+ export function mergeTransforms(options, existing) {
7
+ if (!options) {
8
+ return existing;
9
+ }
10
+ const chunking = typeof options === "boolean"
11
+ ? DEFAULT_STREAMING_OPTIONS.chunking
12
+ : options.chunking;
13
+ const transforms = Array.isArray(existing)
14
+ ? existing
15
+ : existing
16
+ ? [existing]
17
+ : [];
18
+ transforms.push(smoothStream({ delayInMs: null, chunking }));
19
+ return transforms;
20
+ }
21
+ export class DeltaStreamer {
22
+ component;
23
+ ctx;
24
+ metadata;
25
+ streamId;
26
+ options;
27
+ #nextParts = [];
28
+ #nextOrder;
29
+ #nextStepOrder;
30
+ #latestWrite = 0;
31
+ #ongoingWrite;
32
+ #cursor = 0;
33
+ constructor(component, ctx, options, metadata) {
34
+ this.component = component;
35
+ this.ctx = ctx;
36
+ this.metadata = metadata;
37
+ this.options =
38
+ typeof options === "boolean"
39
+ ? DEFAULT_STREAMING_OPTIONS
40
+ : {
41
+ ...DEFAULT_STREAMING_OPTIONS,
42
+ ...options,
43
+ };
44
+ this.metadata = metadata;
45
+ this.#nextParts = [];
46
+ this.#nextOrder = metadata.order ?? 0;
47
+ this.#nextStepOrder = (metadata.stepOrder ?? 0) + 1;
48
+ }
49
+ async addParts(parts) {
50
+ if (!this.streamId) {
51
+ this.streamId = await this.ctx.runMutation(this.component.streams.create, {
52
+ ...this.metadata,
53
+ order: this.#nextOrder,
54
+ stepOrder: this.#nextStepOrder,
55
+ });
56
+ }
57
+ this.#nextParts.push(...parts);
58
+ if (!this.#ongoingWrite &&
59
+ Date.now() - this.#latestWrite >= this.options.throttleMs) {
60
+ this.#ongoingWrite = this.#sendDelta();
61
+ }
62
+ }
63
+ async #sendDelta() {
64
+ const delta = this.#createDelta();
65
+ this.#latestWrite = Date.now();
66
+ await this.ctx.runMutation(this.component.streams.addDelta, delta);
67
+ // Now that we've sent the delta, check if we need to send another one.
68
+ if (this.#nextParts.length > 0 &&
69
+ Date.now() - this.#latestWrite >= this.options.throttleMs) {
70
+ // We send again immediately with the accumulated deltas.
71
+ this.#ongoingWrite = this.#sendDelta();
72
+ console.debug("Sent delta immediately");
73
+ }
74
+ else {
75
+ this.#ongoingWrite = undefined;
76
+ }
77
+ }
78
+ #createDelta() {
79
+ const start = this.#cursor;
80
+ const end = start + this.#nextParts.length;
81
+ this.#cursor = end;
82
+ const parts = this.#nextParts;
83
+ this.#nextParts = [];
84
+ if (!this.streamId) {
85
+ throw new Error("Creating a delta before the stream is created");
86
+ }
87
+ return {
88
+ streamId: this.streamId,
89
+ start,
90
+ end,
91
+ parts,
92
+ };
93
+ }
94
+ async finish(messages) {
95
+ if (this.#ongoingWrite) {
96
+ await this.#ongoingWrite;
97
+ this.#ongoingWrite = undefined;
98
+ }
99
+ if (!this.streamId) {
100
+ throw new Error("Finish called before stream is created");
101
+ }
102
+ const lastMessage = messages.at(-1);
103
+ if (lastMessage) {
104
+ this.#nextOrder = lastMessage.order;
105
+ this.#nextStepOrder = lastMessage.stepOrder + 1;
106
+ }
107
+ else {
108
+ console.warn("Step finished without generating a message");
109
+ }
110
+ const finalDelta = this.#nextParts.length > 0 ? this.#createDelta() : undefined;
111
+ this.#nextParts = [];
112
+ const streamId = this.streamId;
113
+ this.streamId = undefined;
114
+ this.#cursor = 0;
115
+ await this.ctx.runMutation(this.component.streams.finish, {
116
+ streamId,
117
+ finalDelta,
118
+ });
119
+ }
120
+ }
121
+ //# sourceMappingURL=streaming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming.js","sourceRoot":"","sources":["../../../src/client/streaming.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,YAAY,EAAgC,MAAM,IAAI,CAAC;AAoB/E,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,GAAG;CACW,CAAC;AAE7B,MAAM,UAAU,eAAe,CAC7B,OAA+C,EAC/C,QAGa;IAEb,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,QAAQ,GACZ,OAAO,OAAO,KAAK,SAAS;QAC1B,CAAC,CAAC,yBAAyB,CAAC,QAAQ;QACpC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACvB,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QACxC,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,QAAQ;YACR,CAAC,CAAC,CAAC,QAAQ,CAAC;YACZ,CAAC,CAAC,EAAE,CAAC;IACT,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC7D,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,OAAO,aAAa;IAWN;IACA;IAEA;IAbX,QAAQ,CAAqB;IACpB,OAAO,CAA6B;IACpD,UAAU,GAAqB,EAAE,CAAC;IAClC,UAAU,CAAS;IACn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AAC,aAAa,EAAE,CAAC;YACvB,MAAM,IAAI,CAAC,aAAa,CAAC;YACzB,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QACD,MAAM,WAAW,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,KAAK,CAAC;YACpC,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC,SAAS,GAAG,CAAC,CAAC;QAClD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QAC7D,CAAC;QACD,MAAM,UAAU,GACd,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/D,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjB,MAAM,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE;YACxD,QAAQ;YACR,UAAU;SACX,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,5 +1,292 @@
1
- import { GenericQueryCtx, GenericDataModel, GenericMutationCtx, Expand, FunctionReference, GenericActionCtx } from "convex/server";
2
- import { GenericId } from "convex/values";
1
+ import type { CoreMessage, DeepPartial, GenerateObjectResult, GenerateTextResult, JSONValue, RepairTextFunction, StreamObjectResult, StreamTextResult, TelemetrySettings, ToolChoice, ToolSet } from "ai";
2
+ import type { generateObject, generateText, LanguageModelV1, streamObject, streamText } from "ai";
3
+ import type { Expand, FunctionReference, GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx } from "convex/server";
4
+ import type { GenericId } from "convex/values";
5
+ import type { CallSettings, ProviderMetadata, ProviderOptions, StreamDelta, StreamMessage, Usage } from "../validators.js";
6
+ import type { Mounts } from "../component/_generated/api.js";
7
+ import type { Schema } from "zod";
8
+ import type { StreamingOptions } from "./streaming.js";
9
+ /**
10
+ * Options to configure what messages are fetched as context,
11
+ * automatically with thread.generateText, or directly via search.
12
+ */
13
+ export type ContextOptions = {
14
+ /** @deprecated Use excludeToolMessages instead. */
15
+ includeToolCalls?: boolean;
16
+ /**
17
+ * Whether to include tool messages in the context.
18
+ * By default, tool calls and results are not included.
19
+ */
20
+ excludeToolMessages?: boolean;
21
+ /**
22
+ * How many recent messages to include. These are added after the search
23
+ * messages, and do not count against the search limit.
24
+ * Default: 100
25
+ */
26
+ recentMessages?: number;
27
+ /**
28
+ * Options for searching messages.
29
+ */
30
+ searchOptions?: {
31
+ /**
32
+ * The maximum number of messages to fetch. Default is 10.
33
+ */
34
+ limit: number;
35
+ /**
36
+ * Whether to use text search to find messages. Default is false.
37
+ */
38
+ textSearch?: boolean;
39
+ /**
40
+ * Whether to use vector search to find messages. Default is false.
41
+ * At least one of textSearch or vectorSearch must be true.
42
+ */
43
+ vectorSearch?: boolean;
44
+ /**
45
+ * What messages around the search results to include.
46
+ * Default: { before: 2, after: 1 }
47
+ * (two before, and one after each message found in the search)
48
+ * Note, this is after the limit is applied.
49
+ * By default this will quadruple the number of messages fetched.
50
+ */
51
+ messageRange?: {
52
+ before: number;
53
+ after: number;
54
+ };
55
+ };
56
+ /**
57
+ * Whether to search across other threads for relevant messages.
58
+ * By default, only the current thread is searched.
59
+ */
60
+ searchOtherThreads?: boolean;
61
+ };
62
+ /**
63
+ * Options to configure the automatic saving of messages
64
+ * when generating text / objects in a thread.
65
+ */
66
+ export type StorageOptions = {
67
+ /**
68
+ * Defaults to false, allowing you to pass in arbitrary context that will
69
+ * be in addition to automatically fetched content.
70
+ * Pass true to have all input messages saved to the thread history.
71
+ */
72
+ saveAllInputMessages?: boolean;
73
+ /** Defaults to true, saving the prompt, or last message passed to generateText. */
74
+ saveAnyInputMessages?: boolean;
75
+ /** Defaults to true. Whether to save messages generated while chatting. */
76
+ saveOutputMessages?: boolean;
77
+ };
78
+ export type GenerationOutputMetadata = {
79
+ messageId?: string;
80
+ };
81
+ export type UsageHandler = (ctx: RunActionCtx, args: {
82
+ userId: string | undefined;
83
+ threadId: string | undefined;
84
+ agentName: string | undefined;
85
+ usage: Usage;
86
+ providerMetadata: ProviderMetadata | undefined;
87
+ model: string;
88
+ provider: string;
89
+ }) => void | Promise<void>;
90
+ export type AgentComponent = UseApi<Mounts>;
91
+ export 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"> & {
92
+ /**
93
+ * If provided, this message will be used as the "prompt" for the LLM call,
94
+ * instead of the prompt or messages.
95
+ * This is useful if you want to first save a user message, then use it as
96
+ * the prompt for the LLM call in another call.
97
+ */
98
+ promptMessageId?: string;
99
+ /**
100
+ * The model to use for the tool calls. This will override the model specified
101
+ * in the Agent constructor.
102
+ */
103
+ model?: LanguageModelV1;
104
+ /**
105
+ * The tools to use for the tool calls. This will override tools specified
106
+ * in the Agent constructor or createThread / continueThread.
107
+ */
108
+ tools?: TOOLS;
109
+ /**
110
+ * The tool choice to use for the tool calls. This must be one of the tools
111
+ * specified in the tools array. e.g. {toolName: "getWeather", type: "tool"}
112
+ */
113
+ toolChoice?: ToolChoice<TOOLS extends undefined ? AgentTools : TOOLS>;
114
+ };
115
+ export 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"> & {
116
+ /**
117
+ * The model to use for the tool calls. This will override the model specified
118
+ * in the Agent constructor.
119
+ */
120
+ model?: LanguageModelV1;
121
+ /**
122
+ * The tools to use for the tool calls. This will override tools specified
123
+ * in the Agent constructor or createThread / continueThread.
124
+ */
125
+ tools?: TOOLS;
126
+ /**
127
+ * The tool choice to use for the tool calls. This must be one of the tools
128
+ * specified in the tools array. e.g. {toolName: "getWeather", type: "tool"}
129
+ */
130
+ toolChoice?: ToolChoice<TOOLS extends undefined ? AgentTools : TOOLS>;
131
+ };
132
+ type BaseGenerateObjectOptions = CallSettings & {
133
+ /**
134
+ * The model to use for the object generation. This will override the model
135
+ * specified in the Agent constructor.
136
+ */
137
+ model?: LanguageModelV1;
138
+ /**
139
+ * The system prompt to use for the object generation. This will override the
140
+ * system prompt specified in the Agent constructor.
141
+ */
142
+ system?: string;
143
+ /**
144
+ * The prompt to the LLM to use for the object generation.
145
+ * Specify this or messages, but not both.
146
+ */
147
+ prompt?: string;
148
+ /**
149
+ * The messages to use for the object generation.
150
+ * Note: recent messages are automatically added based on the thread it's
151
+ * associated with and your contextOptions.
152
+ */
153
+ messages?: CoreMessage[];
154
+ /**
155
+ * The message to use as the "prompt" for the object generation.
156
+ * If this is provided, it will be used instead of the prompt or messages.
157
+ * This is useful if you want to first save a user message, then use it as
158
+ * the prompt for the object generation in another call.
159
+ */
160
+ promptMessageId?: string;
161
+ experimental_repairText?: RepairTextFunction;
162
+ experimental_telemetry?: TelemetrySettings;
163
+ providerOptions?: ProviderOptions;
164
+ experimental_providerMetadata?: ProviderMetadata;
165
+ };
166
+ type GenerateObjectObjectOptions<T extends Record<string, unknown>> = BaseGenerateObjectOptions & {
167
+ output?: "object";
168
+ mode?: "auto" | "json" | "tool";
169
+ schema: Schema<T>;
170
+ schemaName?: string;
171
+ schemaDescription?: string;
172
+ };
173
+ type GenerateObjectArrayOptions<T> = BaseGenerateObjectOptions & {
174
+ output: "array";
175
+ mode?: "auto" | "json" | "tool";
176
+ schema: Schema<T>;
177
+ schemaName?: string;
178
+ schemaDescription?: string;
179
+ };
180
+ type GenerateObjectWithEnumOptions<T extends string> = BaseGenerateObjectOptions & {
181
+ output: "enum";
182
+ enum: Array<T>;
183
+ mode?: "auto" | "json" | "tool";
184
+ };
185
+ type GenerateObjectNoSchemaOptions = BaseGenerateObjectOptions & {
186
+ schema?: undefined;
187
+ mode?: "json";
188
+ };
189
+ type GenerateObjectArgs<T> = T extends Record<string, unknown> ? GenerateObjectObjectOptions<T> : T extends Array<unknown> ? GenerateObjectArrayOptions<T> : T extends string ? GenerateObjectWithEnumOptions<T> : GenerateObjectNoSchemaOptions;
190
+ type StreamObjectArgs<T> = T extends Record<string, unknown> ? GenerateObjectObjectOptions<T> : T extends Array<unknown> ? GenerateObjectArrayOptions<T> : GenerateObjectNoSchemaOptions;
191
+ export type OurObjectArgs<T> = GenerateObjectArgs<T> & Pick<Parameters<typeof generateObject<any>>[0], "experimental_repairText" | "abortSignal">;
192
+ export type OurStreamObjectArgs<T> = StreamObjectArgs<T> & Pick<Parameters<typeof streamObject<T>>[0], "onError" | "onFinish" | "abortSignal">;
193
+ type ThreadOutputMetadata = GenerationOutputMetadata & {
194
+ messageId: string;
195
+ };
196
+ /**
197
+ * The interface for a thread returned from {@link createThread} or {@link continueThread}.
198
+ * This is contextual to a thread and/or user.
199
+ */
200
+ export interface Thread<DefaultTools extends ToolSet> {
201
+ /**
202
+ * The target threadId, from the startThread or continueThread initializers.
203
+ */
204
+ threadId: string;
205
+ /**
206
+ * This behaves like {@link generateText} from the "ai" package except that
207
+ * it add context based on the userId and threadId and saves the input and
208
+ * resulting messages to the thread, if specified.
209
+ * Use {@link continueThread} to get a version of this function already scoped
210
+ * to a thread (and optionally userId).
211
+ * @param args The arguments to the generateText function, along with extra controls
212
+ * for the {@link ContextOptions} and {@link StorageOptions}.
213
+ * @returns The result of the generateText function.
214
+ */
215
+ 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>;
216
+ /**
217
+ * This behaves like {@link streamText} from the "ai" package except that
218
+ * it add context based on the userId and threadId and saves the input and
219
+ * resulting messages to the thread, if specified.
220
+ * Use {@link continueThread} to get a version of this function already scoped
221
+ * to a thread (and optionally userId).
222
+ * @param args The arguments to the streamText function, along with extra controls
223
+ * for the {@link ContextOptions} and {@link StorageOptions}.
224
+ * @returns The result of the streamText function.
225
+ */
226
+ streamText<TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, PARTIAL_OUTPUT = never>(args: StreamingTextArgs<TOOLS extends undefined ? DefaultTools : TOOLS, TOOLS, OUTPUT, PARTIAL_OUTPUT>, options?: Options & {
227
+ /**
228
+ * Whether to save incremental data (deltas) from streaming responses.
229
+ * Defaults to false.
230
+ * If false, it will not save any deltas to the database.
231
+ * If true, it will save deltas with {@link DEFAULT_STREAMING_OPTIONS}.
232
+ *
233
+ * Regardless of this option, when streaming you are able to use this
234
+ * `streamText` function as you would with the "ai" package's version:
235
+ * iterating over the text, streaming it over HTTP, etc.
236
+ */
237
+ saveStreamDeltas?: boolean | StreamingOptions;
238
+ }): Promise<StreamTextResult<TOOLS extends undefined ? DefaultTools : TOOLS, PARTIAL_OUTPUT> & ThreadOutputMetadata>;
239
+ /**
240
+ * This behaves like {@link generateObject} from the "ai" package except that
241
+ * it add context based on the userId and threadId and saves the input and
242
+ * resulting messages to the thread, if specified. This overload is for objects, arrays, and enums.
243
+ * Use {@link continueThread} to get a version of this function already scoped
244
+ * to a thread (and optionally userId).
245
+ * @param args The arguments to the generateObject function, along with extra controls
246
+ * for the {@link ContextOptions} and {@link StorageOptions}.
247
+ * @returns The result of the generateObject function.
248
+ */
249
+ generateObject<T>(args: OurObjectArgs<T>, options?: Options): Promise<GenerateObjectResult<T> & ThreadOutputMetadata>;
250
+ /**
251
+ * This behaves like {@link generateObject} from the "ai" package except that
252
+ * it add context based on the userId and threadId and saves the input and
253
+ * resulting messages to the thread, if specified. This overload is for when there's no schema.
254
+ * Use {@link continueThread} to get a version of this function already scoped
255
+ * to a thread (and optionally userId).
256
+ * @param args The arguments to the generateObject function, along with extra controls
257
+ * for the {@link ContextOptions} and {@link StorageOptions}.
258
+ * @returns The result of the generateObject function.
259
+ */
260
+ generateObject(args: GenerateObjectNoSchemaOptions, options?: Options): Promise<GenerateObjectResult<JSONValue> & ThreadOutputMetadata>;
261
+ /**
262
+ * This behaves like {@link streamObject} from the "ai" package except that
263
+ * it add context based on the userId and threadId and saves the input and
264
+ * resulting messages to the thread, if specified.
265
+ * Use {@link continueThread} to get a version of this function already scoped
266
+ * to a thread (and optionally userId).
267
+ * @param args The arguments to the streamObject function, along with extra controls
268
+ * for the {@link ContextOptions} and {@link StorageOptions}.
269
+ * @returns The result of the streamObject function.
270
+ */
271
+ streamObject<T>(args: OurStreamObjectArgs<T>, options?: Options): Promise<StreamObjectResult<DeepPartial<T>, T, never> & ThreadOutputMetadata>;
272
+ }
273
+ export type Options = {
274
+ /**
275
+ * The context options to use for passing in message history to the LLM.
276
+ */
277
+ contextOptions?: ContextOptions;
278
+ /**
279
+ * The storage options to use for saving the input and output messages to the thread.
280
+ */
281
+ storageOptions?: StorageOptions;
282
+ };
283
+ export type SyncStreamsReturnValue = {
284
+ kind: "list";
285
+ messages: StreamMessage[];
286
+ } | {
287
+ kind: "deltas";
288
+ deltas: StreamDelta[];
289
+ } | undefined;
3
290
  export type RunQueryCtx = {
4
291
  runQuery: GenericQueryCtx<GenericDataModel>["runQuery"];
5
292
  };
@@ -18,4 +305,5 @@ export type OpaqueIds<T> = T extends GenericId<infer _T> ? string : T extends (i
18
305
  export type UseApi<API> = Expand<{
19
306
  [mod in keyof API]: API[mod] extends FunctionReference<infer FType, "public", infer FArgs, infer FReturnType, infer FComponentPath> ? FunctionReference<FType, "internal", OpaqueIds<FArgs>, OpaqueIds<FReturnType>, FComponentPath> : UseApi<API[mod]>;
20
307
  }>;
308
+ export {};
21
309
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI1C,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC,UAAU,CAAC,CAAC;CACzD,CAAC;AACF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,UAAU,CAAC,CAAC;IAC3D,WAAW,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,aAAa,CAAC,CAAC;CAClE,CAAC;AACF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,UAAU,CAAC,CAAC;IACzD,WAAW,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,aAAa,CAAC,CAAC;IAC/D,SAAS,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,WAAW,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,CAAC,IACrB,CAAC,SAAS,SAAS,CAAC,MAAM,EAAE,CAAC,GACzB,MAAM,GACN,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACnB,SAAS,CAAC,CAAC,CAAC,EAAE,GACd,CAAC,SAAS,WAAW,GACnB,WAAW,GACX,CAAC,SAAS,MAAM,GACd;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,GACD,CAAC,CAAC;AAEd,MAAM,MAAM,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC;KAC9B,GAAG,IAAI,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,iBAAiB,CACpD,MAAM,KAAK,EACX,QAAQ,EACR,MAAM,KAAK,EACX,MAAM,WAAW,EACjB,MAAM,cAAc,CACrB,GACG,iBAAiB,CACf,KAAK,EACL,UAAU,EACV,SAAS,CAAC,KAAK,CAAC,EAChB,SAAS,CAAC,WAAW,CAAC,EACtB,cAAc,CACf,GACD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACrB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,OAAO,EACR,MAAM,IAAI,CAAC;AACZ,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,UAAU,EACX,MAAM,IAAI,CAAC;AACZ,OAAO,KAAK,EACV,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,aAAa,EACb,KAAK,EACN,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,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