modelmix 2.7.8 → 2.8.0
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/demo/demo.mjs +9 -9
- package/index.js +7 -7
- package/package.json +3 -3
package/demo/demo.mjs
CHANGED
|
@@ -33,16 +33,16 @@ mmix.attach(new MixOllama({
|
|
|
33
33
|
|
|
34
34
|
mmix.replace({ '{name}': 'ALF' });
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
console.log("\n" + '--------| o3-mini |--------');
|
|
37
|
+
const gpt = mmix.create('o3-mini', { options: { temperature: 0 } }).addText("Have you ever eaten a {animal}?");
|
|
38
|
+
gpt.replace({ '{animal}': 'cat' });
|
|
39
|
+
console.log(await gpt.message());
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
console.log("\n" + '--------| claude-3-5-sonnet-20240620 |--------');
|
|
42
|
+
const claude = mmix.create('claude-3-5-sonnet-20240620', { options: { temperature: 0 } });
|
|
43
|
+
claude.addImageFromUrl('https://pbs.twimg.com/media/F6-GsjraAAADDGy?format=jpg');
|
|
44
|
+
const imageDescription = await claude.addText('describe the image').message();
|
|
45
|
+
console.log(imageDescription);
|
|
46
46
|
|
|
47
47
|
console.log("\n" + '--------| claude-3-5-sonnet-20240620 |--------');
|
|
48
48
|
const writer = mmix.create('claude-3-5-sonnet-20240620', { options: { temperature: 0.5 } });
|
package/index.js
CHANGED
|
@@ -59,12 +59,6 @@ class ModelMix {
|
|
|
59
59
|
model: modelKey
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
// Remove max_tokens for o3 models
|
|
63
|
-
if (modelKey.startsWith('o3')) {
|
|
64
|
-
delete options.max_tokens;
|
|
65
|
-
delete options.temperature;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
62
|
const config = {
|
|
69
63
|
...this.config,
|
|
70
64
|
...modelEntry.config,
|
|
@@ -434,13 +428,19 @@ class MixOpenAI extends MixCustom {
|
|
|
434
428
|
getDefaultConfig(customConfig) {
|
|
435
429
|
return super.getDefaultConfig({
|
|
436
430
|
url: 'https://api.openai.com/v1/chat/completions',
|
|
437
|
-
prefix: ['gpt', 'ft:', 'o3'],
|
|
431
|
+
prefix: ['gpt', 'ft:', 'o3', 'o1'],
|
|
438
432
|
apiKey: process.env.OPENAI_API_KEY,
|
|
439
433
|
...customConfig
|
|
440
434
|
});
|
|
441
435
|
}
|
|
442
436
|
|
|
443
437
|
create(args = { config: {}, options: {} }) {
|
|
438
|
+
// Remove max_tokens and temperature for o1/o3 models
|
|
439
|
+
if (args.options.model?.startsWith('o')) {
|
|
440
|
+
delete args.options.max_tokens;
|
|
441
|
+
delete args.options.temperature;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
444
|
args.options.messages = [{ role: 'system', content: args.config.system }, ...args.options.messages || []];
|
|
445
445
|
args.options.messages = MixOpenAI.convertMessages(args.options.messages);
|
|
446
446
|
return super.create(args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modelmix",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "🧬 ModelMix - Unified API for Diverse AI LLM.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"ollama",
|
|
30
30
|
"lmstudio",
|
|
31
31
|
"together",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
32
|
+
"o1",
|
|
33
|
+
"o1-mini",
|
|
34
34
|
"deepseek",
|
|
35
35
|
"o3",
|
|
36
36
|
"o3-mini",
|