ai 6.0.73 → 6.0.75
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.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +45 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -12
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +4 -4
- package/src/generate-text/generate-text.ts +8 -0
- package/src/generate-text/stream-text.ts +16 -0
- package/src/model/resolve-model.ts +13 -4
- package/src/registry/custom-provider.ts +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 6.0.75
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7168375: feat (ai, provider): default global provider video model resolution
|
|
8
|
+
- Updated dependencies [7168375]
|
|
9
|
+
- @ai-sdk/provider@3.0.8
|
|
10
|
+
- @ai-sdk/gateway@3.0.37
|
|
11
|
+
- @ai-sdk/provider-utils@4.0.14
|
|
12
|
+
|
|
13
|
+
## 6.0.74
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 471009b: fix(ai): pass reasoning text in telemetry
|
|
18
|
+
|
|
3
19
|
## 6.0.73
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -5617,13 +5617,14 @@ declare function wrapProvider({ provider, languageModelMiddleware, imageModelMid
|
|
|
5617
5617
|
*
|
|
5618
5618
|
* @throws {NoSuchModelError} Throws when a requested model is not found and no fallback provider is available.
|
|
5619
5619
|
*/
|
|
5620
|
-
declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageModelV3>, EMBEDDING_MODELS extends Record<string, EmbeddingModelV3>, IMAGE_MODELS extends Record<string, ImageModelV3>, TRANSCRIPTION_MODELS extends Record<string, TranscriptionModelV3>, SPEECH_MODELS extends Record<string, SpeechModelV3>, RERANKING_MODELS extends Record<string, RerankingModelV3>>({ languageModels, embeddingModels, imageModels, transcriptionModels, speechModels, rerankingModels, fallbackProvider: fallbackProviderArg, }: {
|
|
5620
|
+
declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageModelV3>, EMBEDDING_MODELS extends Record<string, EmbeddingModelV3>, IMAGE_MODELS extends Record<string, ImageModelV3>, TRANSCRIPTION_MODELS extends Record<string, TranscriptionModelV3>, SPEECH_MODELS extends Record<string, SpeechModelV3>, RERANKING_MODELS extends Record<string, RerankingModelV3>, VIDEO_MODELS extends Record<string, Experimental_VideoModelV3>>({ languageModels, embeddingModels, imageModels, transcriptionModels, speechModels, rerankingModels, videoModels, fallbackProvider: fallbackProviderArg, }: {
|
|
5621
5621
|
languageModels?: LANGUAGE_MODELS;
|
|
5622
5622
|
embeddingModels?: EMBEDDING_MODELS;
|
|
5623
5623
|
imageModels?: IMAGE_MODELS;
|
|
5624
5624
|
transcriptionModels?: TRANSCRIPTION_MODELS;
|
|
5625
5625
|
speechModels?: SPEECH_MODELS;
|
|
5626
5626
|
rerankingModels?: RERANKING_MODELS;
|
|
5627
|
+
videoModels?: VIDEO_MODELS;
|
|
5627
5628
|
fallbackProvider?: ProviderV3 | ProviderV2;
|
|
5628
5629
|
}): ProviderV3 & {
|
|
5629
5630
|
languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>): LanguageModelV3;
|
|
@@ -5632,6 +5633,7 @@ declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageM
|
|
|
5632
5633
|
transcriptionModel(modelId: ExtractModelId<TRANSCRIPTION_MODELS>): TranscriptionModelV3;
|
|
5633
5634
|
rerankingModel(modelId: ExtractModelId<RERANKING_MODELS>): RerankingModelV3;
|
|
5634
5635
|
speechModel(modelId: ExtractModelId<SPEECH_MODELS>): SpeechModelV3;
|
|
5636
|
+
videoModel(modelId: ExtractModelId<VIDEO_MODELS>): Experimental_VideoModelV3;
|
|
5635
5637
|
};
|
|
5636
5638
|
/**
|
|
5637
5639
|
* @deprecated Use `customProvider` instead.
|
package/dist/index.d.ts
CHANGED
|
@@ -5617,13 +5617,14 @@ declare function wrapProvider({ provider, languageModelMiddleware, imageModelMid
|
|
|
5617
5617
|
*
|
|
5618
5618
|
* @throws {NoSuchModelError} Throws when a requested model is not found and no fallback provider is available.
|
|
5619
5619
|
*/
|
|
5620
|
-
declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageModelV3>, EMBEDDING_MODELS extends Record<string, EmbeddingModelV3>, IMAGE_MODELS extends Record<string, ImageModelV3>, TRANSCRIPTION_MODELS extends Record<string, TranscriptionModelV3>, SPEECH_MODELS extends Record<string, SpeechModelV3>, RERANKING_MODELS extends Record<string, RerankingModelV3>>({ languageModels, embeddingModels, imageModels, transcriptionModels, speechModels, rerankingModels, fallbackProvider: fallbackProviderArg, }: {
|
|
5620
|
+
declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageModelV3>, EMBEDDING_MODELS extends Record<string, EmbeddingModelV3>, IMAGE_MODELS extends Record<string, ImageModelV3>, TRANSCRIPTION_MODELS extends Record<string, TranscriptionModelV3>, SPEECH_MODELS extends Record<string, SpeechModelV3>, RERANKING_MODELS extends Record<string, RerankingModelV3>, VIDEO_MODELS extends Record<string, Experimental_VideoModelV3>>({ languageModels, embeddingModels, imageModels, transcriptionModels, speechModels, rerankingModels, videoModels, fallbackProvider: fallbackProviderArg, }: {
|
|
5621
5621
|
languageModels?: LANGUAGE_MODELS;
|
|
5622
5622
|
embeddingModels?: EMBEDDING_MODELS;
|
|
5623
5623
|
imageModels?: IMAGE_MODELS;
|
|
5624
5624
|
transcriptionModels?: TRANSCRIPTION_MODELS;
|
|
5625
5625
|
speechModels?: SPEECH_MODELS;
|
|
5626
5626
|
rerankingModels?: RERANKING_MODELS;
|
|
5627
|
+
videoModels?: VIDEO_MODELS;
|
|
5627
5628
|
fallbackProvider?: ProviderV3 | ProviderV2;
|
|
5628
5629
|
}): ProviderV3 & {
|
|
5629
5630
|
languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>): LanguageModelV3;
|
|
@@ -5632,6 +5633,7 @@ declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageM
|
|
|
5632
5633
|
transcriptionModel(modelId: ExtractModelId<TRANSCRIPTION_MODELS>): TranscriptionModelV3;
|
|
5633
5634
|
rerankingModel(modelId: ExtractModelId<RERANKING_MODELS>): RerankingModelV3;
|
|
5634
5635
|
speechModel(modelId: ExtractModelId<SPEECH_MODELS>): SpeechModelV3;
|
|
5636
|
+
videoModel(modelId: ExtractModelId<VIDEO_MODELS>): Experimental_VideoModelV3;
|
|
5635
5637
|
};
|
|
5636
5638
|
/**
|
|
5637
5639
|
* @deprecated Use `customProvider` instead.
|
package/dist/index.js
CHANGED
|
@@ -928,9 +928,14 @@ function resolveImageModel(model) {
|
|
|
928
928
|
}
|
|
929
929
|
function resolveVideoModel(model) {
|
|
930
930
|
if (typeof model === "string") {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
)
|
|
931
|
+
const provider = getGlobalProvider();
|
|
932
|
+
const videoModel = provider.videoModel;
|
|
933
|
+
if (!videoModel) {
|
|
934
|
+
throw new Error(
|
|
935
|
+
'The default provider does not support video models. Please use a Experimental_VideoModelV3 object from a provider (e.g., vertex.video("model-id")).'
|
|
936
|
+
);
|
|
937
|
+
}
|
|
938
|
+
return videoModel(model);
|
|
934
939
|
}
|
|
935
940
|
if (model.specificationVersion !== "v3") {
|
|
936
941
|
const unsupportedModel = model;
|
|
@@ -1205,7 +1210,7 @@ var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
|
1205
1210
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1206
1211
|
|
|
1207
1212
|
// src/version.ts
|
|
1208
|
-
var VERSION = true ? "6.0.
|
|
1213
|
+
var VERSION = true ? "6.0.75" : "0.0.0-test";
|
|
1209
1214
|
|
|
1210
1215
|
// src/util/download/download.ts
|
|
1211
1216
|
var download = async ({ url }) => {
|
|
@@ -2831,6 +2836,14 @@ async function executeToolCall({
|
|
|
2831
2836
|
});
|
|
2832
2837
|
}
|
|
2833
2838
|
|
|
2839
|
+
// src/generate-text/extract-reasoning-content.ts
|
|
2840
|
+
function extractReasoningContent(content) {
|
|
2841
|
+
const parts = content.filter(
|
|
2842
|
+
(content2) => content2.type === "reasoning"
|
|
2843
|
+
);
|
|
2844
|
+
return parts.length === 0 ? void 0 : parts.map((content2) => content2.text).join("\n");
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2834
2847
|
// src/generate-text/extract-text-content.ts
|
|
2835
2848
|
function extractTextContent(content) {
|
|
2836
2849
|
const parts = content.filter(
|
|
@@ -4192,6 +4205,9 @@ async function generateText({
|
|
|
4192
4205
|
"ai.response.text": {
|
|
4193
4206
|
output: () => extractTextContent(result.content)
|
|
4194
4207
|
},
|
|
4208
|
+
"ai.response.reasoning": {
|
|
4209
|
+
output: () => extractReasoningContent(result.content)
|
|
4210
|
+
},
|
|
4195
4211
|
"ai.response.toolCalls": {
|
|
4196
4212
|
output: () => {
|
|
4197
4213
|
const toolCalls = asToolCalls(result.content);
|
|
@@ -4377,6 +4393,9 @@ async function generateText({
|
|
|
4377
4393
|
"ai.response.text": {
|
|
4378
4394
|
output: () => extractTextContent(currentModelResponse.content)
|
|
4379
4395
|
},
|
|
4396
|
+
"ai.response.reasoning": {
|
|
4397
|
+
output: () => extractReasoningContent(currentModelResponse.content)
|
|
4398
|
+
},
|
|
4380
4399
|
"ai.response.toolCalls": {
|
|
4381
4400
|
output: () => {
|
|
4382
4401
|
const toolCalls = asToolCalls(currentModelResponse.content);
|
|
@@ -6474,6 +6493,9 @@ var DefaultStreamTextResult = class {
|
|
|
6474
6493
|
attributes: {
|
|
6475
6494
|
"ai.response.finishReason": finishReason,
|
|
6476
6495
|
"ai.response.text": { output: () => finalStep.text },
|
|
6496
|
+
"ai.response.reasoning": {
|
|
6497
|
+
output: () => finalStep.reasoningText
|
|
6498
|
+
},
|
|
6477
6499
|
"ai.response.toolCalls": {
|
|
6478
6500
|
output: () => {
|
|
6479
6501
|
var _a21;
|
|
@@ -7019,6 +7041,14 @@ var DefaultStreamTextResult = class {
|
|
|
7019
7041
|
"ai.response.text": {
|
|
7020
7042
|
output: () => activeText
|
|
7021
7043
|
},
|
|
7044
|
+
"ai.response.reasoning": {
|
|
7045
|
+
output: () => {
|
|
7046
|
+
const reasoningParts = recordedContent.filter(
|
|
7047
|
+
(c) => c.type === "reasoning"
|
|
7048
|
+
);
|
|
7049
|
+
return reasoningParts.length > 0 ? reasoningParts.map((r) => r.text).join("\n") : void 0;
|
|
7050
|
+
}
|
|
7051
|
+
},
|
|
7022
7052
|
"ai.response.toolCalls": {
|
|
7023
7053
|
output: () => stepToolCallsJson
|
|
7024
7054
|
},
|
|
@@ -9150,14 +9180,6 @@ var experimental_generateImage = generateImage;
|
|
|
9150
9180
|
// src/generate-object/generate-object.ts
|
|
9151
9181
|
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
9152
9182
|
|
|
9153
|
-
// src/generate-text/extract-reasoning-content.ts
|
|
9154
|
-
function extractReasoningContent(content) {
|
|
9155
|
-
const parts = content.filter(
|
|
9156
|
-
(content2) => content2.type === "reasoning"
|
|
9157
|
-
);
|
|
9158
|
-
return parts.length === 0 ? void 0 : parts.map((content2) => content2.text).join("\n");
|
|
9159
|
-
}
|
|
9160
|
-
|
|
9161
9183
|
// src/generate-object/output-strategy.ts
|
|
9162
9184
|
var import_provider30 = require("@ai-sdk/provider");
|
|
9163
9185
|
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
@@ -11642,6 +11664,7 @@ function customProvider({
|
|
|
11642
11664
|
transcriptionModels,
|
|
11643
11665
|
speechModels,
|
|
11644
11666
|
rerankingModels,
|
|
11667
|
+
videoModels,
|
|
11645
11668
|
fallbackProvider: fallbackProviderArg
|
|
11646
11669
|
}) {
|
|
11647
11670
|
const fallbackProvider = fallbackProviderArg ? asProviderV3(fallbackProviderArg) : void 0;
|
|
@@ -11700,6 +11723,16 @@ function customProvider({
|
|
|
11700
11723
|
return fallbackProvider.rerankingModel(modelId);
|
|
11701
11724
|
}
|
|
11702
11725
|
throw new import_provider33.NoSuchModelError({ modelId, modelType: "rerankingModel" });
|
|
11726
|
+
},
|
|
11727
|
+
videoModel(modelId) {
|
|
11728
|
+
if (videoModels != null && modelId in videoModels) {
|
|
11729
|
+
return videoModels[modelId];
|
|
11730
|
+
}
|
|
11731
|
+
const videoModel = fallbackProvider == null ? void 0 : fallbackProvider.videoModel;
|
|
11732
|
+
if (videoModel) {
|
|
11733
|
+
return videoModel(modelId);
|
|
11734
|
+
}
|
|
11735
|
+
throw new import_provider33.NoSuchModelError({ modelId, modelType: "videoModel" });
|
|
11703
11736
|
}
|
|
11704
11737
|
};
|
|
11705
11738
|
}
|