@digipair/skill-dsp 0.88.5 → 0.89.0

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/index.cjs.js CHANGED
@@ -120105,6 +120105,7 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAIBase) {
120105
120105
  function AxAIMistral(param) {
120106
120106
  var apiKey = param.apiKey, config = param.config, options = param.options, models = param.models, modelInfo = param.modelInfo;
120107
120107
  _class_call_check(this, AxAIMistral);
120108
+ var _this;
120108
120109
  if (!apiKey || apiKey === "") {
120109
120110
  throw new Error("Mistral API key not set");
120110
120111
  }
@@ -120117,15 +120118,17 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAIBase) {
120117
120118
  hasShowThoughts: false
120118
120119
  };
120119
120120
  var chatReqUpdater = function(req) {
120120
- var max_completion_tokens = req.max_completion_tokens; req.stream_options; var result = _object_without_properties(req, [
120121
+ var max_completion_tokens = req.max_completion_tokens; req.stream_options; var messages = req.messages, result = _object_without_properties(req, [
120121
120122
  "max_completion_tokens",
120122
- "stream_options"
120123
+ "stream_options",
120124
+ "messages"
120123
120125
  ]);
120124
120126
  return _object_spread_props(_object_spread({}, result), {
120127
+ messages: _this.updateMessages(messages),
120125
120128
  max_tokens: max_completion_tokens
120126
120129
  });
120127
120130
  };
120128
- var _this = _super.call(this, {
120131
+ _this = _super.call(this, {
120129
120132
  apiKey: apiKey,
120130
120133
  config: _config,
120131
120134
  options: options,
@@ -120139,6 +120142,54 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAIBase) {
120139
120142
  _get((_assert_this_initialized(_this), _get_prototype_of(AxAIMistral.prototype)), "setName", _this).call(_this, "Mistral");
120140
120143
  return _this;
120141
120144
  }
120145
+ _create_class(AxAIMistral, [
120146
+ {
120147
+ key: "updateMessages",
120148
+ value: function updateMessages(messages) {
120149
+ var messagesUpdated = [];
120150
+ if (!Array.isArray(messages)) {
120151
+ return messages;
120152
+ }
120153
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
120154
+ try {
120155
+ for(var _iterator = messages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
120156
+ var message = _step.value;
120157
+ if (message.role === "user" && Array.isArray(message.content)) {
120158
+ var contentUpdated = message.content.map(function(item) {
120159
+ if (typeof item === "object" && item !== null && item.type === "image_url") {
120160
+ var _item_image_url;
120161
+ return {
120162
+ type: "image_url",
120163
+ image_url: (_item_image_url = item.image_url) === null || _item_image_url === void 0 ? void 0 : _item_image_url.url
120164
+ };
120165
+ }
120166
+ return item;
120167
+ });
120168
+ messagesUpdated.push(_object_spread_props(_object_spread({}, message), {
120169
+ content: contentUpdated
120170
+ }));
120171
+ } else {
120172
+ messagesUpdated.push(message);
120173
+ }
120174
+ }
120175
+ } catch (err) {
120176
+ _didIteratorError = true;
120177
+ _iteratorError = err;
120178
+ } finally{
120179
+ try {
120180
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
120181
+ _iterator.return();
120182
+ }
120183
+ } finally{
120184
+ if (_didIteratorError) {
120185
+ throw _iteratorError;
120186
+ }
120187
+ }
120188
+ }
120189
+ return messagesUpdated;
120190
+ }
120191
+ }
120192
+ ]);
120142
120193
  return AxAIMistral;
120143
120194
  }(AxAIOpenAIBase);
120144
120195
  // ai/ollama/api.ts
package/index.esm.js CHANGED
@@ -23951,14 +23951,14 @@ function indent(str, spaces) {
23951
23951
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23952
23952
  // match is required
23953
23953
  if (!match) {
23954
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23954
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
23955
23955
  v: nextMatch1
23956
23956
  };
23957
23957
  }
23958
23958
  var token = match.token, offset = match.offset;
23959
23959
  i1 += offset;
23960
23960
  if (token === " ") {
23961
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23961
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23962
23962
  }
23963
23963
  tokens1 = _to_consumable_array$5(tokens1).concat([
23964
23964
  token
@@ -23977,7 +23977,7 @@ function indent(str, spaces) {
23977
23977
  if (contextKeys.some(function(el) {
23978
23978
  return el.startsWith(name);
23979
23979
  })) {
23980
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23980
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
23981
23981
  }
23982
23982
  if (dateTimeIdentifiers.some(function(el) {
23983
23983
  return el === name;
@@ -23996,9 +23996,9 @@ function indent(str, spaces) {
23996
23996
  if (dateTimeIdentifiers.some(function(el) {
23997
23997
  return el.startsWith(name);
23998
23998
  })) {
23999
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23999
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, "continue";
24000
24000
  }
24001
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
24001
+ return nextMatch = nextMatch1, tokens = tokens1, i = i1, {
24002
24002
  v: nextMatch1
24003
24003
  };
24004
24004
  };
@@ -148044,6 +148044,7 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAIBase) {
148044
148044
  function AxAIMistral(param) {
148045
148045
  var apiKey = param.apiKey, config = param.config, options = param.options, models = param.models, modelInfo = param.modelInfo;
148046
148046
  _class_call_check(this, AxAIMistral);
148047
+ var _this;
148047
148048
  if (!apiKey || apiKey === "") {
148048
148049
  throw new Error("Mistral API key not set");
148049
148050
  }
@@ -148056,15 +148057,17 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAIBase) {
148056
148057
  hasShowThoughts: false
148057
148058
  };
148058
148059
  var chatReqUpdater = function(req) {
148059
- var max_completion_tokens = req.max_completion_tokens; req.stream_options; var result = _object_without_properties(req, [
148060
+ var max_completion_tokens = req.max_completion_tokens; req.stream_options; var messages = req.messages, result = _object_without_properties(req, [
148060
148061
  "max_completion_tokens",
148061
- "stream_options"
148062
+ "stream_options",
148063
+ "messages"
148062
148064
  ]);
148063
148065
  return _object_spread_props(_object_spread({}, result), {
148066
+ messages: _this.updateMessages(messages),
148064
148067
  max_tokens: max_completion_tokens
148065
148068
  });
148066
148069
  };
148067
- var _this = _super.call(this, {
148070
+ _this = _super.call(this, {
148068
148071
  apiKey: apiKey,
148069
148072
  config: _config,
148070
148073
  options: options,
@@ -148078,6 +148081,54 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAIBase) {
148078
148081
  _get((_assert_this_initialized(_this), _get_prototype_of(AxAIMistral.prototype)), "setName", _this).call(_this, "Mistral");
148079
148082
  return _this;
148080
148083
  }
148084
+ _create_class(AxAIMistral, [
148085
+ {
148086
+ key: "updateMessages",
148087
+ value: function updateMessages(messages) {
148088
+ var messagesUpdated = [];
148089
+ if (!Array.isArray(messages)) {
148090
+ return messages;
148091
+ }
148092
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
148093
+ try {
148094
+ for(var _iterator = messages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
148095
+ var message = _step.value;
148096
+ if (message.role === "user" && Array.isArray(message.content)) {
148097
+ var contentUpdated = message.content.map(function(item) {
148098
+ if (typeof item === "object" && item !== null && item.type === "image_url") {
148099
+ var _item_image_url;
148100
+ return {
148101
+ type: "image_url",
148102
+ image_url: (_item_image_url = item.image_url) === null || _item_image_url === void 0 ? void 0 : _item_image_url.url
148103
+ };
148104
+ }
148105
+ return item;
148106
+ });
148107
+ messagesUpdated.push(_object_spread_props(_object_spread({}, message), {
148108
+ content: contentUpdated
148109
+ }));
148110
+ } else {
148111
+ messagesUpdated.push(message);
148112
+ }
148113
+ }
148114
+ } catch (err) {
148115
+ _didIteratorError = true;
148116
+ _iteratorError = err;
148117
+ } finally{
148118
+ try {
148119
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
148120
+ _iterator.return();
148121
+ }
148122
+ } finally{
148123
+ if (_didIteratorError) {
148124
+ throw _iteratorError;
148125
+ }
148126
+ }
148127
+ }
148128
+ return messagesUpdated;
148129
+ }
148130
+ }
148131
+ ]);
148081
148132
  return AxAIMistral;
148082
148133
  }(AxAIOpenAIBase);
148083
148134
  // ai/ollama/api.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-dsp",
3
- "version": "0.88.5",
3
+ "version": "0.89.0",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "service",