@ax-llm/ax 12.0.3 → 12.0.4
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 +34 -2
- package/index.cjs.map +1 -1
- package/index.d.cts +34 -1
- package/index.d.ts +34 -1
- package/index.js +34 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -4164,7 +4164,8 @@ var axModelInfoMistral = [
|
|
|
4164
4164
|
// ai/mistral/api.ts
|
|
4165
4165
|
var axAIMistralDefaultConfig = () => structuredClone({
|
|
4166
4166
|
model: "mistral-small-latest" /* MistralSmall */,
|
|
4167
|
-
...axBaseAIDefaultConfig()
|
|
4167
|
+
...axBaseAIDefaultConfig(),
|
|
4168
|
+
topP: 1
|
|
4168
4169
|
});
|
|
4169
4170
|
var axAIMistralBestConfig = () => structuredClone({
|
|
4170
4171
|
...axAIMistralDefaultConfig(),
|
|
@@ -4192,6 +4193,15 @@ var AxAIMistral = class extends AxAIOpenAIBase {
|
|
|
4192
4193
|
hasThinkingBudget: false,
|
|
4193
4194
|
hasShowThoughts: false
|
|
4194
4195
|
};
|
|
4196
|
+
const chatReqUpdater = (req) => {
|
|
4197
|
+
const { max_completion_tokens, stream_options, messages, ...result } = req;
|
|
4198
|
+
return {
|
|
4199
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4200
|
+
...result,
|
|
4201
|
+
messages: this.updateMessages(messages),
|
|
4202
|
+
max_tokens: max_completion_tokens
|
|
4203
|
+
};
|
|
4204
|
+
};
|
|
4195
4205
|
super({
|
|
4196
4206
|
apiKey,
|
|
4197
4207
|
config: _config,
|
|
@@ -4199,10 +4209,32 @@ var AxAIMistral = class extends AxAIOpenAIBase {
|
|
|
4199
4209
|
apiURL: "https://api.mistral.ai/v1",
|
|
4200
4210
|
modelInfo,
|
|
4201
4211
|
models,
|
|
4202
|
-
supportFor
|
|
4212
|
+
supportFor,
|
|
4213
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4214
|
+
chatReqUpdater
|
|
4203
4215
|
});
|
|
4204
4216
|
super.setName("Mistral");
|
|
4205
4217
|
}
|
|
4218
|
+
updateMessages(messages) {
|
|
4219
|
+
const messagesUpdated = [];
|
|
4220
|
+
if (!Array.isArray(messages)) {
|
|
4221
|
+
return messages;
|
|
4222
|
+
}
|
|
4223
|
+
for (const message of messages) {
|
|
4224
|
+
if (message.role === "user" && Array.isArray(message.content)) {
|
|
4225
|
+
const contentUpdated = message.content.map((item) => {
|
|
4226
|
+
if (typeof item === "object" && item !== null && item.type === "image_url") {
|
|
4227
|
+
return { type: "image_url", image_url: item.image_url?.url };
|
|
4228
|
+
}
|
|
4229
|
+
return item;
|
|
4230
|
+
});
|
|
4231
|
+
messagesUpdated.push({ ...message, content: contentUpdated });
|
|
4232
|
+
} else {
|
|
4233
|
+
messagesUpdated.push(message);
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4236
|
+
return messagesUpdated;
|
|
4237
|
+
}
|
|
4206
4238
|
};
|
|
4207
4239
|
|
|
4208
4240
|
// ai/ollama/api.ts
|