@convex-dev/agent 0.6.0-alpha.0 → 0.6.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/MIGRATION.md +153 -0
- package/package.json +4 -2
- package/src/UIMessages.ts +135 -0
- package/src/client/approval.test.ts +350 -0
- package/src/client/createTool.ts +50 -52
- package/src/client/index.ts +162 -1
- package/src/client/mockModel.ts +9 -2
- package/src/client/search.test.ts +4 -5
- package/src/client/search.ts +47 -2
- package/src/client/start.ts +41 -24
- package/src/client/streamText.ts +27 -3
- package/src/client/streaming.integration.test.ts +1206 -0
- package/src/client/streaming.ts +41 -12
- package/src/client/types.ts +14 -12
- package/src/component/_generated/component.ts +53 -64
- package/src/component/messages.ts +12 -2
- package/src/deltas.ts +0 -1
- package/src/mapping.test.ts +143 -1
- package/src/mapping.ts +115 -6
- package/src/react/useDeltaStreams.ts +6 -0
- package/dist/UIMessages.d.ts +0 -46
- package/dist/UIMessages.d.ts.map +0 -1
- package/dist/UIMessages.js +0 -546
- package/dist/UIMessages.js.map +0 -1
- package/dist/client/createTool.d.ts +0 -170
- package/dist/client/createTool.d.ts.map +0 -1
- package/dist/client/createTool.js +0 -115
- package/dist/client/createTool.js.map +0 -1
- package/dist/client/defaultComponent.d.ts +0 -11
- package/dist/client/defaultComponent.d.ts.map +0 -1
- package/dist/client/defaultComponent.js +0 -7
- package/dist/client/defaultComponent.js.map +0 -1
- package/dist/client/definePlaygroundAPI.d.ts +0 -1725
- package/dist/client/definePlaygroundAPI.d.ts.map +0 -1
- package/dist/client/definePlaygroundAPI.js +0 -271
- package/dist/client/definePlaygroundAPI.js.map +0 -1
- package/dist/client/files.d.ts +0 -69
- package/dist/client/files.d.ts.map +0 -1
- package/dist/client/files.js +0 -181
- package/dist/client/files.js.map +0 -1
- package/dist/client/index.d.ts +0 -2044
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -804
- package/dist/client/index.js.map +0 -1
- package/dist/client/messages.d.ts +0 -461
- package/dist/client/messages.d.ts.map +0 -1
- package/dist/client/messages.js +0 -106
- package/dist/client/messages.js.map +0 -1
- package/dist/client/mockModel.d.ts +0 -42
- package/dist/client/mockModel.d.ts.map +0 -1
- package/dist/client/mockModel.js +0 -175
- package/dist/client/mockModel.js.map +0 -1
- package/dist/client/saveInputMessages.d.ts +0 -20
- package/dist/client/saveInputMessages.d.ts.map +0 -1
- package/dist/client/saveInputMessages.js +0 -58
- package/dist/client/saveInputMessages.js.map +0 -1
- package/dist/client/search.d.ts +0 -493
- package/dist/client/search.d.ts.map +0 -1
- package/dist/client/search.js +0 -425
- package/dist/client/search.js.map +0 -1
- package/dist/client/start.d.ts +0 -84
- package/dist/client/start.d.ts.map +0 -1
- package/dist/client/start.js +0 -171
- package/dist/client/start.js.map +0 -1
- package/dist/client/streamText.d.ts +0 -46
- package/dist/client/streamText.d.ts.map +0 -1
- package/dist/client/streamText.js +0 -93
- package/dist/client/streamText.js.map +0 -1
- package/dist/client/streaming.d.ts +0 -3767
- package/dist/client/streaming.d.ts.map +0 -1
- package/dist/client/streaming.js +0 -294
- package/dist/client/streaming.js.map +0 -1
- package/dist/client/threads.d.ts +0 -46
- package/dist/client/threads.d.ts.map +0 -1
- package/dist/client/threads.js +0 -49
- package/dist/client/threads.js.map +0 -1
- package/dist/client/types.d.ts +0 -460
- package/dist/client/types.d.ts.map +0 -1
- package/dist/client/types.js +0 -2
- package/dist/client/types.js.map +0 -1
- package/dist/client/utils.d.ts +0 -4
- package/dist/client/utils.d.ts.map +0 -1
- package/dist/client/utils.js +0 -21
- package/dist/client/utils.js.map +0 -1
- package/dist/component/_generated/api.d.ts +0 -48
- package/dist/component/_generated/api.d.ts.map +0 -1
- package/dist/component/_generated/api.js +0 -31
- package/dist/component/_generated/api.js.map +0 -1
- package/dist/component/_generated/component.d.ts +0 -3119
- package/dist/component/_generated/component.d.ts.map +0 -1
- package/dist/component/_generated/component.js +0 -11
- package/dist/component/_generated/component.js.map +0 -1
- package/dist/component/_generated/dataModel.d.ts +0 -46
- package/dist/component/_generated/dataModel.d.ts.map +0 -1
- package/dist/component/_generated/dataModel.js +0 -11
- package/dist/component/_generated/dataModel.js.map +0 -1
- package/dist/component/_generated/server.d.ts +0 -121
- package/dist/component/_generated/server.d.ts.map +0 -1
- package/dist/component/_generated/server.js +0 -78
- package/dist/component/_generated/server.js.map +0 -1
- package/dist/component/apiKeys.d.ts +0 -11
- package/dist/component/apiKeys.d.ts.map +0 -1
- package/dist/component/apiKeys.js +0 -69
- package/dist/component/apiKeys.js.map +0 -1
- package/dist/component/convex.config.d.ts +0 -3
- package/dist/component/convex.config.d.ts.map +0 -1
- package/dist/component/convex.config.js +0 -3
- package/dist/component/convex.config.js.map +0 -1
- package/dist/component/files.d.ts +0 -97
- package/dist/component/files.d.ts.map +0 -1
- package/dist/component/files.js +0 -190
- package/dist/component/files.js.map +0 -1
- package/dist/component/messages.d.ts +0 -3850
- package/dist/component/messages.d.ts.map +0 -1
- package/dist/component/messages.js +0 -747
- package/dist/component/messages.js.map +0 -1
- package/dist/component/schema.d.ts +0 -8026
- package/dist/component/schema.d.ts.map +0 -1
- package/dist/component/schema.js +0 -147
- package/dist/component/schema.js.map +0 -1
- package/dist/component/streams.d.ts +0 -128
- package/dist/component/streams.d.ts.map +0 -1
- package/dist/component/streams.js +0 -413
- package/dist/component/streams.js.map +0 -1
- package/dist/component/threads.d.ts +0 -115
- package/dist/component/threads.d.ts.map +0 -1
- package/dist/component/threads.js +0 -208
- package/dist/component/threads.js.map +0 -1
- package/dist/component/users.d.ts +0 -52
- package/dist/component/users.d.ts.map +0 -1
- package/dist/component/users.js +0 -229
- package/dist/component/users.js.map +0 -1
- package/dist/component/vector/index.d.ts +0 -61
- package/dist/component/vector/index.d.ts.map +0 -1
- package/dist/component/vector/index.js +0 -146
- package/dist/component/vector/index.js.map +0 -1
- package/dist/component/vector/tables.d.ts +0 -58
- package/dist/component/vector/tables.d.ts.map +0 -1
- package/dist/component/vector/tables.js +0 -56
- package/dist/component/vector/tables.js.map +0 -1
- package/dist/deltas.d.ts +0 -43
- package/dist/deltas.d.ts.map +0 -1
- package/dist/deltas.js +0 -447
- package/dist/deltas.js.map +0 -1
- package/dist/mapping.d.ts +0 -54
- package/dist/mapping.d.ts.map +0 -1
- package/dist/mapping.js +0 -626
- package/dist/mapping.js.map +0 -1
- package/dist/react/SmoothText.d.ts +0 -5
- package/dist/react/SmoothText.d.ts.map +0 -1
- package/dist/react/SmoothText.js +0 -6
- package/dist/react/SmoothText.js.map +0 -1
- package/dist/react/index.d.ts +0 -25
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js +0 -70
- package/dist/react/index.js.map +0 -1
- package/dist/react/optimisticallySendMessage.d.ts +0 -42
- package/dist/react/optimisticallySendMessage.d.ts.map +0 -1
- package/dist/react/optimisticallySendMessage.js +0 -74
- package/dist/react/optimisticallySendMessage.js.map +0 -1
- package/dist/react/types.d.ts +0 -12
- package/dist/react/types.d.ts.map +0 -1
- package/dist/react/types.js +0 -2
- package/dist/react/types.js.map +0 -1
- package/dist/react/useDeltaStreams.d.ts +0 -10
- package/dist/react/useDeltaStreams.d.ts.map +0 -1
- package/dist/react/useDeltaStreams.js +0 -101
- package/dist/react/useDeltaStreams.js.map +0 -1
- package/dist/react/useSmoothText.d.ts +0 -27
- package/dist/react/useSmoothText.d.ts.map +0 -1
- package/dist/react/useSmoothText.js +0 -68
- package/dist/react/useSmoothText.js.map +0 -1
- package/dist/react/useStreamingUIMessages.d.ts +0 -22
- package/dist/react/useStreamingUIMessages.d.ts.map +0 -1
- package/dist/react/useStreamingUIMessages.js +0 -92
- package/dist/react/useStreamingUIMessages.js.map +0 -1
- package/dist/react/useThreadMessages.d.ts +0 -104
- package/dist/react/useThreadMessages.d.ts.map +0 -1
- package/dist/react/useThreadMessages.js +0 -148
- package/dist/react/useThreadMessages.js.map +0 -1
- package/dist/react/useUIMessages.d.ts +0 -96
- package/dist/react/useUIMessages.d.ts.map +0 -1
- package/dist/react/useUIMessages.js +0 -108
- package/dist/react/useUIMessages.js.map +0 -1
- package/dist/shared.d.ts +0 -26
- package/dist/shared.d.ts.map +0 -1
- package/dist/shared.js +0 -67
- package/dist/shared.js.map +0 -1
- package/dist/validators.d.ts +0 -24516
- package/dist/validators.d.ts.map +0 -1
- package/dist/validators.js +0 -475
- package/dist/validators.js.map +0 -1
package/dist/client/index.d.ts
DELETED
|
@@ -1,2044 +0,0 @@
|
|
|
1
|
-
import type { JSONValue } from "@ai-sdk/provider";
|
|
2
|
-
import type { FlexibleSchema, IdGenerator, InferSchema } from "@ai-sdk/provider-utils";
|
|
3
|
-
import type { CallSettings, GenerateObjectResult, GenerateTextResult, LanguageModel, ModelMessage, StepResult, StopCondition, StreamTextResult, ToolSet } from "ai";
|
|
4
|
-
import { streamObject } from "ai";
|
|
5
|
-
import { type GenericDataModel, type PaginationOptions, type PaginationResult } from "convex/server";
|
|
6
|
-
import type { threadFieldsSupportingPatch } from "../component/threads.js";
|
|
7
|
-
import { type VectorDimension } from "../component/vector/tables.js";
|
|
8
|
-
import { type Message, type MessageDoc, type MessageStatus, type MessageWithMetadata, type ProviderMetadata, type StreamArgs, type ThreadDoc } from "../validators.js";
|
|
9
|
-
import { type SaveMessageArgs, type SaveMessagesArgs } from "./messages.js";
|
|
10
|
-
import { type StreamingOptions } from "./streaming.js";
|
|
11
|
-
import type { ActionCtx, AgentComponent, Config, ContextOptions, GenerateObjectArgs, GenerationOutputMetadata, MaybeCustomCtx, ObjectMode, Options, RawRequestResponseHandler, MutationCtx, StorageOptions, StreamingTextArgs, StreamObjectArgs, SyncStreamsReturnValue, TextArgs, Thread, UsageHandler, QueryCtx, AgentPrompt, Output } from "./types.js";
|
|
12
|
-
export { stepCountIs } from "ai";
|
|
13
|
-
export { docsToModelMessages, toModelMessage, toModelMessage as deserializeMessage, guessMimeType, serializeDataOrUrl, serializeMessage, toUIFilePart, } from "../mapping.js";
|
|
14
|
-
export { extractText, isTool, sorted } from "../shared.js";
|
|
15
|
-
export { vAssistantMessage, vContent, vContextOptions, vMessage, vMessageDoc, vPaginationResult, vProviderMetadata, vSource, vStorageOptions, vStreamArgs, vSystemMessage, vThreadDoc, vToolMessage, vUsage, vUserMessage, type Message, type MessageDoc, type SourcePart, type ThreadDoc, type Usage, } from "../validators.js";
|
|
16
|
-
export { createTool, type ToolCtx } from "./createTool.js";
|
|
17
|
-
export { definePlaygroundAPI, type AgentsFn, type PlaygroundAPI, } from "./definePlaygroundAPI.js";
|
|
18
|
-
export { getFile, storeFile } from "./files.js";
|
|
19
|
-
export { listMessages, listUIMessages, saveMessage, saveMessages, type SaveMessageArgs, type SaveMessagesArgs, } from "./messages.js";
|
|
20
|
-
export { mockModel } from "./mockModel.js";
|
|
21
|
-
export { fetchContextMessages, filterOutOrphanedToolMessages, fetchContextWithPrompt, generateAndSaveEmbeddings, embedMessages, embedMany, } from "./search.js";
|
|
22
|
-
export { startGeneration } from "./start.js";
|
|
23
|
-
export { DEFAULT_STREAMING_OPTIONS, DeltaStreamer, abortStream, compressUIMessageChunks, listStreams, syncStreams, vStreamMessagesReturnValue, } from "./streaming.js";
|
|
24
|
-
export { createThread, getThreadMetadata, searchThreadTitles, updateThreadMetadata, } from "./threads.js";
|
|
25
|
-
export type { ContextHandler } from "./types.js";
|
|
26
|
-
export { toUIMessages, fromUIMessages, type UIMessage } from "../UIMessages.js";
|
|
27
|
-
export type { AgentComponent, Config, ContextOptions, ProviderMetadata, RawRequestResponseHandler, StorageOptions, StreamArgs, SyncStreamsReturnValue, Thread, UsageHandler, };
|
|
28
|
-
export declare class Agent<
|
|
29
|
-
/**
|
|
30
|
-
* You can require that all `ctx` args to generateText & streamText
|
|
31
|
-
* have a certain shape by passing a type here.
|
|
32
|
-
* e.g.
|
|
33
|
-
* ```ts
|
|
34
|
-
* const myAgent = new Agent<{ orgId: string }>(...);
|
|
35
|
-
* ```
|
|
36
|
-
* This is useful if you want to share that type in `createTool`
|
|
37
|
-
* e.g.
|
|
38
|
-
* ```ts
|
|
39
|
-
* type MyCtx = ToolCtx & { orgId: string };
|
|
40
|
-
* const myTool = createTool({
|
|
41
|
-
* args: z.object({...}),
|
|
42
|
-
* description: "...",
|
|
43
|
-
* handler: async (ctx: MyCtx, args) => {
|
|
44
|
-
* // use ctx.orgId
|
|
45
|
-
* },
|
|
46
|
-
* });
|
|
47
|
-
*/
|
|
48
|
-
CustomCtx extends object = object, AgentTools extends ToolSet = any> {
|
|
49
|
-
component: AgentComponent;
|
|
50
|
-
options: Config & {
|
|
51
|
-
/**
|
|
52
|
-
* The name for the agent. This will be attributed on each message
|
|
53
|
-
* created by this agent.
|
|
54
|
-
*/
|
|
55
|
-
name: string;
|
|
56
|
-
/**
|
|
57
|
-
* The LLM model to use for generating / streaming text and objects.
|
|
58
|
-
* e.g.
|
|
59
|
-
* import { openai } from "@ai-sdk/openai"
|
|
60
|
-
* const myAgent = new Agent(components.agent, {
|
|
61
|
-
* languageModel: openai.chat("gpt-4o-mini"),
|
|
62
|
-
*/
|
|
63
|
-
languageModel: LanguageModel;
|
|
64
|
-
/**
|
|
65
|
-
* The default system prompt to put in each request.
|
|
66
|
-
* Override per-prompt by passing the "system" parameter.
|
|
67
|
-
*/
|
|
68
|
-
instructions?: string;
|
|
69
|
-
/**
|
|
70
|
-
* Tools that the agent can call out to and get responses from.
|
|
71
|
-
* They can be AI SDK tools (import {tool} from "ai")
|
|
72
|
-
* or tools that have Convex context
|
|
73
|
-
* (import { createTool } from "@convex-dev/agent")
|
|
74
|
-
*/
|
|
75
|
-
tools?: AgentTools;
|
|
76
|
-
/**
|
|
77
|
-
* When generating or streaming text with tools available, this
|
|
78
|
-
* determines when to stop. Defaults to the AI SDK default.
|
|
79
|
-
*/
|
|
80
|
-
stopWhen?: StopCondition<NoInfer<AgentTools>> | Array<StopCondition<NoInfer<AgentTools>>>;
|
|
81
|
-
};
|
|
82
|
-
constructor(component: AgentComponent, options: Config & {
|
|
83
|
-
/**
|
|
84
|
-
* The name for the agent. This will be attributed on each message
|
|
85
|
-
* created by this agent.
|
|
86
|
-
*/
|
|
87
|
-
name: string;
|
|
88
|
-
/**
|
|
89
|
-
* The LLM model to use for generating / streaming text and objects.
|
|
90
|
-
* e.g.
|
|
91
|
-
* import { openai } from "@ai-sdk/openai"
|
|
92
|
-
* const myAgent = new Agent(components.agent, {
|
|
93
|
-
* languageModel: openai.chat("gpt-4o-mini"),
|
|
94
|
-
*/
|
|
95
|
-
languageModel: LanguageModel;
|
|
96
|
-
/**
|
|
97
|
-
* The default system prompt to put in each request.
|
|
98
|
-
* Override per-prompt by passing the "system" parameter.
|
|
99
|
-
*/
|
|
100
|
-
instructions?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Tools that the agent can call out to and get responses from.
|
|
103
|
-
* They can be AI SDK tools (import {tool} from "ai")
|
|
104
|
-
* or tools that have Convex context
|
|
105
|
-
* (import { createTool } from "@convex-dev/agent")
|
|
106
|
-
*/
|
|
107
|
-
tools?: AgentTools;
|
|
108
|
-
/**
|
|
109
|
-
* When generating or streaming text with tools available, this
|
|
110
|
-
* determines when to stop. Defaults to the AI SDK default.
|
|
111
|
-
*/
|
|
112
|
-
stopWhen?: StopCondition<NoInfer<AgentTools>> | Array<StopCondition<NoInfer<AgentTools>>>;
|
|
113
|
-
});
|
|
114
|
-
/**
|
|
115
|
-
* Get the embedding model, prioritizing embeddingModel over textEmbeddingModel.
|
|
116
|
-
* @private
|
|
117
|
-
*/
|
|
118
|
-
private getEmbeddingModel;
|
|
119
|
-
/**
|
|
120
|
-
* Start a new thread with the agent. This will have a fresh history, though if
|
|
121
|
-
* you pass in a userId you can have it search across other threads for relevant
|
|
122
|
-
* messages as context for the LLM calls.
|
|
123
|
-
* @param ctx The context of the Convex function. From an action, you can thread
|
|
124
|
-
* with the agent. From a mutation, you can start a thread and save the threadId
|
|
125
|
-
* to pass to continueThread later.
|
|
126
|
-
* @param args The thread metadata.
|
|
127
|
-
* @returns The threadId of the new thread and the thread object.
|
|
128
|
-
*/
|
|
129
|
-
createThread(ctx: ActionCtx & CustomCtx, args?: {
|
|
130
|
-
/**
|
|
131
|
-
* The userId to associate with the thread. If not provided, the thread will be
|
|
132
|
-
* anonymous.
|
|
133
|
-
*/
|
|
134
|
-
userId?: string | null;
|
|
135
|
-
/**
|
|
136
|
-
* The title of the thread. Not currently used for anything.
|
|
137
|
-
*/
|
|
138
|
-
title?: string;
|
|
139
|
-
/**
|
|
140
|
-
* The summary of the thread. Not currently used for anything.
|
|
141
|
-
*/
|
|
142
|
-
summary?: string;
|
|
143
|
-
}): Promise<{
|
|
144
|
-
threadId: string;
|
|
145
|
-
thread: Thread<AgentTools>;
|
|
146
|
-
}>;
|
|
147
|
-
/**
|
|
148
|
-
* Start a new thread with the agent. This will have a fresh history, though if
|
|
149
|
-
* you pass in a userId you can have it search across other threads for relevant
|
|
150
|
-
* messages as context for the LLM calls.
|
|
151
|
-
* @param ctx The context of the Convex function. From a mutation, you can
|
|
152
|
-
* start a thread and save the threadId to pass to continueThread later.
|
|
153
|
-
* @param args The thread metadata.
|
|
154
|
-
* @returns The threadId of the new thread.
|
|
155
|
-
*/
|
|
156
|
-
createThread(ctx: MutationCtx, args?: {
|
|
157
|
-
/**
|
|
158
|
-
* The userId to associate with the thread. If not provided, the thread will be
|
|
159
|
-
* anonymous.
|
|
160
|
-
*/
|
|
161
|
-
userId?: string | null;
|
|
162
|
-
/**
|
|
163
|
-
* The title of the thread. Not currently used for anything.
|
|
164
|
-
*/
|
|
165
|
-
title?: string;
|
|
166
|
-
/**
|
|
167
|
-
* The summary of the thread. Not currently used for anything.
|
|
168
|
-
*/
|
|
169
|
-
summary?: string;
|
|
170
|
-
}): Promise<{
|
|
171
|
-
threadId: string;
|
|
172
|
-
}>;
|
|
173
|
-
/**
|
|
174
|
-
* Continues a thread using this agent. Note: threads can be continued
|
|
175
|
-
* by different agents. This is a convenience around calling the various
|
|
176
|
-
* generate and stream functions with explicit userId and threadId parameters.
|
|
177
|
-
* @param ctx The ctx object passed to the action handler
|
|
178
|
-
* @param { threadId, userId }: the thread and user to associate the messages with.
|
|
179
|
-
* @returns Functions bound to the userId and threadId on a `{thread}` object.
|
|
180
|
-
*/
|
|
181
|
-
continueThread(ctx: ActionCtx & CustomCtx, args: {
|
|
182
|
-
/**
|
|
183
|
-
* The associated thread created by {@link createThread}
|
|
184
|
-
*/
|
|
185
|
-
threadId: string;
|
|
186
|
-
/**
|
|
187
|
-
* If supplied, the userId can be used to search across other threads for
|
|
188
|
-
* relevant messages from the same user as context for the LLM calls.
|
|
189
|
-
*/
|
|
190
|
-
userId?: string | null;
|
|
191
|
-
}): Promise<{
|
|
192
|
-
thread: Thread<AgentTools>;
|
|
193
|
-
}>;
|
|
194
|
-
start<TOOLS extends ToolSet | undefined, T extends {
|
|
195
|
-
_internal?: {
|
|
196
|
-
generateId?: IdGenerator;
|
|
197
|
-
};
|
|
198
|
-
}>(ctx: ActionCtx & CustomCtx,
|
|
199
|
-
/**
|
|
200
|
-
* These are the arguments you'll pass to the LLM call such as
|
|
201
|
-
* `generateText` or `streamText`. This function will look up the context
|
|
202
|
-
* and provide functions to save the steps, abort the generation, and more.
|
|
203
|
-
* The type of the arguments returned infers from the type of the arguments
|
|
204
|
-
* you pass here.
|
|
205
|
-
*/
|
|
206
|
-
args: T & AgentPrompt & {
|
|
207
|
-
/**
|
|
208
|
-
* The tools to use for the tool calls. This will override tools specified
|
|
209
|
-
* in the Agent constructor or createThread / continueThread.
|
|
210
|
-
*/
|
|
211
|
-
tools?: TOOLS;
|
|
212
|
-
/**
|
|
213
|
-
* The abort signal to be passed to the LLM call. If triggered, it will
|
|
214
|
-
* mark the pending message as failed. If the generation is asynchronously
|
|
215
|
-
* aborted, it will trigger this signal when detected.
|
|
216
|
-
*/
|
|
217
|
-
abortSignal?: AbortSignal;
|
|
218
|
-
stopWhen?: StopCondition<TOOLS extends undefined ? AgentTools : TOOLS> | Array<StopCondition<TOOLS extends undefined ? AgentTools : TOOLS>>;
|
|
219
|
-
}, options?: Options & {
|
|
220
|
-
userId?: string | null;
|
|
221
|
-
threadId?: string;
|
|
222
|
-
}): Promise<{
|
|
223
|
-
args: T & {
|
|
224
|
-
system?: string;
|
|
225
|
-
model: LanguageModel;
|
|
226
|
-
prompt?: never;
|
|
227
|
-
messages: ModelMessage[];
|
|
228
|
-
tools?: TOOLS extends undefined ? AgentTools : TOOLS;
|
|
229
|
-
} & CallSettings;
|
|
230
|
-
order: number;
|
|
231
|
-
stepOrder: number;
|
|
232
|
-
userId: string | undefined;
|
|
233
|
-
promptMessageId: string | undefined;
|
|
234
|
-
updateModel: (model: LanguageModel | undefined) => void;
|
|
235
|
-
save: <TOOLS extends ToolSet>(toSave: {
|
|
236
|
-
step: StepResult<TOOLS>;
|
|
237
|
-
} | {
|
|
238
|
-
object: GenerateObjectResult<unknown>;
|
|
239
|
-
}, createPendingMessage?: boolean) => Promise<void>;
|
|
240
|
-
fail: (reason: string) => Promise<void>;
|
|
241
|
-
getSavedMessages: () => MessageDoc[];
|
|
242
|
-
}>;
|
|
243
|
-
/**
|
|
244
|
-
* This behaves like {@link generateText} from the "ai" package except that
|
|
245
|
-
* it add context based on the userId and threadId and saves the input and
|
|
246
|
-
* resulting messages to the thread, if specified.
|
|
247
|
-
* Use {@link continueThread} to get a version of this function already scoped
|
|
248
|
-
* to a thread (and optionally userId).
|
|
249
|
-
* @param ctx The context passed from the action function calling this.
|
|
250
|
-
* @param scope: The user and thread to associate the message with
|
|
251
|
-
* @param generateTextArgs The arguments to the generateText function, along
|
|
252
|
-
* with {@link AgentPrompt} options, such as promptMessageId.
|
|
253
|
-
* @param options Extra controls for the {@link ContextOptions} and {@link StorageOptions}.
|
|
254
|
-
* @returns The result of the generateText function.
|
|
255
|
-
*/
|
|
256
|
-
generateText<TOOLS extends ToolSet | undefined = undefined, OUTPUT extends Output<any, any, any> = never>(ctx: ActionCtx & CustomCtx, threadOpts: {
|
|
257
|
-
userId?: string | null;
|
|
258
|
-
threadId?: string;
|
|
259
|
-
},
|
|
260
|
-
/**
|
|
261
|
-
* The arguments to the generateText function, similar to the ai sdk's
|
|
262
|
-
* {@link generateText} function, along with Agent prompt options.
|
|
263
|
-
*/
|
|
264
|
-
generateTextArgs: AgentPrompt & TextArgs<AgentTools, TOOLS, OUTPUT>, options?: Options): Promise<GenerateTextResult<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT> & GenerationOutputMetadata>;
|
|
265
|
-
/**
|
|
266
|
-
* This behaves like {@link streamText} from the "ai" package except that
|
|
267
|
-
* it add context based on the userId and threadId and saves the input and
|
|
268
|
-
* resulting messages to the thread, if specified.
|
|
269
|
-
* Use {@link continueThread} to get a version of this function already scoped
|
|
270
|
-
* to a thread (and optionally userId).
|
|
271
|
-
*/
|
|
272
|
-
streamText<TOOLS extends ToolSet | undefined = undefined, OUTPUT extends Output<any, any, any> = never>(ctx: ActionCtx & CustomCtx, threadOpts: {
|
|
273
|
-
userId?: string | null;
|
|
274
|
-
threadId?: string;
|
|
275
|
-
},
|
|
276
|
-
/**
|
|
277
|
-
* The arguments to the streamText function, similar to the ai sdk's
|
|
278
|
-
* {@link streamText} function, along with Agent prompt options.
|
|
279
|
-
*/
|
|
280
|
-
streamTextArgs: AgentPrompt & StreamingTextArgs<AgentTools, TOOLS, OUTPUT>,
|
|
281
|
-
/**
|
|
282
|
-
* The {@link ContextOptions} and {@link StorageOptions}
|
|
283
|
-
* options to use for fetching contextual messages and saving input/output messages.
|
|
284
|
-
*/
|
|
285
|
-
options?: Options & {
|
|
286
|
-
/**
|
|
287
|
-
* Whether to save incremental data (deltas) from streaming responses.
|
|
288
|
-
* Defaults to false.
|
|
289
|
-
* If false, it will not save any deltas to the database.
|
|
290
|
-
* If true, it will save deltas with {@link DEFAULT_STREAMING_OPTIONS}.
|
|
291
|
-
*
|
|
292
|
-
* Regardless of this option, when streaming you are able to use this
|
|
293
|
-
* `streamText` function as you would with the "ai" package's version:
|
|
294
|
-
* iterating over the text, streaming it over HTTP, etc.
|
|
295
|
-
*/
|
|
296
|
-
saveStreamDeltas?: boolean | StreamingOptions;
|
|
297
|
-
}): Promise<StreamTextResult<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT> & GenerationOutputMetadata>;
|
|
298
|
-
/**
|
|
299
|
-
* This behaves like {@link generateObject} from the "ai" package except that
|
|
300
|
-
* it add context based on the userId and threadId and saves the input and
|
|
301
|
-
* resulting messages to the thread, if specified.
|
|
302
|
-
* Use {@link continueThread} to get a version of this function already scoped
|
|
303
|
-
* to a thread (and optionally userId).
|
|
304
|
-
*/
|
|
305
|
-
generateObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue>, OUTPUT extends ObjectMode = InferSchema<SCHEMA> extends string ? "enum" : "object", RESULT = OUTPUT extends "array" ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(ctx: ActionCtx & CustomCtx, threadOpts: {
|
|
306
|
-
userId?: string | null;
|
|
307
|
-
threadId?: string;
|
|
308
|
-
},
|
|
309
|
-
/**
|
|
310
|
-
* The arguments to the generateObject function, similar to the ai sdk's
|
|
311
|
-
* {@link generateObject} function, along with Agent prompt options.
|
|
312
|
-
*/
|
|
313
|
-
generateObjectArgs: AgentPrompt & GenerateObjectArgs<SCHEMA, OUTPUT, RESULT>,
|
|
314
|
-
/**
|
|
315
|
-
* The {@link ContextOptions} and {@link StorageOptions}
|
|
316
|
-
* options to use for fetching contextual messages and saving input/output messages.
|
|
317
|
-
*/
|
|
318
|
-
options?: Options): Promise<GenerateObjectResult<RESULT> & GenerationOutputMetadata>;
|
|
319
|
-
/**
|
|
320
|
-
* This behaves like `streamObject` from the "ai" package except that
|
|
321
|
-
* it add context based on the userId and threadId and saves the input and
|
|
322
|
-
* resulting messages to the thread, if specified.
|
|
323
|
-
* Use {@link continueThread} to get a version of this function already scoped
|
|
324
|
-
* to a thread (and optionally userId).
|
|
325
|
-
*/
|
|
326
|
-
streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue>, OUTPUT extends ObjectMode = InferSchema<SCHEMA> extends string ? "enum" : "object", RESULT = OUTPUT extends "array" ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(ctx: ActionCtx & CustomCtx, threadOpts: {
|
|
327
|
-
userId?: string | null;
|
|
328
|
-
threadId?: string;
|
|
329
|
-
},
|
|
330
|
-
/**
|
|
331
|
-
* The arguments to the streamObject function, similar to the ai sdk's
|
|
332
|
-
* {@link streamObject} function, along with Agent prompt options.
|
|
333
|
-
*/
|
|
334
|
-
streamObjectArgs: AgentPrompt & StreamObjectArgs<SCHEMA, OUTPUT, RESULT>,
|
|
335
|
-
/**
|
|
336
|
-
* The {@link ContextOptions} and {@link StorageOptions}
|
|
337
|
-
* options to use for fetching contextual messages and saving input/output messages.
|
|
338
|
-
*/
|
|
339
|
-
options?: Options): Promise<ReturnType<typeof streamObject<SCHEMA, OUTPUT, RESULT>> & GenerationOutputMetadata>;
|
|
340
|
-
/**
|
|
341
|
-
* Save a message to the thread.
|
|
342
|
-
* @param ctx A ctx object from a mutation or action.
|
|
343
|
-
* @param args The message and what to associate it with (user / thread)
|
|
344
|
-
* You can pass extra metadata alongside the message, e.g. associated fileIds.
|
|
345
|
-
* @returns The messageId of the saved message.
|
|
346
|
-
*/
|
|
347
|
-
saveMessage(ctx: MutationCtx | ActionCtx, args: SaveMessageArgs & {
|
|
348
|
-
/**
|
|
349
|
-
* If true, it will not generate embeddings for the message.
|
|
350
|
-
* Useful if you're saving messages in a mutation where you can't run `fetch`.
|
|
351
|
-
* You can generate them asynchronously by using the scheduler to run an
|
|
352
|
-
* action later that calls `agent.generateAndSaveEmbeddings`.
|
|
353
|
-
*/
|
|
354
|
-
skipEmbeddings?: boolean;
|
|
355
|
-
}): Promise<{
|
|
356
|
-
messageId: string;
|
|
357
|
-
message: {
|
|
358
|
-
id?: string | undefined;
|
|
359
|
-
userId?: string | undefined;
|
|
360
|
-
embeddingId?: string | undefined;
|
|
361
|
-
fileIds?: string[] | undefined;
|
|
362
|
-
error?: string | undefined;
|
|
363
|
-
agentName?: string | undefined;
|
|
364
|
-
model?: string | undefined;
|
|
365
|
-
provider?: string | undefined;
|
|
366
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
367
|
-
message?: {
|
|
368
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
369
|
-
role: "user";
|
|
370
|
-
content: string | ({
|
|
371
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
372
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
373
|
-
type: "text";
|
|
374
|
-
text: string;
|
|
375
|
-
} | {
|
|
376
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
377
|
-
mediaType?: string | undefined;
|
|
378
|
-
mimeType?: string | undefined;
|
|
379
|
-
type: "image";
|
|
380
|
-
image: string | ArrayBuffer;
|
|
381
|
-
} | {
|
|
382
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
383
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
384
|
-
mediaType?: string | undefined;
|
|
385
|
-
mimeType?: string | undefined;
|
|
386
|
-
filename?: string | undefined;
|
|
387
|
-
type: "file";
|
|
388
|
-
data: string | ArrayBuffer;
|
|
389
|
-
})[];
|
|
390
|
-
} | {
|
|
391
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
392
|
-
role: "assistant";
|
|
393
|
-
content: string | ({
|
|
394
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
395
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
396
|
-
type: "text";
|
|
397
|
-
text: string;
|
|
398
|
-
} | {
|
|
399
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
400
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
401
|
-
mediaType?: string | undefined;
|
|
402
|
-
mimeType?: string | undefined;
|
|
403
|
-
filename?: string | undefined;
|
|
404
|
-
type: "file";
|
|
405
|
-
data: string | ArrayBuffer;
|
|
406
|
-
} | {
|
|
407
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
408
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
409
|
-
signature?: string | undefined;
|
|
410
|
-
type: "reasoning";
|
|
411
|
-
text: string;
|
|
412
|
-
} | {
|
|
413
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
414
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
415
|
-
type: "redacted-reasoning";
|
|
416
|
-
data: string;
|
|
417
|
-
} | {
|
|
418
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
419
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
420
|
-
args?: any;
|
|
421
|
-
providerExecuted?: boolean | undefined;
|
|
422
|
-
type: "tool-call";
|
|
423
|
-
toolCallId: string;
|
|
424
|
-
toolName: string;
|
|
425
|
-
input: any;
|
|
426
|
-
} | {
|
|
427
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
428
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
429
|
-
input?: any;
|
|
430
|
-
providerExecuted?: boolean | undefined;
|
|
431
|
-
type: "tool-call";
|
|
432
|
-
toolCallId: string;
|
|
433
|
-
toolName: string;
|
|
434
|
-
args: any;
|
|
435
|
-
} | {
|
|
436
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
437
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
438
|
-
args?: any;
|
|
439
|
-
providerExecuted?: boolean | undefined;
|
|
440
|
-
output?: {
|
|
441
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
442
|
-
type: "text";
|
|
443
|
-
value: string;
|
|
444
|
-
} | {
|
|
445
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
446
|
-
type: "json";
|
|
447
|
-
value: any;
|
|
448
|
-
} | {
|
|
449
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
450
|
-
type: "error-text";
|
|
451
|
-
value: string;
|
|
452
|
-
} | {
|
|
453
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
454
|
-
type: "error-json";
|
|
455
|
-
value: any;
|
|
456
|
-
} | {
|
|
457
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
458
|
-
reason?: string | undefined;
|
|
459
|
-
type: "execution-denied";
|
|
460
|
-
} | {
|
|
461
|
-
type: "content";
|
|
462
|
-
value: ({
|
|
463
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
464
|
-
type: "text";
|
|
465
|
-
text: string;
|
|
466
|
-
} | {
|
|
467
|
-
type: "media";
|
|
468
|
-
mediaType: string;
|
|
469
|
-
data: string;
|
|
470
|
-
} | {
|
|
471
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
472
|
-
filename?: string | undefined;
|
|
473
|
-
type: "file-data";
|
|
474
|
-
mediaType: string;
|
|
475
|
-
data: string;
|
|
476
|
-
} | {
|
|
477
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
478
|
-
type: "file-url";
|
|
479
|
-
url: string;
|
|
480
|
-
} | {
|
|
481
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
482
|
-
type: "file-id";
|
|
483
|
-
fileId: string | Record<string, string>;
|
|
484
|
-
} | {
|
|
485
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
486
|
-
type: "image-data";
|
|
487
|
-
mediaType: string;
|
|
488
|
-
data: string;
|
|
489
|
-
} | {
|
|
490
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
491
|
-
type: "image-url";
|
|
492
|
-
url: string;
|
|
493
|
-
} | {
|
|
494
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
495
|
-
type: "image-file-id";
|
|
496
|
-
fileId: string | Record<string, string>;
|
|
497
|
-
} | {
|
|
498
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
499
|
-
type: "custom";
|
|
500
|
-
})[];
|
|
501
|
-
} | undefined;
|
|
502
|
-
result?: any;
|
|
503
|
-
isError?: boolean | undefined;
|
|
504
|
-
experimental_content?: ({
|
|
505
|
-
type: "text";
|
|
506
|
-
text: string;
|
|
507
|
-
} | {
|
|
508
|
-
mimeType?: string | undefined;
|
|
509
|
-
type: "image";
|
|
510
|
-
data: string;
|
|
511
|
-
})[] | undefined;
|
|
512
|
-
type: "tool-result";
|
|
513
|
-
toolCallId: string;
|
|
514
|
-
toolName: string;
|
|
515
|
-
} | {
|
|
516
|
-
title?: string | undefined;
|
|
517
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
518
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
519
|
-
id: string;
|
|
520
|
-
type: "source";
|
|
521
|
-
url: string;
|
|
522
|
-
sourceType: "url";
|
|
523
|
-
} | {
|
|
524
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
525
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
526
|
-
filename?: string | undefined;
|
|
527
|
-
id: string;
|
|
528
|
-
title: string;
|
|
529
|
-
type: "source";
|
|
530
|
-
mediaType: string;
|
|
531
|
-
sourceType: "document";
|
|
532
|
-
} | {
|
|
533
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
534
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
535
|
-
type: "tool-approval-request";
|
|
536
|
-
toolCallId: string;
|
|
537
|
-
approvalId: string;
|
|
538
|
-
})[];
|
|
539
|
-
} | {
|
|
540
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
541
|
-
role: "tool";
|
|
542
|
-
content: ({
|
|
543
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
544
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
545
|
-
args?: any;
|
|
546
|
-
providerExecuted?: boolean | undefined;
|
|
547
|
-
output?: {
|
|
548
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
549
|
-
type: "text";
|
|
550
|
-
value: string;
|
|
551
|
-
} | {
|
|
552
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
553
|
-
type: "json";
|
|
554
|
-
value: any;
|
|
555
|
-
} | {
|
|
556
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
557
|
-
type: "error-text";
|
|
558
|
-
value: string;
|
|
559
|
-
} | {
|
|
560
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
561
|
-
type: "error-json";
|
|
562
|
-
value: any;
|
|
563
|
-
} | {
|
|
564
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
565
|
-
reason?: string | undefined;
|
|
566
|
-
type: "execution-denied";
|
|
567
|
-
} | {
|
|
568
|
-
type: "content";
|
|
569
|
-
value: ({
|
|
570
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
571
|
-
type: "text";
|
|
572
|
-
text: string;
|
|
573
|
-
} | {
|
|
574
|
-
type: "media";
|
|
575
|
-
mediaType: string;
|
|
576
|
-
data: string;
|
|
577
|
-
} | {
|
|
578
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
579
|
-
filename?: string | undefined;
|
|
580
|
-
type: "file-data";
|
|
581
|
-
mediaType: string;
|
|
582
|
-
data: string;
|
|
583
|
-
} | {
|
|
584
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
585
|
-
type: "file-url";
|
|
586
|
-
url: string;
|
|
587
|
-
} | {
|
|
588
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
589
|
-
type: "file-id";
|
|
590
|
-
fileId: string | Record<string, string>;
|
|
591
|
-
} | {
|
|
592
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
593
|
-
type: "image-data";
|
|
594
|
-
mediaType: string;
|
|
595
|
-
data: string;
|
|
596
|
-
} | {
|
|
597
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
598
|
-
type: "image-url";
|
|
599
|
-
url: string;
|
|
600
|
-
} | {
|
|
601
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
602
|
-
type: "image-file-id";
|
|
603
|
-
fileId: string | Record<string, string>;
|
|
604
|
-
} | {
|
|
605
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
606
|
-
type: "custom";
|
|
607
|
-
})[];
|
|
608
|
-
} | undefined;
|
|
609
|
-
result?: any;
|
|
610
|
-
isError?: boolean | undefined;
|
|
611
|
-
experimental_content?: ({
|
|
612
|
-
type: "text";
|
|
613
|
-
text: string;
|
|
614
|
-
} | {
|
|
615
|
-
mimeType?: string | undefined;
|
|
616
|
-
type: "image";
|
|
617
|
-
data: string;
|
|
618
|
-
})[] | undefined;
|
|
619
|
-
type: "tool-result";
|
|
620
|
-
toolCallId: string;
|
|
621
|
-
toolName: string;
|
|
622
|
-
} | {
|
|
623
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
624
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
625
|
-
providerExecuted?: boolean | undefined;
|
|
626
|
-
reason?: string | undefined;
|
|
627
|
-
type: "tool-approval-response";
|
|
628
|
-
approvalId: string;
|
|
629
|
-
approved: boolean;
|
|
630
|
-
})[];
|
|
631
|
-
} | {
|
|
632
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
633
|
-
role: "system";
|
|
634
|
-
content: string;
|
|
635
|
-
} | undefined;
|
|
636
|
-
text?: string | undefined;
|
|
637
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
638
|
-
reasoning?: string | undefined;
|
|
639
|
-
usage?: {
|
|
640
|
-
reasoningTokens?: number | undefined;
|
|
641
|
-
cachedInputTokens?: number | undefined;
|
|
642
|
-
promptTokens: number;
|
|
643
|
-
completionTokens: number;
|
|
644
|
-
totalTokens: number;
|
|
645
|
-
} | undefined;
|
|
646
|
-
sources?: ({
|
|
647
|
-
title?: string | undefined;
|
|
648
|
-
type?: "source" | undefined;
|
|
649
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
650
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
651
|
-
id: string;
|
|
652
|
-
url: string;
|
|
653
|
-
sourceType: "url";
|
|
654
|
-
} | {
|
|
655
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
656
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
657
|
-
filename?: string | undefined;
|
|
658
|
-
id: string;
|
|
659
|
-
title: string;
|
|
660
|
-
type: "source";
|
|
661
|
-
mediaType: string;
|
|
662
|
-
sourceType: "document";
|
|
663
|
-
})[] | undefined;
|
|
664
|
-
warnings?: ({
|
|
665
|
-
details?: string | undefined;
|
|
666
|
-
type: "unsupported-setting";
|
|
667
|
-
setting: string;
|
|
668
|
-
} | {
|
|
669
|
-
details?: string | undefined;
|
|
670
|
-
type: "unsupported-tool";
|
|
671
|
-
tool: any;
|
|
672
|
-
} | {
|
|
673
|
-
type: "other";
|
|
674
|
-
message: string;
|
|
675
|
-
})[] | undefined;
|
|
676
|
-
finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
|
|
677
|
-
reasoningDetails?: ({
|
|
678
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
679
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
680
|
-
signature?: string | undefined;
|
|
681
|
-
type: "reasoning";
|
|
682
|
-
text: string;
|
|
683
|
-
} | {
|
|
684
|
-
signature?: string | undefined;
|
|
685
|
-
type: "text";
|
|
686
|
-
text: string;
|
|
687
|
-
} | {
|
|
688
|
-
type: "redacted";
|
|
689
|
-
data: string;
|
|
690
|
-
})[] | undefined;
|
|
691
|
-
status: "pending" | "success" | "failed";
|
|
692
|
-
order: number;
|
|
693
|
-
_creationTime: number;
|
|
694
|
-
threadId: string;
|
|
695
|
-
stepOrder: number;
|
|
696
|
-
tool: boolean;
|
|
697
|
-
_id: string;
|
|
698
|
-
};
|
|
699
|
-
}>;
|
|
700
|
-
/**
|
|
701
|
-
* Explicitly save messages associated with the thread (& user if provided)
|
|
702
|
-
* If you have an embedding model set, it will also generate embeddings for
|
|
703
|
-
* the messages.
|
|
704
|
-
* @param ctx The ctx parameter to a mutation or action.
|
|
705
|
-
* @param args The messages and context to save
|
|
706
|
-
* @returns
|
|
707
|
-
*/
|
|
708
|
-
saveMessages(ctx: MutationCtx | ActionCtx, args: SaveMessagesArgs & {
|
|
709
|
-
/**
|
|
710
|
-
* Skip generating embeddings for the messages. Useful if you're
|
|
711
|
-
* saving messages in a mutation where you can't run `fetch`.
|
|
712
|
-
* You can generate them asynchronously by using the scheduler to run an
|
|
713
|
-
* action later that calls `agent.generateAndSaveEmbeddings`.
|
|
714
|
-
*/
|
|
715
|
-
skipEmbeddings?: boolean;
|
|
716
|
-
}): Promise<{
|
|
717
|
-
messages: MessageDoc[];
|
|
718
|
-
}>;
|
|
719
|
-
/**
|
|
720
|
-
* List messages from a thread.
|
|
721
|
-
* @param ctx A ctx object from a query, mutation, or action.
|
|
722
|
-
* @param args.threadId The thread to list messages from.
|
|
723
|
-
* @param args.paginationOpts Pagination options (e.g. via usePaginatedQuery).
|
|
724
|
-
* @param args.excludeToolMessages Whether to exclude tool messages.
|
|
725
|
-
* False by default.
|
|
726
|
-
* @param args.statuses What statuses to include. All by default.
|
|
727
|
-
* @returns The MessageDoc's in a format compatible with usePaginatedQuery.
|
|
728
|
-
*/
|
|
729
|
-
listMessages(ctx: QueryCtx | MutationCtx | ActionCtx, args: {
|
|
730
|
-
threadId: string;
|
|
731
|
-
paginationOpts: PaginationOptions;
|
|
732
|
-
excludeToolMessages?: boolean;
|
|
733
|
-
statuses?: MessageStatus[];
|
|
734
|
-
}): Promise<PaginationResult<MessageDoc>>;
|
|
735
|
-
/**
|
|
736
|
-
* A function that handles fetching stream deltas, used with the React hooks
|
|
737
|
-
* `useThreadMessages` or `useStreamingThreadMessages`.
|
|
738
|
-
* @param ctx A ctx object from a query, mutation, or action.
|
|
739
|
-
* @param args.threadId The thread to sync streams for.
|
|
740
|
-
* @param args.streamArgs The stream arguments with per-stream cursors.
|
|
741
|
-
* @returns The deltas for each stream from their existing cursor.
|
|
742
|
-
*/
|
|
743
|
-
syncStreams(ctx: QueryCtx | MutationCtx | ActionCtx, args: {
|
|
744
|
-
threadId: string;
|
|
745
|
-
streamArgs: StreamArgs | undefined;
|
|
746
|
-
includeStatuses?: ("streaming" | "finished" | "aborted")[];
|
|
747
|
-
}): Promise<SyncStreamsReturnValue | undefined>;
|
|
748
|
-
/**
|
|
749
|
-
* Fetch the context messages for a thread.
|
|
750
|
-
* @param ctx Either a query, mutation, or action ctx.
|
|
751
|
-
* If it is not an action context, you can't do text or
|
|
752
|
-
* vector search.
|
|
753
|
-
* @param args The associated thread, user, message
|
|
754
|
-
* @returns
|
|
755
|
-
*/
|
|
756
|
-
fetchContextMessages(ctx: QueryCtx | MutationCtx | ActionCtx, args: {
|
|
757
|
-
userId: string | undefined;
|
|
758
|
-
threadId: string | undefined;
|
|
759
|
-
/**
|
|
760
|
-
* If targetMessageId is not provided, this text will be used
|
|
761
|
-
* for text and vector search
|
|
762
|
-
*/
|
|
763
|
-
searchText?: string;
|
|
764
|
-
/**
|
|
765
|
-
* If provided, it will use this message for text/vector search (if enabled)
|
|
766
|
-
* and will only fetch messages up to (and including) this message's "order"
|
|
767
|
-
*/
|
|
768
|
-
targetMessageId?: string;
|
|
769
|
-
/**
|
|
770
|
-
* @deprecated use searchText and targetMessageId instead
|
|
771
|
-
*/
|
|
772
|
-
messages?: (ModelMessage | Message)[];
|
|
773
|
-
/**
|
|
774
|
-
* @deprecated use targetMessageId instead
|
|
775
|
-
*/
|
|
776
|
-
upToAndIncludingMessageId?: string;
|
|
777
|
-
contextOptions: ContextOptions | undefined;
|
|
778
|
-
}): Promise<MessageDoc[]>;
|
|
779
|
-
/**
|
|
780
|
-
* Get the metadata for a thread.
|
|
781
|
-
* @param ctx A ctx object from a query, mutation, or action.
|
|
782
|
-
* @param args.threadId The thread to get the metadata for.
|
|
783
|
-
* @returns The metadata for the thread.
|
|
784
|
-
*/
|
|
785
|
-
getThreadMetadata(ctx: QueryCtx | MutationCtx | ActionCtx, args: {
|
|
786
|
-
threadId: string;
|
|
787
|
-
}): Promise<ThreadDoc>;
|
|
788
|
-
/**
|
|
789
|
-
* Update the metadata for a thread.
|
|
790
|
-
* @param ctx A ctx object from a mutation or action.
|
|
791
|
-
* @param args.threadId The thread to update the metadata for.
|
|
792
|
-
* @param args.patch The patch to apply to the thread.
|
|
793
|
-
* @returns The updated thread metadata.
|
|
794
|
-
*/
|
|
795
|
-
updateThreadMetadata(ctx: MutationCtx | ActionCtx, args: {
|
|
796
|
-
threadId: string;
|
|
797
|
-
patch: Partial<Pick<ThreadDoc, (typeof threadFieldsSupportingPatch)[number]>>;
|
|
798
|
-
}): Promise<ThreadDoc>;
|
|
799
|
-
/**
|
|
800
|
-
* Get the embeddings for a set of messages.
|
|
801
|
-
* @param messages The messages to get the embeddings for.
|
|
802
|
-
* @returns The embeddings for the messages.
|
|
803
|
-
*/
|
|
804
|
-
generateEmbeddings(ctx: ActionCtx, args: {
|
|
805
|
-
userId: string | undefined;
|
|
806
|
-
threadId: string | undefined;
|
|
807
|
-
}, messages: (ModelMessage | Message)[]): Promise<{
|
|
808
|
-
vectors: (number[] | null)[];
|
|
809
|
-
dimension: VectorDimension;
|
|
810
|
-
model: string;
|
|
811
|
-
} | undefined>;
|
|
812
|
-
/**
|
|
813
|
-
* Generate embeddings for a set of messages, and save them to the database.
|
|
814
|
-
* It will not generate or save embeddings for messages that already have an
|
|
815
|
-
* embedding.
|
|
816
|
-
* @param ctx The ctx parameter to an action.
|
|
817
|
-
* @param args The messageIds to generate embeddings for.
|
|
818
|
-
*/
|
|
819
|
-
generateAndSaveEmbeddings(ctx: ActionCtx, args: {
|
|
820
|
-
messageIds: string[];
|
|
821
|
-
}): Promise<void>;
|
|
822
|
-
/**
|
|
823
|
-
* Explicitly save a "step" created by the AI SDK.
|
|
824
|
-
* @param ctx The ctx argument to a mutation or action.
|
|
825
|
-
* @param args The Step generated by the AI SDK.
|
|
826
|
-
*/
|
|
827
|
-
saveStep<TOOLS extends ToolSet>(ctx: ActionCtx, args: {
|
|
828
|
-
userId?: string;
|
|
829
|
-
threadId: string;
|
|
830
|
-
/**
|
|
831
|
-
* The message this step is in response to.
|
|
832
|
-
*/
|
|
833
|
-
promptMessageId: string;
|
|
834
|
-
/**
|
|
835
|
-
* The step to save, possibly including multiple tool calls.
|
|
836
|
-
*/
|
|
837
|
-
step: StepResult<TOOLS>;
|
|
838
|
-
/**
|
|
839
|
-
* The model used to generate the step.
|
|
840
|
-
* Defaults to the chat model for the Agent.
|
|
841
|
-
*/
|
|
842
|
-
model?: string;
|
|
843
|
-
/**
|
|
844
|
-
* The provider of the model used to generate the step.
|
|
845
|
-
* Defaults to the chat provider for the Agent.
|
|
846
|
-
*/
|
|
847
|
-
provider?: string;
|
|
848
|
-
}): Promise<{
|
|
849
|
-
messages: MessageDoc[];
|
|
850
|
-
}>;
|
|
851
|
-
/**
|
|
852
|
-
* Manually save the result of a generateObject call to the thread.
|
|
853
|
-
* This happens automatically when using {@link generateObject} or {@link streamObject}
|
|
854
|
-
* from the `thread` object created by {@link continueThread} or {@link createThread}.
|
|
855
|
-
* @param ctx The context passed from the mutation or action function calling this.
|
|
856
|
-
* @param args The arguments to the saveObject function.
|
|
857
|
-
*/
|
|
858
|
-
saveObject(ctx: ActionCtx, args: {
|
|
859
|
-
userId: string | undefined;
|
|
860
|
-
threadId: string;
|
|
861
|
-
promptMessageId: string;
|
|
862
|
-
model: string | undefined;
|
|
863
|
-
provider: string | undefined;
|
|
864
|
-
result: GenerateObjectResult<unknown>;
|
|
865
|
-
metadata?: Omit<MessageWithMetadata, "message">;
|
|
866
|
-
}): Promise<{
|
|
867
|
-
messages: MessageDoc[];
|
|
868
|
-
}>;
|
|
869
|
-
/**
|
|
870
|
-
* Commit or rollback a message that was pending.
|
|
871
|
-
* This is done automatically when saving messages by default.
|
|
872
|
-
* If creating pending messages, you can call this when the full "transaction" is done.
|
|
873
|
-
* @param ctx The ctx argument to your mutation or action.
|
|
874
|
-
* @param args What message to save. Generally the parent message sent into
|
|
875
|
-
* the generateText call.
|
|
876
|
-
*/
|
|
877
|
-
finalizeMessage(ctx: MutationCtx | ActionCtx, args: {
|
|
878
|
-
messageId: string;
|
|
879
|
-
result: {
|
|
880
|
-
status: "failed";
|
|
881
|
-
error: string;
|
|
882
|
-
} | {
|
|
883
|
-
status: "success";
|
|
884
|
-
};
|
|
885
|
-
}): Promise<void>;
|
|
886
|
-
/**
|
|
887
|
-
* Update a message by its id.
|
|
888
|
-
* @param ctx The ctx argument to your mutation or action.
|
|
889
|
-
* @param args The message fields to update.
|
|
890
|
-
*/
|
|
891
|
-
updateMessage(ctx: MutationCtx | ActionCtx, args: {
|
|
892
|
-
/** The id of the message to update. */
|
|
893
|
-
messageId: string;
|
|
894
|
-
patch: {
|
|
895
|
-
/** The message to replace the existing message. */
|
|
896
|
-
message: ModelMessage | Message;
|
|
897
|
-
/** The status to set on the message. */
|
|
898
|
-
status: "success" | "error";
|
|
899
|
-
/** The error message to set on the message. */
|
|
900
|
-
error?: string;
|
|
901
|
-
/**
|
|
902
|
-
* These will override the fileIds in the message.
|
|
903
|
-
* To remove all existing files, pass an empty array.
|
|
904
|
-
* If passing in a new message, pass in the fileIds you explicitly want to keep
|
|
905
|
-
* from the previous message, as the new files generated from the new message
|
|
906
|
-
* will be added to the list.
|
|
907
|
-
* If you pass undefined, it will not change the fileIds unless new
|
|
908
|
-
* files are generated from the message. In that case, the new fileIds
|
|
909
|
-
* will replace the old fileIds.
|
|
910
|
-
*/
|
|
911
|
-
fileIds?: string[];
|
|
912
|
-
};
|
|
913
|
-
}): Promise<void>;
|
|
914
|
-
/**
|
|
915
|
-
* Delete multiple messages by their ids, including their embeddings
|
|
916
|
-
* and reduce the refcount of any files they reference.
|
|
917
|
-
* @param ctx The ctx argument to your mutation or action.
|
|
918
|
-
* @param args The ids of the messages to delete.
|
|
919
|
-
*/
|
|
920
|
-
deleteMessages(ctx: MutationCtx | ActionCtx, args: {
|
|
921
|
-
messageIds: string[];
|
|
922
|
-
}): Promise<void>;
|
|
923
|
-
/**
|
|
924
|
-
* Delete a single message by its id, including its embedding
|
|
925
|
-
* and reduce the refcount of any files it references.
|
|
926
|
-
* @param ctx The ctx argument to your mutation or action.
|
|
927
|
-
* @param args The id of the message to delete.
|
|
928
|
-
*/
|
|
929
|
-
deleteMessage(ctx: MutationCtx | ActionCtx, args: {
|
|
930
|
-
messageId: string;
|
|
931
|
-
}): Promise<void>;
|
|
932
|
-
/**
|
|
933
|
-
* Delete a range of messages by their order and step order.
|
|
934
|
-
* Each "order" is a set of associated messages in response to the message
|
|
935
|
-
* at stepOrder 0.
|
|
936
|
-
* The (startOrder, startStepOrder) is inclusive
|
|
937
|
-
* and the (endOrder, endStepOrder) is exclusive.
|
|
938
|
-
* To delete all messages at "order" 1, you can pass:
|
|
939
|
-
* `{ startOrder: 1, endOrder: 2 }`
|
|
940
|
-
* To delete a message at step (order=1, stepOrder=1), you can pass:
|
|
941
|
-
* `{ startOrder: 1, startStepOrder: 1, endOrder: 1, endStepOrder: 2 }`
|
|
942
|
-
* To delete all messages between (1, 1) up to and including (3, 5), you can pass:
|
|
943
|
-
* `{ startOrder: 1, startStepOrder: 1, endOrder: 3, endStepOrder: 6 }`
|
|
944
|
-
*
|
|
945
|
-
* If it cannot do it in one transaction, it returns information you can use
|
|
946
|
-
* to resume the deletion.
|
|
947
|
-
* e.g.
|
|
948
|
-
* ```ts
|
|
949
|
-
* let isDone = false;
|
|
950
|
-
* let lastOrder = args.startOrder;
|
|
951
|
-
* let lastStepOrder = args.startStepOrder ?? 0;
|
|
952
|
-
* while (!isDone) {
|
|
953
|
-
* // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
954
|
-
* ({ isDone, lastOrder, lastStepOrder } = await agent.deleteMessageRange(
|
|
955
|
-
* ctx,
|
|
956
|
-
* {
|
|
957
|
-
* threadId: args.threadId,
|
|
958
|
-
* startOrder: lastOrder,
|
|
959
|
-
* startStepOrder: lastStepOrder,
|
|
960
|
-
* endOrder: args.endOrder,
|
|
961
|
-
* endStepOrder: args.endStepOrder,
|
|
962
|
-
* }
|
|
963
|
-
* ));
|
|
964
|
-
* }
|
|
965
|
-
* ```
|
|
966
|
-
* @param ctx The ctx argument to your mutation or action.
|
|
967
|
-
* @param args The range of messages to delete.
|
|
968
|
-
*/
|
|
969
|
-
deleteMessageRange(ctx: MutationCtx | ActionCtx, args: {
|
|
970
|
-
threadId: string;
|
|
971
|
-
startOrder: number;
|
|
972
|
-
startStepOrder?: number;
|
|
973
|
-
endOrder: number;
|
|
974
|
-
endStepOrder?: number;
|
|
975
|
-
}): Promise<{
|
|
976
|
-
isDone: boolean;
|
|
977
|
-
lastOrder?: number;
|
|
978
|
-
lastStepOrder?: number;
|
|
979
|
-
}>;
|
|
980
|
-
/**
|
|
981
|
-
* Delete a thread and all its messages and streams asynchronously (in batches)
|
|
982
|
-
* This uses a mutation to that processes one page and recursively queues the
|
|
983
|
-
* next page for deletion.
|
|
984
|
-
* @param ctx The ctx argument to your mutation or action.
|
|
985
|
-
* @param args The id of the thread to delete and optionally the page size to use for the delete.
|
|
986
|
-
*/
|
|
987
|
-
deleteThreadAsync(ctx: MutationCtx | ActionCtx, args: {
|
|
988
|
-
threadId: string;
|
|
989
|
-
pageSize?: number;
|
|
990
|
-
}): Promise<void>;
|
|
991
|
-
/**
|
|
992
|
-
* Delete a thread and all its messages and streams synchronously.
|
|
993
|
-
* This uses an action to iterate through all pages. If the action fails
|
|
994
|
-
* partway, it will not automatically restart.
|
|
995
|
-
* @param ctx The ctx argument to your action.
|
|
996
|
-
* @param args The id of the thread to delete and optionally the page size to use for the delete.
|
|
997
|
-
*/
|
|
998
|
-
deleteThreadSync(ctx: ActionCtx, args: {
|
|
999
|
-
threadId: string;
|
|
1000
|
-
pageSize?: number;
|
|
1001
|
-
}): Promise<void>;
|
|
1002
|
-
/**
|
|
1003
|
-
* WORKFLOW UTILITIES
|
|
1004
|
-
*/
|
|
1005
|
-
/**
|
|
1006
|
-
* Create a mutation that creates a thread so you can call it from a Workflow.
|
|
1007
|
-
* e.g.
|
|
1008
|
-
* ```ts
|
|
1009
|
-
* // in convex/foo.ts
|
|
1010
|
-
* export const createThread = weatherAgent.createThreadMutation();
|
|
1011
|
-
*
|
|
1012
|
-
* const workflow = new WorkflowManager(components.workflow);
|
|
1013
|
-
* export const myWorkflow = workflow.define({
|
|
1014
|
-
* args: {},
|
|
1015
|
-
* handler: async (step) => {
|
|
1016
|
-
* const { threadId } = await step.runMutation(internal.foo.createThread);
|
|
1017
|
-
* // use the threadId to generate text, object, etc.
|
|
1018
|
-
* },
|
|
1019
|
-
* });
|
|
1020
|
-
* ```
|
|
1021
|
-
* @returns A mutation that creates a thread.
|
|
1022
|
-
*/
|
|
1023
|
-
createThreadMutation(): import("convex/server").RegisteredMutation<"internal", {
|
|
1024
|
-
userId?: string | undefined;
|
|
1025
|
-
title?: string | undefined;
|
|
1026
|
-
summary?: string | undefined;
|
|
1027
|
-
}, Promise<{
|
|
1028
|
-
threadId: string;
|
|
1029
|
-
}>>;
|
|
1030
|
-
/**
|
|
1031
|
-
* Create an action out of this agent so you can call it from workflows or other actions
|
|
1032
|
-
* without a wrapping function.
|
|
1033
|
-
* @param spec Configuration for the agent acting as an action, including
|
|
1034
|
-
* {@link ContextOptions}, {@link StorageOptions}, and {@link stopWhen}.
|
|
1035
|
-
*/
|
|
1036
|
-
asTextAction<DataModel extends GenericDataModel>(spec: MaybeCustomCtx<CustomCtx, DataModel, AgentTools> & {
|
|
1037
|
-
/**
|
|
1038
|
-
* Whether to stream the text.
|
|
1039
|
-
* If false, it will generate the text in a single call. (default)
|
|
1040
|
-
* If true or {@link StreamingOptions}, it will stream the text from the LLM
|
|
1041
|
-
* and save the chunks to the database with the options you specify, or the
|
|
1042
|
-
* defaults if you pass true.
|
|
1043
|
-
*/
|
|
1044
|
-
stream?: boolean | StreamingOptions;
|
|
1045
|
-
/**
|
|
1046
|
-
* When to stop generating text.
|
|
1047
|
-
* Defaults to the {@link Agent["options"].stopWhen} option.
|
|
1048
|
-
*/
|
|
1049
|
-
stopWhen?: StopCondition<AgentTools> | Array<StopCondition<AgentTools>>;
|
|
1050
|
-
} & Options, overrides?: CallSettings): import("convex/server").RegisteredAction<"internal", {
|
|
1051
|
-
userId?: string | undefined;
|
|
1052
|
-
threadId?: string | undefined;
|
|
1053
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1054
|
-
system?: string | undefined;
|
|
1055
|
-
messages?: ({
|
|
1056
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1057
|
-
role: "user";
|
|
1058
|
-
content: string | ({
|
|
1059
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1060
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1061
|
-
type: "text";
|
|
1062
|
-
text: string;
|
|
1063
|
-
} | {
|
|
1064
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1065
|
-
mediaType?: string | undefined;
|
|
1066
|
-
mimeType?: string | undefined;
|
|
1067
|
-
type: "image";
|
|
1068
|
-
image: string | ArrayBuffer;
|
|
1069
|
-
} | {
|
|
1070
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1071
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1072
|
-
mediaType?: string | undefined;
|
|
1073
|
-
mimeType?: string | undefined;
|
|
1074
|
-
filename?: string | undefined;
|
|
1075
|
-
type: "file";
|
|
1076
|
-
data: string | ArrayBuffer;
|
|
1077
|
-
})[];
|
|
1078
|
-
} | {
|
|
1079
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1080
|
-
role: "assistant";
|
|
1081
|
-
content: string | ({
|
|
1082
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1083
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1084
|
-
type: "text";
|
|
1085
|
-
text: string;
|
|
1086
|
-
} | {
|
|
1087
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1088
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1089
|
-
mediaType?: string | undefined;
|
|
1090
|
-
mimeType?: string | undefined;
|
|
1091
|
-
filename?: string | undefined;
|
|
1092
|
-
type: "file";
|
|
1093
|
-
data: string | ArrayBuffer;
|
|
1094
|
-
} | {
|
|
1095
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1096
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1097
|
-
signature?: string | undefined;
|
|
1098
|
-
type: "reasoning";
|
|
1099
|
-
text: string;
|
|
1100
|
-
} | {
|
|
1101
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1102
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1103
|
-
type: "redacted-reasoning";
|
|
1104
|
-
data: string;
|
|
1105
|
-
} | {
|
|
1106
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1107
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1108
|
-
args?: any;
|
|
1109
|
-
providerExecuted?: boolean | undefined;
|
|
1110
|
-
type: "tool-call";
|
|
1111
|
-
toolCallId: string;
|
|
1112
|
-
toolName: string;
|
|
1113
|
-
input: any;
|
|
1114
|
-
} | {
|
|
1115
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1116
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1117
|
-
input?: any;
|
|
1118
|
-
providerExecuted?: boolean | undefined;
|
|
1119
|
-
type: "tool-call";
|
|
1120
|
-
toolCallId: string;
|
|
1121
|
-
toolName: string;
|
|
1122
|
-
args: any;
|
|
1123
|
-
} | {
|
|
1124
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1125
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1126
|
-
args?: any;
|
|
1127
|
-
providerExecuted?: boolean | undefined;
|
|
1128
|
-
output?: {
|
|
1129
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1130
|
-
type: "text";
|
|
1131
|
-
value: string;
|
|
1132
|
-
} | {
|
|
1133
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1134
|
-
type: "json";
|
|
1135
|
-
value: any;
|
|
1136
|
-
} | {
|
|
1137
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1138
|
-
type: "error-text";
|
|
1139
|
-
value: string;
|
|
1140
|
-
} | {
|
|
1141
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1142
|
-
type: "error-json";
|
|
1143
|
-
value: any;
|
|
1144
|
-
} | {
|
|
1145
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1146
|
-
reason?: string | undefined;
|
|
1147
|
-
type: "execution-denied";
|
|
1148
|
-
} | {
|
|
1149
|
-
type: "content";
|
|
1150
|
-
value: ({
|
|
1151
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1152
|
-
type: "text";
|
|
1153
|
-
text: string;
|
|
1154
|
-
} | {
|
|
1155
|
-
type: "media";
|
|
1156
|
-
mediaType: string;
|
|
1157
|
-
data: string;
|
|
1158
|
-
} | {
|
|
1159
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1160
|
-
filename?: string | undefined;
|
|
1161
|
-
type: "file-data";
|
|
1162
|
-
mediaType: string;
|
|
1163
|
-
data: string;
|
|
1164
|
-
} | {
|
|
1165
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1166
|
-
type: "file-url";
|
|
1167
|
-
url: string;
|
|
1168
|
-
} | {
|
|
1169
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1170
|
-
type: "file-id";
|
|
1171
|
-
fileId: string | Record<string, string>;
|
|
1172
|
-
} | {
|
|
1173
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1174
|
-
type: "image-data";
|
|
1175
|
-
mediaType: string;
|
|
1176
|
-
data: string;
|
|
1177
|
-
} | {
|
|
1178
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1179
|
-
type: "image-url";
|
|
1180
|
-
url: string;
|
|
1181
|
-
} | {
|
|
1182
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1183
|
-
type: "image-file-id";
|
|
1184
|
-
fileId: string | Record<string, string>;
|
|
1185
|
-
} | {
|
|
1186
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1187
|
-
type: "custom";
|
|
1188
|
-
})[];
|
|
1189
|
-
} | undefined;
|
|
1190
|
-
result?: any;
|
|
1191
|
-
isError?: boolean | undefined;
|
|
1192
|
-
experimental_content?: ({
|
|
1193
|
-
type: "text";
|
|
1194
|
-
text: string;
|
|
1195
|
-
} | {
|
|
1196
|
-
mimeType?: string | undefined;
|
|
1197
|
-
type: "image";
|
|
1198
|
-
data: string;
|
|
1199
|
-
})[] | undefined;
|
|
1200
|
-
type: "tool-result";
|
|
1201
|
-
toolCallId: string;
|
|
1202
|
-
toolName: string;
|
|
1203
|
-
} | {
|
|
1204
|
-
title?: string | undefined;
|
|
1205
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1206
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1207
|
-
id: string;
|
|
1208
|
-
type: "source";
|
|
1209
|
-
url: string;
|
|
1210
|
-
sourceType: "url";
|
|
1211
|
-
} | {
|
|
1212
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1213
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1214
|
-
filename?: string | undefined;
|
|
1215
|
-
id: string;
|
|
1216
|
-
title: string;
|
|
1217
|
-
type: "source";
|
|
1218
|
-
mediaType: string;
|
|
1219
|
-
sourceType: "document";
|
|
1220
|
-
} | {
|
|
1221
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1222
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1223
|
-
type: "tool-approval-request";
|
|
1224
|
-
toolCallId: string;
|
|
1225
|
-
approvalId: string;
|
|
1226
|
-
})[];
|
|
1227
|
-
} | {
|
|
1228
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1229
|
-
role: "tool";
|
|
1230
|
-
content: ({
|
|
1231
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1232
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1233
|
-
args?: any;
|
|
1234
|
-
providerExecuted?: boolean | undefined;
|
|
1235
|
-
output?: {
|
|
1236
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1237
|
-
type: "text";
|
|
1238
|
-
value: string;
|
|
1239
|
-
} | {
|
|
1240
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1241
|
-
type: "json";
|
|
1242
|
-
value: any;
|
|
1243
|
-
} | {
|
|
1244
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1245
|
-
type: "error-text";
|
|
1246
|
-
value: string;
|
|
1247
|
-
} | {
|
|
1248
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1249
|
-
type: "error-json";
|
|
1250
|
-
value: any;
|
|
1251
|
-
} | {
|
|
1252
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1253
|
-
reason?: string | undefined;
|
|
1254
|
-
type: "execution-denied";
|
|
1255
|
-
} | {
|
|
1256
|
-
type: "content";
|
|
1257
|
-
value: ({
|
|
1258
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1259
|
-
type: "text";
|
|
1260
|
-
text: string;
|
|
1261
|
-
} | {
|
|
1262
|
-
type: "media";
|
|
1263
|
-
mediaType: string;
|
|
1264
|
-
data: string;
|
|
1265
|
-
} | {
|
|
1266
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1267
|
-
filename?: string | undefined;
|
|
1268
|
-
type: "file-data";
|
|
1269
|
-
mediaType: string;
|
|
1270
|
-
data: string;
|
|
1271
|
-
} | {
|
|
1272
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1273
|
-
type: "file-url";
|
|
1274
|
-
url: string;
|
|
1275
|
-
} | {
|
|
1276
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1277
|
-
type: "file-id";
|
|
1278
|
-
fileId: string | Record<string, string>;
|
|
1279
|
-
} | {
|
|
1280
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1281
|
-
type: "image-data";
|
|
1282
|
-
mediaType: string;
|
|
1283
|
-
data: string;
|
|
1284
|
-
} | {
|
|
1285
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1286
|
-
type: "image-url";
|
|
1287
|
-
url: string;
|
|
1288
|
-
} | {
|
|
1289
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1290
|
-
type: "image-file-id";
|
|
1291
|
-
fileId: string | Record<string, string>;
|
|
1292
|
-
} | {
|
|
1293
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1294
|
-
type: "custom";
|
|
1295
|
-
})[];
|
|
1296
|
-
} | undefined;
|
|
1297
|
-
result?: any;
|
|
1298
|
-
isError?: boolean | undefined;
|
|
1299
|
-
experimental_content?: ({
|
|
1300
|
-
type: "text";
|
|
1301
|
-
text: string;
|
|
1302
|
-
} | {
|
|
1303
|
-
mimeType?: string | undefined;
|
|
1304
|
-
type: "image";
|
|
1305
|
-
data: string;
|
|
1306
|
-
})[] | undefined;
|
|
1307
|
-
type: "tool-result";
|
|
1308
|
-
toolCallId: string;
|
|
1309
|
-
toolName: string;
|
|
1310
|
-
} | {
|
|
1311
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1312
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1313
|
-
providerExecuted?: boolean | undefined;
|
|
1314
|
-
reason?: string | undefined;
|
|
1315
|
-
type: "tool-approval-response";
|
|
1316
|
-
approvalId: string;
|
|
1317
|
-
approved: boolean;
|
|
1318
|
-
})[];
|
|
1319
|
-
} | {
|
|
1320
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1321
|
-
role: "system";
|
|
1322
|
-
content: string;
|
|
1323
|
-
})[] | undefined;
|
|
1324
|
-
stream?: boolean | undefined;
|
|
1325
|
-
toolChoice?: "required" | "none" | "auto" | {
|
|
1326
|
-
type: "tool";
|
|
1327
|
-
toolName: string;
|
|
1328
|
-
} | undefined;
|
|
1329
|
-
maxSteps?: number | undefined;
|
|
1330
|
-
experimental_continueSteps?: boolean | undefined;
|
|
1331
|
-
prompt?: string | undefined;
|
|
1332
|
-
promptMessageId?: string | undefined;
|
|
1333
|
-
contextOptions?: {
|
|
1334
|
-
excludeToolMessages?: boolean | undefined;
|
|
1335
|
-
recentMessages?: number | undefined;
|
|
1336
|
-
searchOptions?: {
|
|
1337
|
-
textSearch?: boolean | undefined;
|
|
1338
|
-
vectorSearch?: boolean | undefined;
|
|
1339
|
-
vectorScoreThreshold?: number | undefined;
|
|
1340
|
-
messageRange?: {
|
|
1341
|
-
before: number;
|
|
1342
|
-
after: number;
|
|
1343
|
-
} | undefined;
|
|
1344
|
-
limit: number;
|
|
1345
|
-
} | undefined;
|
|
1346
|
-
searchOtherThreads?: boolean | undefined;
|
|
1347
|
-
} | undefined;
|
|
1348
|
-
storageOptions?: {
|
|
1349
|
-
saveMessages?: "all" | "none" | "promptAndOutput" | undefined;
|
|
1350
|
-
} | undefined;
|
|
1351
|
-
callSettings?: {
|
|
1352
|
-
headers?: Record<string, string> | undefined;
|
|
1353
|
-
maxOutputTokens?: number | undefined;
|
|
1354
|
-
temperature?: number | undefined;
|
|
1355
|
-
topP?: number | undefined;
|
|
1356
|
-
topK?: number | undefined;
|
|
1357
|
-
presencePenalty?: number | undefined;
|
|
1358
|
-
frequencyPenalty?: number | undefined;
|
|
1359
|
-
stopSequences?: string[] | undefined;
|
|
1360
|
-
seed?: number | undefined;
|
|
1361
|
-
maxRetries?: number | undefined;
|
|
1362
|
-
} | undefined;
|
|
1363
|
-
}, Promise<{
|
|
1364
|
-
text: string;
|
|
1365
|
-
promptMessageId: string | undefined;
|
|
1366
|
-
order: number | undefined;
|
|
1367
|
-
finishReason: import("ai").FinishReason;
|
|
1368
|
-
warnings: import("@ai-sdk/provider").SharedV3Warning[] | undefined;
|
|
1369
|
-
savedMessageIds: string[];
|
|
1370
|
-
}>>;
|
|
1371
|
-
/**
|
|
1372
|
-
* Create an action that generates an object out of this agent so you can call
|
|
1373
|
-
* it from workflows or other actions without a wrapping function.
|
|
1374
|
-
* @param spec Configuration for the agent acting as an action, including
|
|
1375
|
-
* the normal parameters to {@link generateObject}, plus {@link ContextOptions}
|
|
1376
|
-
* and stopWhen.
|
|
1377
|
-
*/
|
|
1378
|
-
asObjectAction<T, DataModel extends GenericDataModel>(objectArgs: GenerateObjectArgs<FlexibleSchema<T>> & Partial<AgentPrompt>, options?: Options & MaybeCustomCtx<CustomCtx, DataModel, AgentTools>): import("convex/server").RegisteredAction<"internal", {
|
|
1379
|
-
userId?: string | undefined;
|
|
1380
|
-
threadId?: string | undefined;
|
|
1381
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1382
|
-
system?: string | undefined;
|
|
1383
|
-
messages?: ({
|
|
1384
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1385
|
-
role: "user";
|
|
1386
|
-
content: string | ({
|
|
1387
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1388
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1389
|
-
type: "text";
|
|
1390
|
-
text: string;
|
|
1391
|
-
} | {
|
|
1392
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1393
|
-
mediaType?: string | undefined;
|
|
1394
|
-
mimeType?: string | undefined;
|
|
1395
|
-
type: "image";
|
|
1396
|
-
image: string | ArrayBuffer;
|
|
1397
|
-
} | {
|
|
1398
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1399
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1400
|
-
mediaType?: string | undefined;
|
|
1401
|
-
mimeType?: string | undefined;
|
|
1402
|
-
filename?: string | undefined;
|
|
1403
|
-
type: "file";
|
|
1404
|
-
data: string | ArrayBuffer;
|
|
1405
|
-
})[];
|
|
1406
|
-
} | {
|
|
1407
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1408
|
-
role: "assistant";
|
|
1409
|
-
content: string | ({
|
|
1410
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1411
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1412
|
-
type: "text";
|
|
1413
|
-
text: string;
|
|
1414
|
-
} | {
|
|
1415
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1416
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1417
|
-
mediaType?: string | undefined;
|
|
1418
|
-
mimeType?: string | undefined;
|
|
1419
|
-
filename?: string | undefined;
|
|
1420
|
-
type: "file";
|
|
1421
|
-
data: string | ArrayBuffer;
|
|
1422
|
-
} | {
|
|
1423
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1424
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1425
|
-
signature?: string | undefined;
|
|
1426
|
-
type: "reasoning";
|
|
1427
|
-
text: string;
|
|
1428
|
-
} | {
|
|
1429
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1430
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1431
|
-
type: "redacted-reasoning";
|
|
1432
|
-
data: string;
|
|
1433
|
-
} | {
|
|
1434
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1435
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1436
|
-
args?: any;
|
|
1437
|
-
providerExecuted?: boolean | undefined;
|
|
1438
|
-
type: "tool-call";
|
|
1439
|
-
toolCallId: string;
|
|
1440
|
-
toolName: string;
|
|
1441
|
-
input: any;
|
|
1442
|
-
} | {
|
|
1443
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1444
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1445
|
-
input?: any;
|
|
1446
|
-
providerExecuted?: boolean | undefined;
|
|
1447
|
-
type: "tool-call";
|
|
1448
|
-
toolCallId: string;
|
|
1449
|
-
toolName: string;
|
|
1450
|
-
args: any;
|
|
1451
|
-
} | {
|
|
1452
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1453
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1454
|
-
args?: any;
|
|
1455
|
-
providerExecuted?: boolean | undefined;
|
|
1456
|
-
output?: {
|
|
1457
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1458
|
-
type: "text";
|
|
1459
|
-
value: string;
|
|
1460
|
-
} | {
|
|
1461
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1462
|
-
type: "json";
|
|
1463
|
-
value: any;
|
|
1464
|
-
} | {
|
|
1465
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1466
|
-
type: "error-text";
|
|
1467
|
-
value: string;
|
|
1468
|
-
} | {
|
|
1469
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1470
|
-
type: "error-json";
|
|
1471
|
-
value: any;
|
|
1472
|
-
} | {
|
|
1473
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1474
|
-
reason?: string | undefined;
|
|
1475
|
-
type: "execution-denied";
|
|
1476
|
-
} | {
|
|
1477
|
-
type: "content";
|
|
1478
|
-
value: ({
|
|
1479
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1480
|
-
type: "text";
|
|
1481
|
-
text: string;
|
|
1482
|
-
} | {
|
|
1483
|
-
type: "media";
|
|
1484
|
-
mediaType: string;
|
|
1485
|
-
data: string;
|
|
1486
|
-
} | {
|
|
1487
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1488
|
-
filename?: string | undefined;
|
|
1489
|
-
type: "file-data";
|
|
1490
|
-
mediaType: string;
|
|
1491
|
-
data: string;
|
|
1492
|
-
} | {
|
|
1493
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1494
|
-
type: "file-url";
|
|
1495
|
-
url: string;
|
|
1496
|
-
} | {
|
|
1497
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1498
|
-
type: "file-id";
|
|
1499
|
-
fileId: string | Record<string, string>;
|
|
1500
|
-
} | {
|
|
1501
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1502
|
-
type: "image-data";
|
|
1503
|
-
mediaType: string;
|
|
1504
|
-
data: string;
|
|
1505
|
-
} | {
|
|
1506
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1507
|
-
type: "image-url";
|
|
1508
|
-
url: string;
|
|
1509
|
-
} | {
|
|
1510
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1511
|
-
type: "image-file-id";
|
|
1512
|
-
fileId: string | Record<string, string>;
|
|
1513
|
-
} | {
|
|
1514
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1515
|
-
type: "custom";
|
|
1516
|
-
})[];
|
|
1517
|
-
} | undefined;
|
|
1518
|
-
result?: any;
|
|
1519
|
-
isError?: boolean | undefined;
|
|
1520
|
-
experimental_content?: ({
|
|
1521
|
-
type: "text";
|
|
1522
|
-
text: string;
|
|
1523
|
-
} | {
|
|
1524
|
-
mimeType?: string | undefined;
|
|
1525
|
-
type: "image";
|
|
1526
|
-
data: string;
|
|
1527
|
-
})[] | undefined;
|
|
1528
|
-
type: "tool-result";
|
|
1529
|
-
toolCallId: string;
|
|
1530
|
-
toolName: string;
|
|
1531
|
-
} | {
|
|
1532
|
-
title?: string | undefined;
|
|
1533
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1534
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1535
|
-
id: string;
|
|
1536
|
-
type: "source";
|
|
1537
|
-
url: string;
|
|
1538
|
-
sourceType: "url";
|
|
1539
|
-
} | {
|
|
1540
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1541
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1542
|
-
filename?: string | undefined;
|
|
1543
|
-
id: string;
|
|
1544
|
-
title: string;
|
|
1545
|
-
type: "source";
|
|
1546
|
-
mediaType: string;
|
|
1547
|
-
sourceType: "document";
|
|
1548
|
-
} | {
|
|
1549
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1550
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1551
|
-
type: "tool-approval-request";
|
|
1552
|
-
toolCallId: string;
|
|
1553
|
-
approvalId: string;
|
|
1554
|
-
})[];
|
|
1555
|
-
} | {
|
|
1556
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1557
|
-
role: "tool";
|
|
1558
|
-
content: ({
|
|
1559
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1560
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1561
|
-
args?: any;
|
|
1562
|
-
providerExecuted?: boolean | undefined;
|
|
1563
|
-
output?: {
|
|
1564
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1565
|
-
type: "text";
|
|
1566
|
-
value: string;
|
|
1567
|
-
} | {
|
|
1568
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1569
|
-
type: "json";
|
|
1570
|
-
value: any;
|
|
1571
|
-
} | {
|
|
1572
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1573
|
-
type: "error-text";
|
|
1574
|
-
value: string;
|
|
1575
|
-
} | {
|
|
1576
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1577
|
-
type: "error-json";
|
|
1578
|
-
value: any;
|
|
1579
|
-
} | {
|
|
1580
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1581
|
-
reason?: string | undefined;
|
|
1582
|
-
type: "execution-denied";
|
|
1583
|
-
} | {
|
|
1584
|
-
type: "content";
|
|
1585
|
-
value: ({
|
|
1586
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1587
|
-
type: "text";
|
|
1588
|
-
text: string;
|
|
1589
|
-
} | {
|
|
1590
|
-
type: "media";
|
|
1591
|
-
mediaType: string;
|
|
1592
|
-
data: string;
|
|
1593
|
-
} | {
|
|
1594
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1595
|
-
filename?: string | undefined;
|
|
1596
|
-
type: "file-data";
|
|
1597
|
-
mediaType: string;
|
|
1598
|
-
data: string;
|
|
1599
|
-
} | {
|
|
1600
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1601
|
-
type: "file-url";
|
|
1602
|
-
url: string;
|
|
1603
|
-
} | {
|
|
1604
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1605
|
-
type: "file-id";
|
|
1606
|
-
fileId: string | Record<string, string>;
|
|
1607
|
-
} | {
|
|
1608
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1609
|
-
type: "image-data";
|
|
1610
|
-
mediaType: string;
|
|
1611
|
-
data: string;
|
|
1612
|
-
} | {
|
|
1613
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1614
|
-
type: "image-url";
|
|
1615
|
-
url: string;
|
|
1616
|
-
} | {
|
|
1617
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1618
|
-
type: "image-file-id";
|
|
1619
|
-
fileId: string | Record<string, string>;
|
|
1620
|
-
} | {
|
|
1621
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1622
|
-
type: "custom";
|
|
1623
|
-
})[];
|
|
1624
|
-
} | undefined;
|
|
1625
|
-
result?: any;
|
|
1626
|
-
isError?: boolean | undefined;
|
|
1627
|
-
experimental_content?: ({
|
|
1628
|
-
type: "text";
|
|
1629
|
-
text: string;
|
|
1630
|
-
} | {
|
|
1631
|
-
mimeType?: string | undefined;
|
|
1632
|
-
type: "image";
|
|
1633
|
-
data: string;
|
|
1634
|
-
})[] | undefined;
|
|
1635
|
-
type: "tool-result";
|
|
1636
|
-
toolCallId: string;
|
|
1637
|
-
toolName: string;
|
|
1638
|
-
} | {
|
|
1639
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1640
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1641
|
-
providerExecuted?: boolean | undefined;
|
|
1642
|
-
reason?: string | undefined;
|
|
1643
|
-
type: "tool-approval-response";
|
|
1644
|
-
approvalId: string;
|
|
1645
|
-
approved: boolean;
|
|
1646
|
-
})[];
|
|
1647
|
-
} | {
|
|
1648
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1649
|
-
role: "system";
|
|
1650
|
-
content: string;
|
|
1651
|
-
})[] | undefined;
|
|
1652
|
-
prompt?: string | undefined;
|
|
1653
|
-
promptMessageId?: string | undefined;
|
|
1654
|
-
contextOptions?: {
|
|
1655
|
-
excludeToolMessages?: boolean | undefined;
|
|
1656
|
-
recentMessages?: number | undefined;
|
|
1657
|
-
searchOptions?: {
|
|
1658
|
-
textSearch?: boolean | undefined;
|
|
1659
|
-
vectorSearch?: boolean | undefined;
|
|
1660
|
-
vectorScoreThreshold?: number | undefined;
|
|
1661
|
-
messageRange?: {
|
|
1662
|
-
before: number;
|
|
1663
|
-
after: number;
|
|
1664
|
-
} | undefined;
|
|
1665
|
-
limit: number;
|
|
1666
|
-
} | undefined;
|
|
1667
|
-
searchOtherThreads?: boolean | undefined;
|
|
1668
|
-
} | undefined;
|
|
1669
|
-
storageOptions?: {
|
|
1670
|
-
saveMessages?: "all" | "none" | "promptAndOutput" | undefined;
|
|
1671
|
-
} | undefined;
|
|
1672
|
-
callSettings?: {
|
|
1673
|
-
headers?: Record<string, string> | undefined;
|
|
1674
|
-
maxOutputTokens?: number | undefined;
|
|
1675
|
-
temperature?: number | undefined;
|
|
1676
|
-
topP?: number | undefined;
|
|
1677
|
-
topK?: number | undefined;
|
|
1678
|
-
presencePenalty?: number | undefined;
|
|
1679
|
-
frequencyPenalty?: number | undefined;
|
|
1680
|
-
stopSequences?: string[] | undefined;
|
|
1681
|
-
seed?: number | undefined;
|
|
1682
|
-
maxRetries?: number | undefined;
|
|
1683
|
-
} | undefined;
|
|
1684
|
-
}, Promise<{
|
|
1685
|
-
object: T;
|
|
1686
|
-
promptMessageId: string | undefined;
|
|
1687
|
-
order: number | undefined;
|
|
1688
|
-
finishReason: import("ai").FinishReason;
|
|
1689
|
-
warnings: import("@ai-sdk/provider").SharedV3Warning[] | undefined;
|
|
1690
|
-
savedMessageIds: string[];
|
|
1691
|
-
}>>;
|
|
1692
|
-
/**
|
|
1693
|
-
* @deprecated Use {@link saveMessages} directly instead.
|
|
1694
|
-
*/
|
|
1695
|
-
asSaveMessagesMutation(): import("convex/server").RegisteredMutation<"internal", {
|
|
1696
|
-
userId?: string | undefined;
|
|
1697
|
-
promptMessageId?: string | undefined;
|
|
1698
|
-
embeddings?: {
|
|
1699
|
-
model: string;
|
|
1700
|
-
vectors: (number[] | null)[];
|
|
1701
|
-
} | undefined;
|
|
1702
|
-
failPendingSteps?: boolean | undefined;
|
|
1703
|
-
threadId: string;
|
|
1704
|
-
messages: {
|
|
1705
|
-
status?: "pending" | "success" | "failed" | undefined;
|
|
1706
|
-
fileIds?: string[] | undefined;
|
|
1707
|
-
error?: string | undefined;
|
|
1708
|
-
model?: string | undefined;
|
|
1709
|
-
provider?: string | undefined;
|
|
1710
|
-
text?: string | undefined;
|
|
1711
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1712
|
-
reasoning?: string | undefined;
|
|
1713
|
-
usage?: {
|
|
1714
|
-
reasoningTokens?: number | undefined;
|
|
1715
|
-
cachedInputTokens?: number | undefined;
|
|
1716
|
-
promptTokens: number;
|
|
1717
|
-
completionTokens: number;
|
|
1718
|
-
totalTokens: number;
|
|
1719
|
-
} | undefined;
|
|
1720
|
-
sources?: ({
|
|
1721
|
-
title?: string | undefined;
|
|
1722
|
-
type?: "source" | undefined;
|
|
1723
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1724
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1725
|
-
id: string;
|
|
1726
|
-
url: string;
|
|
1727
|
-
sourceType: "url";
|
|
1728
|
-
} | {
|
|
1729
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1730
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1731
|
-
filename?: string | undefined;
|
|
1732
|
-
id: string;
|
|
1733
|
-
title: string;
|
|
1734
|
-
type: "source";
|
|
1735
|
-
mediaType: string;
|
|
1736
|
-
sourceType: "document";
|
|
1737
|
-
})[] | undefined;
|
|
1738
|
-
warnings?: ({
|
|
1739
|
-
details?: string | undefined;
|
|
1740
|
-
type: "unsupported-setting";
|
|
1741
|
-
setting: string;
|
|
1742
|
-
} | {
|
|
1743
|
-
details?: string | undefined;
|
|
1744
|
-
type: "unsupported-tool";
|
|
1745
|
-
tool: any;
|
|
1746
|
-
} | {
|
|
1747
|
-
type: "other";
|
|
1748
|
-
message: string;
|
|
1749
|
-
})[] | undefined;
|
|
1750
|
-
finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
|
|
1751
|
-
reasoningDetails?: ({
|
|
1752
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1753
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1754
|
-
signature?: string | undefined;
|
|
1755
|
-
type: "reasoning";
|
|
1756
|
-
text: string;
|
|
1757
|
-
} | {
|
|
1758
|
-
signature?: string | undefined;
|
|
1759
|
-
type: "text";
|
|
1760
|
-
text: string;
|
|
1761
|
-
} | {
|
|
1762
|
-
type: "redacted";
|
|
1763
|
-
data: string;
|
|
1764
|
-
})[] | undefined;
|
|
1765
|
-
message: {
|
|
1766
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1767
|
-
role: "user";
|
|
1768
|
-
content: string | ({
|
|
1769
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1770
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1771
|
-
type: "text";
|
|
1772
|
-
text: string;
|
|
1773
|
-
} | {
|
|
1774
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1775
|
-
mediaType?: string | undefined;
|
|
1776
|
-
mimeType?: string | undefined;
|
|
1777
|
-
type: "image";
|
|
1778
|
-
image: string | ArrayBuffer;
|
|
1779
|
-
} | {
|
|
1780
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1781
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1782
|
-
mediaType?: string | undefined;
|
|
1783
|
-
mimeType?: string | undefined;
|
|
1784
|
-
filename?: string | undefined;
|
|
1785
|
-
type: "file";
|
|
1786
|
-
data: string | ArrayBuffer;
|
|
1787
|
-
})[];
|
|
1788
|
-
} | {
|
|
1789
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1790
|
-
role: "assistant";
|
|
1791
|
-
content: string | ({
|
|
1792
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1793
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1794
|
-
type: "text";
|
|
1795
|
-
text: string;
|
|
1796
|
-
} | {
|
|
1797
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1798
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1799
|
-
mediaType?: string | undefined;
|
|
1800
|
-
mimeType?: string | undefined;
|
|
1801
|
-
filename?: string | undefined;
|
|
1802
|
-
type: "file";
|
|
1803
|
-
data: string | ArrayBuffer;
|
|
1804
|
-
} | {
|
|
1805
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1806
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1807
|
-
signature?: string | undefined;
|
|
1808
|
-
type: "reasoning";
|
|
1809
|
-
text: string;
|
|
1810
|
-
} | {
|
|
1811
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1812
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1813
|
-
type: "redacted-reasoning";
|
|
1814
|
-
data: string;
|
|
1815
|
-
} | {
|
|
1816
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1817
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1818
|
-
args?: any;
|
|
1819
|
-
providerExecuted?: boolean | undefined;
|
|
1820
|
-
type: "tool-call";
|
|
1821
|
-
toolCallId: string;
|
|
1822
|
-
toolName: string;
|
|
1823
|
-
input: any;
|
|
1824
|
-
} | {
|
|
1825
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1826
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1827
|
-
input?: any;
|
|
1828
|
-
providerExecuted?: boolean | undefined;
|
|
1829
|
-
type: "tool-call";
|
|
1830
|
-
toolCallId: string;
|
|
1831
|
-
toolName: string;
|
|
1832
|
-
args: any;
|
|
1833
|
-
} | {
|
|
1834
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1835
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1836
|
-
args?: any;
|
|
1837
|
-
providerExecuted?: boolean | undefined;
|
|
1838
|
-
output?: {
|
|
1839
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1840
|
-
type: "text";
|
|
1841
|
-
value: string;
|
|
1842
|
-
} | {
|
|
1843
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1844
|
-
type: "json";
|
|
1845
|
-
value: any;
|
|
1846
|
-
} | {
|
|
1847
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1848
|
-
type: "error-text";
|
|
1849
|
-
value: string;
|
|
1850
|
-
} | {
|
|
1851
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1852
|
-
type: "error-json";
|
|
1853
|
-
value: any;
|
|
1854
|
-
} | {
|
|
1855
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1856
|
-
reason?: string | undefined;
|
|
1857
|
-
type: "execution-denied";
|
|
1858
|
-
} | {
|
|
1859
|
-
type: "content";
|
|
1860
|
-
value: ({
|
|
1861
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1862
|
-
type: "text";
|
|
1863
|
-
text: string;
|
|
1864
|
-
} | {
|
|
1865
|
-
type: "media";
|
|
1866
|
-
mediaType: string;
|
|
1867
|
-
data: string;
|
|
1868
|
-
} | {
|
|
1869
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1870
|
-
filename?: string | undefined;
|
|
1871
|
-
type: "file-data";
|
|
1872
|
-
mediaType: string;
|
|
1873
|
-
data: string;
|
|
1874
|
-
} | {
|
|
1875
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1876
|
-
type: "file-url";
|
|
1877
|
-
url: string;
|
|
1878
|
-
} | {
|
|
1879
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1880
|
-
type: "file-id";
|
|
1881
|
-
fileId: string | Record<string, string>;
|
|
1882
|
-
} | {
|
|
1883
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1884
|
-
type: "image-data";
|
|
1885
|
-
mediaType: string;
|
|
1886
|
-
data: string;
|
|
1887
|
-
} | {
|
|
1888
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1889
|
-
type: "image-url";
|
|
1890
|
-
url: string;
|
|
1891
|
-
} | {
|
|
1892
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1893
|
-
type: "image-file-id";
|
|
1894
|
-
fileId: string | Record<string, string>;
|
|
1895
|
-
} | {
|
|
1896
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1897
|
-
type: "custom";
|
|
1898
|
-
})[];
|
|
1899
|
-
} | undefined;
|
|
1900
|
-
result?: any;
|
|
1901
|
-
isError?: boolean | undefined;
|
|
1902
|
-
experimental_content?: ({
|
|
1903
|
-
type: "text";
|
|
1904
|
-
text: string;
|
|
1905
|
-
} | {
|
|
1906
|
-
mimeType?: string | undefined;
|
|
1907
|
-
type: "image";
|
|
1908
|
-
data: string;
|
|
1909
|
-
})[] | undefined;
|
|
1910
|
-
type: "tool-result";
|
|
1911
|
-
toolCallId: string;
|
|
1912
|
-
toolName: string;
|
|
1913
|
-
} | {
|
|
1914
|
-
title?: string | undefined;
|
|
1915
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1916
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1917
|
-
id: string;
|
|
1918
|
-
type: "source";
|
|
1919
|
-
url: string;
|
|
1920
|
-
sourceType: "url";
|
|
1921
|
-
} | {
|
|
1922
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1923
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1924
|
-
filename?: string | undefined;
|
|
1925
|
-
id: string;
|
|
1926
|
-
title: string;
|
|
1927
|
-
type: "source";
|
|
1928
|
-
mediaType: string;
|
|
1929
|
-
sourceType: "document";
|
|
1930
|
-
} | {
|
|
1931
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1932
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1933
|
-
type: "tool-approval-request";
|
|
1934
|
-
toolCallId: string;
|
|
1935
|
-
approvalId: string;
|
|
1936
|
-
})[];
|
|
1937
|
-
} | {
|
|
1938
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1939
|
-
role: "tool";
|
|
1940
|
-
content: ({
|
|
1941
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1942
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
1943
|
-
args?: any;
|
|
1944
|
-
providerExecuted?: boolean | undefined;
|
|
1945
|
-
output?: {
|
|
1946
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1947
|
-
type: "text";
|
|
1948
|
-
value: string;
|
|
1949
|
-
} | {
|
|
1950
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1951
|
-
type: "json";
|
|
1952
|
-
value: any;
|
|
1953
|
-
} | {
|
|
1954
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1955
|
-
type: "error-text";
|
|
1956
|
-
value: string;
|
|
1957
|
-
} | {
|
|
1958
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1959
|
-
type: "error-json";
|
|
1960
|
-
value: any;
|
|
1961
|
-
} | {
|
|
1962
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1963
|
-
reason?: string | undefined;
|
|
1964
|
-
type: "execution-denied";
|
|
1965
|
-
} | {
|
|
1966
|
-
type: "content";
|
|
1967
|
-
value: ({
|
|
1968
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1969
|
-
type: "text";
|
|
1970
|
-
text: string;
|
|
1971
|
-
} | {
|
|
1972
|
-
type: "media";
|
|
1973
|
-
mediaType: string;
|
|
1974
|
-
data: string;
|
|
1975
|
-
} | {
|
|
1976
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1977
|
-
filename?: string | undefined;
|
|
1978
|
-
type: "file-data";
|
|
1979
|
-
mediaType: string;
|
|
1980
|
-
data: string;
|
|
1981
|
-
} | {
|
|
1982
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1983
|
-
type: "file-url";
|
|
1984
|
-
url: string;
|
|
1985
|
-
} | {
|
|
1986
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1987
|
-
type: "file-id";
|
|
1988
|
-
fileId: string | Record<string, string>;
|
|
1989
|
-
} | {
|
|
1990
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1991
|
-
type: "image-data";
|
|
1992
|
-
mediaType: string;
|
|
1993
|
-
data: string;
|
|
1994
|
-
} | {
|
|
1995
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
1996
|
-
type: "image-url";
|
|
1997
|
-
url: string;
|
|
1998
|
-
} | {
|
|
1999
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
2000
|
-
type: "image-file-id";
|
|
2001
|
-
fileId: string | Record<string, string>;
|
|
2002
|
-
} | {
|
|
2003
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
2004
|
-
type: "custom";
|
|
2005
|
-
})[];
|
|
2006
|
-
} | undefined;
|
|
2007
|
-
result?: any;
|
|
2008
|
-
isError?: boolean | undefined;
|
|
2009
|
-
experimental_content?: ({
|
|
2010
|
-
type: "text";
|
|
2011
|
-
text: string;
|
|
2012
|
-
} | {
|
|
2013
|
-
mimeType?: string | undefined;
|
|
2014
|
-
type: "image";
|
|
2015
|
-
data: string;
|
|
2016
|
-
})[] | undefined;
|
|
2017
|
-
type: "tool-result";
|
|
2018
|
-
toolCallId: string;
|
|
2019
|
-
toolName: string;
|
|
2020
|
-
} | {
|
|
2021
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
2022
|
-
providerMetadata?: Record<string, Record<string, any>> | undefined;
|
|
2023
|
-
providerExecuted?: boolean | undefined;
|
|
2024
|
-
reason?: string | undefined;
|
|
2025
|
-
type: "tool-approval-response";
|
|
2026
|
-
approvalId: string;
|
|
2027
|
-
approved: boolean;
|
|
2028
|
-
})[];
|
|
2029
|
-
} | {
|
|
2030
|
-
providerOptions?: Record<string, Record<string, any>> | undefined;
|
|
2031
|
-
role: "system";
|
|
2032
|
-
content: string;
|
|
2033
|
-
};
|
|
2034
|
-
}[];
|
|
2035
|
-
}, Promise<{
|
|
2036
|
-
lastMessageId: string;
|
|
2037
|
-
messages: {
|
|
2038
|
-
order: number;
|
|
2039
|
-
stepOrder: number;
|
|
2040
|
-
_id: string;
|
|
2041
|
-
}[];
|
|
2042
|
-
}>>;
|
|
2043
|
-
}
|
|
2044
|
-
//# sourceMappingURL=index.d.ts.map
|