ai 7.0.0-beta.28 → 7.0.0-beta.29
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 +6 -0
- package/README.md +6 -16
- package/dist/index.d.mts +24 -21
- package/dist/index.d.ts +24 -21
- package/dist/index.js +58 -48
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -48
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +10 -3
- package/src/agent/tool-loop-agent-settings.ts +1 -1
- package/src/embed/embed-events.ts +10 -5
- package/src/embed/embed-many.ts +6 -4
- package/src/embed/embed.ts +4 -3
- package/src/generate-text/{callback-events.ts → core-events.ts} +20 -18
- package/src/generate-text/create-execute-tools-transformation.ts +6 -3
- package/src/generate-text/execute-tool-call.ts +6 -3
- package/src/generate-text/generate-text.ts +19 -17
- package/src/generate-text/index.ts +1 -1
- package/src/generate-text/step-result.ts +5 -3
- package/src/generate-text/stream-text.ts +14 -14
- package/src/telemetry/open-telemetry-integration.ts +8 -8
- package/src/telemetry/telemetry-integration.ts +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ By default, the AI SDK uses the [Vercel AI Gateway](https://vercel.com/docs/ai-g
|
|
|
30
30
|
|
|
31
31
|
```ts
|
|
32
32
|
const result = await generateText({
|
|
33
|
-
model: 'anthropic/claude-opus-4.
|
|
33
|
+
model: 'anthropic/claude-opus-4.6', // or 'openai/gpt-5.4', 'google/gemini-3-flash', etc.
|
|
34
34
|
prompt: 'Hello!',
|
|
35
35
|
});
|
|
36
36
|
```
|
|
@@ -45,7 +45,7 @@ npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google
|
|
|
45
45
|
import { anthropic } from '@ai-sdk/anthropic';
|
|
46
46
|
|
|
47
47
|
const result = await generateText({
|
|
48
|
-
model: anthropic('claude-opus-4-
|
|
48
|
+
model: anthropic('claude-opus-4-6'), // or openai('gpt-5.4'), google('gemini-3-flash'), etc.
|
|
49
49
|
prompt: 'Hello!',
|
|
50
50
|
});
|
|
51
51
|
```
|
|
@@ -58,17 +58,7 @@ const result = await generateText({
|
|
|
58
58
|
import { generateText } from 'ai';
|
|
59
59
|
|
|
60
60
|
const { text } = await generateText({
|
|
61
|
-
model: 'openai/gpt-5', // use Vercel AI Gateway
|
|
62
|
-
prompt: 'What is an agent?',
|
|
63
|
-
});
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
import { generateText } from 'ai';
|
|
68
|
-
import { openai } from '@ai-sdk/openai';
|
|
69
|
-
|
|
70
|
-
const { text } = await generateText({
|
|
71
|
-
model: openai('gpt-5'), // use OpenAI Responses API
|
|
61
|
+
model: 'openai/gpt-5.4', // use Vercel AI Gateway
|
|
72
62
|
prompt: 'What is an agent?',
|
|
73
63
|
});
|
|
74
64
|
```
|
|
@@ -80,7 +70,7 @@ import { generateText, Output } from 'ai';
|
|
|
80
70
|
import { z } from 'zod';
|
|
81
71
|
|
|
82
72
|
const { output } = await generateText({
|
|
83
|
-
model: 'openai/gpt-5',
|
|
73
|
+
model: 'openai/gpt-5.4',
|
|
84
74
|
output: Output.object({
|
|
85
75
|
schema: z.object({
|
|
86
76
|
recipe: z.object({
|
|
@@ -102,7 +92,7 @@ const { output } = await generateText({
|
|
|
102
92
|
import { ToolLoopAgent } from 'ai';
|
|
103
93
|
|
|
104
94
|
const sandboxAgent = new ToolLoopAgent({
|
|
105
|
-
model: 'openai/gpt-5',
|
|
95
|
+
model: 'openai/gpt-5.4',
|
|
106
96
|
system: 'You are an agent with access to a shell environment.',
|
|
107
97
|
tools: {
|
|
108
98
|
shell: openai.tools.localShell({
|
|
@@ -134,7 +124,7 @@ import { openai } from '@ai-sdk/openai';
|
|
|
134
124
|
import { ToolLoopAgent, InferAgentUIMessage } from 'ai';
|
|
135
125
|
|
|
136
126
|
export const imageGenerationAgent = new ToolLoopAgent({
|
|
137
|
-
model: openai
|
|
127
|
+
model: 'openai/gpt-5.4',
|
|
138
128
|
tools: {
|
|
139
129
|
generateImage: openai.tools.imageGeneration({
|
|
140
130
|
partialImages: 3,
|
package/dist/index.d.mts
CHANGED
|
@@ -2541,15 +2541,6 @@ type TextStreamRawPart = {
|
|
|
2541
2541
|
};
|
|
2542
2542
|
type TextStreamPart<TOOLS extends ToolSet> = TextStreamTextStartPart | TextStreamTextEndPart | TextStreamTextDeltaPart | TextStreamReasoningStartPart | TextStreamReasoningEndPart | TextStreamReasoningDeltaPart | TextStreamCustomPart | TextStreamToolInputStartPart | TextStreamToolInputEndPart | TextStreamToolInputDeltaPart | TextStreamSourcePart | TextStreamFilePart | TextStreamReasoningFilePart | TextStreamToolCallPart<TOOLS> | TextStreamToolResultPart<TOOLS> | TextStreamToolErrorPart<TOOLS> | TextStreamToolOutputDeniedPart<TOOLS> | TextStreamToolApprovalRequestPart<TOOLS> | TextStreamStartStepPart | TextStreamFinishStepPart | TextStreamStartPart | TextStreamFinishPart | TextStreamAbortPart | TextStreamErrorPart | TextStreamRawPart;
|
|
2543
2543
|
|
|
2544
|
-
/**
|
|
2545
|
-
* Common model information used across callback events.
|
|
2546
|
-
*/
|
|
2547
|
-
interface ModelEventInfo {
|
|
2548
|
-
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
2549
|
-
readonly provider: string;
|
|
2550
|
-
/** The specific model identifier (e.g., 'gpt-4o'). */
|
|
2551
|
-
readonly modelId: string;
|
|
2552
|
-
}
|
|
2553
2544
|
/**
|
|
2554
2545
|
* Event passed to the `onStart` callback.
|
|
2555
2546
|
*
|
|
@@ -2563,8 +2554,10 @@ interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output =
|
|
|
2563
2554
|
readonly callId: string;
|
|
2564
2555
|
/** Identifies the operation type (e.g. 'ai.generateText' or 'ai.streamText'). */
|
|
2565
2556
|
readonly operationId: string;
|
|
2566
|
-
/** The
|
|
2567
|
-
readonly
|
|
2557
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
2558
|
+
readonly provider: string;
|
|
2559
|
+
/** The specific model identifier (e.g., 'gpt-4o'). */
|
|
2560
|
+
readonly modelId: string;
|
|
2568
2561
|
/** The system message(s) provided to the model. */
|
|
2569
2562
|
readonly system: string | SystemModelMessage | Array<SystemModelMessage> | undefined;
|
|
2570
2563
|
/** The prompt string or array of messages if using the prompt option. */
|
|
@@ -2647,8 +2640,10 @@ interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends Outpu
|
|
|
2647
2640
|
readonly callId: string;
|
|
2648
2641
|
/** Zero-based index of the current step. */
|
|
2649
2642
|
readonly stepNumber: number;
|
|
2650
|
-
/** The
|
|
2651
|
-
readonly
|
|
2643
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
2644
|
+
readonly provider: string;
|
|
2645
|
+
/** The specific model identifier (e.g., 'gpt-4o'). */
|
|
2646
|
+
readonly modelId: string;
|
|
2652
2647
|
/**
|
|
2653
2648
|
* The system message for this step.
|
|
2654
2649
|
*/
|
|
@@ -2708,8 +2703,10 @@ interface OnToolCallStartEvent<TOOLS extends ToolSet = ToolSet> {
|
|
|
2708
2703
|
readonly callId: string;
|
|
2709
2704
|
/** Zero-based index of the current step where this tool call occurs. */
|
|
2710
2705
|
readonly stepNumber: number | undefined;
|
|
2711
|
-
/** The
|
|
2712
|
-
readonly
|
|
2706
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
2707
|
+
readonly provider: string | undefined;
|
|
2708
|
+
/** The specific model identifier (e.g., 'gpt-4o'). */
|
|
2709
|
+
readonly modelId: string | undefined;
|
|
2713
2710
|
/** The full tool call object. */
|
|
2714
2711
|
readonly toolCall: TypedToolCall<TOOLS>;
|
|
2715
2712
|
/** The conversation messages available at tool execution time. */
|
|
@@ -2734,8 +2731,10 @@ type OnToolCallFinishEvent<TOOLS extends ToolSet = ToolSet> = {
|
|
|
2734
2731
|
readonly callId: string;
|
|
2735
2732
|
/** Zero-based index of the current step where this tool call occurred. */
|
|
2736
2733
|
readonly stepNumber: number | undefined;
|
|
2737
|
-
/** The
|
|
2738
|
-
readonly
|
|
2734
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
2735
|
+
readonly provider: string | undefined;
|
|
2736
|
+
/** The specific model identifier (e.g., 'gpt-4o'). */
|
|
2737
|
+
readonly modelId: string | undefined;
|
|
2739
2738
|
/** The full tool call object. */
|
|
2740
2739
|
readonly toolCall: TypedToolCall<TOOLS>;
|
|
2741
2740
|
/** The conversation messages available at tool execution time. */
|
|
@@ -4620,8 +4619,10 @@ interface EmbedOnStartEvent {
|
|
|
4620
4619
|
readonly callId: string;
|
|
4621
4620
|
/** Identifies the operation type (e.g. 'ai.embed' or 'ai.embedMany'). */
|
|
4622
4621
|
readonly operationId: string;
|
|
4623
|
-
/** The
|
|
4624
|
-
readonly
|
|
4622
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
4623
|
+
readonly provider: string;
|
|
4624
|
+
/** The specific model identifier (e.g., 'text-embedding-3-small'). */
|
|
4625
|
+
readonly modelId: string;
|
|
4625
4626
|
/** The value(s) being embedded. A string for embed, an array for embedMany. */
|
|
4626
4627
|
readonly value: string | Array<string>;
|
|
4627
4628
|
/** Maximum number of retries for failed requests. */
|
|
@@ -4653,8 +4654,10 @@ interface EmbedOnFinishEvent {
|
|
|
4653
4654
|
readonly callId: string;
|
|
4654
4655
|
/** Identifies the operation type (e.g. 'ai.embed' or 'ai.embedMany'). */
|
|
4655
4656
|
readonly operationId: string;
|
|
4656
|
-
/** The
|
|
4657
|
-
readonly
|
|
4657
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
4658
|
+
readonly provider: string;
|
|
4659
|
+
/** The specific model identifier (e.g., 'text-embedding-3-small'). */
|
|
4660
|
+
readonly modelId: string;
|
|
4658
4661
|
/** The value(s) that were embedded. A string for embed, an array for embedMany. */
|
|
4659
4662
|
readonly value: string | Array<string>;
|
|
4660
4663
|
/** The resulting embedding(s). A single vector for embed, an array for embedMany. */
|
package/dist/index.d.ts
CHANGED
|
@@ -2541,15 +2541,6 @@ type TextStreamRawPart = {
|
|
|
2541
2541
|
};
|
|
2542
2542
|
type TextStreamPart<TOOLS extends ToolSet> = TextStreamTextStartPart | TextStreamTextEndPart | TextStreamTextDeltaPart | TextStreamReasoningStartPart | TextStreamReasoningEndPart | TextStreamReasoningDeltaPart | TextStreamCustomPart | TextStreamToolInputStartPart | TextStreamToolInputEndPart | TextStreamToolInputDeltaPart | TextStreamSourcePart | TextStreamFilePart | TextStreamReasoningFilePart | TextStreamToolCallPart<TOOLS> | TextStreamToolResultPart<TOOLS> | TextStreamToolErrorPart<TOOLS> | TextStreamToolOutputDeniedPart<TOOLS> | TextStreamToolApprovalRequestPart<TOOLS> | TextStreamStartStepPart | TextStreamFinishStepPart | TextStreamStartPart | TextStreamFinishPart | TextStreamAbortPart | TextStreamErrorPart | TextStreamRawPart;
|
|
2543
2543
|
|
|
2544
|
-
/**
|
|
2545
|
-
* Common model information used across callback events.
|
|
2546
|
-
*/
|
|
2547
|
-
interface ModelEventInfo {
|
|
2548
|
-
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
2549
|
-
readonly provider: string;
|
|
2550
|
-
/** The specific model identifier (e.g., 'gpt-4o'). */
|
|
2551
|
-
readonly modelId: string;
|
|
2552
|
-
}
|
|
2553
2544
|
/**
|
|
2554
2545
|
* Event passed to the `onStart` callback.
|
|
2555
2546
|
*
|
|
@@ -2563,8 +2554,10 @@ interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output =
|
|
|
2563
2554
|
readonly callId: string;
|
|
2564
2555
|
/** Identifies the operation type (e.g. 'ai.generateText' or 'ai.streamText'). */
|
|
2565
2556
|
readonly operationId: string;
|
|
2566
|
-
/** The
|
|
2567
|
-
readonly
|
|
2557
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
2558
|
+
readonly provider: string;
|
|
2559
|
+
/** The specific model identifier (e.g., 'gpt-4o'). */
|
|
2560
|
+
readonly modelId: string;
|
|
2568
2561
|
/** The system message(s) provided to the model. */
|
|
2569
2562
|
readonly system: string | SystemModelMessage | Array<SystemModelMessage> | undefined;
|
|
2570
2563
|
/** The prompt string or array of messages if using the prompt option. */
|
|
@@ -2647,8 +2640,10 @@ interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends Outpu
|
|
|
2647
2640
|
readonly callId: string;
|
|
2648
2641
|
/** Zero-based index of the current step. */
|
|
2649
2642
|
readonly stepNumber: number;
|
|
2650
|
-
/** The
|
|
2651
|
-
readonly
|
|
2643
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
2644
|
+
readonly provider: string;
|
|
2645
|
+
/** The specific model identifier (e.g., 'gpt-4o'). */
|
|
2646
|
+
readonly modelId: string;
|
|
2652
2647
|
/**
|
|
2653
2648
|
* The system message for this step.
|
|
2654
2649
|
*/
|
|
@@ -2708,8 +2703,10 @@ interface OnToolCallStartEvent<TOOLS extends ToolSet = ToolSet> {
|
|
|
2708
2703
|
readonly callId: string;
|
|
2709
2704
|
/** Zero-based index of the current step where this tool call occurs. */
|
|
2710
2705
|
readonly stepNumber: number | undefined;
|
|
2711
|
-
/** The
|
|
2712
|
-
readonly
|
|
2706
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
2707
|
+
readonly provider: string | undefined;
|
|
2708
|
+
/** The specific model identifier (e.g., 'gpt-4o'). */
|
|
2709
|
+
readonly modelId: string | undefined;
|
|
2713
2710
|
/** The full tool call object. */
|
|
2714
2711
|
readonly toolCall: TypedToolCall<TOOLS>;
|
|
2715
2712
|
/** The conversation messages available at tool execution time. */
|
|
@@ -2734,8 +2731,10 @@ type OnToolCallFinishEvent<TOOLS extends ToolSet = ToolSet> = {
|
|
|
2734
2731
|
readonly callId: string;
|
|
2735
2732
|
/** Zero-based index of the current step where this tool call occurred. */
|
|
2736
2733
|
readonly stepNumber: number | undefined;
|
|
2737
|
-
/** The
|
|
2738
|
-
readonly
|
|
2734
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
2735
|
+
readonly provider: string | undefined;
|
|
2736
|
+
/** The specific model identifier (e.g., 'gpt-4o'). */
|
|
2737
|
+
readonly modelId: string | undefined;
|
|
2739
2738
|
/** The full tool call object. */
|
|
2740
2739
|
readonly toolCall: TypedToolCall<TOOLS>;
|
|
2741
2740
|
/** The conversation messages available at tool execution time. */
|
|
@@ -4620,8 +4619,10 @@ interface EmbedOnStartEvent {
|
|
|
4620
4619
|
readonly callId: string;
|
|
4621
4620
|
/** Identifies the operation type (e.g. 'ai.embed' or 'ai.embedMany'). */
|
|
4622
4621
|
readonly operationId: string;
|
|
4623
|
-
/** The
|
|
4624
|
-
readonly
|
|
4622
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
4623
|
+
readonly provider: string;
|
|
4624
|
+
/** The specific model identifier (e.g., 'text-embedding-3-small'). */
|
|
4625
|
+
readonly modelId: string;
|
|
4625
4626
|
/** The value(s) being embedded. A string for embed, an array for embedMany. */
|
|
4626
4627
|
readonly value: string | Array<string>;
|
|
4627
4628
|
/** Maximum number of retries for failed requests. */
|
|
@@ -4653,8 +4654,10 @@ interface EmbedOnFinishEvent {
|
|
|
4653
4654
|
readonly callId: string;
|
|
4654
4655
|
/** Identifies the operation type (e.g. 'ai.embed' or 'ai.embedMany'). */
|
|
4655
4656
|
readonly operationId: string;
|
|
4656
|
-
/** The
|
|
4657
|
-
readonly
|
|
4657
|
+
/** The provider identifier (e.g., 'openai', 'anthropic'). */
|
|
4658
|
+
readonly provider: string;
|
|
4659
|
+
/** The specific model identifier (e.g., 'text-embedding-3-small'). */
|
|
4660
|
+
readonly modelId: string;
|
|
4658
4661
|
/** The value(s) that were embedded. A string for embed, an array for embedMany. */
|
|
4659
4662
|
readonly value: string | Array<string>;
|
|
4660
4663
|
/** The resulting embedding(s). A single vector for embed, an array for embedMany. */
|
package/dist/index.js
CHANGED
|
@@ -1362,7 +1362,7 @@ var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
|
1362
1362
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1363
1363
|
|
|
1364
1364
|
// src/version.ts
|
|
1365
|
-
var VERSION = true ? "7.0.0-beta.
|
|
1365
|
+
var VERSION = true ? "7.0.0-beta.29" : "0.0.0-test";
|
|
1366
1366
|
|
|
1367
1367
|
// src/util/download/download.ts
|
|
1368
1368
|
var download = async ({
|
|
@@ -2548,7 +2548,7 @@ var OpenTelemetryIntegration = class {
|
|
|
2548
2548
|
maxRetries: event.maxRetries
|
|
2549
2549
|
};
|
|
2550
2550
|
const baseTelemetryAttributes = getBaseTelemetryAttributes({
|
|
2551
|
-
model: event.
|
|
2551
|
+
model: { provider: event.provider, modelId: event.modelId },
|
|
2552
2552
|
telemetry,
|
|
2553
2553
|
headers: event.headers,
|
|
2554
2554
|
settings
|
|
@@ -2559,8 +2559,8 @@ var OpenTelemetryIntegration = class {
|
|
|
2559
2559
|
telemetry
|
|
2560
2560
|
}),
|
|
2561
2561
|
...baseTelemetryAttributes,
|
|
2562
|
-
"ai.model.provider": event.
|
|
2563
|
-
"ai.model.id": event.
|
|
2562
|
+
"ai.model.provider": event.provider,
|
|
2563
|
+
"ai.model.id": event.modelId,
|
|
2564
2564
|
"ai.prompt": {
|
|
2565
2565
|
input: () => JSON.stringify({
|
|
2566
2566
|
system: event.system,
|
|
@@ -2596,8 +2596,8 @@ var OpenTelemetryIntegration = class {
|
|
|
2596
2596
|
telemetry
|
|
2597
2597
|
}),
|
|
2598
2598
|
...state.baseTelemetryAttributes,
|
|
2599
|
-
"ai.model.provider": event.
|
|
2600
|
-
"ai.model.id": event.
|
|
2599
|
+
"ai.model.provider": event.provider,
|
|
2600
|
+
"ai.model.id": event.modelId,
|
|
2601
2601
|
"ai.prompt.messages": {
|
|
2602
2602
|
input: () => event.promptMessages ? stringifyForTelemetry(event.promptMessages) : void 0
|
|
2603
2603
|
},
|
|
@@ -2610,8 +2610,8 @@ var OpenTelemetryIntegration = class {
|
|
|
2610
2610
|
"ai.prompt.toolChoice": {
|
|
2611
2611
|
input: () => event.stepToolChoice != null ? JSON.stringify(event.stepToolChoice) : void 0
|
|
2612
2612
|
},
|
|
2613
|
-
"gen_ai.system": event.
|
|
2614
|
-
"gen_ai.request.model": event.
|
|
2613
|
+
"gen_ai.system": event.provider,
|
|
2614
|
+
"gen_ai.request.model": event.modelId,
|
|
2615
2615
|
"gen_ai.request.frequency_penalty": state.settings.frequencyPenalty,
|
|
2616
2616
|
"gen_ai.request.max_tokens": state.settings.maxOutputTokens,
|
|
2617
2617
|
"gen_ai.request.presence_penalty": state.settings.presencePenalty,
|
|
@@ -3290,7 +3290,8 @@ async function executeToolCall({
|
|
|
3290
3290
|
timeout,
|
|
3291
3291
|
experimental_context,
|
|
3292
3292
|
stepNumber,
|
|
3293
|
-
|
|
3293
|
+
provider,
|
|
3294
|
+
modelId,
|
|
3294
3295
|
onPreliminaryToolResult,
|
|
3295
3296
|
onToolCallStart,
|
|
3296
3297
|
onToolCallFinish,
|
|
@@ -3304,7 +3305,8 @@ async function executeToolCall({
|
|
|
3304
3305
|
const baseCallbackEvent = {
|
|
3305
3306
|
callId,
|
|
3306
3307
|
stepNumber,
|
|
3307
|
-
|
|
3308
|
+
provider,
|
|
3309
|
+
modelId,
|
|
3308
3310
|
toolCall,
|
|
3309
3311
|
messages,
|
|
3310
3312
|
abortSignal,
|
|
@@ -4279,7 +4281,8 @@ var DefaultStepResult = class {
|
|
|
4279
4281
|
constructor({
|
|
4280
4282
|
callId,
|
|
4281
4283
|
stepNumber,
|
|
4282
|
-
|
|
4284
|
+
provider,
|
|
4285
|
+
modelId,
|
|
4283
4286
|
functionId,
|
|
4284
4287
|
metadata,
|
|
4285
4288
|
experimental_context,
|
|
@@ -4294,7 +4297,7 @@ var DefaultStepResult = class {
|
|
|
4294
4297
|
}) {
|
|
4295
4298
|
this.callId = callId;
|
|
4296
4299
|
this.stepNumber = stepNumber;
|
|
4297
|
-
this.model =
|
|
4300
|
+
this.model = { provider, modelId };
|
|
4298
4301
|
this.functionId = functionId;
|
|
4299
4302
|
this.metadata = metadata;
|
|
4300
4303
|
this.experimental_context = experimental_context;
|
|
@@ -4582,7 +4585,6 @@ async function generateText({
|
|
|
4582
4585
|
headers != null ? headers : {},
|
|
4583
4586
|
`ai/${VERSION}`
|
|
4584
4587
|
);
|
|
4585
|
-
const modelInfo = { provider: model.provider, modelId: model.modelId };
|
|
4586
4588
|
const initialPrompt = await standardizePrompt({
|
|
4587
4589
|
system,
|
|
4588
4590
|
prompt,
|
|
@@ -4596,7 +4598,8 @@ async function generateText({
|
|
|
4596
4598
|
event: {
|
|
4597
4599
|
callId,
|
|
4598
4600
|
operationId: "ai.generateText",
|
|
4599
|
-
|
|
4601
|
+
provider: model.provider,
|
|
4602
|
+
modelId: model.modelId,
|
|
4600
4603
|
system,
|
|
4601
4604
|
prompt,
|
|
4602
4605
|
messages,
|
|
@@ -4652,7 +4655,8 @@ async function generateText({
|
|
|
4652
4655
|
timeout,
|
|
4653
4656
|
experimental_context,
|
|
4654
4657
|
stepNumber: 0,
|
|
4655
|
-
|
|
4658
|
+
provider: model.provider,
|
|
4659
|
+
modelId: model.modelId,
|
|
4656
4660
|
onToolCallStart: (event) => notify({
|
|
4657
4661
|
event,
|
|
4658
4662
|
callbacks: [
|
|
@@ -4747,10 +4751,6 @@ async function generateText({
|
|
|
4747
4751
|
const stepModel = resolveLanguageModel(
|
|
4748
4752
|
(_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
|
|
4749
4753
|
);
|
|
4750
|
-
const stepModelInfo = {
|
|
4751
|
-
provider: stepModel.provider,
|
|
4752
|
-
modelId: stepModel.modelId
|
|
4753
|
-
};
|
|
4754
4754
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
4755
4755
|
prompt: {
|
|
4756
4756
|
system: (_b = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b : initialPrompt.system,
|
|
@@ -4775,7 +4775,8 @@ async function generateText({
|
|
|
4775
4775
|
const onStepStartEvent = {
|
|
4776
4776
|
callId,
|
|
4777
4777
|
stepNumber: steps.length,
|
|
4778
|
-
|
|
4778
|
+
provider: stepModel.provider,
|
|
4779
|
+
modelId: stepModel.modelId,
|
|
4779
4780
|
system: stepSystem,
|
|
4780
4781
|
messages: stepMessages,
|
|
4781
4782
|
tools,
|
|
@@ -4899,7 +4900,8 @@ async function generateText({
|
|
|
4899
4900
|
timeout,
|
|
4900
4901
|
experimental_context,
|
|
4901
4902
|
stepNumber: steps.length,
|
|
4902
|
-
|
|
4903
|
+
provider: stepModel.provider,
|
|
4904
|
+
modelId: stepModel.modelId,
|
|
4903
4905
|
onToolCallStart: (event) => notify({
|
|
4904
4906
|
event,
|
|
4905
4907
|
callbacks: [
|
|
@@ -4963,7 +4965,8 @@ async function generateText({
|
|
|
4963
4965
|
const currentStepResult = new DefaultStepResult({
|
|
4964
4966
|
callId,
|
|
4965
4967
|
stepNumber,
|
|
4966
|
-
|
|
4968
|
+
provider: stepModel.provider,
|
|
4969
|
+
modelId: stepModel.modelId,
|
|
4967
4970
|
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
4968
4971
|
metadata: telemetry == null ? void 0 : telemetry.metadata,
|
|
4969
4972
|
experimental_context,
|
|
@@ -4978,8 +4981,8 @@ async function generateText({
|
|
|
4978
4981
|
});
|
|
4979
4982
|
logWarnings({
|
|
4980
4983
|
warnings: (_m = currentModelResponse.warnings) != null ? _m : [],
|
|
4981
|
-
provider:
|
|
4982
|
-
model:
|
|
4984
|
+
provider: stepModel.provider,
|
|
4985
|
+
model: stepModel.modelId
|
|
4983
4986
|
});
|
|
4984
4987
|
steps.push(currentStepResult);
|
|
4985
4988
|
await notify({
|
|
@@ -5082,7 +5085,8 @@ async function executeTools({
|
|
|
5082
5085
|
timeout,
|
|
5083
5086
|
experimental_context,
|
|
5084
5087
|
stepNumber,
|
|
5085
|
-
|
|
5088
|
+
provider,
|
|
5089
|
+
modelId,
|
|
5086
5090
|
onToolCallStart,
|
|
5087
5091
|
onToolCallFinish,
|
|
5088
5092
|
executeToolInTelemetryContext
|
|
@@ -5099,7 +5103,8 @@ async function executeTools({
|
|
|
5099
5103
|
timeout,
|
|
5100
5104
|
experimental_context,
|
|
5101
5105
|
stepNumber,
|
|
5102
|
-
|
|
5106
|
+
provider,
|
|
5107
|
+
modelId,
|
|
5103
5108
|
onToolCallStart,
|
|
5104
5109
|
onToolCallFinish,
|
|
5105
5110
|
executeToolInTelemetryContext
|
|
@@ -6541,7 +6546,8 @@ function createExecuteToolsTransformation({
|
|
|
6541
6546
|
experimental_context,
|
|
6542
6547
|
generateId: generateId2,
|
|
6543
6548
|
stepNumber,
|
|
6544
|
-
|
|
6549
|
+
provider,
|
|
6550
|
+
modelId,
|
|
6545
6551
|
onToolCallStart,
|
|
6546
6552
|
onToolCallFinish,
|
|
6547
6553
|
executeToolInTelemetryContext
|
|
@@ -6565,7 +6571,8 @@ function createExecuteToolsTransformation({
|
|
|
6565
6571
|
timeout,
|
|
6566
6572
|
experimental_context,
|
|
6567
6573
|
stepNumber,
|
|
6568
|
-
|
|
6574
|
+
provider,
|
|
6575
|
+
modelId,
|
|
6569
6576
|
onToolCallStart,
|
|
6570
6577
|
onToolCallFinish,
|
|
6571
6578
|
executeToolInTelemetryContext,
|
|
@@ -7122,7 +7129,8 @@ var DefaultStreamTextResult = class {
|
|
|
7122
7129
|
const currentStepResult = new DefaultStepResult({
|
|
7123
7130
|
callId,
|
|
7124
7131
|
stepNumber: recordedSteps.length,
|
|
7125
|
-
|
|
7132
|
+
provider: model.provider,
|
|
7133
|
+
modelId: model.modelId,
|
|
7126
7134
|
...callbackTelemetryProps,
|
|
7127
7135
|
experimental_context,
|
|
7128
7136
|
content: recordedContent,
|
|
@@ -7143,8 +7151,8 @@ var DefaultStreamTextResult = class {
|
|
|
7143
7151
|
});
|
|
7144
7152
|
logWarnings({
|
|
7145
7153
|
warnings: recordedWarnings,
|
|
7146
|
-
provider:
|
|
7147
|
-
model:
|
|
7154
|
+
provider: model.provider,
|
|
7155
|
+
model: model.modelId
|
|
7148
7156
|
});
|
|
7149
7157
|
recordedSteps.push(currentStepResult);
|
|
7150
7158
|
recordedResponseMessages.push(...stepMessages);
|
|
@@ -7275,7 +7283,6 @@ var DefaultStreamTextResult = class {
|
|
|
7275
7283
|
});
|
|
7276
7284
|
const callSettings = prepareCallSettings(settings);
|
|
7277
7285
|
const self = this;
|
|
7278
|
-
const modelInfo = { provider: model.provider, modelId: model.modelId };
|
|
7279
7286
|
const callId = generateCallId();
|
|
7280
7287
|
const callbackTelemetryProps = {
|
|
7281
7288
|
functionId: telemetry == null ? void 0 : telemetry.functionId,
|
|
@@ -7298,7 +7305,8 @@ var DefaultStreamTextResult = class {
|
|
|
7298
7305
|
event: {
|
|
7299
7306
|
callId,
|
|
7300
7307
|
operationId: "ai.streamText",
|
|
7301
|
-
|
|
7308
|
+
provider: model.provider,
|
|
7309
|
+
modelId: model.modelId,
|
|
7302
7310
|
system,
|
|
7303
7311
|
prompt,
|
|
7304
7312
|
messages,
|
|
@@ -7378,7 +7386,8 @@ var DefaultStreamTextResult = class {
|
|
|
7378
7386
|
timeout,
|
|
7379
7387
|
experimental_context,
|
|
7380
7388
|
stepNumber: recordedSteps.length,
|
|
7381
|
-
|
|
7389
|
+
provider: model.provider,
|
|
7390
|
+
modelId: model.modelId,
|
|
7382
7391
|
onToolCallStart: [
|
|
7383
7392
|
onToolCallStart,
|
|
7384
7393
|
globalTelemetry.onToolCallStart
|
|
@@ -7493,10 +7502,6 @@ var DefaultStreamTextResult = class {
|
|
|
7493
7502
|
const stepModel = resolveLanguageModel(
|
|
7494
7503
|
(_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
|
|
7495
7504
|
);
|
|
7496
|
-
const stepModelInfo = {
|
|
7497
|
-
provider: stepModel.provider,
|
|
7498
|
-
modelId: stepModel.modelId
|
|
7499
|
-
};
|
|
7500
7505
|
const promptMessages = await convertToLanguageModelPrompt({
|
|
7501
7506
|
prompt: {
|
|
7502
7507
|
system: (_b = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b : initialPrompt.system,
|
|
@@ -7522,7 +7527,8 @@ var DefaultStreamTextResult = class {
|
|
|
7522
7527
|
event: {
|
|
7523
7528
|
callId,
|
|
7524
7529
|
stepNumber: recordedSteps.length,
|
|
7525
|
-
|
|
7530
|
+
provider: stepModel.provider,
|
|
7531
|
+
modelId: stepModel.modelId,
|
|
7526
7532
|
system: stepSystem,
|
|
7527
7533
|
messages: stepMessages,
|
|
7528
7534
|
tools,
|
|
@@ -7583,7 +7589,8 @@ var DefaultStreamTextResult = class {
|
|
|
7583
7589
|
experimental_context,
|
|
7584
7590
|
generateId: generateId2,
|
|
7585
7591
|
stepNumber: recordedSteps.length,
|
|
7586
|
-
|
|
7592
|
+
provider: stepModel.provider,
|
|
7593
|
+
modelId: stepModel.modelId,
|
|
7587
7594
|
onToolCallStart: [
|
|
7588
7595
|
onToolCallStart,
|
|
7589
7596
|
globalTelemetry.onToolCallStart
|
|
@@ -7608,7 +7615,7 @@ var DefaultStreamTextResult = class {
|
|
|
7608
7615
|
let stepResponse = {
|
|
7609
7616
|
id: generateId2(),
|
|
7610
7617
|
timestamp: /* @__PURE__ */ new Date(),
|
|
7611
|
-
modelId:
|
|
7618
|
+
modelId: model.modelId
|
|
7612
7619
|
};
|
|
7613
7620
|
self.addStream(
|
|
7614
7621
|
streamWithToolResults.pipeThrough(
|
|
@@ -9598,12 +9605,12 @@ async function embed({
|
|
|
9598
9605
|
`ai/${VERSION}`
|
|
9599
9606
|
);
|
|
9600
9607
|
const callId = generateCallId();
|
|
9601
|
-
const modelInfo = { provider: model.provider, modelId: model.modelId };
|
|
9602
9608
|
await notify({
|
|
9603
9609
|
event: {
|
|
9604
9610
|
callId,
|
|
9605
9611
|
operationId: "ai.embed",
|
|
9606
|
-
|
|
9612
|
+
provider: model.provider,
|
|
9613
|
+
modelId: model.modelId,
|
|
9607
9614
|
value,
|
|
9608
9615
|
maxRetries,
|
|
9609
9616
|
abortSignal,
|
|
@@ -9702,7 +9709,8 @@ async function embed({
|
|
|
9702
9709
|
event: {
|
|
9703
9710
|
callId,
|
|
9704
9711
|
operationId: "ai.embed",
|
|
9705
|
-
|
|
9712
|
+
provider: model.provider,
|
|
9713
|
+
modelId: model.modelId,
|
|
9706
9714
|
value,
|
|
9707
9715
|
embedding,
|
|
9708
9716
|
usage,
|
|
@@ -9782,12 +9790,12 @@ async function embedMany({
|
|
|
9782
9790
|
`ai/${VERSION}`
|
|
9783
9791
|
);
|
|
9784
9792
|
const callId = generateCallId();
|
|
9785
|
-
const modelInfo = { provider: model.provider, modelId: model.modelId };
|
|
9786
9793
|
await notify({
|
|
9787
9794
|
event: {
|
|
9788
9795
|
callId,
|
|
9789
9796
|
operationId: "ai.embedMany",
|
|
9790
|
-
|
|
9797
|
+
provider: model.provider,
|
|
9798
|
+
modelId: model.modelId,
|
|
9791
9799
|
value: values,
|
|
9792
9800
|
maxRetries,
|
|
9793
9801
|
abortSignal,
|
|
@@ -9900,7 +9908,8 @@ async function embedMany({
|
|
|
9900
9908
|
event: {
|
|
9901
9909
|
callId,
|
|
9902
9910
|
operationId: "ai.embedMany",
|
|
9903
|
-
|
|
9911
|
+
provider: model.provider,
|
|
9912
|
+
modelId: model.modelId,
|
|
9904
9913
|
value: values,
|
|
9905
9914
|
embedding: embeddings2,
|
|
9906
9915
|
usage,
|
|
@@ -10031,7 +10040,8 @@ async function embedMany({
|
|
|
10031
10040
|
event: {
|
|
10032
10041
|
callId,
|
|
10033
10042
|
operationId: "ai.embedMany",
|
|
10034
|
-
|
|
10043
|
+
provider: model.provider,
|
|
10044
|
+
modelId: model.modelId,
|
|
10035
10045
|
value: values,
|
|
10036
10046
|
embedding: embeddings,
|
|
10037
10047
|
usage: { tokens },
|