ai 4.1.50 → 4.1.51
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 +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +25 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
@@ -5723,7 +5723,8 @@ var DefaultStreamTextResult = class {
|
|
5723
5723
|
// mask error messages for safety by default
|
5724
5724
|
sendUsage = true,
|
5725
5725
|
sendReasoning = false,
|
5726
|
-
sendSources = false
|
5726
|
+
sendSources = false,
|
5727
|
+
experimental_sendFinish = true
|
5727
5728
|
}) {
|
5728
5729
|
return this.fullStream.pipeThrough(
|
5729
5730
|
new TransformStream({
|
@@ -5835,15 +5836,17 @@ var DefaultStreamTextResult = class {
|
|
5835
5836
|
break;
|
5836
5837
|
}
|
5837
5838
|
case "finish": {
|
5838
|
-
|
5839
|
-
|
5840
|
-
|
5841
|
-
|
5842
|
-
|
5843
|
-
|
5844
|
-
|
5845
|
-
|
5846
|
-
|
5839
|
+
if (experimental_sendFinish) {
|
5840
|
+
controller.enqueue(
|
5841
|
+
formatDataStreamPart2("finish_message", {
|
5842
|
+
finishReason: chunk.finishReason,
|
5843
|
+
usage: sendUsage ? {
|
5844
|
+
promptTokens: chunk.usage.promptTokens,
|
5845
|
+
completionTokens: chunk.usage.completionTokens
|
5846
|
+
} : void 0
|
5847
|
+
})
|
5848
|
+
);
|
5849
|
+
}
|
5847
5850
|
break;
|
5848
5851
|
}
|
5849
5852
|
default: {
|
@@ -5863,7 +5866,8 @@ var DefaultStreamTextResult = class {
|
|
5863
5866
|
getErrorMessage: getErrorMessage5,
|
5864
5867
|
sendUsage,
|
5865
5868
|
sendReasoning,
|
5866
|
-
sendSources
|
5869
|
+
sendSources,
|
5870
|
+
experimental_sendFinish
|
5867
5871
|
} = {}) {
|
5868
5872
|
writeToServerResponse({
|
5869
5873
|
response,
|
@@ -5878,7 +5882,8 @@ var DefaultStreamTextResult = class {
|
|
5878
5882
|
getErrorMessage: getErrorMessage5,
|
5879
5883
|
sendUsage,
|
5880
5884
|
sendReasoning,
|
5881
|
-
sendSources
|
5885
|
+
sendSources,
|
5886
|
+
experimental_sendFinish
|
5882
5887
|
})
|
5883
5888
|
});
|
5884
5889
|
}
|
@@ -5899,7 +5904,8 @@ var DefaultStreamTextResult = class {
|
|
5899
5904
|
getErrorMessage: options == null ? void 0 : options.getErrorMessage,
|
5900
5905
|
sendUsage: options == null ? void 0 : options.sendUsage,
|
5901
5906
|
sendReasoning: options == null ? void 0 : options.sendReasoning,
|
5902
|
-
sendSources: options == null ? void 0 : options.sendSources
|
5907
|
+
sendSources: options == null ? void 0 : options.sendSources,
|
5908
|
+
experimental_sendFinish: options == null ? void 0 : options.experimental_sendFinish
|
5903
5909
|
}).pipeThrough(new TextEncoderStream());
|
5904
5910
|
return (options == null ? void 0 : options.data) ? mergeStreams(options == null ? void 0 : options.data.stream, stream) : stream;
|
5905
5911
|
}
|
@@ -5909,7 +5915,8 @@ var DefaultStreamTextResult = class {
|
|
5909
5915
|
getErrorMessage: writer.onError,
|
5910
5916
|
sendUsage: options == null ? void 0 : options.sendUsage,
|
5911
5917
|
sendReasoning: options == null ? void 0 : options.sendReasoning,
|
5912
|
-
sendSources: options == null ? void 0 : options.sendSources
|
5918
|
+
sendSources: options == null ? void 0 : options.sendSources,
|
5919
|
+
experimental_sendFinish: options == null ? void 0 : options.experimental_sendFinish
|
5913
5920
|
})
|
5914
5921
|
);
|
5915
5922
|
}
|
@@ -5921,7 +5928,8 @@ var DefaultStreamTextResult = class {
|
|
5921
5928
|
getErrorMessage: getErrorMessage5,
|
5922
5929
|
sendUsage,
|
5923
5930
|
sendReasoning,
|
5924
|
-
sendSources
|
5931
|
+
sendSources,
|
5932
|
+
experimental_sendFinish
|
5925
5933
|
} = {}) {
|
5926
5934
|
return new Response(
|
5927
5935
|
this.toDataStream({
|
@@ -5929,7 +5937,8 @@ var DefaultStreamTextResult = class {
|
|
5929
5937
|
getErrorMessage: getErrorMessage5,
|
5930
5938
|
sendUsage,
|
5931
5939
|
sendReasoning,
|
5932
|
-
sendSources
|
5940
|
+
sendSources,
|
5941
|
+
experimental_sendFinish
|
5933
5942
|
}),
|
5934
5943
|
{
|
5935
5944
|
status,
|