aimodels 0.2.3 → 0.2.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/README.md +44 -47
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -13,36 +13,23 @@ npm install aimodels
|
|
|
13
13
|
```typescript
|
|
14
14
|
import { models } from 'aimodels';
|
|
15
15
|
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// Get list of all providers
|
|
20
|
-
console.log(models.providers); // ['openai', 'anthropic', 'mistral', ...]
|
|
21
|
-
|
|
22
|
-
// Get list of model creators
|
|
23
|
-
console.log(models.creators); // ['meta', 'mistral', ...]
|
|
16
|
+
// Find models by capability
|
|
17
|
+
const chatModels = models.can('chat');
|
|
18
|
+
const multimodalModels = models.can('chat', 'img-in');
|
|
24
19
|
|
|
25
|
-
//
|
|
26
|
-
const
|
|
20
|
+
// Find models by provider
|
|
21
|
+
const openaiModels = models.fromProvider('openai');
|
|
27
22
|
|
|
28
|
-
//
|
|
23
|
+
// Find models by creator
|
|
29
24
|
const metaModels = models.fromCreator('meta');
|
|
30
25
|
|
|
31
|
-
// Find
|
|
32
|
-
const
|
|
26
|
+
// Find models by context window
|
|
27
|
+
const largeContextModels = models.withMinContext(32768);
|
|
28
|
+
|
|
29
|
+
// Find specific model
|
|
30
|
+
const model = models.id('gpt-4');
|
|
33
31
|
console.log(model?.context.total); // Context window size
|
|
34
32
|
console.log(model?.providers); // ['openai']
|
|
35
|
-
|
|
36
|
-
// Get model pricing for a specific provider
|
|
37
|
-
const price = models.getPrice('gpt-4', 'openai');
|
|
38
|
-
console.log(price); // { type: 'token', input: 0.03, output: 0.06 }
|
|
39
|
-
|
|
40
|
-
// Filter models by capabilities
|
|
41
|
-
const chatModels = models.can('chat');
|
|
42
|
-
const multimodalModels = models.can('chat', 'img-in');
|
|
43
|
-
|
|
44
|
-
// Filter by context window
|
|
45
|
-
const largeContextModels = models.withMinContext(32768);
|
|
46
33
|
```
|
|
47
34
|
|
|
48
35
|
## Features
|
|
@@ -51,43 +38,53 @@ const largeContextModels = models.withMinContext(32768);
|
|
|
51
38
|
- Normalized data structure for easy comparison
|
|
52
39
|
- Model capabilities (chat, img-in, img-out, function-out, etc.)
|
|
53
40
|
- Context window information
|
|
54
|
-
- Pricing information per provider
|
|
55
41
|
- Creator and provider associations
|
|
56
42
|
- TypeScript support with full type safety
|
|
57
43
|
- Zero dependencies
|
|
58
44
|
- Universal JavaScript support (Node.js, browsers, Deno)
|
|
59
45
|
- Regular updates with new models
|
|
60
46
|
|
|
61
|
-
|
|
62
47
|
## Types
|
|
63
48
|
|
|
49
|
+
### Model
|
|
64
50
|
```typescript
|
|
65
51
|
interface Model {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
52
|
+
/** Unique identifier */
|
|
53
|
+
id: string;
|
|
54
|
+
/** Display name */
|
|
55
|
+
name: string;
|
|
56
|
+
/** Model capabilities */
|
|
57
|
+
can: Capability[];
|
|
58
|
+
/** Available providers */
|
|
59
|
+
providers: string[];
|
|
60
|
+
/** Context window information */
|
|
61
|
+
context: ModelContext;
|
|
62
|
+
/** License or creator */
|
|
63
|
+
license: string;
|
|
74
64
|
}
|
|
65
|
+
```
|
|
75
66
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
67
|
+
### Capabilities
|
|
68
|
+
```typescript
|
|
69
|
+
type Capability =
|
|
70
|
+
| "chat" // shortcut for "text-in" and "text-out"
|
|
71
|
+
| "reason" // when the model spends some tokens on reasoning
|
|
72
|
+
| "text-in" // process text input
|
|
73
|
+
| "text-out" // output text
|
|
74
|
+
| "img-in" // understand images
|
|
75
|
+
| "img-out" // generate images
|
|
76
|
+
| "sound-in" // process audio input
|
|
77
|
+
| "sound-out" // generate audio/speech
|
|
78
|
+
| "json-out" // structured JSON output
|
|
79
|
+
| "function-out" // function calling
|
|
80
|
+
| "vectors-out"; // output vector embeddings
|
|
89
81
|
```
|
|
90
82
|
|
|
83
|
+
For more detailed information, see:
|
|
84
|
+
- [Model Capabilities](/docs/model-capabilities.md)
|
|
85
|
+
- [Model Structure](/docs/model-structure.md)
|
|
86
|
+
- [Providers](/docs/providers.md)
|
|
87
|
+
|
|
91
88
|
## License
|
|
92
89
|
|
|
93
90
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aimodels",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "A collection of AI model specifications across different providers",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"prebuild": "npm run typecheck && npm run lint && npm test",
|
|
21
21
|
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
22
|
+
"gen-ai-rules": "node scripts/gen-ai-rules.js",
|
|
22
23
|
"test": "deno test tests/",
|
|
23
24
|
"test:watch": "deno test --watch tests/",
|
|
24
25
|
"typecheck": "tsc --noEmit",
|