@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.cjs.js
CHANGED
|
@@ -20358,6 +20358,7 @@ about the parse state.
|
|
|
20358
20358
|
var _a;
|
|
20359
20359
|
var depth = action >> 19 /* Action.ReduceDepthShift */ , type = action & 65535 /* Action.ValueMask */ ;
|
|
20360
20360
|
var parser = this.p.parser;
|
|
20361
|
+
if (this.reducePos < this.pos - 25 /* Lookahead.Margin */ ) this.setLookAhead(this.pos);
|
|
20361
20362
|
var dPrec = parser.dynamicPrecedence(type);
|
|
20362
20363
|
if (dPrec) this.score += dPrec;
|
|
20363
20364
|
if (depth == 0) {
|
|
@@ -21310,7 +21311,7 @@ function cutAt(tree, pos, side) {
|
|
|
21310
21311
|
cursor.moveTo(pos);
|
|
21311
21312
|
for(;;){
|
|
21312
21313
|
if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos))) for(;;){
|
|
21313
|
-
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 /*
|
|
21314
|
+
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 */ ));
|
|
21314
21315
|
if (side < 0 ? cursor.prevSibling() : cursor.nextSibling()) break;
|
|
21315
21316
|
if (!cursor.parent()) return side < 0 ? 0 : tree.length;
|
|
21316
21317
|
}
|
|
@@ -21433,7 +21434,7 @@ var TokenCache = /*#__PURE__*/ function() {
|
|
|
21433
21434
|
token.mask = mask;
|
|
21434
21435
|
token.context = context;
|
|
21435
21436
|
}
|
|
21436
|
-
if (token.lookAhead > token.end + 25 /*
|
|
21437
|
+
if (token.lookAhead > token.end + 25 /* Lookahead.Margin */ ) lookAhead = Math.max(token.lookAhead, lookAhead);
|
|
21437
21438
|
if (token.value != 0 /* Term.Err */ ) {
|
|
21438
21439
|
var startIndex = actionIndex;
|
|
21439
21440
|
if (token.extended > -1) actionIndex = this.addActions(stack, token.extended, token.end, actionIndex);
|
|
@@ -23524,14 +23525,14 @@ function indent(str, spaces) {
|
|
|
23524
23525
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
23525
23526
|
// match is required
|
|
23526
23527
|
if (!match) {
|
|
23527
|
-
return
|
|
23528
|
+
return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
|
|
23528
23529
|
v: nextMatch1
|
|
23529
23530
|
};
|
|
23530
23531
|
}
|
|
23531
23532
|
var token = match.token, offset = match.offset;
|
|
23532
23533
|
i1 += offset;
|
|
23533
23534
|
if (token === " ") {
|
|
23534
|
-
return
|
|
23535
|
+
return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
|
|
23535
23536
|
}
|
|
23536
23537
|
tokens1 = _to_consumable_array$6(tokens1).concat([
|
|
23537
23538
|
token
|
|
@@ -23550,7 +23551,7 @@ function indent(str, spaces) {
|
|
|
23550
23551
|
if (contextKeys.some(function(el) {
|
|
23551
23552
|
return el.startsWith(name);
|
|
23552
23553
|
})) {
|
|
23553
|
-
return
|
|
23554
|
+
return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
|
|
23554
23555
|
}
|
|
23555
23556
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23556
23557
|
return el === name;
|
|
@@ -23569,9 +23570,9 @@ function indent(str, spaces) {
|
|
|
23569
23570
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23570
23571
|
return el.startsWith(name);
|
|
23571
23572
|
})) {
|
|
23572
|
-
return
|
|
23573
|
+
return i = i1, nextMatch = nextMatch1, tokens = tokens1, "continue";
|
|
23573
23574
|
}
|
|
23574
|
-
return
|
|
23575
|
+
return i = i1, nextMatch = nextMatch1, tokens = tokens1, {
|
|
23575
23576
|
v: nextMatch1
|
|
23576
23577
|
};
|
|
23577
23578
|
};
|
|
@@ -24374,6 +24375,7 @@ var parser = LRParser.deserialize({
|
|
|
24374
24375
|
},
|
|
24375
24376
|
dynamicPrecedences: {
|
|
24376
24377
|
"31": -1,
|
|
24378
|
+
"67": 1,
|
|
24377
24379
|
"71": -1,
|
|
24378
24380
|
"73": -1
|
|
24379
24381
|
},
|
|
@@ -28636,7 +28638,7 @@ var axBaseAIDefaultConfig = function() {
|
|
|
28636
28638
|
};
|
|
28637
28639
|
var AxBaseAI = /*#__PURE__*/ function() {
|
|
28638
28640
|
function AxBaseAI(param) {
|
|
28639
|
-
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;
|
|
28641
|
+
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;
|
|
28640
28642
|
_class_call_check$p(this, AxBaseAI);
|
|
28641
28643
|
_define_property$p(this, "generateChatReq", void 0);
|
|
28642
28644
|
_define_property$p(this, "generateEmbedReq", void 0);
|
|
@@ -28648,48 +28650,29 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28648
28650
|
_define_property$p(this, "fetch", void 0);
|
|
28649
28651
|
_define_property$p(this, "tracer", void 0);
|
|
28650
28652
|
_define_property$p(this, "modelMap", void 0);
|
|
28651
|
-
_define_property$p(this, "
|
|
28653
|
+
_define_property$p(this, "modelInfo", void 0);
|
|
28652
28654
|
_define_property$p(this, "modelUsage", void 0);
|
|
28653
28655
|
_define_property$p(this, "embedModelUsage", void 0);
|
|
28656
|
+
_define_property$p(this, "models", void 0);
|
|
28654
28657
|
_define_property$p(this, "apiURL", void 0);
|
|
28655
28658
|
_define_property$p(this, "name", void 0);
|
|
28656
28659
|
_define_property$p(this, "headers", void 0);
|
|
28657
|
-
_define_property$p(this, "modelInfo", void 0);
|
|
28658
|
-
_define_property$p(this, "embedModelInfo", void 0);
|
|
28659
28660
|
_define_property$p(this, "supportFor", void 0);
|
|
28660
28661
|
this.name = name;
|
|
28661
28662
|
this.apiURL = apiURL;
|
|
28662
28663
|
this.headers = headers;
|
|
28663
28664
|
this.supportFor = supportFor;
|
|
28664
28665
|
this.tracer = options.tracer;
|
|
28665
|
-
|
|
28666
|
-
|
|
28667
|
-
|
|
28668
|
-
|
|
28669
|
-
|
|
28670
|
-
|
|
28671
|
-
|
|
28672
|
-
|
|
28673
|
-
name: model,
|
|
28674
|
-
currency: "usd",
|
|
28675
|
-
promptTokenCostPer1M: 0,
|
|
28676
|
-
completionTokenCostPer1M: 0
|
|
28677
|
-
};
|
|
28678
|
-
} else {
|
|
28666
|
+
this.modelInfo = modelInfo;
|
|
28667
|
+
this.modelMap = modelMap;
|
|
28668
|
+
var _modelMap_models_model, _models_embedModel, _modelMap_;
|
|
28669
|
+
this.models = {
|
|
28670
|
+
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,
|
|
28671
|
+
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
|
|
28672
|
+
};
|
|
28673
|
+
if (!models.model || typeof models.model !== "string" || models.model === "") {
|
|
28679
28674
|
throw new Error("No model defined");
|
|
28680
28675
|
}
|
|
28681
|
-
if (typeof embedModel === "string") {
|
|
28682
|
-
var embedModelName = embedModel === null || embedModel === void 0 ? void 0 : embedModel.replace(/-0\d+$|-\d{2,}$/, "");
|
|
28683
|
-
var _modelInfo_filter_at1;
|
|
28684
|
-
this.embedModelInfo = (_modelInfo_filter_at1 = modelInfo.filter(function(v) {
|
|
28685
|
-
return v.name === embedModelName;
|
|
28686
|
-
}).at(0)) !== null && _modelInfo_filter_at1 !== void 0 ? _modelInfo_filter_at1 : {
|
|
28687
|
-
name: embedModel !== null && embedModel !== void 0 ? embedModel : "",
|
|
28688
|
-
currency: "usd",
|
|
28689
|
-
promptTokenCostPer1M: 0,
|
|
28690
|
-
completionTokenCostPer1M: 0
|
|
28691
|
-
};
|
|
28692
|
-
}
|
|
28693
28676
|
this.setOptions(options);
|
|
28694
28677
|
}
|
|
28695
28678
|
_create_class$c(AxBaseAI, [
|
|
@@ -28729,21 +28712,27 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28729
28712
|
}
|
|
28730
28713
|
},
|
|
28731
28714
|
{
|
|
28732
|
-
key: "
|
|
28733
|
-
value: function
|
|
28734
|
-
|
|
28735
|
-
|
|
28736
|
-
|
|
28737
|
-
|
|
28738
|
-
|
|
28739
|
-
|
|
28740
|
-
|
|
28715
|
+
key: "_getModelInfo",
|
|
28716
|
+
value: function _getModelInfo(model) {
|
|
28717
|
+
var _this_modelMap;
|
|
28718
|
+
var _this_modelMap_model;
|
|
28719
|
+
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;
|
|
28720
|
+
var modelName = _model.replace(/-0\d+$|-\d{2,}$/, "");
|
|
28721
|
+
var _this_modelInfo_filter_at;
|
|
28722
|
+
return (_this_modelInfo_filter_at = this.modelInfo.filter(function(v) {
|
|
28723
|
+
return v.name === modelName;
|
|
28724
|
+
}).at(0)) !== null && _this_modelInfo_filter_at !== void 0 ? _this_modelInfo_filter_at : {
|
|
28725
|
+
name: model,
|
|
28726
|
+
currency: "usd",
|
|
28727
|
+
promptTokenCostPer1M: 0,
|
|
28728
|
+
completionTokenCostPer1M: 0
|
|
28729
|
+
};
|
|
28741
28730
|
}
|
|
28742
28731
|
},
|
|
28743
28732
|
{
|
|
28744
28733
|
key: "getModelInfo",
|
|
28745
28734
|
value: function getModelInfo() {
|
|
28746
|
-
return _object_spread_props$8(_object_spread$h({}, this.
|
|
28735
|
+
return _object_spread_props$8(_object_spread$h({}, this._getModelInfo(this.models.model)), {
|
|
28747
28736
|
provider: this.name
|
|
28748
28737
|
});
|
|
28749
28738
|
}
|
|
@@ -28751,9 +28740,17 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28751
28740
|
{
|
|
28752
28741
|
key: "getEmbedModelInfo",
|
|
28753
28742
|
value: function getEmbedModelInfo() {
|
|
28754
|
-
|
|
28755
|
-
|
|
28756
|
-
|
|
28743
|
+
if (this.models.embedModel) {
|
|
28744
|
+
return _object_spread_props$8(_object_spread$h({}, this._getModelInfo(this.models.embedModel)), {
|
|
28745
|
+
provider: this.name
|
|
28746
|
+
});
|
|
28747
|
+
}
|
|
28748
|
+
}
|
|
28749
|
+
},
|
|
28750
|
+
{
|
|
28751
|
+
key: "getModelMap",
|
|
28752
|
+
value: function getModelMap() {
|
|
28753
|
+
return this.modelMap;
|
|
28757
28754
|
}
|
|
28758
28755
|
},
|
|
28759
28756
|
{
|
|
@@ -28776,13 +28773,14 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28776
28773
|
},
|
|
28777
28774
|
{
|
|
28778
28775
|
key: "chat",
|
|
28779
|
-
value: function chat(
|
|
28776
|
+
value: function chat(req, options) {
|
|
28780
28777
|
var _this = this;
|
|
28781
28778
|
return _async_to_generator$7(function() {
|
|
28782
|
-
var _mc_stopSequences, _this_tracer, mc, _obj;
|
|
28779
|
+
var _this_modelMap, _this_modelMap_req_model, model, _mc_stopSequences, _this_tracer, mc, _obj;
|
|
28783
28780
|
return _ts_generator$8(this, function(_state) {
|
|
28784
28781
|
switch(_state.label){
|
|
28785
28782
|
case 0:
|
|
28783
|
+
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;
|
|
28786
28784
|
if (!_this.tracer) return [
|
|
28787
28785
|
3,
|
|
28788
28786
|
2
|
|
@@ -28792,7 +28790,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28792
28790
|
4,
|
|
28793
28791
|
(_this_tracer = _this.tracer) === null || _this_tracer === void 0 ? void 0 : _this_tracer.startActiveSpan("Chat Request", {
|
|
28794
28792
|
kind: AxSpanKind.SERVER,
|
|
28795
|
-
attributes: (_obj = {}, _define_property$p(_obj, axSpanAttributes.LLM_SYSTEM, _this.name), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_MODEL,
|
|
28793
|
+
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)
|
|
28796
28794
|
}, function() {
|
|
28797
28795
|
var _ref = _async_to_generator$7(function(span) {
|
|
28798
28796
|
var res;
|
|
@@ -28801,7 +28799,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28801
28799
|
case 0:
|
|
28802
28800
|
return [
|
|
28803
28801
|
4,
|
|
28804
|
-
_this._chat(
|
|
28802
|
+
_this._chat(model, req, options, span)
|
|
28805
28803
|
];
|
|
28806
28804
|
case 1:
|
|
28807
28805
|
res = _state.sent();
|
|
@@ -28826,7 +28824,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28826
28824
|
case 2:
|
|
28827
28825
|
return [
|
|
28828
28826
|
4,
|
|
28829
|
-
_this._chat(
|
|
28827
|
+
_this._chat(model, req, options)
|
|
28830
28828
|
];
|
|
28831
28829
|
case 3:
|
|
28832
28830
|
return [
|
|
@@ -28840,10 +28838,10 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28840
28838
|
},
|
|
28841
28839
|
{
|
|
28842
28840
|
key: "_chat",
|
|
28843
|
-
value: function _chat(
|
|
28841
|
+
value: function _chat(model, chatReq, options, span) {
|
|
28844
28842
|
var _this = this;
|
|
28845
28843
|
return _async_to_generator$7(function() {
|
|
28846
|
-
var
|
|
28844
|
+
var _chatReq_modelConfig, reqFn, _options_stream, stream, functions, req, fn, rv, _tmp, respFn, wrappedRespFn, doneCb, st, res;
|
|
28847
28845
|
return _ts_generator$8(this, function(_state) {
|
|
28848
28846
|
switch(_state.label){
|
|
28849
28847
|
case 0:
|
|
@@ -28851,11 +28849,14 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28851
28849
|
throw new Error("generateChatReq not implemented");
|
|
28852
28850
|
}
|
|
28853
28851
|
reqFn = _this.generateChatReq;
|
|
28854
|
-
stream = (_options_stream = options === null || options === void 0 ? void 0 : options.stream) !== null && _options_stream !== void 0 ? _options_stream : (
|
|
28855
|
-
|
|
28856
|
-
|
|
28852
|
+
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;
|
|
28853
|
+
if (chatReq.functions && chatReq.functions.length > 0) {
|
|
28854
|
+
functions = chatReq.functions;
|
|
28855
|
+
}
|
|
28856
|
+
req = _object_spread_props$8(_object_spread$h({}, chatReq), {
|
|
28857
|
+
model: model,
|
|
28857
28858
|
functions: functions,
|
|
28858
|
-
modelConfig: _object_spread_props$8(_object_spread$h({},
|
|
28859
|
+
modelConfig: _object_spread_props$8(_object_spread$h({}, chatReq.modelConfig), {
|
|
28859
28860
|
stream: stream
|
|
28860
28861
|
})
|
|
28861
28862
|
});
|
|
@@ -28992,10 +28993,14 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28992
28993
|
value: function embed(req, options) {
|
|
28993
28994
|
var _this = this;
|
|
28994
28995
|
return _async_to_generator$7(function() {
|
|
28995
|
-
var _this_tracer, _obj;
|
|
28996
|
+
var _this_modelMap, _this_modelMap_req_embedModel, embedModel, _this_tracer, _req_embedModel, _obj;
|
|
28996
28997
|
return _ts_generator$8(this, function(_state) {
|
|
28997
28998
|
switch(_state.label){
|
|
28998
28999
|
case 0:
|
|
29000
|
+
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;
|
|
29001
|
+
if (!embedModel) {
|
|
29002
|
+
throw new Error("No embed model defined");
|
|
29003
|
+
}
|
|
28999
29004
|
if (!_this.tracer) return [
|
|
29000
29005
|
3,
|
|
29001
29006
|
2
|
|
@@ -29004,7 +29009,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29004
29009
|
4,
|
|
29005
29010
|
(_this_tracer = _this.tracer) === null || _this_tracer === void 0 ? void 0 : _this_tracer.startActiveSpan("Embed Request", {
|
|
29006
29011
|
kind: AxSpanKind.SERVER,
|
|
29007
|
-
attributes: (_obj = {}, _define_property$p(_obj, axSpanAttributes.LLM_SYSTEM, _this.name), _define_property$p(_obj, axSpanAttributes.LLM_REQUEST_MODEL, _this.
|
|
29012
|
+
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)
|
|
29008
29013
|
}, function() {
|
|
29009
29014
|
var _ref = _async_to_generator$7(function(span) {
|
|
29010
29015
|
var res;
|
|
@@ -29013,7 +29018,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29013
29018
|
case 0:
|
|
29014
29019
|
return [
|
|
29015
29020
|
4,
|
|
29016
|
-
_this._embed(req, options, span)
|
|
29021
|
+
_this._embed(embedModel, req, options, span)
|
|
29017
29022
|
];
|
|
29018
29023
|
case 1:
|
|
29019
29024
|
res = _state.sent();
|
|
@@ -29038,7 +29043,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29038
29043
|
case 2:
|
|
29039
29044
|
return [
|
|
29040
29045
|
2,
|
|
29041
|
-
_this._embed(req, options)
|
|
29046
|
+
_this._embed(embedModel, req, options)
|
|
29042
29047
|
];
|
|
29043
29048
|
}
|
|
29044
29049
|
});
|
|
@@ -29047,10 +29052,10 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29047
29052
|
},
|
|
29048
29053
|
{
|
|
29049
29054
|
key: "_embed",
|
|
29050
|
-
value: function _embed(
|
|
29055
|
+
value: function _embed(embedModel, embedReq, options, span) {
|
|
29051
29056
|
var _this = this;
|
|
29052
29057
|
return _async_to_generator$7(function() {
|
|
29053
|
-
var fn, resValue, _tmp, res, _res_modelUsage_completionTokens, _obj;
|
|
29058
|
+
var req, fn, resValue, _tmp, res, _res_modelUsage_completionTokens, _obj;
|
|
29054
29059
|
return _ts_generator$8(this, function(_state) {
|
|
29055
29060
|
switch(_state.label){
|
|
29056
29061
|
case 0:
|
|
@@ -29060,6 +29065,9 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29060
29065
|
if (!_this.generateEmbedResp) {
|
|
29061
29066
|
throw new Error("generateEmbedResp not implemented");
|
|
29062
29067
|
}
|
|
29068
|
+
req = _object_spread_props$8(_object_spread$h({}, embedReq), {
|
|
29069
|
+
embedModel: embedModel
|
|
29070
|
+
});
|
|
29063
29071
|
fn = function() {
|
|
29064
29072
|
var _ref = _async_to_generator$7(function() {
|
|
29065
29073
|
var _this_generateEmbedReq, apiConfig, reqValue, res;
|
|
@@ -29141,22 +29149,6 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29141
29149
|
var headers = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
29142
29150
|
return _object_spread$h({}, headers, this.headers);
|
|
29143
29151
|
}
|
|
29144
|
-
},
|
|
29145
|
-
{
|
|
29146
|
-
key: "getEmbedModel",
|
|
29147
|
-
value: function getEmbedModel(name) {
|
|
29148
|
-
var _this_embedModelMap;
|
|
29149
|
-
var _this_embedModelMap_name;
|
|
29150
|
-
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;
|
|
29151
|
-
}
|
|
29152
|
-
},
|
|
29153
|
-
{
|
|
29154
|
-
key: "getModel",
|
|
29155
|
-
value: function getModel(name) {
|
|
29156
|
-
var _this_modelMap;
|
|
29157
|
-
var _this_modelMap_name;
|
|
29158
|
-
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;
|
|
29159
|
-
}
|
|
29160
29152
|
}
|
|
29161
29153
|
]);
|
|
29162
29154
|
return AxBaseAI;
|
|
@@ -29320,6 +29312,7 @@ var AxAIOpenAIModel;
|
|
|
29320
29312
|
(function(AxAIOpenAIModel) {
|
|
29321
29313
|
AxAIOpenAIModel["GPT4"] = "gpt-4";
|
|
29322
29314
|
AxAIOpenAIModel["GPT4O"] = "gpt-4o";
|
|
29315
|
+
AxAIOpenAIModel["GPT4OMini"] = "gpt-4o-mini";
|
|
29323
29316
|
AxAIOpenAIModel["GPT4Turbo"] = "gpt-4-turbo";
|
|
29324
29317
|
AxAIOpenAIModel["GPT35Turbo"] = "gpt-3.5-turbo";
|
|
29325
29318
|
AxAIOpenAIModel["GPT35TurboInstruct"] = "gpt-3.5-turbo-instruct";
|
|
@@ -29350,6 +29343,12 @@ var AxAIOpenAIEmbedModel;
|
|
|
29350
29343
|
promptTokenCostPer1M: 5,
|
|
29351
29344
|
completionTokenCostPer1M: 15
|
|
29352
29345
|
},
|
|
29346
|
+
{
|
|
29347
|
+
name: AxAIOpenAIModel.GPT4OMini,
|
|
29348
|
+
currency: "usd",
|
|
29349
|
+
promptTokenCostPer1M: 0.15,
|
|
29350
|
+
completionTokenCostPer1M: 0.6
|
|
29351
|
+
},
|
|
29353
29352
|
{
|
|
29354
29353
|
name: AxAIOpenAIModel.GPT4Turbo,
|
|
29355
29354
|
currency: "usd",
|
|
@@ -29505,7 +29504,7 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29505
29504
|
_inherits$f(AxAIOpenAI, AxBaseAI);
|
|
29506
29505
|
var _super = _create_super$f(AxAIOpenAI);
|
|
29507
29506
|
function AxAIOpenAI(param) {
|
|
29508
|
-
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;
|
|
29507
|
+
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;
|
|
29509
29508
|
_class_call_check$o(this, AxAIOpenAI);
|
|
29510
29509
|
var _this;
|
|
29511
29510
|
if (!apiKey || apiKey === "") {
|
|
@@ -29527,14 +29526,16 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29527
29526
|
supportFor: {
|
|
29528
29527
|
functions: true,
|
|
29529
29528
|
streaming: true
|
|
29530
|
-
}
|
|
29529
|
+
},
|
|
29530
|
+
modelMap: modelMap
|
|
29531
29531
|
});
|
|
29532
29532
|
_define_property$o(_assert_this_initialized$f(_this), "config", void 0);
|
|
29533
29533
|
_define_property$o(_assert_this_initialized$f(_this), "streamingUsage", void 0);
|
|
29534
|
+
_define_property$o(_assert_this_initialized$f(_this), "dimensions", void 0);
|
|
29534
29535
|
_define_property$o(_assert_this_initialized$f(_this), "generateChatReq", function(req, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29535
29536
|
_config) {
|
|
29536
29537
|
var _req_functions, _req_modelConfig, _req_modelConfig1, _this_config, _this_config1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5, _req_modelConfig6, _req_modelConfig7;
|
|
29537
|
-
var model =
|
|
29538
|
+
var model = req.model;
|
|
29538
29539
|
if (!req.chatPrompt || req.chatPrompt.length === 0) {
|
|
29539
29540
|
throw new Error("Chat prompt is empty");
|
|
29540
29541
|
}
|
|
@@ -29587,7 +29588,7 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29587
29588
|
];
|
|
29588
29589
|
});
|
|
29589
29590
|
_define_property$o(_assert_this_initialized$f(_this), "generateEmbedReq", function(req) {
|
|
29590
|
-
var model =
|
|
29591
|
+
var model = req.embedModel;
|
|
29591
29592
|
if (!model) {
|
|
29592
29593
|
throw new Error("Embed model not set");
|
|
29593
29594
|
}
|
|
@@ -29599,7 +29600,8 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29599
29600
|
};
|
|
29600
29601
|
var reqValue = {
|
|
29601
29602
|
model: model,
|
|
29602
|
-
input: req.texts
|
|
29603
|
+
input: req.texts,
|
|
29604
|
+
dimensions: _this.dimensions
|
|
29603
29605
|
};
|
|
29604
29606
|
return [
|
|
29605
29607
|
apiConfig,
|
|
@@ -29708,6 +29710,7 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29708
29710
|
_this.config = _config;
|
|
29709
29711
|
var _options_streamingUsage;
|
|
29710
29712
|
_this.streamingUsage = (_options_streamingUsage = options === null || options === void 0 ? void 0 : options.streamingUsage) !== null && _options_streamingUsage !== void 0 ? _options_streamingUsage : true;
|
|
29713
|
+
_this.dimensions = config === null || config === void 0 ? void 0 : config.dimensions;
|
|
29711
29714
|
return _this;
|
|
29712
29715
|
}
|
|
29713
29716
|
_create_class$b(AxAIOpenAI, [
|
|
@@ -29941,7 +29944,7 @@ var AxAIAzureOpenAI = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
29941
29944
|
_inherits$e(AxAIAzureOpenAI, AxAIOpenAI);
|
|
29942
29945
|
var _super = _create_super$e(AxAIAzureOpenAI);
|
|
29943
29946
|
function AxAIAzureOpenAI(param) {
|
|
29944
|
-
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;
|
|
29947
|
+
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;
|
|
29945
29948
|
_class_call_check$n(this, AxAIAzureOpenAI);
|
|
29946
29949
|
if (!apiKey || apiKey === "") {
|
|
29947
29950
|
throw new Error("Azure OpenAPI API key not set");
|
|
@@ -29956,7 +29959,8 @@ var AxAIAzureOpenAI = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
29956
29959
|
var _this = _super.call(this, {
|
|
29957
29960
|
apiKey: apiKey,
|
|
29958
29961
|
config: _config,
|
|
29959
|
-
options: options
|
|
29962
|
+
options: options,
|
|
29963
|
+
modelMap: modelMap
|
|
29960
29964
|
});
|
|
29961
29965
|
var host = resourceName.includes("://") ? resourceName : "https://".concat(resourceName, ".openai.azure.com/");
|
|
29962
29966
|
_get$5((_assert_this_initialized$e(_this), _get_prototype_of$e(AxAIAzureOpenAI.prototype)), "setName", _this).call(_this, "Azure OpenAI");
|
|
@@ -30102,7 +30106,7 @@ var AxAIHuggingFace = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30102
30106
|
_inherits$d(AxAIHuggingFace, AxBaseAI);
|
|
30103
30107
|
var _super = _create_super$d(AxAIHuggingFace);
|
|
30104
30108
|
function AxAIHuggingFace(param) {
|
|
30105
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
30109
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
30106
30110
|
_class_call_check$m(this, AxAIHuggingFace);
|
|
30107
30111
|
var _this;
|
|
30108
30112
|
if (!apiKey || apiKey === "") {
|
|
@@ -30123,13 +30127,14 @@ var AxAIHuggingFace = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30123
30127
|
supportFor: {
|
|
30124
30128
|
functions: false,
|
|
30125
30129
|
streaming: false
|
|
30126
|
-
}
|
|
30130
|
+
},
|
|
30131
|
+
modelMap: modelMap
|
|
30127
30132
|
});
|
|
30128
30133
|
_define_property$m(_assert_this_initialized$d(_this), "config", void 0);
|
|
30129
30134
|
_define_property$m(_assert_this_initialized$d(_this), "generateChatReq", function(req, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30130
30135
|
_config) {
|
|
30131
30136
|
var _req_chatPrompt, _req_modelConfig, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4;
|
|
30132
|
-
var model =
|
|
30137
|
+
var model = req.model;
|
|
30133
30138
|
var functionsList = req.functions ? "Functions:\n".concat(JSON.stringify(req.functions, null, 2), "\n") : "";
|
|
30134
30139
|
var prompt = (_req_chatPrompt = req.chatPrompt) === null || _req_chatPrompt === void 0 ? void 0 : _req_chatPrompt.map(function(msg) {
|
|
30135
30140
|
switch(msg.role){
|
|
@@ -30351,7 +30356,7 @@ var AxAITogether = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
30351
30356
|
_inherits$c(AxAITogether, AxAIOpenAI);
|
|
30352
30357
|
var _super = _create_super$c(AxAITogether);
|
|
30353
30358
|
function AxAITogether(param) {
|
|
30354
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
30359
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
30355
30360
|
_class_call_check$l(this, AxAITogether);
|
|
30356
30361
|
if (!apiKey || apiKey === "") {
|
|
30357
30362
|
throw new Error("Together API key not set");
|
|
@@ -30362,7 +30367,8 @@ var AxAITogether = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
30362
30367
|
config: _config,
|
|
30363
30368
|
options: options,
|
|
30364
30369
|
apiURL: "https://api.together.xyz/v1",
|
|
30365
|
-
modelInfo: axModelInfoTogether
|
|
30370
|
+
modelInfo: axModelInfoTogether,
|
|
30371
|
+
modelMap: modelMap
|
|
30366
30372
|
});
|
|
30367
30373
|
_get$4((_assert_this_initialized$c(_this), _get_prototype_of$c(AxAITogether.prototype)), "setName", _this).call(_this, "Together");
|
|
30368
30374
|
return _this;
|
|
@@ -30636,7 +30642,7 @@ var AxAICohere = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30636
30642
|
_inherits$b(AxAICohere, AxBaseAI);
|
|
30637
30643
|
var _super = _create_super$b(AxAICohere);
|
|
30638
30644
|
function AxAICohere(param) {
|
|
30639
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
30645
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
30640
30646
|
_class_call_check$k(this, AxAICohere);
|
|
30641
30647
|
var _this;
|
|
30642
30648
|
if (!apiKey || apiKey === "") {
|
|
@@ -30657,13 +30663,14 @@ var AxAICohere = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30657
30663
|
functions: true,
|
|
30658
30664
|
streaming: true
|
|
30659
30665
|
},
|
|
30660
|
-
options: options
|
|
30666
|
+
options: options,
|
|
30667
|
+
modelMap: modelMap
|
|
30661
30668
|
});
|
|
30662
30669
|
_define_property$k(_assert_this_initialized$b(_this), "config", void 0);
|
|
30663
30670
|
_define_property$k(_assert_this_initialized$b(_this), "generateChatReq", function(req, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30664
30671
|
_config) {
|
|
30665
30672
|
var _req_functions, _req_modelConfig, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5, _req_modelConfig6;
|
|
30666
|
-
var model =
|
|
30673
|
+
var model = req.model;
|
|
30667
30674
|
var lastChatMsg = req.chatPrompt.at(-1);
|
|
30668
30675
|
var restOfChat = req.chatPrompt.slice(0, -1);
|
|
30669
30676
|
var message;
|
|
@@ -30758,7 +30765,7 @@ var AxAICohere = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30758
30765
|
];
|
|
30759
30766
|
});
|
|
30760
30767
|
_define_property$k(_assert_this_initialized$b(_this), "generateEmbedReq", function(req) {
|
|
30761
|
-
var model =
|
|
30768
|
+
var model = req.embedModel;
|
|
30762
30769
|
if (!model) {
|
|
30763
30770
|
throw new Error("Embed model not set");
|
|
30764
30771
|
}
|
|
@@ -31157,7 +31164,7 @@ var safetySettings = [
|
|
|
31157
31164
|
_inherits$a(AxAIGoogleGemini, AxBaseAI);
|
|
31158
31165
|
var _super = _create_super$a(AxAIGoogleGemini);
|
|
31159
31166
|
function AxAIGoogleGemini(param) {
|
|
31160
|
-
var apiKey = param.apiKey, projectId = param.projectId, region = param.region, config = param.config, options = param.options;
|
|
31167
|
+
var apiKey = param.apiKey, projectId = param.projectId, region = param.region, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
31161
31168
|
_class_call_check$j(this, AxAIGoogleGemini);
|
|
31162
31169
|
var _this;
|
|
31163
31170
|
if (!apiKey || apiKey === "") {
|
|
@@ -31181,14 +31188,15 @@ var safetySettings = [
|
|
|
31181
31188
|
supportFor: {
|
|
31182
31189
|
functions: true,
|
|
31183
31190
|
streaming: true
|
|
31184
|
-
}
|
|
31191
|
+
},
|
|
31192
|
+
modelMap: modelMap
|
|
31185
31193
|
});
|
|
31186
31194
|
_define_property$j(_assert_this_initialized$a(_this), "options", void 0);
|
|
31187
31195
|
_define_property$j(_assert_this_initialized$a(_this), "config", void 0);
|
|
31188
31196
|
_define_property$j(_assert_this_initialized$a(_this), "apiKey", void 0);
|
|
31189
31197
|
_define_property$j(_assert_this_initialized$a(_this), "generateChatReq", function(req) {
|
|
31190
31198
|
var _req_modelConfig, _this_options, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5;
|
|
31191
|
-
var model =
|
|
31199
|
+
var model = req.model;
|
|
31192
31200
|
var _req_modelConfig_stream;
|
|
31193
31201
|
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;
|
|
31194
31202
|
if (!req.chatPrompt || req.chatPrompt.length === 0) {
|
|
@@ -31368,7 +31376,7 @@ var safetySettings = [
|
|
|
31368
31376
|
];
|
|
31369
31377
|
});
|
|
31370
31378
|
_define_property$j(_assert_this_initialized$a(_this), "generateEmbedReq", function(req) {
|
|
31371
|
-
var model =
|
|
31379
|
+
var model = req.embedModel;
|
|
31372
31380
|
if (!model) {
|
|
31373
31381
|
throw new Error("Embed model not set");
|
|
31374
31382
|
}
|
|
@@ -31732,7 +31740,7 @@ var AxAIAnthropic = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
31732
31740
|
_inherits$9(AxAIAnthropic, AxBaseAI);
|
|
31733
31741
|
var _super = _create_super$9(AxAIAnthropic);
|
|
31734
31742
|
function AxAIAnthropic(param) {
|
|
31735
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
31743
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
31736
31744
|
_class_call_check$i(this, AxAIAnthropic);
|
|
31737
31745
|
var _this;
|
|
31738
31746
|
if (!apiKey || apiKey === "") {
|
|
@@ -31754,12 +31762,13 @@ var AxAIAnthropic = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
31754
31762
|
supportFor: {
|
|
31755
31763
|
functions: true,
|
|
31756
31764
|
streaming: true
|
|
31757
|
-
}
|
|
31765
|
+
},
|
|
31766
|
+
modelMap: modelMap
|
|
31758
31767
|
});
|
|
31759
31768
|
_define_property$i(_assert_this_initialized$9(_this), "config", void 0);
|
|
31760
31769
|
_define_property$i(_assert_this_initialized$9(_this), "generateChatReq", function(req) {
|
|
31761
31770
|
var _req_functions, _req_modelConfig, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5;
|
|
31762
|
-
var model =
|
|
31771
|
+
var model = req.model;
|
|
31763
31772
|
var apiConfig = {
|
|
31764
31773
|
name: "/messages"
|
|
31765
31774
|
};
|
|
@@ -32656,7 +32665,7 @@ var AxAIGroq = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32656
32665
|
_inherits$8(AxAIGroq, AxAIOpenAI);
|
|
32657
32666
|
var _super = _create_super$8(AxAIGroq);
|
|
32658
32667
|
function AxAIGroq(param) {
|
|
32659
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
32668
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
32660
32669
|
_class_call_check$g(this, AxAIGroq);
|
|
32661
32670
|
var _this;
|
|
32662
32671
|
if (!apiKey || apiKey === "") {
|
|
@@ -32671,7 +32680,8 @@ var AxAIGroq = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32671
32680
|
config: _config,
|
|
32672
32681
|
options: _options,
|
|
32673
32682
|
apiURL: "https://api.groq.com/openai/v1",
|
|
32674
|
-
modelInfo: []
|
|
32683
|
+
modelInfo: [],
|
|
32684
|
+
modelMap: modelMap
|
|
32675
32685
|
});
|
|
32676
32686
|
_define_property$g(_assert_this_initialized$8(_this), "setOptions", function(options) {
|
|
32677
32687
|
var rateLimiter = _this.newRateLimiter(options);
|
|
@@ -32727,19 +32737,23 @@ var AxAIGroq = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32727
32737
|
}
|
|
32728
32738
|
(AxAIOpenAI);
|
|
32729
32739
|
|
|
32740
|
+
// cspell:ignore mistral, mixtral, codestral, nemo
|
|
32730
32741
|
var AxAIMistralModel;
|
|
32731
32742
|
(function(AxAIMistralModel) {
|
|
32732
32743
|
AxAIMistralModel["Mistral7B"] = "open-mistral-7b";
|
|
32733
32744
|
AxAIMistralModel["Mistral8x7B"] = "open-mixtral-8x7b";
|
|
32734
32745
|
AxAIMistralModel["MistralSmall"] = "mistral-small-latest";
|
|
32735
|
-
AxAIMistralModel["MistralMedium"] = "mistral-medium-latest";
|
|
32736
32746
|
AxAIMistralModel["MistralLarge"] = "mistral-large-latest";
|
|
32747
|
+
AxAIMistralModel["Codestral"] = "codestral-latest";
|
|
32748
|
+
AxAIMistralModel["OpenCodestralMamba"] = "open-codestral-mamba";
|
|
32749
|
+
AxAIMistralModel["OpenMistralNemo"] = "open-mistral-nemo-latest";
|
|
32737
32750
|
})(AxAIMistralModel || (AxAIMistralModel = {}));
|
|
32738
32751
|
var AxAIMistralEmbedModels;
|
|
32739
32752
|
(function(AxAIMistralEmbedModels) {
|
|
32740
32753
|
AxAIMistralEmbedModels["MistralEmbed"] = "mistral-embed";
|
|
32741
32754
|
})(AxAIMistralEmbedModels || (AxAIMistralEmbedModels = {}));
|
|
32742
32755
|
|
|
32756
|
+
// cspell:ignore mistral, mixtral, codestral, nemo
|
|
32743
32757
|
var axModelInfoMistral = [
|
|
32744
32758
|
{
|
|
32745
32759
|
name: AxAIMistralModel.Mistral7B,
|
|
@@ -32759,17 +32773,29 @@ var axModelInfoMistral = [
|
|
|
32759
32773
|
promptTokenCostPer1M: 2,
|
|
32760
32774
|
completionTokenCostPer1M: 6
|
|
32761
32775
|
},
|
|
32762
|
-
{
|
|
32763
|
-
name: AxAIMistralModel.MistralMedium,
|
|
32764
|
-
currency: "USD",
|
|
32765
|
-
promptTokenCostPer1M: 2.7,
|
|
32766
|
-
completionTokenCostPer1M: 8.1
|
|
32767
|
-
},
|
|
32768
32776
|
{
|
|
32769
32777
|
name: AxAIMistralModel.MistralLarge,
|
|
32770
32778
|
currency: "USD",
|
|
32771
32779
|
promptTokenCostPer1M: 8,
|
|
32772
32780
|
completionTokenCostPer1M: 24
|
|
32781
|
+
},
|
|
32782
|
+
{
|
|
32783
|
+
name: AxAIMistralModel.Codestral,
|
|
32784
|
+
currency: "USD",
|
|
32785
|
+
promptTokenCostPer1M: 1,
|
|
32786
|
+
completionTokenCostPer1M: 3
|
|
32787
|
+
},
|
|
32788
|
+
{
|
|
32789
|
+
name: AxAIMistralModel.OpenCodestralMamba,
|
|
32790
|
+
currency: "USD",
|
|
32791
|
+
promptTokenCostPer1M: 0.25,
|
|
32792
|
+
completionTokenCostPer1M: 0.25
|
|
32793
|
+
},
|
|
32794
|
+
{
|
|
32795
|
+
name: AxAIMistralModel.OpenMistralNemo,
|
|
32796
|
+
currency: "USD",
|
|
32797
|
+
promptTokenCostPer1M: 0.3,
|
|
32798
|
+
completionTokenCostPer1M: 0.3
|
|
32773
32799
|
}
|
|
32774
32800
|
];
|
|
32775
32801
|
|
|
@@ -32904,7 +32930,7 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32904
32930
|
_inherits$7(AxAIMistral, AxAIOpenAI);
|
|
32905
32931
|
var _super = _create_super$7(AxAIMistral);
|
|
32906
32932
|
function AxAIMistral(param) {
|
|
32907
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
32933
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
32908
32934
|
_class_call_check$f(this, AxAIMistral);
|
|
32909
32935
|
if (!apiKey || apiKey === "") {
|
|
32910
32936
|
throw new Error("Mistral API key not set");
|
|
@@ -32915,7 +32941,8 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32915
32941
|
config: _config,
|
|
32916
32942
|
options: options,
|
|
32917
32943
|
apiURL: "https://api.mistral.ai/v1",
|
|
32918
|
-
modelInfo: axModelInfoMistral
|
|
32944
|
+
modelInfo: axModelInfoMistral,
|
|
32945
|
+
modelMap: modelMap
|
|
32919
32946
|
});
|
|
32920
32947
|
_get$2((_assert_this_initialized$7(_this), _get_prototype_of$7(AxAIMistral.prototype)), "setName", _this).call(_this, "Mistral");
|
|
32921
32948
|
return _this;
|
|
@@ -33079,7 +33106,7 @@ var AxAIDeepSeek = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
33079
33106
|
_inherits$6(AxAIDeepSeek, AxAIOpenAI);
|
|
33080
33107
|
var _super = _create_super$6(AxAIDeepSeek);
|
|
33081
33108
|
function AxAIDeepSeek(param) {
|
|
33082
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
33109
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
33083
33110
|
_class_call_check$e(this, AxAIDeepSeek);
|
|
33084
33111
|
if (!apiKey || apiKey === "") {
|
|
33085
33112
|
throw new Error("DeepSeek API key not set");
|
|
@@ -33090,7 +33117,8 @@ var AxAIDeepSeek = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
33090
33117
|
config: _config,
|
|
33091
33118
|
options: options,
|
|
33092
33119
|
apiURL: "https://api.deepseek.com",
|
|
33093
|
-
modelInfo: axModelInfoDeepSeek
|
|
33120
|
+
modelInfo: axModelInfoDeepSeek,
|
|
33121
|
+
modelMap: modelMap
|
|
33094
33122
|
});
|
|
33095
33123
|
_get$1((_assert_this_initialized$6(_this), _get_prototype_of$6(AxAIDeepSeek.prototype)), "setName", _this).call(_this, "DeepSeek");
|
|
33096
33124
|
return _this;
|
|
@@ -33258,14 +33286,15 @@ var axAIOllamaDefaultConfig = function() {
|
|
|
33258
33286
|
_inherits$5(AxAIOllama, AxAIOpenAI);
|
|
33259
33287
|
var _super = _create_super$5(AxAIOllama);
|
|
33260
33288
|
function AxAIOllama(param) {
|
|
33261
|
-
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;
|
|
33289
|
+
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;
|
|
33262
33290
|
_class_call_check$d(this, AxAIOllama);
|
|
33263
33291
|
var _config = _object_spread$6({}, axAIOllamaDefaultConfig(), config);
|
|
33264
33292
|
var _this = _super.call(this, {
|
|
33265
33293
|
apiKey: apiKey,
|
|
33266
33294
|
options: options,
|
|
33267
33295
|
config: _config,
|
|
33268
|
-
apiURL: new URL("/
|
|
33296
|
+
apiURL: new URL("/api", url).href,
|
|
33297
|
+
modelMap: modelMap
|
|
33269
33298
|
});
|
|
33270
33299
|
_get((_assert_this_initialized$5(_this), _get_prototype_of$5(AxAIOllama.prototype)), "setName", _this).call(_this, "Ollama");
|
|
33271
33300
|
return _this;
|
|
@@ -33473,18 +33502,6 @@ var AxAI = /*#__PURE__*/ function() {
|
|
|
33473
33502
|
}
|
|
33474
33503
|
}
|
|
33475
33504
|
_create_class$5(AxAI, [
|
|
33476
|
-
{
|
|
33477
|
-
key: "setModelMap",
|
|
33478
|
-
value: function setModelMap(modelMap) {
|
|
33479
|
-
this.ai.setModelMap(modelMap);
|
|
33480
|
-
}
|
|
33481
|
-
},
|
|
33482
|
-
{
|
|
33483
|
-
key: "setEmbedModelMap",
|
|
33484
|
-
value: function setEmbedModelMap(modelMap) {
|
|
33485
|
-
this.ai.setEmbedModelMap(modelMap);
|
|
33486
|
-
}
|
|
33487
|
-
},
|
|
33488
33505
|
{
|
|
33489
33506
|
key: "getName",
|
|
33490
33507
|
value: function getName() {
|
|
@@ -33515,6 +33532,12 @@ var AxAI = /*#__PURE__*/ function() {
|
|
|
33515
33532
|
return this.ai.getFeatures();
|
|
33516
33533
|
}
|
|
33517
33534
|
},
|
|
33535
|
+
{
|
|
33536
|
+
key: "getModelMap",
|
|
33537
|
+
value: function getModelMap() {
|
|
33538
|
+
return this.ai.getModelMap();
|
|
33539
|
+
}
|
|
33540
|
+
},
|
|
33518
33541
|
{
|
|
33519
33542
|
key: "chat",
|
|
33520
33543
|
value: function chat(req, options) {
|
|
@@ -34073,8 +34096,8 @@ var assertRequiredFields = function(sig, values) {
|
|
|
34073
34096
|
});
|
|
34074
34097
|
if (missingFields.length > 0) {
|
|
34075
34098
|
throw new AxAssertionError({
|
|
34076
|
-
message: "
|
|
34077
|
-
return f.
|
|
34099
|
+
message: "Output must include: t: ".concat(missingFields.map(function(f) {
|
|
34100
|
+
return "`".concat(f.title, ":`");
|
|
34078
34101
|
}).join(", ")),
|
|
34079
34102
|
values: values
|
|
34080
34103
|
});
|
|
@@ -38880,7 +38903,7 @@ var AxPromptTemplate = function AxPromptTemplate(sig, fieldTemplates) {
|
|
|
38880
38903
|
this.outputFormat = {
|
|
38881
38904
|
type: "text",
|
|
38882
38905
|
text: [
|
|
38883
|
-
"
|
|
38906
|
+
"Use the following output format."
|
|
38884
38907
|
].concat(_to_consumable_array$2(this.renderOutFields(this.sig.getOutputFields())), [
|
|
38885
38908
|
"---\n\n"
|
|
38886
38909
|
]).join("\n\n")
|