ai 4.1.56 → 4.1.57

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/dist/index.mjs CHANGED
@@ -5994,6 +5994,62 @@ var DefaultStreamTextResult = class {
5994
5994
  }
5995
5995
  };
5996
5996
 
5997
+ // core/util/merge-objects.ts
5998
+ function mergeObjects(target, source) {
5999
+ if (target === void 0 && source === void 0) {
6000
+ return void 0;
6001
+ }
6002
+ if (target === void 0) {
6003
+ return source;
6004
+ }
6005
+ if (source === void 0) {
6006
+ return target;
6007
+ }
6008
+ const result = { ...target };
6009
+ for (const key in source) {
6010
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
6011
+ const sourceValue = source[key];
6012
+ if (sourceValue === void 0)
6013
+ continue;
6014
+ const targetValue = key in target ? target[key] : void 0;
6015
+ const isSourceObject = sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) && !(sourceValue instanceof Date) && !(sourceValue instanceof RegExp);
6016
+ const isTargetObject = targetValue !== null && targetValue !== void 0 && typeof targetValue === "object" && !Array.isArray(targetValue) && !(targetValue instanceof Date) && !(targetValue instanceof RegExp);
6017
+ if (isSourceObject && isTargetObject) {
6018
+ result[key] = mergeObjects(
6019
+ targetValue,
6020
+ sourceValue
6021
+ );
6022
+ } else {
6023
+ result[key] = sourceValue;
6024
+ }
6025
+ }
6026
+ }
6027
+ return result;
6028
+ }
6029
+
6030
+ // core/middleware/default-settings-middleware.ts
6031
+ function defaultSettingsMiddleware({
6032
+ settings
6033
+ }) {
6034
+ return {
6035
+ middlewareVersion: "v1",
6036
+ transformParams: async ({ params }) => {
6037
+ var _a17;
6038
+ return {
6039
+ ...settings,
6040
+ ...params,
6041
+ providerMetadata: mergeObjects(
6042
+ settings.providerMetadata,
6043
+ params.providerMetadata
6044
+ ),
6045
+ // special case for temperature 0
6046
+ // TODO remove when temperature defaults to undefined
6047
+ temperature: params.temperature === 0 || params.temperature == null ? (_a17 = settings.temperature) != null ? _a17 : 0 : params.temperature
6048
+ };
6049
+ }
6050
+ };
6051
+ }
6052
+
5997
6053
  // core/util/get-potential-start-index.ts
5998
6054
  function getPotentialStartIndex(text2, searchedText) {
5999
6055
  if (searchedText.length === 0) {
@@ -7722,6 +7778,7 @@ export {
7722
7778
  createDataStreamResponse,
7723
7779
  createIdGenerator5 as createIdGenerator,
7724
7780
  customProvider,
7781
+ defaultSettingsMiddleware,
7725
7782
  embed,
7726
7783
  embedMany,
7727
7784
  createMCPClient as experimental_createMCPClient,