@digipair/skill-dsp 0.22.2 → 0.23.3
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 +159 -136
- package/index.esm.js +159 -136
- package/libs/skill-dsp/src/lib/skill-dsp.d.ts +1 -1
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -20332,6 +20332,7 @@ about the parse state.
|
|
|
20332
20332
|
var _a;
|
|
20333
20333
|
var depth = action >> 19 /* Action.ReduceDepthShift */ , type = action & 65535 /* Action.ValueMask */ ;
|
|
20334
20334
|
var parser = this.p.parser;
|
|
20335
|
+
if (this.reducePos < this.pos - 25 /* Lookahead.Margin */ ) this.setLookAhead(this.pos);
|
|
20335
20336
|
var dPrec = parser.dynamicPrecedence(type);
|
|
20336
20337
|
if (dPrec) this.score += dPrec;
|
|
20337
20338
|
if (depth == 0) {
|
|
@@ -21284,7 +21285,7 @@ function cutAt(tree, pos, side) {
|
|
|
21284
21285
|
cursor.moveTo(pos);
|
|
21285
21286
|
for(;;){
|
|
21286
21287
|
if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos))) for(;;){
|
|
21287
|
-
if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError) return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /*
|
|
21288
|
+
if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError) return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Lookahead.Margin */ )) : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Lookahead.Margin */ ));
|
|
21288
21289
|
if (side < 0 ? cursor.prevSibling() : cursor.nextSibling()) break;
|
|
21289
21290
|
if (!cursor.parent()) return side < 0 ? 0 : tree.length;
|
|
21290
21291
|
}
|
|
@@ -21407,7 +21408,7 @@ var TokenCache = /*#__PURE__*/ function() {
|
|
|
21407
21408
|
token.mask = mask;
|
|
21408
21409
|
token.context = context;
|
|
21409
21410
|
}
|
|
21410
|
-
if (token.lookAhead > token.end + 25 /*
|
|
21411
|
+
if (token.lookAhead > token.end + 25 /* Lookahead.Margin */ ) lookAhead = Math.max(token.lookAhead, lookAhead);
|
|
21411
21412
|
if (token.value != 0 /* Term.Err */ ) {
|
|
21412
21413
|
var startIndex = actionIndex;
|
|
21413
21414
|
if (token.extended > -1) actionIndex = this.addActions(stack, token.extended, token.end, actionIndex);
|
|
@@ -23498,14 +23499,14 @@ function indent(str, spaces) {
|
|
|
23498
23499
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
23499
23500
|
// match is required
|
|
23500
23501
|
if (!match) {
|
|
23501
|
-
return
|
|
23502
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
|
|
23502
23503
|
v: nextMatch1
|
|
23503
23504
|
};
|
|
23504
23505
|
}
|
|
23505
23506
|
var token = match.token, offset = match.offset;
|
|
23506
23507
|
i1 += offset;
|
|
23507
23508
|
if (token === " ") {
|
|
23508
|
-
return
|
|
23509
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23509
23510
|
}
|
|
23510
23511
|
tokens1 = _to_consumable_array$6(tokens1).concat([
|
|
23511
23512
|
token
|
|
@@ -23524,7 +23525,7 @@ function indent(str, spaces) {
|
|
|
23524
23525
|
if (contextKeys.some(function(el) {
|
|
23525
23526
|
return el.startsWith(name);
|
|
23526
23527
|
})) {
|
|
23527
|
-
return
|
|
23528
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23528
23529
|
}
|
|
23529
23530
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23530
23531
|
return el === name;
|
|
@@ -23543,9 +23544,9 @@ function indent(str, spaces) {
|
|
|
23543
23544
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23544
23545
|
return el.startsWith(name);
|
|
23545
23546
|
})) {
|
|
23546
|
-
return
|
|
23547
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23547
23548
|
}
|
|
23548
|
-
return
|
|
23549
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
|
|
23549
23550
|
v: nextMatch1
|
|
23550
23551
|
};
|
|
23551
23552
|
};
|
|
@@ -24348,6 +24349,7 @@ var parser = LRParser.deserialize({
|
|
|
24348
24349
|
},
|
|
24349
24350
|
dynamicPrecedences: {
|
|
24350
24351
|
"31": -1,
|
|
24352
|
+
"67": 1,
|
|
24351
24353
|
"71": -1,
|
|
24352
24354
|
"73": -1
|
|
24353
24355
|
},
|
|
@@ -28610,7 +28612,7 @@ var axBaseAIDefaultConfig = function() {
|
|
|
28610
28612
|
};
|
|
28611
28613
|
var AxBaseAI = /*#__PURE__*/ function() {
|
|
28612
28614
|
function AxBaseAI(param) {
|
|
28613
|
-
var name = param.name, apiURL = param.apiURL, headers = param.headers, modelInfo = param.modelInfo, models = param.models, _param_options = param.options, options = _param_options === void 0 ? {} : _param_options, supportFor = param.supportFor;
|
|
28615
|
+
var name = param.name, apiURL = param.apiURL, headers = param.headers, modelInfo = param.modelInfo, models = param.models, _param_options = param.options, options = _param_options === void 0 ? {} : _param_options, supportFor = param.supportFor, modelMap = param.modelMap;
|
|
28614
28616
|
_class_call_check$p(this, AxBaseAI);
|
|
28615
28617
|
_define_property$p(this, "generateChatReq", void 0);
|
|
28616
28618
|
_define_property$p(this, "generateEmbedReq", void 0);
|
|
@@ -28622,48 +28624,29 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28622
28624
|
_define_property$p(this, "fetch", void 0);
|
|
28623
28625
|
_define_property$p(this, "tracer", void 0);
|
|
28624
28626
|
_define_property$p(this, "modelMap", void 0);
|
|
28625
|
-
_define_property$p(this, "
|
|
28627
|
+
_define_property$p(this, "modelInfo", void 0);
|
|
28626
28628
|
_define_property$p(this, "modelUsage", void 0);
|
|
28627
28629
|
_define_property$p(this, "embedModelUsage", void 0);
|
|
28630
|
+
_define_property$p(this, "models", void 0);
|
|
28628
28631
|
_define_property$p(this, "apiURL", void 0);
|
|
28629
28632
|
_define_property$p(this, "name", void 0);
|
|
28630
28633
|
_define_property$p(this, "headers", void 0);
|
|
28631
|
-
_define_property$p(this, "modelInfo", void 0);
|
|
28632
|
-
_define_property$p(this, "embedModelInfo", void 0);
|
|
28633
28634
|
_define_property$p(this, "supportFor", void 0);
|
|
28634
28635
|
this.name = name;
|
|
28635
28636
|
this.apiURL = apiURL;
|
|
28636
28637
|
this.headers = headers;
|
|
28637
28638
|
this.supportFor = supportFor;
|
|
28638
28639
|
this.tracer = options.tracer;
|
|
28639
|
-
|
|
28640
|
-
|
|
28641
|
-
|
|
28642
|
-
|
|
28643
|
-
|
|
28644
|
-
|
|
28645
|
-
|
|
28646
|
-
|
|
28647
|
-
name: model,
|
|
28648
|
-
currency: "usd",
|
|
28649
|
-
promptTokenCostPer1M: 0,
|
|
28650
|
-
completionTokenCostPer1M: 0
|
|
28651
|
-
};
|
|
28652
|
-
} else {
|
|
28640
|
+
this.modelInfo = modelInfo;
|
|
28641
|
+
this.modelMap = modelMap;
|
|
28642
|
+
var _modelMap_models_model, _models_embedModel, _modelMap_;
|
|
28643
|
+
this.models = {
|
|
28644
|
+
model: (_modelMap_models_model = modelMap === null || modelMap === void 0 ? void 0 : modelMap[models.model]) !== null && _modelMap_models_model !== void 0 ? _modelMap_models_model : models.model,
|
|
28645
|
+
embedModel: (_modelMap_ = modelMap === null || modelMap === void 0 ? void 0 : modelMap[(_models_embedModel = models.embedModel) !== null && _models_embedModel !== void 0 ? _models_embedModel : ""]) !== null && _modelMap_ !== void 0 ? _modelMap_ : models.embedModel
|
|
28646
|
+
};
|
|
28647
|
+
if (!models.model || typeof models.model !== "string" || models.model === "") {
|
|
28653
28648
|
throw new Error("No model defined");
|
|
28654
28649
|
}
|
|
28655
|
-
if (typeof embedModel === "string") {
|
|
28656
|
-
var embedModelName = embedModel === null || embedModel === void 0 ? void 0 : embedModel.replace(/-0\d+$|-\d{2,}$/, "");
|
|
28657
|
-
var _modelInfo_filter_at1;
|
|
28658
|
-
this.embedModelInfo = (_modelInfo_filter_at1 = modelInfo.filter(function(v) {
|
|
28659
|
-
return v.name === embedModelName;
|
|
28660
|
-
}).at(0)) !== null && _modelInfo_filter_at1 !== void 0 ? _modelInfo_filter_at1 : {
|
|
28661
|
-
name: embedModel !== null && embedModel !== void 0 ? embedModel : "",
|
|
28662
|
-
currency: "usd",
|
|
28663
|
-
promptTokenCostPer1M: 0,
|
|
28664
|
-
completionTokenCostPer1M: 0
|
|
28665
|
-
};
|
|
28666
|
-
}
|
|
28667
28650
|
this.setOptions(options);
|
|
28668
28651
|
}
|
|
28669
28652
|
_create_class$c(AxBaseAI, [
|
|
@@ -28703,21 +28686,27 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28703
28686
|
}
|
|
28704
28687
|
},
|
|
28705
28688
|
{
|
|
28706
|
-
key: "
|
|
28707
|
-
value: function
|
|
28708
|
-
|
|
28709
|
-
|
|
28710
|
-
|
|
28711
|
-
|
|
28712
|
-
|
|
28713
|
-
|
|
28714
|
-
|
|
28689
|
+
key: "_getModelInfo",
|
|
28690
|
+
value: function _getModelInfo(model) {
|
|
28691
|
+
var _this_modelMap;
|
|
28692
|
+
var _this_modelMap_model;
|
|
28693
|
+
var _model = (_this_modelMap_model = (_this_modelMap = this.modelMap) === null || _this_modelMap === void 0 ? void 0 : _this_modelMap[model]) !== null && _this_modelMap_model !== void 0 ? _this_modelMap_model : model;
|
|
28694
|
+
var modelName = _model.replace(/-0\d+$|-\d{2,}$/, "");
|
|
28695
|
+
var _this_modelInfo_filter_at;
|
|
28696
|
+
return (_this_modelInfo_filter_at = this.modelInfo.filter(function(v) {
|
|
28697
|
+
return v.name === modelName;
|
|
28698
|
+
}).at(0)) !== null && _this_modelInfo_filter_at !== void 0 ? _this_modelInfo_filter_at : {
|
|
28699
|
+
name: model,
|
|
28700
|
+
currency: "usd",
|
|
28701
|
+
promptTokenCostPer1M: 0,
|
|
28702
|
+
completionTokenCostPer1M: 0
|
|
28703
|
+
};
|
|
28715
28704
|
}
|
|
28716
28705
|
},
|
|
28717
28706
|
{
|
|
28718
28707
|
key: "getModelInfo",
|
|
28719
28708
|
value: function getModelInfo() {
|
|
28720
|
-
return _object_spread_props$8(_object_spread$h({}, this.
|
|
28709
|
+
return _object_spread_props$8(_object_spread$h({}, this._getModelInfo(this.models.model)), {
|
|
28721
28710
|
provider: this.name
|
|
28722
28711
|
});
|
|
28723
28712
|
}
|
|
@@ -28725,9 +28714,17 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28725
28714
|
{
|
|
28726
28715
|
key: "getEmbedModelInfo",
|
|
28727
28716
|
value: function getEmbedModelInfo() {
|
|
28728
|
-
|
|
28729
|
-
|
|
28730
|
-
|
|
28717
|
+
if (this.models.embedModel) {
|
|
28718
|
+
return _object_spread_props$8(_object_spread$h({}, this._getModelInfo(this.models.embedModel)), {
|
|
28719
|
+
provider: this.name
|
|
28720
|
+
});
|
|
28721
|
+
}
|
|
28722
|
+
}
|
|
28723
|
+
},
|
|
28724
|
+
{
|
|
28725
|
+
key: "getModelMap",
|
|
28726
|
+
value: function getModelMap() {
|
|
28727
|
+
return this.modelMap;
|
|
28731
28728
|
}
|
|
28732
28729
|
},
|
|
28733
28730
|
{
|
|
@@ -28750,13 +28747,14 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28750
28747
|
},
|
|
28751
28748
|
{
|
|
28752
28749
|
key: "chat",
|
|
28753
|
-
value: function chat(
|
|
28750
|
+
value: function chat(req, options) {
|
|
28754
28751
|
var _this = this;
|
|
28755
28752
|
return _async_to_generator$7(function() {
|
|
28756
|
-
var _mc_stopSequences, _this_tracer, mc, _obj;
|
|
28753
|
+
var _this_modelMap, _this_modelMap_req_model, model, _mc_stopSequences, _this_tracer, mc, _obj;
|
|
28757
28754
|
return _ts_generator$8(this, function(_state) {
|
|
28758
28755
|
switch(_state.label){
|
|
28759
28756
|
case 0:
|
|
28757
|
+
model = req.model ? (_this_modelMap_req_model = (_this_modelMap = _this.modelMap) === null || _this_modelMap === void 0 ? void 0 : _this_modelMap[req.model]) !== null && _this_modelMap_req_model !== void 0 ? _this_modelMap_req_model : req.model : _this.models.model;
|
|
28760
28758
|
if (!_this.tracer) return [
|
|
28761
28759
|
3,
|
|
28762
28760
|
2
|
|
@@ -28766,7 +28764,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28766
28764
|
4,
|
|
28767
28765
|
(_this_tracer = _this.tracer) === null || _this_tracer === void 0 ? void 0 : _this_tracer.startActiveSpan("Chat Request", {
|
|
28768
28766
|
kind: AxSpanKind.SERVER,
|
|
28769
|
-
attributes: (_obj = {}, _define_property$p(_obj, axSpanAttributes.LLM_SYSTEM, _this.name), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_MODEL,
|
|
28767
|
+
attributes: (_obj = {}, _define_property$p(_obj, axSpanAttributes.LLM_SYSTEM, _this.name), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_MODEL, model), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_MAX_TOKENS, mc.maxTokens), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_TEMPERATURE, mc.temperature), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_TOP_P, mc.topP), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_TOP_K, mc.topK), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_FREQUENCY_PENALTY, mc.frequencyPenalty), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_PRESENCE_PENALTY, mc.presencePenalty), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_STOP_SEQUENCES, (_mc_stopSequences = mc.stopSequences) === null || _mc_stopSequences === void 0 ? void 0 : _mc_stopSequences.join(", ")), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_LLM_IS_STREAMING, mc.stream), _obj)
|
|
28770
28768
|
}, function() {
|
|
28771
28769
|
var _ref = _async_to_generator$7(function(span) {
|
|
28772
28770
|
var res;
|
|
@@ -28775,7 +28773,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28775
28773
|
case 0:
|
|
28776
28774
|
return [
|
|
28777
28775
|
4,
|
|
28778
|
-
_this._chat(
|
|
28776
|
+
_this._chat(model, req, options, span)
|
|
28779
28777
|
];
|
|
28780
28778
|
case 1:
|
|
28781
28779
|
res = _state.sent();
|
|
@@ -28800,7 +28798,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28800
28798
|
case 2:
|
|
28801
28799
|
return [
|
|
28802
28800
|
4,
|
|
28803
|
-
_this._chat(
|
|
28801
|
+
_this._chat(model, req, options)
|
|
28804
28802
|
];
|
|
28805
28803
|
case 3:
|
|
28806
28804
|
return [
|
|
@@ -28814,10 +28812,10 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28814
28812
|
},
|
|
28815
28813
|
{
|
|
28816
28814
|
key: "_chat",
|
|
28817
|
-
value: function _chat(
|
|
28815
|
+
value: function _chat(model, chatReq, options, span) {
|
|
28818
28816
|
var _this = this;
|
|
28819
28817
|
return _async_to_generator$7(function() {
|
|
28820
|
-
var
|
|
28818
|
+
var _chatReq_modelConfig, reqFn, _options_stream, stream, functions, req, fn, rv, _tmp, respFn, wrappedRespFn, doneCb, st, res;
|
|
28821
28819
|
return _ts_generator$8(this, function(_state) {
|
|
28822
28820
|
switch(_state.label){
|
|
28823
28821
|
case 0:
|
|
@@ -28825,11 +28823,14 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28825
28823
|
throw new Error("generateChatReq not implemented");
|
|
28826
28824
|
}
|
|
28827
28825
|
reqFn = _this.generateChatReq;
|
|
28828
|
-
stream = (_options_stream = options === null || options === void 0 ? void 0 : options.stream) !== null && _options_stream !== void 0 ? _options_stream : (
|
|
28829
|
-
|
|
28830
|
-
|
|
28826
|
+
stream = (_options_stream = options === null || options === void 0 ? void 0 : options.stream) !== null && _options_stream !== void 0 ? _options_stream : (_chatReq_modelConfig = chatReq.modelConfig) === null || _chatReq_modelConfig === void 0 ? void 0 : _chatReq_modelConfig.stream;
|
|
28827
|
+
if (chatReq.functions && chatReq.functions.length > 0) {
|
|
28828
|
+
functions = chatReq.functions;
|
|
28829
|
+
}
|
|
28830
|
+
req = _object_spread_props$8(_object_spread$h({}, chatReq), {
|
|
28831
|
+
model: model,
|
|
28831
28832
|
functions: functions,
|
|
28832
|
-
modelConfig: _object_spread_props$8(_object_spread$h({},
|
|
28833
|
+
modelConfig: _object_spread_props$8(_object_spread$h({}, chatReq.modelConfig), {
|
|
28833
28834
|
stream: stream
|
|
28834
28835
|
})
|
|
28835
28836
|
});
|
|
@@ -28966,10 +28967,14 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28966
28967
|
value: function embed(req, options) {
|
|
28967
28968
|
var _this = this;
|
|
28968
28969
|
return _async_to_generator$7(function() {
|
|
28969
|
-
var _this_tracer, _obj;
|
|
28970
|
+
var _this_modelMap, _this_modelMap_req_embedModel, embedModel, _this_tracer, _req_embedModel, _obj;
|
|
28970
28971
|
return _ts_generator$8(this, function(_state) {
|
|
28971
28972
|
switch(_state.label){
|
|
28972
28973
|
case 0:
|
|
28974
|
+
embedModel = req.embedModel ? (_this_modelMap_req_embedModel = (_this_modelMap = _this.modelMap) === null || _this_modelMap === void 0 ? void 0 : _this_modelMap[req.embedModel]) !== null && _this_modelMap_req_embedModel !== void 0 ? _this_modelMap_req_embedModel : req.embedModel : _this.models.embedModel;
|
|
28975
|
+
if (!embedModel) {
|
|
28976
|
+
throw new Error("No embed model defined");
|
|
28977
|
+
}
|
|
28973
28978
|
if (!_this.tracer) return [
|
|
28974
28979
|
3,
|
|
28975
28980
|
2
|
|
@@ -28978,7 +28983,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28978
28983
|
4,
|
|
28979
28984
|
(_this_tracer = _this.tracer) === null || _this_tracer === void 0 ? void 0 : _this_tracer.startActiveSpan("Embed Request", {
|
|
28980
28985
|
kind: AxSpanKind.SERVER,
|
|
28981
|
-
attributes: (_obj = {}, _define_property$p(_obj, axSpanAttributes.LLM_SYSTEM, _this.name), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_MODEL, _this.
|
|
28986
|
+
attributes: (_obj = {}, _define_property$p(_obj, axSpanAttributes.LLM_SYSTEM, _this.name), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_MODEL, (_req_embedModel = req.embedModel) !== null && _req_embedModel !== void 0 ? _req_embedModel : _this.models.embedModel), _obj)
|
|
28982
28987
|
}, function() {
|
|
28983
28988
|
var _ref = _async_to_generator$7(function(span) {
|
|
28984
28989
|
var res;
|
|
@@ -28987,7 +28992,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28987
28992
|
case 0:
|
|
28988
28993
|
return [
|
|
28989
28994
|
4,
|
|
28990
|
-
_this._embed(req, options, span)
|
|
28995
|
+
_this._embed(embedModel, req, options, span)
|
|
28991
28996
|
];
|
|
28992
28997
|
case 1:
|
|
28993
28998
|
res = _state.sent();
|
|
@@ -29012,7 +29017,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29012
29017
|
case 2:
|
|
29013
29018
|
return [
|
|
29014
29019
|
2,
|
|
29015
|
-
_this._embed(req, options)
|
|
29020
|
+
_this._embed(embedModel, req, options)
|
|
29016
29021
|
];
|
|
29017
29022
|
}
|
|
29018
29023
|
});
|
|
@@ -29021,10 +29026,10 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29021
29026
|
},
|
|
29022
29027
|
{
|
|
29023
29028
|
key: "_embed",
|
|
29024
|
-
value: function _embed(
|
|
29029
|
+
value: function _embed(embedModel, embedReq, options, span) {
|
|
29025
29030
|
var _this = this;
|
|
29026
29031
|
return _async_to_generator$7(function() {
|
|
29027
|
-
var fn, resValue, _tmp, res, _res_modelUsage_completionTokens, _obj;
|
|
29032
|
+
var req, fn, resValue, _tmp, res, _res_modelUsage_completionTokens, _obj;
|
|
29028
29033
|
return _ts_generator$8(this, function(_state) {
|
|
29029
29034
|
switch(_state.label){
|
|
29030
29035
|
case 0:
|
|
@@ -29034,6 +29039,9 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29034
29039
|
if (!_this.generateEmbedResp) {
|
|
29035
29040
|
throw new Error("generateEmbedResp not implemented");
|
|
29036
29041
|
}
|
|
29042
|
+
req = _object_spread_props$8(_object_spread$h({}, embedReq), {
|
|
29043
|
+
embedModel: embedModel
|
|
29044
|
+
});
|
|
29037
29045
|
fn = function() {
|
|
29038
29046
|
var _ref = _async_to_generator$7(function() {
|
|
29039
29047
|
var _this_generateEmbedReq, apiConfig, reqValue, res;
|
|
@@ -29115,22 +29123,6 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29115
29123
|
var headers = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
29116
29124
|
return _object_spread$h({}, headers, this.headers);
|
|
29117
29125
|
}
|
|
29118
|
-
},
|
|
29119
|
-
{
|
|
29120
|
-
key: "getEmbedModel",
|
|
29121
|
-
value: function getEmbedModel(name) {
|
|
29122
|
-
var _this_embedModelMap;
|
|
29123
|
-
var _this_embedModelMap_name;
|
|
29124
|
-
return name ? (_this_embedModelMap_name = (_this_embedModelMap = this.embedModelMap) === null || _this_embedModelMap === void 0 ? void 0 : _this_embedModelMap[name]) !== null && _this_embedModelMap_name !== void 0 ? _this_embedModelMap_name : name : undefined;
|
|
29125
|
-
}
|
|
29126
|
-
},
|
|
29127
|
-
{
|
|
29128
|
-
key: "getModel",
|
|
29129
|
-
value: function getModel(name) {
|
|
29130
|
-
var _this_modelMap;
|
|
29131
|
-
var _this_modelMap_name;
|
|
29132
|
-
return (_this_modelMap_name = (_this_modelMap = this.modelMap) === null || _this_modelMap === void 0 ? void 0 : _this_modelMap[name]) !== null && _this_modelMap_name !== void 0 ? _this_modelMap_name : name;
|
|
29133
|
-
}
|
|
29134
29126
|
}
|
|
29135
29127
|
]);
|
|
29136
29128
|
return AxBaseAI;
|
|
@@ -29294,6 +29286,7 @@ var AxAIOpenAIModel;
|
|
|
29294
29286
|
(function(AxAIOpenAIModel) {
|
|
29295
29287
|
AxAIOpenAIModel["GPT4"] = "gpt-4";
|
|
29296
29288
|
AxAIOpenAIModel["GPT4O"] = "gpt-4o";
|
|
29289
|
+
AxAIOpenAIModel["GPT4OMini"] = "gpt-4o-mini";
|
|
29297
29290
|
AxAIOpenAIModel["GPT4Turbo"] = "gpt-4-turbo";
|
|
29298
29291
|
AxAIOpenAIModel["GPT35Turbo"] = "gpt-3.5-turbo";
|
|
29299
29292
|
AxAIOpenAIModel["GPT35TurboInstruct"] = "gpt-3.5-turbo-instruct";
|
|
@@ -29324,6 +29317,12 @@ var AxAIOpenAIEmbedModel;
|
|
|
29324
29317
|
promptTokenCostPer1M: 5,
|
|
29325
29318
|
completionTokenCostPer1M: 15
|
|
29326
29319
|
},
|
|
29320
|
+
{
|
|
29321
|
+
name: AxAIOpenAIModel.GPT4OMini,
|
|
29322
|
+
currency: "usd",
|
|
29323
|
+
promptTokenCostPer1M: 0.15,
|
|
29324
|
+
completionTokenCostPer1M: 0.6
|
|
29325
|
+
},
|
|
29327
29326
|
{
|
|
29328
29327
|
name: AxAIOpenAIModel.GPT4Turbo,
|
|
29329
29328
|
currency: "usd",
|
|
@@ -29479,7 +29478,7 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29479
29478
|
_inherits$f(AxAIOpenAI, AxBaseAI);
|
|
29480
29479
|
var _super = _create_super$f(AxAIOpenAI);
|
|
29481
29480
|
function AxAIOpenAI(param) {
|
|
29482
|
-
var apiKey = param.apiKey, config = param.config, options = param.options, apiURL = param.apiURL, _param_modelInfo = param.modelInfo, modelInfo = _param_modelInfo === void 0 ? axModelInfoOpenAI : _param_modelInfo;
|
|
29481
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, apiURL = param.apiURL, _param_modelInfo = param.modelInfo, modelInfo = _param_modelInfo === void 0 ? axModelInfoOpenAI : _param_modelInfo, modelMap = param.modelMap;
|
|
29483
29482
|
_class_call_check$o(this, AxAIOpenAI);
|
|
29484
29483
|
var _this;
|
|
29485
29484
|
if (!apiKey || apiKey === "") {
|
|
@@ -29501,14 +29500,16 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29501
29500
|
supportFor: {
|
|
29502
29501
|
functions: true,
|
|
29503
29502
|
streaming: true
|
|
29504
|
-
}
|
|
29503
|
+
},
|
|
29504
|
+
modelMap: modelMap
|
|
29505
29505
|
});
|
|
29506
29506
|
_define_property$o(_assert_this_initialized$f(_this), "config", void 0);
|
|
29507
29507
|
_define_property$o(_assert_this_initialized$f(_this), "streamingUsage", void 0);
|
|
29508
|
+
_define_property$o(_assert_this_initialized$f(_this), "dimensions", void 0);
|
|
29508
29509
|
_define_property$o(_assert_this_initialized$f(_this), "generateChatReq", function(req, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29509
29510
|
_config) {
|
|
29510
29511
|
var _req_functions, _req_modelConfig, _req_modelConfig1, _this_config, _this_config1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5, _req_modelConfig6, _req_modelConfig7;
|
|
29511
|
-
var model =
|
|
29512
|
+
var model = req.model;
|
|
29512
29513
|
if (!req.chatPrompt || req.chatPrompt.length === 0) {
|
|
29513
29514
|
throw new Error("Chat prompt is empty");
|
|
29514
29515
|
}
|
|
@@ -29561,7 +29562,7 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29561
29562
|
];
|
|
29562
29563
|
});
|
|
29563
29564
|
_define_property$o(_assert_this_initialized$f(_this), "generateEmbedReq", function(req) {
|
|
29564
|
-
var model =
|
|
29565
|
+
var model = req.embedModel;
|
|
29565
29566
|
if (!model) {
|
|
29566
29567
|
throw new Error("Embed model not set");
|
|
29567
29568
|
}
|
|
@@ -29573,7 +29574,8 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29573
29574
|
};
|
|
29574
29575
|
var reqValue = {
|
|
29575
29576
|
model: model,
|
|
29576
|
-
input: req.texts
|
|
29577
|
+
input: req.texts,
|
|
29578
|
+
dimensions: _this.dimensions
|
|
29577
29579
|
};
|
|
29578
29580
|
return [
|
|
29579
29581
|
apiConfig,
|
|
@@ -29682,6 +29684,7 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29682
29684
|
_this.config = _config;
|
|
29683
29685
|
var _options_streamingUsage;
|
|
29684
29686
|
_this.streamingUsage = (_options_streamingUsage = options === null || options === void 0 ? void 0 : options.streamingUsage) !== null && _options_streamingUsage !== void 0 ? _options_streamingUsage : true;
|
|
29687
|
+
_this.dimensions = config === null || config === void 0 ? void 0 : config.dimensions;
|
|
29685
29688
|
return _this;
|
|
29686
29689
|
}
|
|
29687
29690
|
_create_class$b(AxAIOpenAI, [
|
|
@@ -29915,7 +29918,7 @@ var AxAIAzureOpenAI = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
29915
29918
|
_inherits$e(AxAIAzureOpenAI, AxAIOpenAI);
|
|
29916
29919
|
var _super = _create_super$e(AxAIAzureOpenAI);
|
|
29917
29920
|
function AxAIAzureOpenAI(param) {
|
|
29918
|
-
var apiKey = param.apiKey, resourceName = param.resourceName, deploymentName = param.deploymentName, _param_version = param.version, version = _param_version === void 0 ? "api-version=2024-02-15-preview" : _param_version, config = param.config, options = param.options;
|
|
29921
|
+
var apiKey = param.apiKey, resourceName = param.resourceName, deploymentName = param.deploymentName, _param_version = param.version, version = _param_version === void 0 ? "api-version=2024-02-15-preview" : _param_version, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
29919
29922
|
_class_call_check$n(this, AxAIAzureOpenAI);
|
|
29920
29923
|
if (!apiKey || apiKey === "") {
|
|
29921
29924
|
throw new Error("Azure OpenAPI API key not set");
|
|
@@ -29930,7 +29933,8 @@ var AxAIAzureOpenAI = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
29930
29933
|
var _this = _super.call(this, {
|
|
29931
29934
|
apiKey: apiKey,
|
|
29932
29935
|
config: _config,
|
|
29933
|
-
options: options
|
|
29936
|
+
options: options,
|
|
29937
|
+
modelMap: modelMap
|
|
29934
29938
|
});
|
|
29935
29939
|
var host = resourceName.includes("://") ? resourceName : "https://".concat(resourceName, ".openai.azure.com/");
|
|
29936
29940
|
_get$5((_assert_this_initialized$e(_this), _get_prototype_of$e(AxAIAzureOpenAI.prototype)), "setName", _this).call(_this, "Azure OpenAI");
|
|
@@ -30076,7 +30080,7 @@ var AxAIHuggingFace = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30076
30080
|
_inherits$d(AxAIHuggingFace, AxBaseAI);
|
|
30077
30081
|
var _super = _create_super$d(AxAIHuggingFace);
|
|
30078
30082
|
function AxAIHuggingFace(param) {
|
|
30079
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
30083
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
30080
30084
|
_class_call_check$m(this, AxAIHuggingFace);
|
|
30081
30085
|
var _this;
|
|
30082
30086
|
if (!apiKey || apiKey === "") {
|
|
@@ -30097,13 +30101,14 @@ var AxAIHuggingFace = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30097
30101
|
supportFor: {
|
|
30098
30102
|
functions: false,
|
|
30099
30103
|
streaming: false
|
|
30100
|
-
}
|
|
30104
|
+
},
|
|
30105
|
+
modelMap: modelMap
|
|
30101
30106
|
});
|
|
30102
30107
|
_define_property$m(_assert_this_initialized$d(_this), "config", void 0);
|
|
30103
30108
|
_define_property$m(_assert_this_initialized$d(_this), "generateChatReq", function(req, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30104
30109
|
_config) {
|
|
30105
30110
|
var _req_chatPrompt, _req_modelConfig, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4;
|
|
30106
|
-
var model =
|
|
30111
|
+
var model = req.model;
|
|
30107
30112
|
var functionsList = req.functions ? "Functions:\n".concat(JSON.stringify(req.functions, null, 2), "\n") : "";
|
|
30108
30113
|
var prompt = (_req_chatPrompt = req.chatPrompt) === null || _req_chatPrompt === void 0 ? void 0 : _req_chatPrompt.map(function(msg) {
|
|
30109
30114
|
switch(msg.role){
|
|
@@ -30325,7 +30330,7 @@ var AxAITogether = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
30325
30330
|
_inherits$c(AxAITogether, AxAIOpenAI);
|
|
30326
30331
|
var _super = _create_super$c(AxAITogether);
|
|
30327
30332
|
function AxAITogether(param) {
|
|
30328
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
30333
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
30329
30334
|
_class_call_check$l(this, AxAITogether);
|
|
30330
30335
|
if (!apiKey || apiKey === "") {
|
|
30331
30336
|
throw new Error("Together API key not set");
|
|
@@ -30336,7 +30341,8 @@ var AxAITogether = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
30336
30341
|
config: _config,
|
|
30337
30342
|
options: options,
|
|
30338
30343
|
apiURL: "https://api.together.xyz/v1",
|
|
30339
|
-
modelInfo: axModelInfoTogether
|
|
30344
|
+
modelInfo: axModelInfoTogether,
|
|
30345
|
+
modelMap: modelMap
|
|
30340
30346
|
});
|
|
30341
30347
|
_get$4((_assert_this_initialized$c(_this), _get_prototype_of$c(AxAITogether.prototype)), "setName", _this).call(_this, "Together");
|
|
30342
30348
|
return _this;
|
|
@@ -30610,7 +30616,7 @@ var AxAICohere = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30610
30616
|
_inherits$b(AxAICohere, AxBaseAI);
|
|
30611
30617
|
var _super = _create_super$b(AxAICohere);
|
|
30612
30618
|
function AxAICohere(param) {
|
|
30613
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
30619
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
30614
30620
|
_class_call_check$k(this, AxAICohere);
|
|
30615
30621
|
var _this;
|
|
30616
30622
|
if (!apiKey || apiKey === "") {
|
|
@@ -30631,13 +30637,14 @@ var AxAICohere = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30631
30637
|
functions: true,
|
|
30632
30638
|
streaming: true
|
|
30633
30639
|
},
|
|
30634
|
-
options: options
|
|
30640
|
+
options: options,
|
|
30641
|
+
modelMap: modelMap
|
|
30635
30642
|
});
|
|
30636
30643
|
_define_property$k(_assert_this_initialized$b(_this), "config", void 0);
|
|
30637
30644
|
_define_property$k(_assert_this_initialized$b(_this), "generateChatReq", function(req, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30638
30645
|
_config) {
|
|
30639
30646
|
var _req_functions, _req_modelConfig, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5, _req_modelConfig6;
|
|
30640
|
-
var model =
|
|
30647
|
+
var model = req.model;
|
|
30641
30648
|
var lastChatMsg = req.chatPrompt.at(-1);
|
|
30642
30649
|
var restOfChat = req.chatPrompt.slice(0, -1);
|
|
30643
30650
|
var message;
|
|
@@ -30732,7 +30739,7 @@ var AxAICohere = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30732
30739
|
];
|
|
30733
30740
|
});
|
|
30734
30741
|
_define_property$k(_assert_this_initialized$b(_this), "generateEmbedReq", function(req) {
|
|
30735
|
-
var model =
|
|
30742
|
+
var model = req.embedModel;
|
|
30736
30743
|
if (!model) {
|
|
30737
30744
|
throw new Error("Embed model not set");
|
|
30738
30745
|
}
|
|
@@ -31131,7 +31138,7 @@ var safetySettings = [
|
|
|
31131
31138
|
_inherits$a(AxAIGoogleGemini, AxBaseAI);
|
|
31132
31139
|
var _super = _create_super$a(AxAIGoogleGemini);
|
|
31133
31140
|
function AxAIGoogleGemini(param) {
|
|
31134
|
-
var apiKey = param.apiKey, projectId = param.projectId, region = param.region, config = param.config, options = param.options;
|
|
31141
|
+
var apiKey = param.apiKey, projectId = param.projectId, region = param.region, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
31135
31142
|
_class_call_check$j(this, AxAIGoogleGemini);
|
|
31136
31143
|
var _this;
|
|
31137
31144
|
if (!apiKey || apiKey === "") {
|
|
@@ -31155,14 +31162,15 @@ var safetySettings = [
|
|
|
31155
31162
|
supportFor: {
|
|
31156
31163
|
functions: true,
|
|
31157
31164
|
streaming: true
|
|
31158
|
-
}
|
|
31165
|
+
},
|
|
31166
|
+
modelMap: modelMap
|
|
31159
31167
|
});
|
|
31160
31168
|
_define_property$j(_assert_this_initialized$a(_this), "options", void 0);
|
|
31161
31169
|
_define_property$j(_assert_this_initialized$a(_this), "config", void 0);
|
|
31162
31170
|
_define_property$j(_assert_this_initialized$a(_this), "apiKey", void 0);
|
|
31163
31171
|
_define_property$j(_assert_this_initialized$a(_this), "generateChatReq", function(req) {
|
|
31164
31172
|
var _req_modelConfig, _this_options, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5;
|
|
31165
|
-
var model =
|
|
31173
|
+
var model = req.model;
|
|
31166
31174
|
var _req_modelConfig_stream;
|
|
31167
31175
|
var stream = (_req_modelConfig_stream = (_req_modelConfig = req.modelConfig) === null || _req_modelConfig === void 0 ? void 0 : _req_modelConfig.stream) !== null && _req_modelConfig_stream !== void 0 ? _req_modelConfig_stream : _this.config.stream;
|
|
31168
31176
|
if (!req.chatPrompt || req.chatPrompt.length === 0) {
|
|
@@ -31342,7 +31350,7 @@ var safetySettings = [
|
|
|
31342
31350
|
];
|
|
31343
31351
|
});
|
|
31344
31352
|
_define_property$j(_assert_this_initialized$a(_this), "generateEmbedReq", function(req) {
|
|
31345
|
-
var model =
|
|
31353
|
+
var model = req.embedModel;
|
|
31346
31354
|
if (!model) {
|
|
31347
31355
|
throw new Error("Embed model not set");
|
|
31348
31356
|
}
|
|
@@ -31706,7 +31714,7 @@ var AxAIAnthropic = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
31706
31714
|
_inherits$9(AxAIAnthropic, AxBaseAI);
|
|
31707
31715
|
var _super = _create_super$9(AxAIAnthropic);
|
|
31708
31716
|
function AxAIAnthropic(param) {
|
|
31709
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
31717
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
31710
31718
|
_class_call_check$i(this, AxAIAnthropic);
|
|
31711
31719
|
var _this;
|
|
31712
31720
|
if (!apiKey || apiKey === "") {
|
|
@@ -31728,12 +31736,13 @@ var AxAIAnthropic = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
31728
31736
|
supportFor: {
|
|
31729
31737
|
functions: true,
|
|
31730
31738
|
streaming: true
|
|
31731
|
-
}
|
|
31739
|
+
},
|
|
31740
|
+
modelMap: modelMap
|
|
31732
31741
|
});
|
|
31733
31742
|
_define_property$i(_assert_this_initialized$9(_this), "config", void 0);
|
|
31734
31743
|
_define_property$i(_assert_this_initialized$9(_this), "generateChatReq", function(req) {
|
|
31735
31744
|
var _req_functions, _req_modelConfig, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5;
|
|
31736
|
-
var model =
|
|
31745
|
+
var model = req.model;
|
|
31737
31746
|
var apiConfig = {
|
|
31738
31747
|
name: "/messages"
|
|
31739
31748
|
};
|
|
@@ -32630,7 +32639,7 @@ var AxAIGroq = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32630
32639
|
_inherits$8(AxAIGroq, AxAIOpenAI);
|
|
32631
32640
|
var _super = _create_super$8(AxAIGroq);
|
|
32632
32641
|
function AxAIGroq(param) {
|
|
32633
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
32642
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
32634
32643
|
_class_call_check$g(this, AxAIGroq);
|
|
32635
32644
|
var _this;
|
|
32636
32645
|
if (!apiKey || apiKey === "") {
|
|
@@ -32645,7 +32654,8 @@ var AxAIGroq = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32645
32654
|
config: _config,
|
|
32646
32655
|
options: _options,
|
|
32647
32656
|
apiURL: "https://api.groq.com/openai/v1",
|
|
32648
|
-
modelInfo: []
|
|
32657
|
+
modelInfo: [],
|
|
32658
|
+
modelMap: modelMap
|
|
32649
32659
|
});
|
|
32650
32660
|
_define_property$g(_assert_this_initialized$8(_this), "setOptions", function(options) {
|
|
32651
32661
|
var rateLimiter = _this.newRateLimiter(options);
|
|
@@ -32701,19 +32711,23 @@ var AxAIGroq = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32701
32711
|
}
|
|
32702
32712
|
(AxAIOpenAI);
|
|
32703
32713
|
|
|
32714
|
+
// cspell:ignore mistral, mixtral, codestral, nemo
|
|
32704
32715
|
var AxAIMistralModel;
|
|
32705
32716
|
(function(AxAIMistralModel) {
|
|
32706
32717
|
AxAIMistralModel["Mistral7B"] = "open-mistral-7b";
|
|
32707
32718
|
AxAIMistralModel["Mistral8x7B"] = "open-mixtral-8x7b";
|
|
32708
32719
|
AxAIMistralModel["MistralSmall"] = "mistral-small-latest";
|
|
32709
|
-
AxAIMistralModel["MistralMedium"] = "mistral-medium-latest";
|
|
32710
32720
|
AxAIMistralModel["MistralLarge"] = "mistral-large-latest";
|
|
32721
|
+
AxAIMistralModel["Codestral"] = "codestral-latest";
|
|
32722
|
+
AxAIMistralModel["OpenCodestralMamba"] = "open-codestral-mamba";
|
|
32723
|
+
AxAIMistralModel["OpenMistralNemo"] = "open-mistral-nemo-latest";
|
|
32711
32724
|
})(AxAIMistralModel || (AxAIMistralModel = {}));
|
|
32712
32725
|
var AxAIMistralEmbedModels;
|
|
32713
32726
|
(function(AxAIMistralEmbedModels) {
|
|
32714
32727
|
AxAIMistralEmbedModels["MistralEmbed"] = "mistral-embed";
|
|
32715
32728
|
})(AxAIMistralEmbedModels || (AxAIMistralEmbedModels = {}));
|
|
32716
32729
|
|
|
32730
|
+
// cspell:ignore mistral, mixtral, codestral, nemo
|
|
32717
32731
|
var axModelInfoMistral = [
|
|
32718
32732
|
{
|
|
32719
32733
|
name: AxAIMistralModel.Mistral7B,
|
|
@@ -32733,17 +32747,29 @@ var axModelInfoMistral = [
|
|
|
32733
32747
|
promptTokenCostPer1M: 2,
|
|
32734
32748
|
completionTokenCostPer1M: 6
|
|
32735
32749
|
},
|
|
32736
|
-
{
|
|
32737
|
-
name: AxAIMistralModel.MistralMedium,
|
|
32738
|
-
currency: "USD",
|
|
32739
|
-
promptTokenCostPer1M: 2.7,
|
|
32740
|
-
completionTokenCostPer1M: 8.1
|
|
32741
|
-
},
|
|
32742
32750
|
{
|
|
32743
32751
|
name: AxAIMistralModel.MistralLarge,
|
|
32744
32752
|
currency: "USD",
|
|
32745
32753
|
promptTokenCostPer1M: 8,
|
|
32746
32754
|
completionTokenCostPer1M: 24
|
|
32755
|
+
},
|
|
32756
|
+
{
|
|
32757
|
+
name: AxAIMistralModel.Codestral,
|
|
32758
|
+
currency: "USD",
|
|
32759
|
+
promptTokenCostPer1M: 1,
|
|
32760
|
+
completionTokenCostPer1M: 3
|
|
32761
|
+
},
|
|
32762
|
+
{
|
|
32763
|
+
name: AxAIMistralModel.OpenCodestralMamba,
|
|
32764
|
+
currency: "USD",
|
|
32765
|
+
promptTokenCostPer1M: 0.25,
|
|
32766
|
+
completionTokenCostPer1M: 0.25
|
|
32767
|
+
},
|
|
32768
|
+
{
|
|
32769
|
+
name: AxAIMistralModel.OpenMistralNemo,
|
|
32770
|
+
currency: "USD",
|
|
32771
|
+
promptTokenCostPer1M: 0.3,
|
|
32772
|
+
completionTokenCostPer1M: 0.3
|
|
32747
32773
|
}
|
|
32748
32774
|
];
|
|
32749
32775
|
|
|
@@ -32878,7 +32904,7 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32878
32904
|
_inherits$7(AxAIMistral, AxAIOpenAI);
|
|
32879
32905
|
var _super = _create_super$7(AxAIMistral);
|
|
32880
32906
|
function AxAIMistral(param) {
|
|
32881
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
32907
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
32882
32908
|
_class_call_check$f(this, AxAIMistral);
|
|
32883
32909
|
if (!apiKey || apiKey === "") {
|
|
32884
32910
|
throw new Error("Mistral API key not set");
|
|
@@ -32889,7 +32915,8 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32889
32915
|
config: _config,
|
|
32890
32916
|
options: options,
|
|
32891
32917
|
apiURL: "https://api.mistral.ai/v1",
|
|
32892
|
-
modelInfo: axModelInfoMistral
|
|
32918
|
+
modelInfo: axModelInfoMistral,
|
|
32919
|
+
modelMap: modelMap
|
|
32893
32920
|
});
|
|
32894
32921
|
_get$2((_assert_this_initialized$7(_this), _get_prototype_of$7(AxAIMistral.prototype)), "setName", _this).call(_this, "Mistral");
|
|
32895
32922
|
return _this;
|
|
@@ -33053,7 +33080,7 @@ var AxAIDeepSeek = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
33053
33080
|
_inherits$6(AxAIDeepSeek, AxAIOpenAI);
|
|
33054
33081
|
var _super = _create_super$6(AxAIDeepSeek);
|
|
33055
33082
|
function AxAIDeepSeek(param) {
|
|
33056
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
33083
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
33057
33084
|
_class_call_check$e(this, AxAIDeepSeek);
|
|
33058
33085
|
if (!apiKey || apiKey === "") {
|
|
33059
33086
|
throw new Error("DeepSeek API key not set");
|
|
@@ -33064,7 +33091,8 @@ var AxAIDeepSeek = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
33064
33091
|
config: _config,
|
|
33065
33092
|
options: options,
|
|
33066
33093
|
apiURL: "https://api.deepseek.com",
|
|
33067
|
-
modelInfo: axModelInfoDeepSeek
|
|
33094
|
+
modelInfo: axModelInfoDeepSeek,
|
|
33095
|
+
modelMap: modelMap
|
|
33068
33096
|
});
|
|
33069
33097
|
_get$1((_assert_this_initialized$6(_this), _get_prototype_of$6(AxAIDeepSeek.prototype)), "setName", _this).call(_this, "DeepSeek");
|
|
33070
33098
|
return _this;
|
|
@@ -33232,14 +33260,15 @@ var axAIOllamaDefaultConfig = function() {
|
|
|
33232
33260
|
_inherits$5(AxAIOllama, AxAIOpenAI);
|
|
33233
33261
|
var _super = _create_super$5(AxAIOllama);
|
|
33234
33262
|
function AxAIOllama(param) {
|
|
33235
|
-
var _param_apiKey = param.apiKey, apiKey = _param_apiKey === void 0 ? "not-set" : _param_apiKey, _param_url = param.url, url = _param_url === void 0 ? "http://localhost:11434" : _param_url, config = param.config, options = param.options;
|
|
33263
|
+
var _param_apiKey = param.apiKey, apiKey = _param_apiKey === void 0 ? "not-set" : _param_apiKey, _param_url = param.url, url = _param_url === void 0 ? "http://localhost:11434" : _param_url, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
33236
33264
|
_class_call_check$d(this, AxAIOllama);
|
|
33237
33265
|
var _config = _object_spread$6({}, axAIOllamaDefaultConfig(), config);
|
|
33238
33266
|
var _this = _super.call(this, {
|
|
33239
33267
|
apiKey: apiKey,
|
|
33240
33268
|
options: options,
|
|
33241
33269
|
config: _config,
|
|
33242
|
-
apiURL: new URL("/
|
|
33270
|
+
apiURL: new URL("/api", url).href,
|
|
33271
|
+
modelMap: modelMap
|
|
33243
33272
|
});
|
|
33244
33273
|
_get((_assert_this_initialized$5(_this), _get_prototype_of$5(AxAIOllama.prototype)), "setName", _this).call(_this, "Ollama");
|
|
33245
33274
|
return _this;
|
|
@@ -33447,18 +33476,6 @@ var AxAI = /*#__PURE__*/ function() {
|
|
|
33447
33476
|
}
|
|
33448
33477
|
}
|
|
33449
33478
|
_create_class$5(AxAI, [
|
|
33450
|
-
{
|
|
33451
|
-
key: "setModelMap",
|
|
33452
|
-
value: function setModelMap(modelMap) {
|
|
33453
|
-
this.ai.setModelMap(modelMap);
|
|
33454
|
-
}
|
|
33455
|
-
},
|
|
33456
|
-
{
|
|
33457
|
-
key: "setEmbedModelMap",
|
|
33458
|
-
value: function setEmbedModelMap(modelMap) {
|
|
33459
|
-
this.ai.setEmbedModelMap(modelMap);
|
|
33460
|
-
}
|
|
33461
|
-
},
|
|
33462
33479
|
{
|
|
33463
33480
|
key: "getName",
|
|
33464
33481
|
value: function getName() {
|
|
@@ -33489,6 +33506,12 @@ var AxAI = /*#__PURE__*/ function() {
|
|
|
33489
33506
|
return this.ai.getFeatures();
|
|
33490
33507
|
}
|
|
33491
33508
|
},
|
|
33509
|
+
{
|
|
33510
|
+
key: "getModelMap",
|
|
33511
|
+
value: function getModelMap() {
|
|
33512
|
+
return this.ai.getModelMap();
|
|
33513
|
+
}
|
|
33514
|
+
},
|
|
33492
33515
|
{
|
|
33493
33516
|
key: "chat",
|
|
33494
33517
|
value: function chat(req, options) {
|
|
@@ -34047,8 +34070,8 @@ var assertRequiredFields = function(sig, values) {
|
|
|
34047
34070
|
});
|
|
34048
34071
|
if (missingFields.length > 0) {
|
|
34049
34072
|
throw new AxAssertionError({
|
|
34050
|
-
message: "
|
|
34051
|
-
return f.
|
|
34073
|
+
message: "Output must include: t: ".concat(missingFields.map(function(f) {
|
|
34074
|
+
return "`".concat(f.title, ":`");
|
|
34052
34075
|
}).join(", ")),
|
|
34053
34076
|
values: values
|
|
34054
34077
|
});
|
|
@@ -38854,7 +38877,7 @@ var AxPromptTemplate = function AxPromptTemplate(sig, fieldTemplates) {
|
|
|
38854
38877
|
this.outputFormat = {
|
|
38855
38878
|
type: "text",
|
|
38856
38879
|
text: [
|
|
38857
|
-
"
|
|
38880
|
+
"Use the following output format."
|
|
38858
38881
|
].concat(_to_consumable_array$2(this.renderOutFields(this.sig.getOutputFields())), [
|
|
38859
38882
|
"---\n\n"
|
|
38860
38883
|
]).join("\n\n")
|