@ax-llm/ax 9.0.26 → 9.0.28
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/ai/anthropic/api.d.ts +2 -2
- package/ai/anthropic/api.js +2 -1
- package/ai/anthropic/api.js.map +1 -1
- package/ai/balance.d.ts +3 -0
- package/ai/balance.js +6 -0
- package/ai/balance.js.map +1 -1
- package/ai/base.d.ts +17 -7
- package/ai/base.js +37 -11
- package/ai/base.js.map +1 -1
- package/ai/cohere/api.d.ts +2 -2
- package/ai/cohere/api.js +2 -2
- package/ai/cohere/api.js.map +1 -1
- package/ai/deepseek/api.d.ts +2 -1
- package/ai/deepseek/api.js.map +1 -1
- package/ai/google-gemini/api.d.ts +2 -2
- package/ai/google-gemini/api.js +6 -3
- package/ai/google-gemini/api.js.map +1 -1
- package/ai/groq/api.d.ts +2 -1
- package/ai/groq/api.js.map +1 -1
- package/ai/huggingface/api.d.ts +2 -2
- package/ai/huggingface/api.js +1 -1
- package/ai/huggingface/api.js.map +1 -1
- package/ai/mistral/api.d.ts +2 -1
- package/ai/mistral/api.js +1 -1
- package/ai/mistral/api.js.map +1 -1
- package/ai/ollama/api.d.ts +1 -1
- package/ai/ollama/api.js.map +1 -1
- package/ai/openai/api.d.ts +2 -2
- package/ai/openai/api.js +6 -3
- package/ai/openai/api.js.map +1 -1
- package/ai/together/api.d.ts +1 -1
- package/ai/together/api.js.map +1 -1
- package/ai/types.d.ts +3 -2
- package/ai/wrap.d.ts +3 -7
- package/ai/wrap.js +18 -29
- package/ai/wrap.js.map +1 -1
- package/cjs/ai/anthropic/api.d.ts +2 -2
- package/cjs/ai/anthropic/api.js +2 -1
- package/cjs/ai/anthropic/api.js.map +1 -1
- package/cjs/ai/balance.d.ts +3 -0
- package/cjs/ai/balance.js +6 -0
- package/cjs/ai/balance.js.map +1 -1
- package/cjs/ai/base.d.ts +17 -7
- package/cjs/ai/base.js +37 -11
- package/cjs/ai/base.js.map +1 -1
- package/cjs/ai/cohere/api.d.ts +2 -2
- package/cjs/ai/cohere/api.js +2 -2
- package/cjs/ai/cohere/api.js.map +1 -1
- package/cjs/ai/deepseek/api.d.ts +2 -1
- package/cjs/ai/deepseek/api.js.map +1 -1
- package/cjs/ai/google-gemini/api.d.ts +2 -2
- package/cjs/ai/google-gemini/api.js +6 -3
- package/cjs/ai/google-gemini/api.js.map +1 -1
- package/cjs/ai/groq/api.d.ts +2 -1
- package/cjs/ai/groq/api.js.map +1 -1
- package/cjs/ai/huggingface/api.d.ts +2 -2
- package/cjs/ai/huggingface/api.js +1 -1
- package/cjs/ai/huggingface/api.js.map +1 -1
- package/cjs/ai/mistral/api.d.ts +2 -1
- package/cjs/ai/mistral/api.js.map +1 -1
- package/cjs/ai/ollama/api.d.ts +1 -1
- package/cjs/ai/ollama/api.js.map +1 -1
- package/cjs/ai/openai/api.d.ts +2 -2
- package/cjs/ai/openai/api.js +6 -3
- package/cjs/ai/openai/api.js.map +1 -1
- package/cjs/ai/together/api.d.ts +1 -1
- package/cjs/ai/together/api.js.map +1 -1
- package/cjs/ai/types.d.ts +3 -2
- package/cjs/ai/wrap.d.ts +3 -7
- package/cjs/ai/wrap.js +18 -29
- package/cjs/ai/wrap.js.map +1 -1
- package/package.json +1 -1
package/cjs/ai/wrap.js
CHANGED
|
@@ -14,48 +14,51 @@ const api_js_10 = require("./openai/api.js");
|
|
|
14
14
|
const api_js_11 = require("./together/api.js");
|
|
15
15
|
class AxAI {
|
|
16
16
|
ai;
|
|
17
|
-
options;
|
|
18
17
|
constructor(options) {
|
|
19
|
-
|
|
20
|
-
this.options = { modelMap, embedModelMap };
|
|
21
|
-
switch (args.name) {
|
|
18
|
+
switch (options.name) {
|
|
22
19
|
case 'openai':
|
|
23
|
-
this.ai = new api_js_10.AxAIOpenAI(
|
|
20
|
+
this.ai = new api_js_10.AxAIOpenAI(options);
|
|
24
21
|
break;
|
|
25
22
|
case 'azure-openai':
|
|
26
|
-
this.ai = new api_js_2.AxAIAzureOpenAI(
|
|
23
|
+
this.ai = new api_js_2.AxAIAzureOpenAI(options);
|
|
27
24
|
break;
|
|
28
25
|
case 'huggingface':
|
|
29
|
-
this.ai = new api_js_7.AxAIHuggingFace(
|
|
26
|
+
this.ai = new api_js_7.AxAIHuggingFace(options);
|
|
30
27
|
break;
|
|
31
28
|
case 'groq':
|
|
32
|
-
this.ai = new api_js_6.AxAIGroq(
|
|
29
|
+
this.ai = new api_js_6.AxAIGroq(options);
|
|
33
30
|
break;
|
|
34
31
|
case 'together':
|
|
35
|
-
this.ai = new api_js_11.AxAITogether(
|
|
32
|
+
this.ai = new api_js_11.AxAITogether(options);
|
|
36
33
|
break;
|
|
37
34
|
case 'cohere':
|
|
38
|
-
this.ai = new api_js_3.AxAICohere(
|
|
35
|
+
this.ai = new api_js_3.AxAICohere(options);
|
|
39
36
|
break;
|
|
40
37
|
case 'google-gemini':
|
|
41
|
-
this.ai = new api_js_5.AxAIGoogleGemini(
|
|
38
|
+
this.ai = new api_js_5.AxAIGoogleGemini(options);
|
|
42
39
|
break;
|
|
43
40
|
case 'anthropic':
|
|
44
|
-
this.ai = new api_js_1.AxAIAnthropic(
|
|
41
|
+
this.ai = new api_js_1.AxAIAnthropic(options);
|
|
45
42
|
break;
|
|
46
43
|
case 'mistral':
|
|
47
|
-
this.ai = new api_js_8.AxAIMistral(
|
|
44
|
+
this.ai = new api_js_8.AxAIMistral(options);
|
|
48
45
|
break;
|
|
49
46
|
case 'deepseek':
|
|
50
|
-
this.ai = new api_js_4.AxAIDeepSeek(
|
|
47
|
+
this.ai = new api_js_4.AxAIDeepSeek(options);
|
|
51
48
|
break;
|
|
52
49
|
case 'ollama':
|
|
53
|
-
this.ai = new api_js_9.AxAIOllama(
|
|
50
|
+
this.ai = new api_js_9.AxAIOllama(options);
|
|
54
51
|
break;
|
|
55
52
|
default:
|
|
56
53
|
throw new Error(`Unknown AI`);
|
|
57
54
|
}
|
|
58
55
|
}
|
|
56
|
+
setModelMap(modelMap) {
|
|
57
|
+
this.ai.setModelMap(modelMap);
|
|
58
|
+
}
|
|
59
|
+
setEmbedModelMap(modelMap) {
|
|
60
|
+
this.ai.setEmbedModelMap(modelMap);
|
|
61
|
+
}
|
|
59
62
|
getName() {
|
|
60
63
|
return this.ai.getName();
|
|
61
64
|
}
|
|
@@ -72,23 +75,9 @@ class AxAI {
|
|
|
72
75
|
return this.ai.getFeatures();
|
|
73
76
|
}
|
|
74
77
|
async chat(req, options) {
|
|
75
|
-
if (this.options?.modelMap && req.model) {
|
|
76
|
-
const model = this.options.modelMap[req.model];
|
|
77
|
-
if (!model || model.length === 0) {
|
|
78
|
-
throw new Error(`Model not found in model map: ${req.model}`);
|
|
79
|
-
}
|
|
80
|
-
return await this.ai.chat({ ...req, model }, options);
|
|
81
|
-
}
|
|
82
78
|
return await this.ai.chat(req, options);
|
|
83
79
|
}
|
|
84
80
|
async embed(req, options) {
|
|
85
|
-
if (this.options?.embedModelMap && req.embedModel) {
|
|
86
|
-
const embedModel = this.options.embedModelMap[req.embedModel];
|
|
87
|
-
if (!embedModel || embedModel.length === 0) {
|
|
88
|
-
throw new Error(`Model not found in embed model map: ${req.embedModel}`);
|
|
89
|
-
}
|
|
90
|
-
return await this.ai.embed({ ...req, embedModel }, options);
|
|
91
|
-
}
|
|
92
81
|
return await this.ai.embed(req, options);
|
|
93
82
|
}
|
|
94
83
|
setOptions(options) {
|
package/cjs/ai/wrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../../ai/wrap.ts"],"names":[],"mappings":";;;AAEA,+CAA2E;AAE3E,kDAG+B;AAC/B,4CAAkE;AAElE,8CAAwE;AAExE,mDAGgC;AAKhC,0CAA4D;AAE5D,iDAG8B;AAE9B,6CAAqE;AAErE,4CAAkE;AAClE,6CAGyB;AAEzB,+CAAwE;
|
|
1
|
+
{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../../ai/wrap.ts"],"names":[],"mappings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