modelmix 1.1.2 → 1.1.6
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/README.md +10 -7
- package/demo/demo.mjs +7 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ Here's a quick example to get you started:
|
|
|
41
41
|
import OpenAI from 'openai';
|
|
42
42
|
import Anthropic from '@anthropic-ai/sdk';
|
|
43
43
|
|
|
44
|
-
import { ModelMix, OpenAIModel, AnthropicModel, CustomModel } from '
|
|
44
|
+
import { ModelMix, OpenAIModel, AnthropicModel, CustomModel } from 'modelmix';
|
|
45
45
|
|
|
46
46
|
const env = process.env;
|
|
47
47
|
|
|
@@ -97,8 +97,16 @@ Here's a quick example to get you started:
|
|
|
97
97
|
```javascript
|
|
98
98
|
new ModelMix(args = { options: {}, config: {} })
|
|
99
99
|
```
|
|
100
|
-
|
|
101
100
|
- **args**: Configuration object with `options` and `config` properties.
|
|
101
|
+
- **options**: This object contains default options that are applied to all models. These options can be overridden when creating a specific model instance. Examples of default options include:
|
|
102
|
+
- `max_tokens`: Sets the maximum number of tokens to generate, e.g., 2000.
|
|
103
|
+
- `temperature`: Controls the randomness of the model's output, e.g., 1.
|
|
104
|
+
- `top_p`: Controls the diversity of the output, e.g., 1.
|
|
105
|
+
- ...
|
|
106
|
+
- **config**: This object contains configuration settings that control the behavior of the `ModelMix` instance. These settings can also be overridden for specific model instances. Examples of configuration settings include:
|
|
107
|
+
- `system`: Sets the default system message for the model, e.g., "You are an assistant."
|
|
108
|
+
- `max_history`: Limits the number of historical messages to retain, e.g., 5.
|
|
109
|
+
- `max_request`: Limits the number of parallel request.
|
|
102
110
|
|
|
103
111
|
**Methods**
|
|
104
112
|
|
|
@@ -107,11 +115,6 @@ new ModelMix(args = { options: {}, config: {} })
|
|
|
107
115
|
|
|
108
116
|
#### MessageHandler
|
|
109
117
|
|
|
110
|
-
- **mix**: Instance of `ModelMix`.
|
|
111
|
-
- **modelEntry**: Model entry object.
|
|
112
|
-
- **options**: Options for the message handler.
|
|
113
|
-
- **config**: Configuration for the message handler.
|
|
114
|
-
|
|
115
118
|
**Methods**
|
|
116
119
|
|
|
117
120
|
- `new()`: Initializes a new message handler instance.
|
package/demo/demo.mjs
CHANGED
|
@@ -7,7 +7,6 @@ import { ModelMix, OpenAIModel, AnthropicModel, CustomModel } from '../index.js'
|
|
|
7
7
|
|
|
8
8
|
const env = process.env;
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
const driver = new ModelMix({
|
|
12
11
|
options: {
|
|
13
12
|
max_tokens: 200,
|
|
@@ -29,15 +28,18 @@ driver.attach(new CustomModel({
|
|
|
29
28
|
}
|
|
30
29
|
}));
|
|
31
30
|
|
|
31
|
+
console.log("\n" + '--------| gpt-4o |--------');
|
|
32
|
+
const gpt = await driver.create('gpt-4o', { temperature: 0.5 });
|
|
33
|
+
const question = await gpt.addText("Have you ever eaten a cat?").message();
|
|
34
|
+
console.log(question);
|
|
35
|
+
|
|
36
|
+
console.log("\n" + '--------| claude-3-sonnet-20240229 |--------');
|
|
32
37
|
const claude = await driver.create('claude-3-sonnet-20240229', { temperature: 0.5 });
|
|
33
38
|
await claude.addImage("./watson.png")
|
|
34
39
|
const imageDescription = await claude.addText("describe the image").message();
|
|
35
40
|
console.log(imageDescription);
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
const question = await gpt.addText("Have you ever eaten a cat?").message();
|
|
39
|
-
console.log(question);
|
|
40
|
-
|
|
42
|
+
console.log("\n" + '--------| pplx-70b-online |--------');
|
|
41
43
|
const pplx = await driver.create('pplx-70b-online', { max_tokens: 500 });
|
|
42
44
|
await pplx.addText('How much is ETH trading in USD?');
|
|
43
45
|
const news = await pplx.addText('What are the 3 most recent Ethereum news?').message();
|