ai 3.4.15 → 3.4.17
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 +12 -0
- package/dist/index.d.mts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/rsc/dist/rsc-server.mjs +11 -3
- package/rsc/dist/rsc-server.mjs.map +1 -1
package/dist/index.mjs
CHANGED
@@ -288,6 +288,9 @@ function selectTelemetryAttributes({
|
|
288
288
|
telemetry,
|
289
289
|
attributes
|
290
290
|
}) {
|
291
|
+
if ((telemetry == null ? void 0 : telemetry.isEnabled) !== true) {
|
292
|
+
return {};
|
293
|
+
}
|
291
294
|
return Object.entries(attributes).reduce((attributes2, [key, value]) => {
|
292
295
|
if (value === void 0) {
|
293
296
|
return attributes2;
|
@@ -3008,7 +3011,8 @@ function isNonEmptyObject(object) {
|
|
3008
3011
|
// core/prompt/prepare-tools-and-tool-choice.ts
|
3009
3012
|
function prepareToolsAndToolChoice({
|
3010
3013
|
tools,
|
3011
|
-
toolChoice
|
3014
|
+
toolChoice,
|
3015
|
+
activeTools
|
3012
3016
|
}) {
|
3013
3017
|
if (!isNonEmptyObject(tools)) {
|
3014
3018
|
return {
|
@@ -3016,8 +3020,11 @@ function prepareToolsAndToolChoice({
|
|
3016
3020
|
toolChoice: void 0
|
3017
3021
|
};
|
3018
3022
|
}
|
3023
|
+
const filteredTools = activeTools != null ? Object.entries(tools).filter(
|
3024
|
+
([name11]) => activeTools.includes(name11)
|
3025
|
+
) : Object.entries(tools);
|
3019
3026
|
return {
|
3020
|
-
tools:
|
3027
|
+
tools: filteredTools.map(([name11, tool2]) => ({
|
3021
3028
|
type: "function",
|
3022
3029
|
name: name11,
|
3023
3030
|
description: tool2.description,
|
@@ -3119,6 +3126,7 @@ async function generateText({
|
|
3119
3126
|
experimental_continueSteps: continueSteps = experimental_continuationSteps != null ? experimental_continuationSteps : false,
|
3120
3127
|
experimental_telemetry: telemetry,
|
3121
3128
|
experimental_providerMetadata: providerMetadata,
|
3129
|
+
experimental_activeTools: activeTools,
|
3122
3130
|
_internal: {
|
3123
3131
|
generateId: generateId3 = originalGenerateId3,
|
3124
3132
|
currentDate = () => /* @__PURE__ */ new Date()
|
@@ -3168,7 +3176,7 @@ async function generateText({
|
|
3168
3176
|
});
|
3169
3177
|
const mode = {
|
3170
3178
|
type: "regular",
|
3171
|
-
...prepareToolsAndToolChoice({ tools, toolChoice })
|
3179
|
+
...prepareToolsAndToolChoice({ tools, toolChoice, activeTools })
|
3172
3180
|
};
|
3173
3181
|
const callSettings = prepareCallSettings(settings);
|
3174
3182
|
const promptMessages = await convertToLanguageModelPrompt({
|
@@ -3847,6 +3855,7 @@ async function streamText({
|
|
3847
3855
|
experimental_telemetry: telemetry,
|
3848
3856
|
experimental_providerMetadata: providerMetadata,
|
3849
3857
|
experimental_toolCallStreaming: toolCallStreaming = false,
|
3858
|
+
experimental_activeTools: activeTools,
|
3850
3859
|
onChunk,
|
3851
3860
|
onFinish,
|
3852
3861
|
onStepFinish,
|
@@ -3935,7 +3944,11 @@ async function streamText({
|
|
3935
3944
|
result: await model.doStream({
|
3936
3945
|
mode: {
|
3937
3946
|
type: "regular",
|
3938
|
-
...prepareToolsAndToolChoice({
|
3947
|
+
...prepareToolsAndToolChoice({
|
3948
|
+
tools,
|
3949
|
+
toolChoice,
|
3950
|
+
activeTools
|
3951
|
+
})
|
3939
3952
|
},
|
3940
3953
|
...prepareCallSettings(settings),
|
3941
3954
|
inputFormat: promptType,
|