ai 6.0.15 → 6.0.16
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/dist/index.d.mts +24 -7
- package/dist/index.d.ts +24 -7
- package/dist/index.js +28 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +11 -1
- package/dist/internal/index.d.ts +11 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -700,6 +700,17 @@ function getGlobalProvider() {
|
|
|
700
700
|
return (_a16 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a16 : gateway;
|
|
701
701
|
}
|
|
702
702
|
|
|
703
|
+
// src/prompt/call-settings.ts
|
|
704
|
+
function getTotalTimeoutMs(timeout) {
|
|
705
|
+
if (timeout == null) {
|
|
706
|
+
return void 0;
|
|
707
|
+
}
|
|
708
|
+
if (typeof timeout === "number") {
|
|
709
|
+
return timeout;
|
|
710
|
+
}
|
|
711
|
+
return timeout.totalMs;
|
|
712
|
+
}
|
|
713
|
+
|
|
703
714
|
// src/prompt/convert-to-language-model-prompt.ts
|
|
704
715
|
import {
|
|
705
716
|
isUrlSupported
|
|
@@ -898,7 +909,7 @@ import {
|
|
|
898
909
|
} from "@ai-sdk/provider-utils";
|
|
899
910
|
|
|
900
911
|
// src/version.ts
|
|
901
|
-
var VERSION = true ? "6.0.
|
|
912
|
+
var VERSION = true ? "6.0.16" : "0.0.0-test";
|
|
902
913
|
|
|
903
914
|
// src/util/download/download.ts
|
|
904
915
|
var download = async ({ url }) => {
|
|
@@ -1829,7 +1840,16 @@ function getBaseTelemetryAttributes({
|
|
|
1829
1840
|
"ai.model.id": model.modelId,
|
|
1830
1841
|
// settings:
|
|
1831
1842
|
...Object.entries(settings).reduce((attributes, [key, value]) => {
|
|
1832
|
-
|
|
1843
|
+
if (key === "timeout") {
|
|
1844
|
+
const totalTimeoutMs = getTotalTimeoutMs(
|
|
1845
|
+
value
|
|
1846
|
+
);
|
|
1847
|
+
if (totalTimeoutMs != null) {
|
|
1848
|
+
attributes[`ai.settings.${key}`] = totalTimeoutMs;
|
|
1849
|
+
}
|
|
1850
|
+
} else {
|
|
1851
|
+
attributes[`ai.settings.${key}`] = value;
|
|
1852
|
+
}
|
|
1833
1853
|
return attributes;
|
|
1834
1854
|
}, {}),
|
|
1835
1855
|
// add metadata as attributes:
|
|
@@ -3564,9 +3584,10 @@ async function generateText({
|
|
|
3564
3584
|
}) {
|
|
3565
3585
|
const model = resolveLanguageModel(modelArg);
|
|
3566
3586
|
const stopConditions = asArray(stopWhen);
|
|
3587
|
+
const totalTimeoutMs = getTotalTimeoutMs(timeout);
|
|
3567
3588
|
const mergedAbortSignal = mergeAbortSignals(
|
|
3568
3589
|
abortSignal,
|
|
3569
|
-
|
|
3590
|
+
totalTimeoutMs != null ? AbortSignal.timeout(totalTimeoutMs) : void 0
|
|
3570
3591
|
);
|
|
3571
3592
|
const { maxRetries, retry } = prepareRetries({
|
|
3572
3593
|
maxRetries: maxRetriesArg,
|
|
@@ -5661,6 +5682,7 @@ function streamText({
|
|
|
5661
5682
|
} = {},
|
|
5662
5683
|
...settings
|
|
5663
5684
|
}) {
|
|
5685
|
+
const totalTimeoutMs = getTotalTimeoutMs(timeout);
|
|
5664
5686
|
return new DefaultStreamTextResult({
|
|
5665
5687
|
model: resolveLanguageModel(model),
|
|
5666
5688
|
telemetry,
|
|
@@ -5669,7 +5691,7 @@ function streamText({
|
|
|
5669
5691
|
maxRetries,
|
|
5670
5692
|
abortSignal: mergeAbortSignals(
|
|
5671
5693
|
abortSignal,
|
|
5672
|
-
|
|
5694
|
+
totalTimeoutMs != null ? AbortSignal.timeout(totalTimeoutMs) : void 0
|
|
5673
5695
|
),
|
|
5674
5696
|
system,
|
|
5675
5697
|
prompt,
|
|
@@ -12068,6 +12090,7 @@ export {
|
|
|
12068
12090
|
getTextFromDataUrl,
|
|
12069
12091
|
getToolName,
|
|
12070
12092
|
getToolOrDynamicToolName,
|
|
12093
|
+
getTotalTimeoutMs,
|
|
12071
12094
|
hasToolCall,
|
|
12072
12095
|
isDataUIPart,
|
|
12073
12096
|
isDeepEqualData,
|