ai 6.0.133 → 6.0.135
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 +32 -20
- package/dist/index.d.mts +13 -160
- package/dist/index.d.ts +13 -160
- package/dist/index.js +15 -185
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -199
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/03-agents/02-building-agents.mdx +6 -48
- package/docs/03-ai-sdk-core/65-event-listeners.mdx +10 -213
- package/docs/07-reference/01-ai-sdk-core/05-embed.mdx +0 -135
- package/docs/07-reference/01-ai-sdk-core/06-embed-many.mdx +0 -139
- package/docs/07-reference/01-ai-sdk-core/15-agent.mdx +0 -25
- package/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +0 -475
- package/package.json +3 -7
- package/src/agent/agent.ts +1 -33
- package/src/agent/index.ts +0 -4
- package/src/agent/tool-loop-agent-settings.ts +0 -49
- package/src/agent/tool-loop-agent.ts +24 -84
- package/src/embed/embed-many.ts +1 -97
- package/src/embed/embed.ts +1 -77
- package/src/embed/index.ts +0 -1
- package/src/generate-object/generate-object.ts +2 -5
- package/src/generate-object/stream-object.ts +7 -8
- package/src/generate-text/callback-events.ts +5 -5
- package/src/generate-text/generate-text.ts +4 -3
- package/src/generate-text/step-result.ts +3 -3
- package/src/generate-text/stream-text.ts +4 -3
- package/src/registry/provider-registry.ts +1 -2
- package/src/telemetry/get-base-telemetry-attributes.ts +1 -3
- package/src/telemetry/telemetry-settings.ts +1 -2
- package/src/ui/direct-chat-transport.ts +1 -2
- package/src/ui/http-chat-transport.ts +3 -3
- package/src/embed/embed-events.ts +0 -104
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 6.0.135
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- df6a330: chore(ai): remove all experimental agent events
|
|
8
|
+
|
|
9
|
+
## 6.0.134
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ed6876b: chore(ai): remove all experimental embed events
|
|
14
|
+
|
|
3
15
|
## 6.0.133
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -980,13 +992,13 @@
|
|
|
980
992
|
Before
|
|
981
993
|
|
|
982
994
|
```ts
|
|
983
|
-
model.textEmbeddingModel(
|
|
995
|
+
model.textEmbeddingModel("my-model-id");
|
|
984
996
|
```
|
|
985
997
|
|
|
986
998
|
After
|
|
987
999
|
|
|
988
1000
|
```ts
|
|
989
|
-
model.embeddingModel(
|
|
1001
|
+
model.embeddingModel("my-model-id");
|
|
990
1002
|
```
|
|
991
1003
|
|
|
992
1004
|
- b67d224: Fixes an issue where `providerMetadata` and `providerExecuted` were lost when tool input validation failed
|
|
@@ -1009,15 +1021,15 @@
|
|
|
1009
1021
|
This change replaces
|
|
1010
1022
|
|
|
1011
1023
|
```ts
|
|
1012
|
-
import { experimental_createMCPClient } from
|
|
1013
|
-
import { Experimental_StdioMCPTransport } from
|
|
1024
|
+
import { experimental_createMCPClient } from "ai";
|
|
1025
|
+
import { Experimental_StdioMCPTransport } from "ai/mcp-stdio";
|
|
1014
1026
|
```
|
|
1015
1027
|
|
|
1016
1028
|
with
|
|
1017
1029
|
|
|
1018
1030
|
```ts
|
|
1019
|
-
import { experimental_createMCPClient } from
|
|
1020
|
-
import { Experimental_StdioMCPTransport } from
|
|
1031
|
+
import { experimental_createMCPClient } from "@ai-sdk/mcp";
|
|
1032
|
+
import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio";
|
|
1021
1033
|
```
|
|
1022
1034
|
|
|
1023
1035
|
- 90e5bdd: chore(ai): restructure agent files
|
|
@@ -1537,13 +1549,13 @@
|
|
|
1537
1549
|
Before
|
|
1538
1550
|
|
|
1539
1551
|
```ts
|
|
1540
|
-
model.textEmbeddingModel(
|
|
1552
|
+
model.textEmbeddingModel("my-model-id");
|
|
1541
1553
|
```
|
|
1542
1554
|
|
|
1543
1555
|
After
|
|
1544
1556
|
|
|
1545
1557
|
```ts
|
|
1546
|
-
model.embeddingModel(
|
|
1558
|
+
model.embeddingModel("my-model-id");
|
|
1547
1559
|
```
|
|
1548
1560
|
|
|
1549
1561
|
- Updated dependencies [8d9e8ad]
|
|
@@ -1890,15 +1902,15 @@
|
|
|
1890
1902
|
This change replaces
|
|
1891
1903
|
|
|
1892
1904
|
```ts
|
|
1893
|
-
import { experimental_createMCPClient } from
|
|
1894
|
-
import { Experimental_StdioMCPTransport } from
|
|
1905
|
+
import { experimental_createMCPClient } from "ai";
|
|
1906
|
+
import { Experimental_StdioMCPTransport } from "ai/mcp-stdio";
|
|
1895
1907
|
```
|
|
1896
1908
|
|
|
1897
1909
|
with
|
|
1898
1910
|
|
|
1899
1911
|
```ts
|
|
1900
|
-
import { experimental_createMCPClient } from
|
|
1901
|
-
import { Experimental_StdioMCPTransport } from
|
|
1912
|
+
import { experimental_createMCPClient } from "@ai-sdk/mcp";
|
|
1913
|
+
import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio";
|
|
1902
1914
|
```
|
|
1903
1915
|
|
|
1904
1916
|
## 6.0.0-beta.71
|
|
@@ -2817,7 +2829,7 @@
|
|
|
2817
2829
|
|
|
2818
2830
|
```js
|
|
2819
2831
|
await generateImage({
|
|
2820
|
-
model: luma.image(
|
|
2832
|
+
model: luma.image("photon-flash-1", {
|
|
2821
2833
|
maxImagesPerCall: 5,
|
|
2822
2834
|
pollIntervalMillis: 500,
|
|
2823
2835
|
}),
|
|
@@ -2830,7 +2842,7 @@
|
|
|
2830
2842
|
|
|
2831
2843
|
```js
|
|
2832
2844
|
await generateImage({
|
|
2833
|
-
model: luma.image(
|
|
2845
|
+
model: luma.image("photon-flash-1"),
|
|
2834
2846
|
prompt,
|
|
2835
2847
|
n: 10,
|
|
2836
2848
|
maxImagesPerCall: 5,
|
|
@@ -3030,10 +3042,10 @@
|
|
|
3030
3042
|
The `experimental_generateImage` method from the `ai` package now returnes revised prompts for OpenAI's image models.
|
|
3031
3043
|
|
|
3032
3044
|
```js
|
|
3033
|
-
const prompt =
|
|
3045
|
+
const prompt = "Santa Claus driving a Cadillac";
|
|
3034
3046
|
|
|
3035
3047
|
const { providerMetadata } = await experimental_generateImage({
|
|
3036
|
-
model: openai.image(
|
|
3048
|
+
model: openai.image("dall-e-3"),
|
|
3037
3049
|
prompt,
|
|
3038
3050
|
});
|
|
3039
3051
|
|
|
@@ -3696,7 +3708,7 @@
|
|
|
3696
3708
|
|
|
3697
3709
|
```js
|
|
3698
3710
|
await generateImage({
|
|
3699
|
-
model: luma.image(
|
|
3711
|
+
model: luma.image("photon-flash-1", {
|
|
3700
3712
|
maxImagesPerCall: 5,
|
|
3701
3713
|
pollIntervalMillis: 500,
|
|
3702
3714
|
}),
|
|
@@ -3709,7 +3721,7 @@
|
|
|
3709
3721
|
|
|
3710
3722
|
```js
|
|
3711
3723
|
await generateImage({
|
|
3712
|
-
model: luma.image(
|
|
3724
|
+
model: luma.image("photon-flash-1"),
|
|
3713
3725
|
prompt,
|
|
3714
3726
|
n: 10,
|
|
3715
3727
|
maxImagesPerCall: 5,
|
|
@@ -3807,10 +3819,10 @@
|
|
|
3807
3819
|
The `experimental_generateImage` method from the `ai` package now returnes revised prompts for OpenAI's image models.
|
|
3808
3820
|
|
|
3809
3821
|
```js
|
|
3810
|
-
const prompt =
|
|
3822
|
+
const prompt = "Santa Claus driving a Cadillac";
|
|
3811
3823
|
|
|
3812
3824
|
const { providerMetadata } = await experimental_generateImage({
|
|
3813
|
-
model: openai.image(
|
|
3825
|
+
model: openai.image("dall-e-3"),
|
|
3814
3826
|
prompt,
|
|
3815
3827
|
});
|
|
3816
3828
|
|
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ export { AssistantContent, AssistantModelMessage, DataContent, DownloadError, Fi
|
|
|
6
6
|
import * as _ai_sdk_provider from '@ai-sdk/provider';
|
|
7
7
|
import { EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV3Embedding, EmbeddingModelV3Middleware, ImageModelV3, ImageModelV2, ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata, ImageModelV3Middleware, JSONValue as JSONValue$1, LanguageModelV3, LanguageModelV2, SharedV3Warning, LanguageModelV3Source, LanguageModelV3Middleware, RerankingModelV3, SharedV3ProviderMetadata, SpeechModelV3, SpeechModelV2, TranscriptionModelV3, TranscriptionModelV2, JSONObject, ImageModelV3Usage, LanguageModelV3ToolChoice, AISDKError, LanguageModelV3ToolCall, JSONSchema7, LanguageModelV3CallOptions, JSONParseError, TypeValidationError, Experimental_VideoModelV3, EmbeddingModelV3CallOptions, ProviderV3, ProviderV2, NoSuchModelError } from '@ai-sdk/provider';
|
|
8
8
|
export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
|
9
|
-
import { Tracer } from '@opentelemetry/api';
|
|
9
|
+
import { AttributeValue, Tracer } from '@opentelemetry/api';
|
|
10
10
|
import { ServerResponse } from 'node:http';
|
|
11
11
|
import { ServerResponse as ServerResponse$1 } from 'http';
|
|
12
12
|
import { z } from 'zod/v4';
|
|
@@ -844,7 +844,7 @@ declare function hasToolCall(toolName: string): StopCondition<any>;
|
|
|
844
844
|
/**
|
|
845
845
|
* Common model information used across callback events.
|
|
846
846
|
*/
|
|
847
|
-
interface
|
|
847
|
+
interface CallbackModelInfo {
|
|
848
848
|
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
849
849
|
readonly provider: string;
|
|
850
850
|
/** The specific model identifier (e.g., 'gpt-4o'). */
|
|
@@ -860,7 +860,7 @@ interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output =
|
|
|
860
860
|
responseBody?: boolean;
|
|
861
861
|
}> {
|
|
862
862
|
/** The model being used for generation. */
|
|
863
|
-
readonly model:
|
|
863
|
+
readonly model: CallbackModelInfo;
|
|
864
864
|
/** The system message(s) provided to the model. */
|
|
865
865
|
readonly system: string | SystemModelMessage | Array<SystemModelMessage> | undefined;
|
|
866
866
|
/** The prompt string or array of messages if using the prompt option. */
|
|
@@ -936,7 +936,7 @@ interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends Outpu
|
|
|
936
936
|
/** Zero-based index of the current step. */
|
|
937
937
|
readonly stepNumber: number;
|
|
938
938
|
/** The model being used for this step. */
|
|
939
|
-
readonly model:
|
|
939
|
+
readonly model: CallbackModelInfo;
|
|
940
940
|
/**
|
|
941
941
|
* The system message for this step.
|
|
942
942
|
*/
|
|
@@ -995,7 +995,7 @@ interface OnToolCallStartEvent<TOOLS extends ToolSet = ToolSet> {
|
|
|
995
995
|
/** Zero-based index of the current step where this tool call occurs. */
|
|
996
996
|
readonly stepNumber: number | undefined;
|
|
997
997
|
/** The model being used for this step. */
|
|
998
|
-
readonly model:
|
|
998
|
+
readonly model: CallbackModelInfo | undefined;
|
|
999
999
|
/** The full tool call object. */
|
|
1000
1000
|
readonly toolCall: TypedToolCall<TOOLS>;
|
|
1001
1001
|
/** The conversation messages available at tool execution time. */
|
|
@@ -1019,7 +1019,7 @@ type OnToolCallFinishEvent<TOOLS extends ToolSet = ToolSet> = {
|
|
|
1019
1019
|
/** Zero-based index of the current step where this tool call occurred. */
|
|
1020
1020
|
readonly stepNumber: number | undefined;
|
|
1021
1021
|
/** The model being used for this step. */
|
|
1022
|
-
readonly model:
|
|
1022
|
+
readonly model: CallbackModelInfo | undefined;
|
|
1023
1023
|
/** The full tool call object. */
|
|
1024
1024
|
readonly toolCall: TypedToolCall<TOOLS>;
|
|
1025
1025
|
/** The conversation messages available at tool execution time. */
|
|
@@ -1126,7 +1126,7 @@ type TelemetrySettings = {
|
|
|
1126
1126
|
/**
|
|
1127
1127
|
* Additional information to include in the telemetry data.
|
|
1128
1128
|
*/
|
|
1129
|
-
metadata?: Record<string,
|
|
1129
|
+
metadata?: Record<string, AttributeValue>;
|
|
1130
1130
|
/**
|
|
1131
1131
|
* A custom tracer to use for the telemetry data.
|
|
1132
1132
|
*/
|
|
@@ -3239,10 +3239,6 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT extends Output> {
|
|
|
3239
3239
|
readonly output: InferCompleteOutput<OUTPUT>;
|
|
3240
3240
|
}
|
|
3241
3241
|
|
|
3242
|
-
type ToolLoopAgentOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output = Output> = (event: OnStartEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
|
|
3243
|
-
type ToolLoopAgentOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output = Output> = (event: OnStepStartEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
|
|
3244
|
-
type ToolLoopAgentOnToolCallStartCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallStartEvent<TOOLS>) => PromiseLike<void> | void;
|
|
3245
|
-
type ToolLoopAgentOnToolCallFinishCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallFinishEvent<TOOLS>) => PromiseLike<void> | void;
|
|
3246
3242
|
type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult: OnStepFinishEvent<TOOLS>) => Promise<void> | void;
|
|
3247
3243
|
type ToolLoopAgentOnFinishCallback<TOOLS extends ToolSet = {}> = (event: OnFinishEvent<TOOLS>) => PromiseLike<void> | void;
|
|
3248
3244
|
/**
|
|
@@ -3299,22 +3295,6 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
|
|
|
3299
3295
|
* A function that attempts to repair a tool call that failed to parse.
|
|
3300
3296
|
*/
|
|
3301
3297
|
experimental_repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
|
|
3302
|
-
/**
|
|
3303
|
-
* Callback that is called when the agent operation begins, before any LLM calls.
|
|
3304
|
-
*/
|
|
3305
|
-
experimental_onStart?: ToolLoopAgentOnStartCallback<NoInfer<TOOLS>, OUTPUT>;
|
|
3306
|
-
/**
|
|
3307
|
-
* Callback that is called when a step (LLM call) begins, before the provider is called.
|
|
3308
|
-
*/
|
|
3309
|
-
experimental_onStepStart?: ToolLoopAgentOnStepStartCallback<NoInfer<TOOLS>, OUTPUT>;
|
|
3310
|
-
/**
|
|
3311
|
-
* Callback that is called before each tool execution begins.
|
|
3312
|
-
*/
|
|
3313
|
-
experimental_onToolCallStart?: ToolLoopAgentOnToolCallStartCallback<NoInfer<TOOLS>>;
|
|
3314
|
-
/**
|
|
3315
|
-
* Callback that is called after each tool execution completes.
|
|
3316
|
-
*/
|
|
3317
|
-
experimental_onToolCallFinish?: ToolLoopAgentOnToolCallFinishCallback<NoInfer<TOOLS>>;
|
|
3318
3298
|
/**
|
|
3319
3299
|
* Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
|
3320
3300
|
*/
|
|
@@ -3399,30 +3379,10 @@ type AgentCallParameters<CALL_OPTIONS, TOOLS extends ToolSet = {}> = ([
|
|
|
3399
3379
|
* Timeout in milliseconds. Can be specified as a number or as an object with `totalMs`.
|
|
3400
3380
|
*/
|
|
3401
3381
|
timeout?: TimeoutConfiguration;
|
|
3402
|
-
/**
|
|
3403
|
-
* Callback that is called when the agent operation begins, before any LLM calls.
|
|
3404
|
-
*/
|
|
3405
|
-
experimental_onStart?: ToolLoopAgentOnStartCallback<TOOLS>;
|
|
3406
|
-
/**
|
|
3407
|
-
* Callback that is called when a step (LLM call) begins, before the provider is called.
|
|
3408
|
-
*/
|
|
3409
|
-
experimental_onStepStart?: ToolLoopAgentOnStepStartCallback<TOOLS>;
|
|
3410
|
-
/**
|
|
3411
|
-
* Callback that is called before each tool execution begins.
|
|
3412
|
-
*/
|
|
3413
|
-
experimental_onToolCallStart?: ToolLoopAgentOnToolCallStartCallback<TOOLS>;
|
|
3414
|
-
/**
|
|
3415
|
-
* Callback that is called after each tool execution completes.
|
|
3416
|
-
*/
|
|
3417
|
-
experimental_onToolCallFinish?: ToolLoopAgentOnToolCallFinishCallback<TOOLS>;
|
|
3418
3382
|
/**
|
|
3419
3383
|
* Callback that is called when each step (LLM call) is finished, including intermediate steps.
|
|
3420
3384
|
*/
|
|
3421
3385
|
onStepFinish?: ToolLoopAgentOnStepFinishCallback<TOOLS>;
|
|
3422
|
-
/**
|
|
3423
|
-
* Callback that is called when all steps are finished and the response is complete.
|
|
3424
|
-
*/
|
|
3425
|
-
onFinish?: ToolLoopAgentOnFinishCallback<TOOLS>;
|
|
3426
3386
|
};
|
|
3427
3387
|
/**
|
|
3428
3388
|
* Parameters for streaming an output from an agent.
|
|
@@ -3490,15 +3450,15 @@ declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OU
|
|
|
3490
3450
|
*/
|
|
3491
3451
|
get tools(): TOOLS;
|
|
3492
3452
|
private prepareCall;
|
|
3493
|
-
private
|
|
3453
|
+
private mergeOnStepFinishCallbacks;
|
|
3494
3454
|
/**
|
|
3495
3455
|
* Generates an output from the agent (non-streaming).
|
|
3496
3456
|
*/
|
|
3497
|
-
generate({ abortSignal, timeout,
|
|
3457
|
+
generate({ abortSignal, timeout, onStepFinish, ...options }: AgentCallParameters<CALL_OPTIONS, TOOLS>): Promise<GenerateTextResult<TOOLS, OUTPUT>>;
|
|
3498
3458
|
/**
|
|
3499
3459
|
* Streams an output from the agent (streaming).
|
|
3500
3460
|
*/
|
|
3501
|
-
stream({ abortSignal, timeout, experimental_transform,
|
|
3461
|
+
stream({ abortSignal, timeout, experimental_transform, onStepFinish, ...options }: AgentStreamParameters<CALL_OPTIONS, TOOLS>): Promise<StreamTextResult<TOOLS, OUTPUT>>;
|
|
3502
3462
|
}
|
|
3503
3463
|
|
|
3504
3464
|
/**
|
|
@@ -4352,81 +4312,6 @@ declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends
|
|
|
4352
4312
|
onStepFinish?: ToolLoopAgentOnStepFinishCallback<TOOLS>;
|
|
4353
4313
|
} & UIMessageStreamResponseInit & UIMessageStreamOptions<UIMessage<MESSAGE_METADATA, never, InferUITools<TOOLS>>>): Promise<void>;
|
|
4354
4314
|
|
|
4355
|
-
/**
|
|
4356
|
-
* Event passed to the `onStart` callback for embed and embedMany operations.
|
|
4357
|
-
*
|
|
4358
|
-
* Called when the operation begins, before the embedding model is called.
|
|
4359
|
-
*/
|
|
4360
|
-
interface EmbedOnStartEvent {
|
|
4361
|
-
/** Unique identifier for this embed call, used to correlate events. */
|
|
4362
|
-
readonly callId: string;
|
|
4363
|
-
/** Identifies the operation type (e.g. 'ai.embed' or 'ai.embedMany'). */
|
|
4364
|
-
readonly operationId: string;
|
|
4365
|
-
/** The embedding model being used. */
|
|
4366
|
-
readonly model: ModelEventInfo;
|
|
4367
|
-
/** The value(s) being embedded. A string for embed, an array for embedMany. */
|
|
4368
|
-
readonly value: string | Array<string>;
|
|
4369
|
-
/** Maximum number of retries for failed requests. */
|
|
4370
|
-
readonly maxRetries: number;
|
|
4371
|
-
/** Abort signal for cancelling the operation. */
|
|
4372
|
-
readonly abortSignal: AbortSignal | undefined;
|
|
4373
|
-
/** Additional HTTP headers sent with the request. */
|
|
4374
|
-
readonly headers: Record<string, string | undefined> | undefined;
|
|
4375
|
-
/** Additional provider-specific options. */
|
|
4376
|
-
readonly providerOptions: ProviderOptions | undefined;
|
|
4377
|
-
/** Whether telemetry is enabled. */
|
|
4378
|
-
readonly isEnabled: boolean | undefined;
|
|
4379
|
-
/** Whether to record inputs in telemetry. Enabled by default. */
|
|
4380
|
-
readonly recordInputs: boolean | undefined;
|
|
4381
|
-
/** Whether to record outputs in telemetry. Enabled by default. */
|
|
4382
|
-
readonly recordOutputs: boolean | undefined;
|
|
4383
|
-
/** Identifier from telemetry settings for grouping related operations. */
|
|
4384
|
-
readonly functionId: string | undefined;
|
|
4385
|
-
/** Additional metadata from telemetry settings. */
|
|
4386
|
-
readonly metadata: Record<string, JSONValue$1> | undefined;
|
|
4387
|
-
}
|
|
4388
|
-
/**
|
|
4389
|
-
* Event passed to the `onFinish` callback for embed and embedMany operations.
|
|
4390
|
-
*
|
|
4391
|
-
* Called when the operation completes, after the embedding model returns.
|
|
4392
|
-
*/
|
|
4393
|
-
interface EmbedOnFinishEvent {
|
|
4394
|
-
/** Unique identifier for this embed call, used to correlate events. */
|
|
4395
|
-
readonly callId: string;
|
|
4396
|
-
/** Identifies the operation type (e.g. 'ai.embed' or 'ai.embedMany'). */
|
|
4397
|
-
readonly operationId: string;
|
|
4398
|
-
/** The embedding model that was used. */
|
|
4399
|
-
readonly model: ModelEventInfo;
|
|
4400
|
-
/** The value(s) that were embedded. A string for embed, an array for embedMany. */
|
|
4401
|
-
readonly value: string | Array<string>;
|
|
4402
|
-
/** The resulting embedding(s). A single vector for embed, an array for embedMany. */
|
|
4403
|
-
readonly embedding: Embedding | Array<Embedding>;
|
|
4404
|
-
/** Token usage for the embedding operation. */
|
|
4405
|
-
readonly usage: EmbeddingModelUsage;
|
|
4406
|
-
/** Warnings from the embedding model, e.g. unsupported settings. */
|
|
4407
|
-
readonly warnings: Array<Warning>;
|
|
4408
|
-
/** Optional provider-specific metadata. */
|
|
4409
|
-
readonly providerMetadata: ProviderMetadata | undefined;
|
|
4410
|
-
/** Response data including headers and body. A single response for embed, an array for embedMany. */
|
|
4411
|
-
readonly response: {
|
|
4412
|
-
headers?: Record<string, string>;
|
|
4413
|
-
body?: unknown;
|
|
4414
|
-
} | Array<{
|
|
4415
|
-
headers?: Record<string, string>;
|
|
4416
|
-
body?: unknown;
|
|
4417
|
-
} | undefined> | undefined;
|
|
4418
|
-
/** Whether telemetry is enabled. */
|
|
4419
|
-
readonly isEnabled: boolean | undefined;
|
|
4420
|
-
/** Whether to record inputs in telemetry. Enabled by default. */
|
|
4421
|
-
readonly recordInputs: boolean | undefined;
|
|
4422
|
-
/** Whether to record outputs in telemetry. Enabled by default. */
|
|
4423
|
-
readonly recordOutputs: boolean | undefined;
|
|
4424
|
-
/** Identifier from telemetry settings for grouping related operations. */
|
|
4425
|
-
readonly functionId: string | undefined;
|
|
4426
|
-
/** Additional metadata from telemetry settings. */
|
|
4427
|
-
readonly metadata: Record<string, JSONValue$1> | undefined;
|
|
4428
|
-
}
|
|
4429
|
-
|
|
4430
4315
|
/**
|
|
4431
4316
|
* The result of an `embed` call.
|
|
4432
4317
|
* It contains the embedding, the value, and additional information.
|
|
@@ -4485,7 +4370,7 @@ interface EmbedResult {
|
|
|
4485
4370
|
*
|
|
4486
4371
|
* @returns A result object that contains the embedding, the value, and additional information.
|
|
4487
4372
|
*/
|
|
4488
|
-
declare function embed({ model: modelArg, value, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, experimental_telemetry: telemetry,
|
|
4373
|
+
declare function embed({ model: modelArg, value, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, experimental_telemetry: telemetry, }: {
|
|
4489
4374
|
/**
|
|
4490
4375
|
* The embedding model to use.
|
|
4491
4376
|
*/
|
|
@@ -4519,22 +4404,6 @@ declare function embed({ model: modelArg, value, providerOptions, maxRetries: ma
|
|
|
4519
4404
|
* Optional telemetry configuration (experimental).
|
|
4520
4405
|
*/
|
|
4521
4406
|
experimental_telemetry?: TelemetrySettings;
|
|
4522
|
-
/**
|
|
4523
|
-
* Callback that is called when the embed operation begins,
|
|
4524
|
-
* before the embedding model is called.
|
|
4525
|
-
*/
|
|
4526
|
-
experimental_onStart?: Listener<EmbedOnStartEvent>;
|
|
4527
|
-
/**
|
|
4528
|
-
* Callback that is called when the embed operation completes,
|
|
4529
|
-
* after the embedding model returns.
|
|
4530
|
-
*/
|
|
4531
|
-
experimental_onFinish?: Listener<EmbedOnFinishEvent>;
|
|
4532
|
-
/**
|
|
4533
|
-
* Internal. For test use only. May change without notice.
|
|
4534
|
-
*/
|
|
4535
|
-
_internal?: {
|
|
4536
|
-
generateCallId?: () => string;
|
|
4537
|
-
};
|
|
4538
4407
|
}): Promise<EmbedResult>;
|
|
4539
4408
|
|
|
4540
4409
|
/**
|
|
@@ -4601,7 +4470,7 @@ interface EmbedManyResult {
|
|
|
4601
4470
|
*
|
|
4602
4471
|
* @returns A result object that contains the embeddings, the value, and additional information.
|
|
4603
4472
|
*/
|
|
4604
|
-
declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry: telemetry,
|
|
4473
|
+
declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry: telemetry, }: {
|
|
4605
4474
|
/**
|
|
4606
4475
|
* The embedding model to use.
|
|
4607
4476
|
*/
|
|
@@ -4641,22 +4510,6 @@ declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetri
|
|
|
4641
4510
|
* @default Infinity
|
|
4642
4511
|
*/
|
|
4643
4512
|
maxParallelCalls?: number;
|
|
4644
|
-
/**
|
|
4645
|
-
* Callback that is called when the embedMany operation begins,
|
|
4646
|
-
* before the embedding model is called.
|
|
4647
|
-
*/
|
|
4648
|
-
experimental_onStart?: Listener<EmbedOnStartEvent>;
|
|
4649
|
-
/**
|
|
4650
|
-
* Callback that is called when the embedMany operation completes,
|
|
4651
|
-
* after all embedding model calls return.
|
|
4652
|
-
*/
|
|
4653
|
-
experimental_onFinish?: Listener<EmbedOnFinishEvent>;
|
|
4654
|
-
/**
|
|
4655
|
-
* Internal. For test use only. May change without notice.
|
|
4656
|
-
*/
|
|
4657
|
-
_internal?: {
|
|
4658
|
-
generateCallId?: () => string;
|
|
4659
|
-
};
|
|
4660
4513
|
}): Promise<EmbedManyResult>;
|
|
4661
4514
|
|
|
4662
4515
|
declare const symbol$h: unique symbol;
|
|
@@ -6546,4 +6399,4 @@ declare global {
|
|
|
6546
6399
|
var AI_SDK_TELEMETRY_INTEGRATIONS: TelemetryIntegration[] | undefined;
|
|
6547
6400
|
}
|
|
6548
6401
|
|
|
6549
|
-
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult,
|
|
6402
|
+
export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextOnToolCallFinishCallback, GenerateTextOnToolCallStartCallback, GenerateTextResult, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankResult, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStartCallback, StreamTextOnStepFinishCallback, StreamTextOnStepStartCallback, StreamTextOnToolCallFinishCallback, StreamTextOnToolCallStartCallback, StreamTextResult, StreamTextTransform, TelemetryIntegration, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToolApprovalRequestOutput, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, bindTelemetryIntegration, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, experimental_generateImage, generateSpeech as experimental_generateSpeech, experimental_generateVideo, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetryIntegration, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
|