ai 3.4.15 → 3.4.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 +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -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
@@ -3008,7 +3008,8 @@ function isNonEmptyObject(object) {
|
|
3008
3008
|
// core/prompt/prepare-tools-and-tool-choice.ts
|
3009
3009
|
function prepareToolsAndToolChoice({
|
3010
3010
|
tools,
|
3011
|
-
toolChoice
|
3011
|
+
toolChoice,
|
3012
|
+
activeTools
|
3012
3013
|
}) {
|
3013
3014
|
if (!isNonEmptyObject(tools)) {
|
3014
3015
|
return {
|
@@ -3016,8 +3017,11 @@ function prepareToolsAndToolChoice({
|
|
3016
3017
|
toolChoice: void 0
|
3017
3018
|
};
|
3018
3019
|
}
|
3020
|
+
const filteredTools = activeTools != null ? Object.entries(tools).filter(
|
3021
|
+
([name11]) => activeTools.includes(name11)
|
3022
|
+
) : Object.entries(tools);
|
3019
3023
|
return {
|
3020
|
-
tools:
|
3024
|
+
tools: filteredTools.map(([name11, tool2]) => ({
|
3021
3025
|
type: "function",
|
3022
3026
|
name: name11,
|
3023
3027
|
description: tool2.description,
|
@@ -3119,6 +3123,7 @@ async function generateText({
|
|
3119
3123
|
experimental_continueSteps: continueSteps = experimental_continuationSteps != null ? experimental_continuationSteps : false,
|
3120
3124
|
experimental_telemetry: telemetry,
|
3121
3125
|
experimental_providerMetadata: providerMetadata,
|
3126
|
+
experimental_activeTools: activeTools,
|
3122
3127
|
_internal: {
|
3123
3128
|
generateId: generateId3 = originalGenerateId3,
|
3124
3129
|
currentDate = () => /* @__PURE__ */ new Date()
|
@@ -3168,7 +3173,7 @@ async function generateText({
|
|
3168
3173
|
});
|
3169
3174
|
const mode = {
|
3170
3175
|
type: "regular",
|
3171
|
-
...prepareToolsAndToolChoice({ tools, toolChoice })
|
3176
|
+
...prepareToolsAndToolChoice({ tools, toolChoice, activeTools })
|
3172
3177
|
};
|
3173
3178
|
const callSettings = prepareCallSettings(settings);
|
3174
3179
|
const promptMessages = await convertToLanguageModelPrompt({
|
@@ -3847,6 +3852,7 @@ async function streamText({
|
|
3847
3852
|
experimental_telemetry: telemetry,
|
3848
3853
|
experimental_providerMetadata: providerMetadata,
|
3849
3854
|
experimental_toolCallStreaming: toolCallStreaming = false,
|
3855
|
+
experimental_activeTools: activeTools,
|
3850
3856
|
onChunk,
|
3851
3857
|
onFinish,
|
3852
3858
|
onStepFinish,
|
@@ -3935,7 +3941,11 @@ async function streamText({
|
|
3935
3941
|
result: await model.doStream({
|
3936
3942
|
mode: {
|
3937
3943
|
type: "regular",
|
3938
|
-
...prepareToolsAndToolChoice({
|
3944
|
+
...prepareToolsAndToolChoice({
|
3945
|
+
tools,
|
3946
|
+
toolChoice,
|
3947
|
+
activeTools
|
3948
|
+
})
|
3939
3949
|
},
|
3940
3950
|
...prepareCallSettings(settings),
|
3941
3951
|
inputFormat: promptType,
|