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/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
@@ -2199,6 +2199,25 @@ type DataStreamOptions = {
|
|
2199
2199
|
* Default to false.
|
2200
2200
|
*/
|
2201
2201
|
sendSources?: boolean;
|
2202
|
+
/**
|
2203
|
+
* Send the finish event to the client.
|
2204
|
+
* Set to false if you are using additional streamText calls
|
2205
|
+
* that send additional data.
|
2206
|
+
* Default to true.
|
2207
|
+
*/
|
2208
|
+
experimental_sendFinish?: boolean;
|
2209
|
+
/**
|
2210
|
+
* Send the message start event to the client.
|
2211
|
+
* Set to false if you are using additional streamText calls
|
2212
|
+
* and the message start event has already been sent.
|
2213
|
+
* Default to true.
|
2214
|
+
*
|
2215
|
+
* Note: this setting is currently not used, but you should
|
2216
|
+
* already set it to false if you are using additional
|
2217
|
+
* streamText calls that send additional data to prevent
|
2218
|
+
* the message start event from being sent multiple times.
|
2219
|
+
*/
|
2220
|
+
experimental_sendStart?: boolean;
|
2202
2221
|
};
|
2203
2222
|
/**
|
2204
2223
|
A result object for accessing different stream types and additional information.
|
package/dist/index.d.ts
CHANGED
@@ -2199,6 +2199,25 @@ type DataStreamOptions = {
|
|
2199
2199
|
* Default to false.
|
2200
2200
|
*/
|
2201
2201
|
sendSources?: boolean;
|
2202
|
+
/**
|
2203
|
+
* Send the finish event to the client.
|
2204
|
+
* Set to false if you are using additional streamText calls
|
2205
|
+
* that send additional data.
|
2206
|
+
* Default to true.
|
2207
|
+
*/
|
2208
|
+
experimental_sendFinish?: boolean;
|
2209
|
+
/**
|
2210
|
+
* Send the message start event to the client.
|
2211
|
+
* Set to false if you are using additional streamText calls
|
2212
|
+
* and the message start event has already been sent.
|
2213
|
+
* Default to true.
|
2214
|
+
*
|
2215
|
+
* Note: this setting is currently not used, but you should
|
2216
|
+
* already set it to false if you are using additional
|
2217
|
+
* streamText calls that send additional data to prevent
|
2218
|
+
* the message start event from being sent multiple times.
|
2219
|
+
*/
|
2220
|
+
experimental_sendStart?: boolean;
|
2202
2221
|
};
|
2203
2222
|
/**
|
2204
2223
|
A result object for accessing different stream types and additional information.
|
package/dist/index.js
CHANGED
@@ -5770,7 +5770,8 @@ var DefaultStreamTextResult = class {
|
|
5770
5770
|
// mask error messages for safety by default
|
5771
5771
|
sendUsage = true,
|
5772
5772
|
sendReasoning = false,
|
5773
|
-
sendSources = false
|
5773
|
+
sendSources = false,
|
5774
|
+
experimental_sendFinish = true
|
5774
5775
|
}) {
|
5775
5776
|
return this.fullStream.pipeThrough(
|
5776
5777
|
new TransformStream({
|
@@ -5882,15 +5883,17 @@ var DefaultStreamTextResult = class {
|
|
5882
5883
|
break;
|
5883
5884
|
}
|
5884
5885
|
case "finish": {
|
5885
|
-
|
5886
|
-
|
5887
|
-
|
5888
|
-
|
5889
|
-
|
5890
|
-
|
5891
|
-
|
5892
|
-
|
5893
|
-
|
5886
|
+
if (experimental_sendFinish) {
|
5887
|
+
controller.enqueue(
|
5888
|
+
(0, import_ui_utils8.formatDataStreamPart)("finish_message", {
|
5889
|
+
finishReason: chunk.finishReason,
|
5890
|
+
usage: sendUsage ? {
|
5891
|
+
promptTokens: chunk.usage.promptTokens,
|
5892
|
+
completionTokens: chunk.usage.completionTokens
|
5893
|
+
} : void 0
|
5894
|
+
})
|
5895
|
+
);
|
5896
|
+
}
|
5894
5897
|
break;
|
5895
5898
|
}
|
5896
5899
|
default: {
|
@@ -5910,7 +5913,8 @@ var DefaultStreamTextResult = class {
|
|
5910
5913
|
getErrorMessage: getErrorMessage5,
|
5911
5914
|
sendUsage,
|
5912
5915
|
sendReasoning,
|
5913
|
-
sendSources
|
5916
|
+
sendSources,
|
5917
|
+
experimental_sendFinish
|
5914
5918
|
} = {}) {
|
5915
5919
|
writeToServerResponse({
|
5916
5920
|
response,
|
@@ -5925,7 +5929,8 @@ var DefaultStreamTextResult = class {
|
|
5925
5929
|
getErrorMessage: getErrorMessage5,
|
5926
5930
|
sendUsage,
|
5927
5931
|
sendReasoning,
|
5928
|
-
sendSources
|
5932
|
+
sendSources,
|
5933
|
+
experimental_sendFinish
|
5929
5934
|
})
|
5930
5935
|
});
|
5931
5936
|
}
|
@@ -5946,7 +5951,8 @@ var DefaultStreamTextResult = class {
|
|
5946
5951
|
getErrorMessage: options == null ? void 0 : options.getErrorMessage,
|
5947
5952
|
sendUsage: options == null ? void 0 : options.sendUsage,
|
5948
5953
|
sendReasoning: options == null ? void 0 : options.sendReasoning,
|
5949
|
-
sendSources: options == null ? void 0 : options.sendSources
|
5954
|
+
sendSources: options == null ? void 0 : options.sendSources,
|
5955
|
+
experimental_sendFinish: options == null ? void 0 : options.experimental_sendFinish
|
5950
5956
|
}).pipeThrough(new TextEncoderStream());
|
5951
5957
|
return (options == null ? void 0 : options.data) ? mergeStreams(options == null ? void 0 : options.data.stream, stream) : stream;
|
5952
5958
|
}
|
@@ -5956,7 +5962,8 @@ var DefaultStreamTextResult = class {
|
|
5956
5962
|
getErrorMessage: writer.onError,
|
5957
5963
|
sendUsage: options == null ? void 0 : options.sendUsage,
|
5958
5964
|
sendReasoning: options == null ? void 0 : options.sendReasoning,
|
5959
|
-
sendSources: options == null ? void 0 : options.sendSources
|
5965
|
+
sendSources: options == null ? void 0 : options.sendSources,
|
5966
|
+
experimental_sendFinish: options == null ? void 0 : options.experimental_sendFinish
|
5960
5967
|
})
|
5961
5968
|
);
|
5962
5969
|
}
|
@@ -5968,7 +5975,8 @@ var DefaultStreamTextResult = class {
|
|
5968
5975
|
getErrorMessage: getErrorMessage5,
|
5969
5976
|
sendUsage,
|
5970
5977
|
sendReasoning,
|
5971
|
-
sendSources
|
5978
|
+
sendSources,
|
5979
|
+
experimental_sendFinish
|
5972
5980
|
} = {}) {
|
5973
5981
|
return new Response(
|
5974
5982
|
this.toDataStream({
|
@@ -5976,7 +5984,8 @@ var DefaultStreamTextResult = class {
|
|
5976
5984
|
getErrorMessage: getErrorMessage5,
|
5977
5985
|
sendUsage,
|
5978
5986
|
sendReasoning,
|
5979
|
-
sendSources
|
5987
|
+
sendSources,
|
5988
|
+
experimental_sendFinish
|
5980
5989
|
}),
|
5981
5990
|
{
|
5982
5991
|
status,
|