@digipair/skill-dsp 0.22.1 → 0.23.2
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 +160 -136
- package/index.esm.js +160 -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
|
},
|
|
@@ -27377,6 +27379,7 @@ const applyTemplate = (value, context)=>{
|
|
|
27377
27379
|
const path = result.replace(/^EVALUATE:/, '');
|
|
27378
27380
|
result = evaluate(path, _extends({}, context, {
|
|
27379
27381
|
getTime: (time)=>new Date(time).getTime(),
|
|
27382
|
+
fromTime: (time)=>new Date(time).toISOString(),
|
|
27380
27383
|
atob: (value)=>atob(value),
|
|
27381
27384
|
btoa: (value)=>btoa(value),
|
|
27382
27385
|
encodeURIComponent: (value)=>encodeURIComponent(value),
|
|
@@ -28635,7 +28638,7 @@ var axBaseAIDefaultConfig = function() {
|
|
|
28635
28638
|
};
|
|
28636
28639
|
var AxBaseAI = /*#__PURE__*/ function() {
|
|
28637
28640
|
function AxBaseAI(param) {
|
|
28638
|
-
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;
|
|
28639
28642
|
_class_call_check$p(this, AxBaseAI);
|
|
28640
28643
|
_define_property$p(this, "generateChatReq", void 0);
|
|
28641
28644
|
_define_property$p(this, "generateEmbedReq", void 0);
|
|
@@ -28647,48 +28650,29 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28647
28650
|
_define_property$p(this, "fetch", void 0);
|
|
28648
28651
|
_define_property$p(this, "tracer", void 0);
|
|
28649
28652
|
_define_property$p(this, "modelMap", void 0);
|
|
28650
|
-
_define_property$p(this, "
|
|
28653
|
+
_define_property$p(this, "modelInfo", void 0);
|
|
28651
28654
|
_define_property$p(this, "modelUsage", void 0);
|
|
28652
28655
|
_define_property$p(this, "embedModelUsage", void 0);
|
|
28656
|
+
_define_property$p(this, "models", void 0);
|
|
28653
28657
|
_define_property$p(this, "apiURL", void 0);
|
|
28654
28658
|
_define_property$p(this, "name", void 0);
|
|
28655
28659
|
_define_property$p(this, "headers", void 0);
|
|
28656
|
-
_define_property$p(this, "modelInfo", void 0);
|
|
28657
|
-
_define_property$p(this, "embedModelInfo", void 0);
|
|
28658
28660
|
_define_property$p(this, "supportFor", void 0);
|
|
28659
28661
|
this.name = name;
|
|
28660
28662
|
this.apiURL = apiURL;
|
|
28661
28663
|
this.headers = headers;
|
|
28662
28664
|
this.supportFor = supportFor;
|
|
28663
28665
|
this.tracer = options.tracer;
|
|
28664
|
-
|
|
28665
|
-
|
|
28666
|
-
|
|
28667
|
-
|
|
28668
|
-
|
|
28669
|
-
|
|
28670
|
-
|
|
28671
|
-
|
|
28672
|
-
name: model,
|
|
28673
|
-
currency: "usd",
|
|
28674
|
-
promptTokenCostPer1M: 0,
|
|
28675
|
-
completionTokenCostPer1M: 0
|
|
28676
|
-
};
|
|
28677
|
-
} 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 === "") {
|
|
28678
28674
|
throw new Error("No model defined");
|
|
28679
28675
|
}
|
|
28680
|
-
if (typeof embedModel === "string") {
|
|
28681
|
-
var embedModelName = embedModel === null || embedModel === void 0 ? void 0 : embedModel.replace(/-0\d+$|-\d{2,}$/, "");
|
|
28682
|
-
var _modelInfo_filter_at1;
|
|
28683
|
-
this.embedModelInfo = (_modelInfo_filter_at1 = modelInfo.filter(function(v) {
|
|
28684
|
-
return v.name === embedModelName;
|
|
28685
|
-
}).at(0)) !== null && _modelInfo_filter_at1 !== void 0 ? _modelInfo_filter_at1 : {
|
|
28686
|
-
name: embedModel !== null && embedModel !== void 0 ? embedModel : "",
|
|
28687
|
-
currency: "usd",
|
|
28688
|
-
promptTokenCostPer1M: 0,
|
|
28689
|
-
completionTokenCostPer1M: 0
|
|
28690
|
-
};
|
|
28691
|
-
}
|
|
28692
28676
|
this.setOptions(options);
|
|
28693
28677
|
}
|
|
28694
28678
|
_create_class$c(AxBaseAI, [
|
|
@@ -28728,21 +28712,27 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28728
28712
|
}
|
|
28729
28713
|
},
|
|
28730
28714
|
{
|
|
28731
|
-
key: "
|
|
28732
|
-
value: function
|
|
28733
|
-
|
|
28734
|
-
|
|
28735
|
-
|
|
28736
|
-
|
|
28737
|
-
|
|
28738
|
-
|
|
28739
|
-
|
|
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
|
+
};
|
|
28740
28730
|
}
|
|
28741
28731
|
},
|
|
28742
28732
|
{
|
|
28743
28733
|
key: "getModelInfo",
|
|
28744
28734
|
value: function getModelInfo() {
|
|
28745
|
-
return _object_spread_props$8(_object_spread$h({}, this.
|
|
28735
|
+
return _object_spread_props$8(_object_spread$h({}, this._getModelInfo(this.models.model)), {
|
|
28746
28736
|
provider: this.name
|
|
28747
28737
|
});
|
|
28748
28738
|
}
|
|
@@ -28750,9 +28740,17 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28750
28740
|
{
|
|
28751
28741
|
key: "getEmbedModelInfo",
|
|
28752
28742
|
value: function getEmbedModelInfo() {
|
|
28753
|
-
|
|
28754
|
-
|
|
28755
|
-
|
|
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;
|
|
28756
28754
|
}
|
|
28757
28755
|
},
|
|
28758
28756
|
{
|
|
@@ -28775,13 +28773,14 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28775
28773
|
},
|
|
28776
28774
|
{
|
|
28777
28775
|
key: "chat",
|
|
28778
|
-
value: function chat(
|
|
28776
|
+
value: function chat(req, options) {
|
|
28779
28777
|
var _this = this;
|
|
28780
28778
|
return _async_to_generator$7(function() {
|
|
28781
|
-
var _mc_stopSequences, _this_tracer, mc, _obj;
|
|
28779
|
+
var _this_modelMap, _this_modelMap_req_model, model, _mc_stopSequences, _this_tracer, mc, _obj;
|
|
28782
28780
|
return _ts_generator$8(this, function(_state) {
|
|
28783
28781
|
switch(_state.label){
|
|
28784
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;
|
|
28785
28784
|
if (!_this.tracer) return [
|
|
28786
28785
|
3,
|
|
28787
28786
|
2
|
|
@@ -28791,7 +28790,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28791
28790
|
4,
|
|
28792
28791
|
(_this_tracer = _this.tracer) === null || _this_tracer === void 0 ? void 0 : _this_tracer.startActiveSpan("Chat Request", {
|
|
28793
28792
|
kind: AxSpanKind.SERVER,
|
|
28794
|
-
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)
|
|
28795
28794
|
}, function() {
|
|
28796
28795
|
var _ref = _async_to_generator$7(function(span) {
|
|
28797
28796
|
var res;
|
|
@@ -28800,7 +28799,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28800
28799
|
case 0:
|
|
28801
28800
|
return [
|
|
28802
28801
|
4,
|
|
28803
|
-
_this._chat(
|
|
28802
|
+
_this._chat(model, req, options, span)
|
|
28804
28803
|
];
|
|
28805
28804
|
case 1:
|
|
28806
28805
|
res = _state.sent();
|
|
@@ -28825,7 +28824,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28825
28824
|
case 2:
|
|
28826
28825
|
return [
|
|
28827
28826
|
4,
|
|
28828
|
-
_this._chat(
|
|
28827
|
+
_this._chat(model, req, options)
|
|
28829
28828
|
];
|
|
28830
28829
|
case 3:
|
|
28831
28830
|
return [
|
|
@@ -28839,10 +28838,10 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28839
28838
|
},
|
|
28840
28839
|
{
|
|
28841
28840
|
key: "_chat",
|
|
28842
|
-
value: function _chat(
|
|
28841
|
+
value: function _chat(model, chatReq, options, span) {
|
|
28843
28842
|
var _this = this;
|
|
28844
28843
|
return _async_to_generator$7(function() {
|
|
28845
|
-
var
|
|
28844
|
+
var _chatReq_modelConfig, reqFn, _options_stream, stream, functions, req, fn, rv, _tmp, respFn, wrappedRespFn, doneCb, st, res;
|
|
28846
28845
|
return _ts_generator$8(this, function(_state) {
|
|
28847
28846
|
switch(_state.label){
|
|
28848
28847
|
case 0:
|
|
@@ -28850,11 +28849,14 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28850
28849
|
throw new Error("generateChatReq not implemented");
|
|
28851
28850
|
}
|
|
28852
28851
|
reqFn = _this.generateChatReq;
|
|
28853
|
-
stream = (_options_stream = options === null || options === void 0 ? void 0 : options.stream) !== null && _options_stream !== void 0 ? _options_stream : (
|
|
28854
|
-
|
|
28855
|
-
|
|
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,
|
|
28856
28858
|
functions: functions,
|
|
28857
|
-
modelConfig: _object_spread_props$8(_object_spread$h({},
|
|
28859
|
+
modelConfig: _object_spread_props$8(_object_spread$h({}, chatReq.modelConfig), {
|
|
28858
28860
|
stream: stream
|
|
28859
28861
|
})
|
|
28860
28862
|
});
|
|
@@ -28991,10 +28993,14 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
28991
28993
|
value: function embed(req, options) {
|
|
28992
28994
|
var _this = this;
|
|
28993
28995
|
return _async_to_generator$7(function() {
|
|
28994
|
-
var _this_tracer, _obj;
|
|
28996
|
+
var _this_modelMap, _this_modelMap_req_embedModel, embedModel, _this_tracer, _req_embedModel, _obj;
|
|
28995
28997
|
return _ts_generator$8(this, function(_state) {
|
|
28996
28998
|
switch(_state.label){
|
|
28997
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
|
+
}
|
|
28998
29004
|
if (!_this.tracer) return [
|
|
28999
29005
|
3,
|
|
29000
29006
|
2
|
|
@@ -29003,7 +29009,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29003
29009
|
4,
|
|
29004
29010
|
(_this_tracer = _this.tracer) === null || _this_tracer === void 0 ? void 0 : _this_tracer.startActiveSpan("Embed Request", {
|
|
29005
29011
|
kind: AxSpanKind.SERVER,
|
|
29006
|
-
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)
|
|
29007
29013
|
}, function() {
|
|
29008
29014
|
var _ref = _async_to_generator$7(function(span) {
|
|
29009
29015
|
var res;
|
|
@@ -29012,7 +29018,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29012
29018
|
case 0:
|
|
29013
29019
|
return [
|
|
29014
29020
|
4,
|
|
29015
|
-
_this._embed(req, options, span)
|
|
29021
|
+
_this._embed(embedModel, req, options, span)
|
|
29016
29022
|
];
|
|
29017
29023
|
case 1:
|
|
29018
29024
|
res = _state.sent();
|
|
@@ -29037,7 +29043,7 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29037
29043
|
case 2:
|
|
29038
29044
|
return [
|
|
29039
29045
|
2,
|
|
29040
|
-
_this._embed(req, options)
|
|
29046
|
+
_this._embed(embedModel, req, options)
|
|
29041
29047
|
];
|
|
29042
29048
|
}
|
|
29043
29049
|
});
|
|
@@ -29046,10 +29052,10 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29046
29052
|
},
|
|
29047
29053
|
{
|
|
29048
29054
|
key: "_embed",
|
|
29049
|
-
value: function _embed(
|
|
29055
|
+
value: function _embed(embedModel, embedReq, options, span) {
|
|
29050
29056
|
var _this = this;
|
|
29051
29057
|
return _async_to_generator$7(function() {
|
|
29052
|
-
var fn, resValue, _tmp, res, _res_modelUsage_completionTokens, _obj;
|
|
29058
|
+
var req, fn, resValue, _tmp, res, _res_modelUsage_completionTokens, _obj;
|
|
29053
29059
|
return _ts_generator$8(this, function(_state) {
|
|
29054
29060
|
switch(_state.label){
|
|
29055
29061
|
case 0:
|
|
@@ -29059,6 +29065,9 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29059
29065
|
if (!_this.generateEmbedResp) {
|
|
29060
29066
|
throw new Error("generateEmbedResp not implemented");
|
|
29061
29067
|
}
|
|
29068
|
+
req = _object_spread_props$8(_object_spread$h({}, embedReq), {
|
|
29069
|
+
embedModel: embedModel
|
|
29070
|
+
});
|
|
29062
29071
|
fn = function() {
|
|
29063
29072
|
var _ref = _async_to_generator$7(function() {
|
|
29064
29073
|
var _this_generateEmbedReq, apiConfig, reqValue, res;
|
|
@@ -29140,22 +29149,6 @@ var AxBaseAI = /*#__PURE__*/ function() {
|
|
|
29140
29149
|
var headers = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
29141
29150
|
return _object_spread$h({}, headers, this.headers);
|
|
29142
29151
|
}
|
|
29143
|
-
},
|
|
29144
|
-
{
|
|
29145
|
-
key: "getEmbedModel",
|
|
29146
|
-
value: function getEmbedModel(name) {
|
|
29147
|
-
var _this_embedModelMap;
|
|
29148
|
-
var _this_embedModelMap_name;
|
|
29149
|
-
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;
|
|
29150
|
-
}
|
|
29151
|
-
},
|
|
29152
|
-
{
|
|
29153
|
-
key: "getModel",
|
|
29154
|
-
value: function getModel(name) {
|
|
29155
|
-
var _this_modelMap;
|
|
29156
|
-
var _this_modelMap_name;
|
|
29157
|
-
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;
|
|
29158
|
-
}
|
|
29159
29152
|
}
|
|
29160
29153
|
]);
|
|
29161
29154
|
return AxBaseAI;
|
|
@@ -29319,6 +29312,7 @@ var AxAIOpenAIModel;
|
|
|
29319
29312
|
(function(AxAIOpenAIModel) {
|
|
29320
29313
|
AxAIOpenAIModel["GPT4"] = "gpt-4";
|
|
29321
29314
|
AxAIOpenAIModel["GPT4O"] = "gpt-4o";
|
|
29315
|
+
AxAIOpenAIModel["GPT4OMini"] = "gpt-4o-mini";
|
|
29322
29316
|
AxAIOpenAIModel["GPT4Turbo"] = "gpt-4-turbo";
|
|
29323
29317
|
AxAIOpenAIModel["GPT35Turbo"] = "gpt-3.5-turbo";
|
|
29324
29318
|
AxAIOpenAIModel["GPT35TurboInstruct"] = "gpt-3.5-turbo-instruct";
|
|
@@ -29349,6 +29343,12 @@ var AxAIOpenAIEmbedModel;
|
|
|
29349
29343
|
promptTokenCostPer1M: 5,
|
|
29350
29344
|
completionTokenCostPer1M: 15
|
|
29351
29345
|
},
|
|
29346
|
+
{
|
|
29347
|
+
name: AxAIOpenAIModel.GPT4OMini,
|
|
29348
|
+
currency: "usd",
|
|
29349
|
+
promptTokenCostPer1M: 0.15,
|
|
29350
|
+
completionTokenCostPer1M: 0.6
|
|
29351
|
+
},
|
|
29352
29352
|
{
|
|
29353
29353
|
name: AxAIOpenAIModel.GPT4Turbo,
|
|
29354
29354
|
currency: "usd",
|
|
@@ -29504,7 +29504,7 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29504
29504
|
_inherits$f(AxAIOpenAI, AxBaseAI);
|
|
29505
29505
|
var _super = _create_super$f(AxAIOpenAI);
|
|
29506
29506
|
function AxAIOpenAI(param) {
|
|
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;
|
|
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;
|
|
29508
29508
|
_class_call_check$o(this, AxAIOpenAI);
|
|
29509
29509
|
var _this;
|
|
29510
29510
|
if (!apiKey || apiKey === "") {
|
|
@@ -29526,14 +29526,16 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29526
29526
|
supportFor: {
|
|
29527
29527
|
functions: true,
|
|
29528
29528
|
streaming: true
|
|
29529
|
-
}
|
|
29529
|
+
},
|
|
29530
|
+
modelMap: modelMap
|
|
29530
29531
|
});
|
|
29531
29532
|
_define_property$o(_assert_this_initialized$f(_this), "config", void 0);
|
|
29532
29533
|
_define_property$o(_assert_this_initialized$f(_this), "streamingUsage", void 0);
|
|
29534
|
+
_define_property$o(_assert_this_initialized$f(_this), "dimensions", void 0);
|
|
29533
29535
|
_define_property$o(_assert_this_initialized$f(_this), "generateChatReq", function(req, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29534
29536
|
_config) {
|
|
29535
29537
|
var _req_functions, _req_modelConfig, _req_modelConfig1, _this_config, _this_config1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5, _req_modelConfig6, _req_modelConfig7;
|
|
29536
|
-
var model =
|
|
29538
|
+
var model = req.model;
|
|
29537
29539
|
if (!req.chatPrompt || req.chatPrompt.length === 0) {
|
|
29538
29540
|
throw new Error("Chat prompt is empty");
|
|
29539
29541
|
}
|
|
@@ -29586,7 +29588,7 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29586
29588
|
];
|
|
29587
29589
|
});
|
|
29588
29590
|
_define_property$o(_assert_this_initialized$f(_this), "generateEmbedReq", function(req) {
|
|
29589
|
-
var model =
|
|
29591
|
+
var model = req.embedModel;
|
|
29590
29592
|
if (!model) {
|
|
29591
29593
|
throw new Error("Embed model not set");
|
|
29592
29594
|
}
|
|
@@ -29598,7 +29600,8 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29598
29600
|
};
|
|
29599
29601
|
var reqValue = {
|
|
29600
29602
|
model: model,
|
|
29601
|
-
input: req.texts
|
|
29603
|
+
input: req.texts,
|
|
29604
|
+
dimensions: _this.dimensions
|
|
29602
29605
|
};
|
|
29603
29606
|
return [
|
|
29604
29607
|
apiConfig,
|
|
@@ -29707,6 +29710,7 @@ var AxAIOpenAI = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
29707
29710
|
_this.config = _config;
|
|
29708
29711
|
var _options_streamingUsage;
|
|
29709
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;
|
|
29710
29714
|
return _this;
|
|
29711
29715
|
}
|
|
29712
29716
|
_create_class$b(AxAIOpenAI, [
|
|
@@ -29940,7 +29944,7 @@ var AxAIAzureOpenAI = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
29940
29944
|
_inherits$e(AxAIAzureOpenAI, AxAIOpenAI);
|
|
29941
29945
|
var _super = _create_super$e(AxAIAzureOpenAI);
|
|
29942
29946
|
function AxAIAzureOpenAI(param) {
|
|
29943
|
-
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;
|
|
29944
29948
|
_class_call_check$n(this, AxAIAzureOpenAI);
|
|
29945
29949
|
if (!apiKey || apiKey === "") {
|
|
29946
29950
|
throw new Error("Azure OpenAPI API key not set");
|
|
@@ -29955,7 +29959,8 @@ var AxAIAzureOpenAI = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
29955
29959
|
var _this = _super.call(this, {
|
|
29956
29960
|
apiKey: apiKey,
|
|
29957
29961
|
config: _config,
|
|
29958
|
-
options: options
|
|
29962
|
+
options: options,
|
|
29963
|
+
modelMap: modelMap
|
|
29959
29964
|
});
|
|
29960
29965
|
var host = resourceName.includes("://") ? resourceName : "https://".concat(resourceName, ".openai.azure.com/");
|
|
29961
29966
|
_get$5((_assert_this_initialized$e(_this), _get_prototype_of$e(AxAIAzureOpenAI.prototype)), "setName", _this).call(_this, "Azure OpenAI");
|
|
@@ -30101,7 +30106,7 @@ var AxAIHuggingFace = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30101
30106
|
_inherits$d(AxAIHuggingFace, AxBaseAI);
|
|
30102
30107
|
var _super = _create_super$d(AxAIHuggingFace);
|
|
30103
30108
|
function AxAIHuggingFace(param) {
|
|
30104
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
30109
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
30105
30110
|
_class_call_check$m(this, AxAIHuggingFace);
|
|
30106
30111
|
var _this;
|
|
30107
30112
|
if (!apiKey || apiKey === "") {
|
|
@@ -30122,13 +30127,14 @@ var AxAIHuggingFace = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30122
30127
|
supportFor: {
|
|
30123
30128
|
functions: false,
|
|
30124
30129
|
streaming: false
|
|
30125
|
-
}
|
|
30130
|
+
},
|
|
30131
|
+
modelMap: modelMap
|
|
30126
30132
|
});
|
|
30127
30133
|
_define_property$m(_assert_this_initialized$d(_this), "config", void 0);
|
|
30128
30134
|
_define_property$m(_assert_this_initialized$d(_this), "generateChatReq", function(req, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30129
30135
|
_config) {
|
|
30130
30136
|
var _req_chatPrompt, _req_modelConfig, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4;
|
|
30131
|
-
var model =
|
|
30137
|
+
var model = req.model;
|
|
30132
30138
|
var functionsList = req.functions ? "Functions:\n".concat(JSON.stringify(req.functions, null, 2), "\n") : "";
|
|
30133
30139
|
var prompt = (_req_chatPrompt = req.chatPrompt) === null || _req_chatPrompt === void 0 ? void 0 : _req_chatPrompt.map(function(msg) {
|
|
30134
30140
|
switch(msg.role){
|
|
@@ -30350,7 +30356,7 @@ var AxAITogether = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
30350
30356
|
_inherits$c(AxAITogether, AxAIOpenAI);
|
|
30351
30357
|
var _super = _create_super$c(AxAITogether);
|
|
30352
30358
|
function AxAITogether(param) {
|
|
30353
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
30359
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
30354
30360
|
_class_call_check$l(this, AxAITogether);
|
|
30355
30361
|
if (!apiKey || apiKey === "") {
|
|
30356
30362
|
throw new Error("Together API key not set");
|
|
@@ -30361,7 +30367,8 @@ var AxAITogether = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
30361
30367
|
config: _config,
|
|
30362
30368
|
options: options,
|
|
30363
30369
|
apiURL: "https://api.together.xyz/v1",
|
|
30364
|
-
modelInfo: axModelInfoTogether
|
|
30370
|
+
modelInfo: axModelInfoTogether,
|
|
30371
|
+
modelMap: modelMap
|
|
30365
30372
|
});
|
|
30366
30373
|
_get$4((_assert_this_initialized$c(_this), _get_prototype_of$c(AxAITogether.prototype)), "setName", _this).call(_this, "Together");
|
|
30367
30374
|
return _this;
|
|
@@ -30635,7 +30642,7 @@ var AxAICohere = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30635
30642
|
_inherits$b(AxAICohere, AxBaseAI);
|
|
30636
30643
|
var _super = _create_super$b(AxAICohere);
|
|
30637
30644
|
function AxAICohere(param) {
|
|
30638
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
30645
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
30639
30646
|
_class_call_check$k(this, AxAICohere);
|
|
30640
30647
|
var _this;
|
|
30641
30648
|
if (!apiKey || apiKey === "") {
|
|
@@ -30656,13 +30663,14 @@ var AxAICohere = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30656
30663
|
functions: true,
|
|
30657
30664
|
streaming: true
|
|
30658
30665
|
},
|
|
30659
|
-
options: options
|
|
30666
|
+
options: options,
|
|
30667
|
+
modelMap: modelMap
|
|
30660
30668
|
});
|
|
30661
30669
|
_define_property$k(_assert_this_initialized$b(_this), "config", void 0);
|
|
30662
30670
|
_define_property$k(_assert_this_initialized$b(_this), "generateChatReq", function(req, // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30663
30671
|
_config) {
|
|
30664
30672
|
var _req_functions, _req_modelConfig, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5, _req_modelConfig6;
|
|
30665
|
-
var model =
|
|
30673
|
+
var model = req.model;
|
|
30666
30674
|
var lastChatMsg = req.chatPrompt.at(-1);
|
|
30667
30675
|
var restOfChat = req.chatPrompt.slice(0, -1);
|
|
30668
30676
|
var message;
|
|
@@ -30757,7 +30765,7 @@ var AxAICohere = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
30757
30765
|
];
|
|
30758
30766
|
});
|
|
30759
30767
|
_define_property$k(_assert_this_initialized$b(_this), "generateEmbedReq", function(req) {
|
|
30760
|
-
var model =
|
|
30768
|
+
var model = req.embedModel;
|
|
30761
30769
|
if (!model) {
|
|
30762
30770
|
throw new Error("Embed model not set");
|
|
30763
30771
|
}
|
|
@@ -31156,7 +31164,7 @@ var safetySettings = [
|
|
|
31156
31164
|
_inherits$a(AxAIGoogleGemini, AxBaseAI);
|
|
31157
31165
|
var _super = _create_super$a(AxAIGoogleGemini);
|
|
31158
31166
|
function AxAIGoogleGemini(param) {
|
|
31159
|
-
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;
|
|
31160
31168
|
_class_call_check$j(this, AxAIGoogleGemini);
|
|
31161
31169
|
var _this;
|
|
31162
31170
|
if (!apiKey || apiKey === "") {
|
|
@@ -31180,14 +31188,15 @@ var safetySettings = [
|
|
|
31180
31188
|
supportFor: {
|
|
31181
31189
|
functions: true,
|
|
31182
31190
|
streaming: true
|
|
31183
|
-
}
|
|
31191
|
+
},
|
|
31192
|
+
modelMap: modelMap
|
|
31184
31193
|
});
|
|
31185
31194
|
_define_property$j(_assert_this_initialized$a(_this), "options", void 0);
|
|
31186
31195
|
_define_property$j(_assert_this_initialized$a(_this), "config", void 0);
|
|
31187
31196
|
_define_property$j(_assert_this_initialized$a(_this), "apiKey", void 0);
|
|
31188
31197
|
_define_property$j(_assert_this_initialized$a(_this), "generateChatReq", function(req) {
|
|
31189
31198
|
var _req_modelConfig, _this_options, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5;
|
|
31190
|
-
var model =
|
|
31199
|
+
var model = req.model;
|
|
31191
31200
|
var _req_modelConfig_stream;
|
|
31192
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;
|
|
31193
31202
|
if (!req.chatPrompt || req.chatPrompt.length === 0) {
|
|
@@ -31367,7 +31376,7 @@ var safetySettings = [
|
|
|
31367
31376
|
];
|
|
31368
31377
|
});
|
|
31369
31378
|
_define_property$j(_assert_this_initialized$a(_this), "generateEmbedReq", function(req) {
|
|
31370
|
-
var model =
|
|
31379
|
+
var model = req.embedModel;
|
|
31371
31380
|
if (!model) {
|
|
31372
31381
|
throw new Error("Embed model not set");
|
|
31373
31382
|
}
|
|
@@ -31731,7 +31740,7 @@ var AxAIAnthropic = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
31731
31740
|
_inherits$9(AxAIAnthropic, AxBaseAI);
|
|
31732
31741
|
var _super = _create_super$9(AxAIAnthropic);
|
|
31733
31742
|
function AxAIAnthropic(param) {
|
|
31734
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
31743
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
31735
31744
|
_class_call_check$i(this, AxAIAnthropic);
|
|
31736
31745
|
var _this;
|
|
31737
31746
|
if (!apiKey || apiKey === "") {
|
|
@@ -31753,12 +31762,13 @@ var AxAIAnthropic = /*#__PURE__*/ function(AxBaseAI) {
|
|
|
31753
31762
|
supportFor: {
|
|
31754
31763
|
functions: true,
|
|
31755
31764
|
streaming: true
|
|
31756
|
-
}
|
|
31765
|
+
},
|
|
31766
|
+
modelMap: modelMap
|
|
31757
31767
|
});
|
|
31758
31768
|
_define_property$i(_assert_this_initialized$9(_this), "config", void 0);
|
|
31759
31769
|
_define_property$i(_assert_this_initialized$9(_this), "generateChatReq", function(req) {
|
|
31760
31770
|
var _req_functions, _req_modelConfig, _req_modelConfig1, _req_modelConfig2, _req_modelConfig3, _req_modelConfig4, _req_modelConfig5;
|
|
31761
|
-
var model =
|
|
31771
|
+
var model = req.model;
|
|
31762
31772
|
var apiConfig = {
|
|
31763
31773
|
name: "/messages"
|
|
31764
31774
|
};
|
|
@@ -32655,7 +32665,7 @@ var AxAIGroq = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32655
32665
|
_inherits$8(AxAIGroq, AxAIOpenAI);
|
|
32656
32666
|
var _super = _create_super$8(AxAIGroq);
|
|
32657
32667
|
function AxAIGroq(param) {
|
|
32658
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
32668
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
32659
32669
|
_class_call_check$g(this, AxAIGroq);
|
|
32660
32670
|
var _this;
|
|
32661
32671
|
if (!apiKey || apiKey === "") {
|
|
@@ -32670,7 +32680,8 @@ var AxAIGroq = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32670
32680
|
config: _config,
|
|
32671
32681
|
options: _options,
|
|
32672
32682
|
apiURL: "https://api.groq.com/openai/v1",
|
|
32673
|
-
modelInfo: []
|
|
32683
|
+
modelInfo: [],
|
|
32684
|
+
modelMap: modelMap
|
|
32674
32685
|
});
|
|
32675
32686
|
_define_property$g(_assert_this_initialized$8(_this), "setOptions", function(options) {
|
|
32676
32687
|
var rateLimiter = _this.newRateLimiter(options);
|
|
@@ -32726,19 +32737,23 @@ var AxAIGroq = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32726
32737
|
}
|
|
32727
32738
|
(AxAIOpenAI);
|
|
32728
32739
|
|
|
32740
|
+
// cspell:ignore mistral, mixtral, codestral, nemo
|
|
32729
32741
|
var AxAIMistralModel;
|
|
32730
32742
|
(function(AxAIMistralModel) {
|
|
32731
32743
|
AxAIMistralModel["Mistral7B"] = "open-mistral-7b";
|
|
32732
32744
|
AxAIMistralModel["Mistral8x7B"] = "open-mixtral-8x7b";
|
|
32733
32745
|
AxAIMistralModel["MistralSmall"] = "mistral-small-latest";
|
|
32734
|
-
AxAIMistralModel["MistralMedium"] = "mistral-medium-latest";
|
|
32735
32746
|
AxAIMistralModel["MistralLarge"] = "mistral-large-latest";
|
|
32747
|
+
AxAIMistralModel["Codestral"] = "codestral-latest";
|
|
32748
|
+
AxAIMistralModel["OpenCodestralMamba"] = "open-codestral-mamba";
|
|
32749
|
+
AxAIMistralModel["OpenMistralNemo"] = "open-mistral-nemo-latest";
|
|
32736
32750
|
})(AxAIMistralModel || (AxAIMistralModel = {}));
|
|
32737
32751
|
var AxAIMistralEmbedModels;
|
|
32738
32752
|
(function(AxAIMistralEmbedModels) {
|
|
32739
32753
|
AxAIMistralEmbedModels["MistralEmbed"] = "mistral-embed";
|
|
32740
32754
|
})(AxAIMistralEmbedModels || (AxAIMistralEmbedModels = {}));
|
|
32741
32755
|
|
|
32756
|
+
// cspell:ignore mistral, mixtral, codestral, nemo
|
|
32742
32757
|
var axModelInfoMistral = [
|
|
32743
32758
|
{
|
|
32744
32759
|
name: AxAIMistralModel.Mistral7B,
|
|
@@ -32758,17 +32773,29 @@ var axModelInfoMistral = [
|
|
|
32758
32773
|
promptTokenCostPer1M: 2,
|
|
32759
32774
|
completionTokenCostPer1M: 6
|
|
32760
32775
|
},
|
|
32761
|
-
{
|
|
32762
|
-
name: AxAIMistralModel.MistralMedium,
|
|
32763
|
-
currency: "USD",
|
|
32764
|
-
promptTokenCostPer1M: 2.7,
|
|
32765
|
-
completionTokenCostPer1M: 8.1
|
|
32766
|
-
},
|
|
32767
32776
|
{
|
|
32768
32777
|
name: AxAIMistralModel.MistralLarge,
|
|
32769
32778
|
currency: "USD",
|
|
32770
32779
|
promptTokenCostPer1M: 8,
|
|
32771
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
|
|
32772
32799
|
}
|
|
32773
32800
|
];
|
|
32774
32801
|
|
|
@@ -32903,7 +32930,7 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32903
32930
|
_inherits$7(AxAIMistral, AxAIOpenAI);
|
|
32904
32931
|
var _super = _create_super$7(AxAIMistral);
|
|
32905
32932
|
function AxAIMistral(param) {
|
|
32906
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
32933
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
32907
32934
|
_class_call_check$f(this, AxAIMistral);
|
|
32908
32935
|
if (!apiKey || apiKey === "") {
|
|
32909
32936
|
throw new Error("Mistral API key not set");
|
|
@@ -32914,7 +32941,8 @@ var AxAIMistral = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
32914
32941
|
config: _config,
|
|
32915
32942
|
options: options,
|
|
32916
32943
|
apiURL: "https://api.mistral.ai/v1",
|
|
32917
|
-
modelInfo: axModelInfoMistral
|
|
32944
|
+
modelInfo: axModelInfoMistral,
|
|
32945
|
+
modelMap: modelMap
|
|
32918
32946
|
});
|
|
32919
32947
|
_get$2((_assert_this_initialized$7(_this), _get_prototype_of$7(AxAIMistral.prototype)), "setName", _this).call(_this, "Mistral");
|
|
32920
32948
|
return _this;
|
|
@@ -33078,7 +33106,7 @@ var AxAIDeepSeek = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
33078
33106
|
_inherits$6(AxAIDeepSeek, AxAIOpenAI);
|
|
33079
33107
|
var _super = _create_super$6(AxAIDeepSeek);
|
|
33080
33108
|
function AxAIDeepSeek(param) {
|
|
33081
|
-
var apiKey = param.apiKey, config = param.config, options = param.options;
|
|
33109
|
+
var apiKey = param.apiKey, config = param.config, options = param.options, modelMap = param.modelMap;
|
|
33082
33110
|
_class_call_check$e(this, AxAIDeepSeek);
|
|
33083
33111
|
if (!apiKey || apiKey === "") {
|
|
33084
33112
|
throw new Error("DeepSeek API key not set");
|
|
@@ -33089,7 +33117,8 @@ var AxAIDeepSeek = /*#__PURE__*/ function(AxAIOpenAI) {
|
|
|
33089
33117
|
config: _config,
|
|
33090
33118
|
options: options,
|
|
33091
33119
|
apiURL: "https://api.deepseek.com",
|
|
33092
|
-
modelInfo: axModelInfoDeepSeek
|
|
33120
|
+
modelInfo: axModelInfoDeepSeek,
|
|
33121
|
+
modelMap: modelMap
|
|
33093
33122
|
});
|
|
33094
33123
|
_get$1((_assert_this_initialized$6(_this), _get_prototype_of$6(AxAIDeepSeek.prototype)), "setName", _this).call(_this, "DeepSeek");
|
|
33095
33124
|
return _this;
|
|
@@ -33257,14 +33286,15 @@ var axAIOllamaDefaultConfig = function() {
|
|
|
33257
33286
|
_inherits$5(AxAIOllama, AxAIOpenAI);
|
|
33258
33287
|
var _super = _create_super$5(AxAIOllama);
|
|
33259
33288
|
function AxAIOllama(param) {
|
|
33260
|
-
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;
|
|
33261
33290
|
_class_call_check$d(this, AxAIOllama);
|
|
33262
33291
|
var _config = _object_spread$6({}, axAIOllamaDefaultConfig(), config);
|
|
33263
33292
|
var _this = _super.call(this, {
|
|
33264
33293
|
apiKey: apiKey,
|
|
33265
33294
|
options: options,
|
|
33266
33295
|
config: _config,
|
|
33267
|
-
apiURL: new URL("/
|
|
33296
|
+
apiURL: new URL("/api", url).href,
|
|
33297
|
+
modelMap: modelMap
|
|
33268
33298
|
});
|
|
33269
33299
|
_get((_assert_this_initialized$5(_this), _get_prototype_of$5(AxAIOllama.prototype)), "setName", _this).call(_this, "Ollama");
|
|
33270
33300
|
return _this;
|
|
@@ -33472,18 +33502,6 @@ var AxAI = /*#__PURE__*/ function() {
|
|
|
33472
33502
|
}
|
|
33473
33503
|
}
|
|
33474
33504
|
_create_class$5(AxAI, [
|
|
33475
|
-
{
|
|
33476
|
-
key: "setModelMap",
|
|
33477
|
-
value: function setModelMap(modelMap) {
|
|
33478
|
-
this.ai.setModelMap(modelMap);
|
|
33479
|
-
}
|
|
33480
|
-
},
|
|
33481
|
-
{
|
|
33482
|
-
key: "setEmbedModelMap",
|
|
33483
|
-
value: function setEmbedModelMap(modelMap) {
|
|
33484
|
-
this.ai.setEmbedModelMap(modelMap);
|
|
33485
|
-
}
|
|
33486
|
-
},
|
|
33487
33505
|
{
|
|
33488
33506
|
key: "getName",
|
|
33489
33507
|
value: function getName() {
|
|
@@ -33514,6 +33532,12 @@ var AxAI = /*#__PURE__*/ function() {
|
|
|
33514
33532
|
return this.ai.getFeatures();
|
|
33515
33533
|
}
|
|
33516
33534
|
},
|
|
33535
|
+
{
|
|
33536
|
+
key: "getModelMap",
|
|
33537
|
+
value: function getModelMap() {
|
|
33538
|
+
return this.ai.getModelMap();
|
|
33539
|
+
}
|
|
33540
|
+
},
|
|
33517
33541
|
{
|
|
33518
33542
|
key: "chat",
|
|
33519
33543
|
value: function chat(req, options) {
|
|
@@ -34072,8 +34096,8 @@ var assertRequiredFields = function(sig, values) {
|
|
|
34072
34096
|
});
|
|
34073
34097
|
if (missingFields.length > 0) {
|
|
34074
34098
|
throw new AxAssertionError({
|
|
34075
|
-
message: "
|
|
34076
|
-
return f.
|
|
34099
|
+
message: "Output must include: t: ".concat(missingFields.map(function(f) {
|
|
34100
|
+
return "`".concat(f.title, ":`");
|
|
34077
34101
|
}).join(", ")),
|
|
34078
34102
|
values: values
|
|
34079
34103
|
});
|
|
@@ -38879,7 +38903,7 @@ var AxPromptTemplate = function AxPromptTemplate(sig, fieldTemplates) {
|
|
|
38879
38903
|
this.outputFormat = {
|
|
38880
38904
|
type: "text",
|
|
38881
38905
|
text: [
|
|
38882
|
-
"
|
|
38906
|
+
"Use the following output format."
|
|
38883
38907
|
].concat(_to_consumable_array$2(this.renderOutFields(this.sig.getOutputFields())), [
|
|
38884
38908
|
"---\n\n"
|
|
38885
38909
|
]).join("\n\n")
|