ai 7.0.92 → 7.0.93
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/CHANGELOG.md +16 -0
- package/dist/index.d.ts +176 -152
- package/dist/index.js +132 -16
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +2 -2
- package/dist/internal/index.js.map +1 -1
- package/docs/02-foundations/02-providers-and-models.mdx +1 -0
- package/docs/03-agents/04-loop-control.mdx +5 -3
- package/docs/03-agents/07-workflow-agent.mdx +27 -6
- package/docs/03-ai-sdk-core/10-generating-structured-data.mdx +15 -3
- package/docs/03-ai-sdk-core/16-mcp-tools.mdx +64 -1
- package/docs/03-ai-sdk-core/35-image-generation.mdx +7 -0
- package/docs/03-ai-sdk-core/36-transcription.mdx +36 -35
- package/docs/03-ai-sdk-harnesses/02-harness-agent.mdx +36 -0
- package/docs/04-ai-sdk-ui/20-streaming-data.mdx +11 -6
- package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +14 -0
- package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +15 -1
- package/docs/07-reference/01-ai-sdk-core/28-output.mdx +27 -1
- package/docs/07-reference/02-ai-sdk-ui/01-use-chat.mdx +1 -1
- package/docs/07-reference/02-ai-sdk-ui/40-create-ui-message-stream.mdx +4 -0
- package/docs/07-reference/02-ai-sdk-ui/41-create-ui-message-stream-response.mdx +6 -1
- package/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +42 -28
- package/docs/07-reference/05-ai-sdk-errors/ai-no-image-generated-error.mdx +7 -0
- package/package.json +6 -6
- package/src/agent/tool-loop-agent-settings.ts +15 -0
- package/src/embed/embed-many.ts +27 -2
- package/src/error/no-image-generated-error.ts +9 -0
- package/src/generate-image/generate-image.ts +1 -1
- package/src/generate-text/output.ts +111 -1
- package/src/ui/chat.ts +1 -1
- package/src/ui/convert-to-model-messages.ts +8 -2
- package/src/ui/validate-ui-messages.ts +14 -0
- package/src/util/data-url.ts +1 -1
- package/src/util/merge-abort-signals.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 7.0.93
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- df6c009: fix(ai): use new message ID when replacing a message in `sendMessage`
|
|
8
|
+
- 6ee74a3: fix(ai): preserve tool part titles when validating UI messages
|
|
9
|
+
- f13d371: fix(ai): preserve provider metadata when converting failed tool calls
|
|
10
|
+
- d4485fe: feat(ai): support minItems and maxItems in array outputs
|
|
11
|
+
- 4f201cc: chore(ai): formally include already supported `onLanguageModelCallStart` and `onLanguageModelCallEnd` in `ToolLoopAgentSettings` type
|
|
12
|
+
- 8cdb2a7: fix(ai): decode text data URLs in Node.js
|
|
13
|
+
- 0f2281e: fix(ai): reject embedding responses whose count does not match the input values
|
|
14
|
+
- fc8e8ac: fix(ai): preserve image call diagnostics when no image is generated
|
|
15
|
+
- ee8391e: fix(ai): support abort signals when the global AbortSignal is not a constructor
|
|
16
|
+
- Updated dependencies [3cfc1fc]
|
|
17
|
+
- @ai-sdk/gateway@4.0.75
|
|
18
|
+
|
|
3
19
|
## 7.0.92
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -3814,13 +3814,23 @@ declare const object: <OBJECT>({ schema: inputSchema, name, description, }: {
|
|
|
3814
3814
|
* When the model generates a text response, it will return an array of elements.
|
|
3815
3815
|
*
|
|
3816
3816
|
* @param element - The schema of the array elements to generate.
|
|
3817
|
+
* @param minItems - Optional minimum number of elements to generate.
|
|
3818
|
+
* @param maxItems - Optional maximum number of elements to generate.
|
|
3817
3819
|
* @param name - Optional name of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema name.
|
|
3818
3820
|
* @param description - Optional description of the output that should be generated. Used by some providers for additional LLM guidance, e.g. via tool or schema description.
|
|
3819
3821
|
*
|
|
3820
3822
|
* @returns An output specification for generating an array of elements.
|
|
3821
3823
|
*/
|
|
3822
|
-
declare const array: <ELEMENT>({ element: inputElementSchema, name, description, }: {
|
|
3824
|
+
declare const array: <ELEMENT>({ element: inputElementSchema, minItems, maxItems, name, description, }: {
|
|
3823
3825
|
element: FlexibleSchema<ELEMENT>;
|
|
3826
|
+
/**
|
|
3827
|
+
* Optional minimum number of elements to generate.
|
|
3828
|
+
*/
|
|
3829
|
+
minItems?: number;
|
|
3830
|
+
/**
|
|
3831
|
+
* Optional maximum number of elements to generate.
|
|
3832
|
+
*/
|
|
3833
|
+
maxItems?: number;
|
|
3824
3834
|
/**
|
|
3825
3835
|
* Optional name of the output that should be generated.
|
|
3826
3836
|
* Used by some providers for additional LLM guidance, e.g. via tool or schema name.
|
|
@@ -5156,6 +5166,15 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, RUN
|
|
|
5156
5166
|
* @deprecated Use `onStepStart` instead.
|
|
5157
5167
|
*/
|
|
5158
5168
|
experimental_onStepStart?: GenerateTextOnStepStartCallback<NoInfer<TOOLS>, NoInfer<RUNTIME_CONTEXT>, NoInfer<OUTPUT>>;
|
|
5169
|
+
/**
|
|
5170
|
+
* Callback that is called immediately before the provider model call begins.
|
|
5171
|
+
*/
|
|
5172
|
+
onLanguageModelCallStart?: OnLanguageModelCallStartCallback;
|
|
5173
|
+
/**
|
|
5174
|
+
* Callback that is called after the model response has been normalized and parsed,
|
|
5175
|
+
* but before any client-side tool execution begins.
|
|
5176
|
+
*/
|
|
5177
|
+
onLanguageModelCallEnd?: OnLanguageModelCallEndCallback<NoInfer<TOOLS>>;
|
|
5159
5178
|
/**
|
|
5160
5179
|
* Callback that is called before each tool execution begins.
|
|
5161
5180
|
*/
|
|
@@ -6839,6 +6858,156 @@ declare class MissingToolResultsError extends AISDKError {
|
|
|
6839
6858
|
static isInstance(error: unknown): error is MissingToolResultsError;
|
|
6840
6859
|
}
|
|
6841
6860
|
|
|
6861
|
+
type ActiveToolSubset<TOOLS extends ToolSet | undefined, ACTIVE_TOOL_NAMES extends ActiveTools<NonNullable<TOOLS>>> = TOOLS extends undefined ? undefined : [ACTIVE_TOOL_NAMES] extends [NonNullable<ActiveTools<NonNullable<TOOLS>>>] ? Pick<NonNullable<TOOLS>, ACTIVE_TOOL_NAMES[number]> : TOOLS;
|
|
6862
|
+
/**
|
|
6863
|
+
* Filters the tools to only include the active tools.
|
|
6864
|
+
* When activeTools is provided, we only include the tools that are in the list.
|
|
6865
|
+
*
|
|
6866
|
+
* @param tools - The tools to filter.
|
|
6867
|
+
* @param activeTools - The active tools to include.
|
|
6868
|
+
* @returns The filtered tools.
|
|
6869
|
+
*/
|
|
6870
|
+
declare function filterActiveTools<TOOLS extends ToolSet | undefined, ACTIVE_TOOL_NAMES extends ActiveTools<NonNullable<TOOLS>>>({ tools, activeTools, }: {
|
|
6871
|
+
tools: TOOLS;
|
|
6872
|
+
activeTools: ACTIVE_TOOL_NAMES;
|
|
6873
|
+
}): ActiveToolSubset<TOOLS, ACTIVE_TOOL_NAMES>;
|
|
6874
|
+
|
|
6875
|
+
/**
|
|
6876
|
+
* Prunes model messages from a list of model messages.
|
|
6877
|
+
*
|
|
6878
|
+
* @param messages - The list of model messages to prune.
|
|
6879
|
+
* @param reasoning - How to remove reasoning content from assistant messages. Default is `'none'`.
|
|
6880
|
+
* @param toolCalls - How to prune tool call/results/approval content. Default is `[]`.
|
|
6881
|
+
* @param emptyMessages - Whether to keep or remove messages whose content is empty after pruning. Default is `'remove'`.
|
|
6882
|
+
*
|
|
6883
|
+
* @returns The pruned list of model messages.
|
|
6884
|
+
*/
|
|
6885
|
+
declare function pruneMessages({ messages, reasoning, toolCalls, emptyMessages, }: {
|
|
6886
|
+
messages: ModelMessage[];
|
|
6887
|
+
reasoning?: 'all' | 'before-last-message' | 'none';
|
|
6888
|
+
toolCalls?: 'all' | 'before-last-message' | `before-last-${number}-messages` | 'none' | Array<{
|
|
6889
|
+
type: 'all' | 'before-last-message' | `before-last-${number}-messages`;
|
|
6890
|
+
tools?: string[];
|
|
6891
|
+
}>;
|
|
6892
|
+
emptyMessages?: 'keep' | 'remove';
|
|
6893
|
+
}): ModelMessage[];
|
|
6894
|
+
|
|
6895
|
+
/**
|
|
6896
|
+
* Detects the first chunk in a buffer.
|
|
6897
|
+
*
|
|
6898
|
+
* @param buffer - The buffer to detect the first chunk in.
|
|
6899
|
+
*
|
|
6900
|
+
* @returns The first detected chunk, or `undefined` if no chunk was detected.
|
|
6901
|
+
*/
|
|
6902
|
+
type ChunkDetector = (buffer: string) => string | undefined | null;
|
|
6903
|
+
/**
|
|
6904
|
+
* Smooths text and reasoning streaming output.
|
|
6905
|
+
*
|
|
6906
|
+
* @param delayInMs - The delay in milliseconds between each chunk. Defaults to 10ms. Can be set to `null` to skip the delay. The delay is skipped while the document is hidden (e.g. browser background tabs), where timer throttling would otherwise stall the stream.
|
|
6907
|
+
* @param chunking - Controls how the text is chunked for streaming. Use "word" to stream word by word (default), "line" to stream line by line, provide a custom RegExp pattern that does not match the empty string for custom chunking, provide an Intl.Segmenter for locale-aware word segmentation (recommended for CJK languages), or provide a custom ChunkDetector function.
|
|
6908
|
+
*
|
|
6909
|
+
* @returns A transform stream that smooths text streaming output.
|
|
6910
|
+
*/
|
|
6911
|
+
declare function smoothStream<TOOLS extends ToolSet>({ delayInMs, chunking, _internal: { delay }, }?: {
|
|
6912
|
+
delayInMs?: number | null;
|
|
6913
|
+
chunking?: 'word' | 'line' | RegExp | ChunkDetector | Intl.Segmenter;
|
|
6914
|
+
/**
|
|
6915
|
+
* Internal. For test use only. May change without notice.
|
|
6916
|
+
*/
|
|
6917
|
+
_internal?: {
|
|
6918
|
+
delay?: (delayInMs: number | null) => Promise<void>;
|
|
6919
|
+
};
|
|
6920
|
+
}): (options: {
|
|
6921
|
+
tools: TOOLS;
|
|
6922
|
+
}) => TransformStream<TextStreamPart<TOOLS>, TextStreamPart<TOOLS>>;
|
|
6923
|
+
|
|
6924
|
+
/**
|
|
6925
|
+
* Fingerprint the server-controlled, security-relevant fields of each tool in a
|
|
6926
|
+
* `ToolSet`: `description` (string form only), the resolved input JSON schema,
|
|
6927
|
+
* and `title`. Returns a map of tool name to a stable digest.
|
|
6928
|
+
*
|
|
6929
|
+
* Capture a baseline at trust time (first connect, human-reviewed) and compare
|
|
6930
|
+
* later fetches with {@link detectToolDrift} to catch MCP tool-definition drift
|
|
6931
|
+
* ("rug pull"). Baseline storage and the drift response are the app's concern.
|
|
6932
|
+
*/
|
|
6933
|
+
declare function fingerprintTools(tools: ToolSet): Promise<Record<string, string>>;
|
|
6934
|
+
/**
|
|
6935
|
+
* Pure diff of two fingerprint maps produced by {@link fingerprintTools}.
|
|
6936
|
+
* `added`/`removed` are tools present in only one map; `changed` are tools whose
|
|
6937
|
+
* pinned definition differs. Uses own-property lookups so a tool literally named
|
|
6938
|
+
* `constructor` or `toString` diffs correctly.
|
|
6939
|
+
*/
|
|
6940
|
+
declare function detectToolDrift(current: Record<string, string>, baseline: Record<string, string>): {
|
|
6941
|
+
added: string[];
|
|
6942
|
+
removed: string[];
|
|
6943
|
+
changed: string[];
|
|
6944
|
+
};
|
|
6945
|
+
|
|
6946
|
+
/**
|
|
6947
|
+
* The result of one underlying image model call.
|
|
6948
|
+
*/
|
|
6949
|
+
interface GenerateImageCall {
|
|
6950
|
+
/**
|
|
6951
|
+
* The images generated by this call.
|
|
6952
|
+
*/
|
|
6953
|
+
readonly images: Array<GeneratedFile>;
|
|
6954
|
+
/**
|
|
6955
|
+
* Provider-specific metadata for this call.
|
|
6956
|
+
*/
|
|
6957
|
+
readonly providerMetadata?: ImageModelV4ProviderMetadata;
|
|
6958
|
+
/**
|
|
6959
|
+
* Response metadata from the provider.
|
|
6960
|
+
*/
|
|
6961
|
+
readonly response: ImageModelResponseMetadata;
|
|
6962
|
+
/**
|
|
6963
|
+
* Warnings for this call, e.g. unsupported settings.
|
|
6964
|
+
*/
|
|
6965
|
+
readonly warnings: Array<Warning>;
|
|
6966
|
+
/**
|
|
6967
|
+
* Token usage for this call, if reported by the provider.
|
|
6968
|
+
*/
|
|
6969
|
+
readonly usage?: ImageModelUsage;
|
|
6970
|
+
}
|
|
6971
|
+
/**
|
|
6972
|
+
* The result of a `generateImage` call.
|
|
6973
|
+
* It contains the images and additional information.
|
|
6974
|
+
*/
|
|
6975
|
+
interface GenerateImageResult {
|
|
6976
|
+
/**
|
|
6977
|
+
* The first image that was generated.
|
|
6978
|
+
*/
|
|
6979
|
+
readonly image: GeneratedFile;
|
|
6980
|
+
/**
|
|
6981
|
+
* The images that were generated.
|
|
6982
|
+
*/
|
|
6983
|
+
readonly images: Array<GeneratedFile>;
|
|
6984
|
+
/**
|
|
6985
|
+
* The results of the underlying image model calls.
|
|
6986
|
+
*/
|
|
6987
|
+
readonly calls: Array<GenerateImageCall>;
|
|
6988
|
+
/**
|
|
6989
|
+
* Warnings for the call, e.g. unsupported settings.
|
|
6990
|
+
*/
|
|
6991
|
+
readonly warnings: Array<Warning>;
|
|
6992
|
+
/**
|
|
6993
|
+
* Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
|
|
6994
|
+
*
|
|
6995
|
+
* @deprecated Use `calls` to preserve each response with its corresponding images, metadata, warnings, and usage.
|
|
6996
|
+
*/
|
|
6997
|
+
readonly responses: Array<ImageModelResponseMetadata>;
|
|
6998
|
+
/**
|
|
6999
|
+
* Provider-specific metadata. They are passed through from the provider to the AI SDK and enable provider-specific
|
|
7000
|
+
* results that can be fully encapsulated in the provider.
|
|
7001
|
+
*
|
|
7002
|
+
* @deprecated Use the provider metadata in `calls` or on individual `images` to preserve its scope.
|
|
7003
|
+
*/
|
|
7004
|
+
readonly providerMetadata: ImageModelProviderMetadata;
|
|
7005
|
+
/**
|
|
7006
|
+
* Combined token usage across all underlying provider calls for this image generation.
|
|
7007
|
+
*/
|
|
7008
|
+
readonly usage: ImageModelUsage;
|
|
7009
|
+
}
|
|
7010
|
+
|
|
6842
7011
|
declare const symbol$f: unique symbol;
|
|
6843
7012
|
/**
|
|
6844
7013
|
* Thrown when no image could be generated. This can have multiple causes:
|
|
@@ -6848,13 +7017,18 @@ declare const symbol$f: unique symbol;
|
|
|
6848
7017
|
*/
|
|
6849
7018
|
declare class NoImageGeneratedError extends AISDKError {
|
|
6850
7019
|
private readonly [symbol$f];
|
|
7020
|
+
/**
|
|
7021
|
+
* The results of the underlying image model calls.
|
|
7022
|
+
*/
|
|
7023
|
+
readonly calls: Array<GenerateImageCall> | undefined;
|
|
6851
7024
|
/**
|
|
6852
7025
|
* The response metadata for each call.
|
|
6853
7026
|
*/
|
|
6854
7027
|
readonly responses: Array<ImageModelResponseMetadata> | undefined;
|
|
6855
|
-
constructor({ message, cause, responses, }: {
|
|
7028
|
+
constructor({ message, cause, calls, responses, }: {
|
|
6856
7029
|
message?: string;
|
|
6857
7030
|
cause?: Error;
|
|
7031
|
+
calls?: Array<GenerateImageCall>;
|
|
6858
7032
|
responses?: Array<ImageModelResponseMetadata>;
|
|
6859
7033
|
});
|
|
6860
7034
|
static isInstance(error: unknown): error is NoImageGeneratedError;
|
|
@@ -7212,156 +7386,6 @@ declare class RetryError extends AISDKError {
|
|
|
7212
7386
|
static isInstance(error: unknown): error is RetryError;
|
|
7213
7387
|
}
|
|
7214
7388
|
|
|
7215
|
-
type ActiveToolSubset<TOOLS extends ToolSet | undefined, ACTIVE_TOOL_NAMES extends ActiveTools<NonNullable<TOOLS>>> = TOOLS extends undefined ? undefined : [ACTIVE_TOOL_NAMES] extends [NonNullable<ActiveTools<NonNullable<TOOLS>>>] ? Pick<NonNullable<TOOLS>, ACTIVE_TOOL_NAMES[number]> : TOOLS;
|
|
7216
|
-
/**
|
|
7217
|
-
* Filters the tools to only include the active tools.
|
|
7218
|
-
* When activeTools is provided, we only include the tools that are in the list.
|
|
7219
|
-
*
|
|
7220
|
-
* @param tools - The tools to filter.
|
|
7221
|
-
* @param activeTools - The active tools to include.
|
|
7222
|
-
* @returns The filtered tools.
|
|
7223
|
-
*/
|
|
7224
|
-
declare function filterActiveTools<TOOLS extends ToolSet | undefined, ACTIVE_TOOL_NAMES extends ActiveTools<NonNullable<TOOLS>>>({ tools, activeTools, }: {
|
|
7225
|
-
tools: TOOLS;
|
|
7226
|
-
activeTools: ACTIVE_TOOL_NAMES;
|
|
7227
|
-
}): ActiveToolSubset<TOOLS, ACTIVE_TOOL_NAMES>;
|
|
7228
|
-
|
|
7229
|
-
/**
|
|
7230
|
-
* Prunes model messages from a list of model messages.
|
|
7231
|
-
*
|
|
7232
|
-
* @param messages - The list of model messages to prune.
|
|
7233
|
-
* @param reasoning - How to remove reasoning content from assistant messages. Default is `'none'`.
|
|
7234
|
-
* @param toolCalls - How to prune tool call/results/approval content. Default is `[]`.
|
|
7235
|
-
* @param emptyMessages - Whether to keep or remove messages whose content is empty after pruning. Default is `'remove'`.
|
|
7236
|
-
*
|
|
7237
|
-
* @returns The pruned list of model messages.
|
|
7238
|
-
*/
|
|
7239
|
-
declare function pruneMessages({ messages, reasoning, toolCalls, emptyMessages, }: {
|
|
7240
|
-
messages: ModelMessage[];
|
|
7241
|
-
reasoning?: 'all' | 'before-last-message' | 'none';
|
|
7242
|
-
toolCalls?: 'all' | 'before-last-message' | `before-last-${number}-messages` | 'none' | Array<{
|
|
7243
|
-
type: 'all' | 'before-last-message' | `before-last-${number}-messages`;
|
|
7244
|
-
tools?: string[];
|
|
7245
|
-
}>;
|
|
7246
|
-
emptyMessages?: 'keep' | 'remove';
|
|
7247
|
-
}): ModelMessage[];
|
|
7248
|
-
|
|
7249
|
-
/**
|
|
7250
|
-
* Detects the first chunk in a buffer.
|
|
7251
|
-
*
|
|
7252
|
-
* @param buffer - The buffer to detect the first chunk in.
|
|
7253
|
-
*
|
|
7254
|
-
* @returns The first detected chunk, or `undefined` if no chunk was detected.
|
|
7255
|
-
*/
|
|
7256
|
-
type ChunkDetector = (buffer: string) => string | undefined | null;
|
|
7257
|
-
/**
|
|
7258
|
-
* Smooths text and reasoning streaming output.
|
|
7259
|
-
*
|
|
7260
|
-
* @param delayInMs - The delay in milliseconds between each chunk. Defaults to 10ms. Can be set to `null` to skip the delay. The delay is skipped while the document is hidden (e.g. browser background tabs), where timer throttling would otherwise stall the stream.
|
|
7261
|
-
* @param chunking - Controls how the text is chunked for streaming. Use "word" to stream word by word (default), "line" to stream line by line, provide a custom RegExp pattern that does not match the empty string for custom chunking, provide an Intl.Segmenter for locale-aware word segmentation (recommended for CJK languages), or provide a custom ChunkDetector function.
|
|
7262
|
-
*
|
|
7263
|
-
* @returns A transform stream that smooths text streaming output.
|
|
7264
|
-
*/
|
|
7265
|
-
declare function smoothStream<TOOLS extends ToolSet>({ delayInMs, chunking, _internal: { delay }, }?: {
|
|
7266
|
-
delayInMs?: number | null;
|
|
7267
|
-
chunking?: 'word' | 'line' | RegExp | ChunkDetector | Intl.Segmenter;
|
|
7268
|
-
/**
|
|
7269
|
-
* Internal. For test use only. May change without notice.
|
|
7270
|
-
*/
|
|
7271
|
-
_internal?: {
|
|
7272
|
-
delay?: (delayInMs: number | null) => Promise<void>;
|
|
7273
|
-
};
|
|
7274
|
-
}): (options: {
|
|
7275
|
-
tools: TOOLS;
|
|
7276
|
-
}) => TransformStream<TextStreamPart<TOOLS>, TextStreamPart<TOOLS>>;
|
|
7277
|
-
|
|
7278
|
-
/**
|
|
7279
|
-
* Fingerprint the server-controlled, security-relevant fields of each tool in a
|
|
7280
|
-
* `ToolSet`: `description` (string form only), the resolved input JSON schema,
|
|
7281
|
-
* and `title`. Returns a map of tool name to a stable digest.
|
|
7282
|
-
*
|
|
7283
|
-
* Capture a baseline at trust time (first connect, human-reviewed) and compare
|
|
7284
|
-
* later fetches with {@link detectToolDrift} to catch MCP tool-definition drift
|
|
7285
|
-
* ("rug pull"). Baseline storage and the drift response are the app's concern.
|
|
7286
|
-
*/
|
|
7287
|
-
declare function fingerprintTools(tools: ToolSet): Promise<Record<string, string>>;
|
|
7288
|
-
/**
|
|
7289
|
-
* Pure diff of two fingerprint maps produced by {@link fingerprintTools}.
|
|
7290
|
-
* `added`/`removed` are tools present in only one map; `changed` are tools whose
|
|
7291
|
-
* pinned definition differs. Uses own-property lookups so a tool literally named
|
|
7292
|
-
* `constructor` or `toString` diffs correctly.
|
|
7293
|
-
*/
|
|
7294
|
-
declare function detectToolDrift(current: Record<string, string>, baseline: Record<string, string>): {
|
|
7295
|
-
added: string[];
|
|
7296
|
-
removed: string[];
|
|
7297
|
-
changed: string[];
|
|
7298
|
-
};
|
|
7299
|
-
|
|
7300
|
-
/**
|
|
7301
|
-
* The result of one underlying image model call.
|
|
7302
|
-
*/
|
|
7303
|
-
interface GenerateImageCall {
|
|
7304
|
-
/**
|
|
7305
|
-
* The images generated by this call.
|
|
7306
|
-
*/
|
|
7307
|
-
readonly images: Array<GeneratedFile>;
|
|
7308
|
-
/**
|
|
7309
|
-
* Provider-specific metadata for this call.
|
|
7310
|
-
*/
|
|
7311
|
-
readonly providerMetadata?: ImageModelV4ProviderMetadata;
|
|
7312
|
-
/**
|
|
7313
|
-
* Response metadata from the provider.
|
|
7314
|
-
*/
|
|
7315
|
-
readonly response: ImageModelResponseMetadata;
|
|
7316
|
-
/**
|
|
7317
|
-
* Warnings for this call, e.g. unsupported settings.
|
|
7318
|
-
*/
|
|
7319
|
-
readonly warnings: Array<Warning>;
|
|
7320
|
-
/**
|
|
7321
|
-
* Token usage for this call, if reported by the provider.
|
|
7322
|
-
*/
|
|
7323
|
-
readonly usage?: ImageModelUsage;
|
|
7324
|
-
}
|
|
7325
|
-
/**
|
|
7326
|
-
* The result of a `generateImage` call.
|
|
7327
|
-
* It contains the images and additional information.
|
|
7328
|
-
*/
|
|
7329
|
-
interface GenerateImageResult {
|
|
7330
|
-
/**
|
|
7331
|
-
* The first image that was generated.
|
|
7332
|
-
*/
|
|
7333
|
-
readonly image: GeneratedFile;
|
|
7334
|
-
/**
|
|
7335
|
-
* The images that were generated.
|
|
7336
|
-
*/
|
|
7337
|
-
readonly images: Array<GeneratedFile>;
|
|
7338
|
-
/**
|
|
7339
|
-
* The results of the underlying image model calls.
|
|
7340
|
-
*/
|
|
7341
|
-
readonly calls: Array<GenerateImageCall>;
|
|
7342
|
-
/**
|
|
7343
|
-
* Warnings for the call, e.g. unsupported settings.
|
|
7344
|
-
*/
|
|
7345
|
-
readonly warnings: Array<Warning>;
|
|
7346
|
-
/**
|
|
7347
|
-
* Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
|
|
7348
|
-
*
|
|
7349
|
-
* @deprecated Use `calls` to preserve each response with its corresponding images, metadata, warnings, and usage.
|
|
7350
|
-
*/
|
|
7351
|
-
readonly responses: Array<ImageModelResponseMetadata>;
|
|
7352
|
-
/**
|
|
7353
|
-
* Provider-specific metadata. They are passed through from the provider to the AI SDK and enable provider-specific
|
|
7354
|
-
* results that can be fully encapsulated in the provider.
|
|
7355
|
-
*
|
|
7356
|
-
* @deprecated Use the provider metadata in `calls` or on individual `images` to preserve its scope.
|
|
7357
|
-
*/
|
|
7358
|
-
readonly providerMetadata: ImageModelProviderMetadata;
|
|
7359
|
-
/**
|
|
7360
|
-
* Combined token usage across all underlying provider calls for this image generation.
|
|
7361
|
-
*/
|
|
7362
|
-
readonly usage: ImageModelUsage;
|
|
7363
|
-
}
|
|
7364
|
-
|
|
7365
7389
|
type GenerateImagePrompt = string | {
|
|
7366
7390
|
images: Array<DataContent>;
|
|
7367
7391
|
text?: string;
|