aimodels 0.3.10 → 0.3.12
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 +30 -21
- package/dist/index.d.mts +36 -20
- package/dist/index.d.ts +36 -20
- package/dist/index.js +243 -138
- package/dist/index.mjs +243 -138
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,9 +13,34 @@ npm install aimodels
|
|
|
13
13
|
```typescript
|
|
14
14
|
import { models } from 'aimodels';
|
|
15
15
|
|
|
16
|
-
// Find models by capability
|
|
17
|
-
const chatModels = models.
|
|
18
|
-
const
|
|
16
|
+
// Find models by capability using fluent API
|
|
17
|
+
const chatModels = models.canChat();
|
|
18
|
+
const visionModels = models.canSee();
|
|
19
|
+
const reasoningModels = models.canReason();
|
|
20
|
+
|
|
21
|
+
// Chain methods for more specific filtering
|
|
22
|
+
const smartVisionModels = models.canChat().canReason().canSee();
|
|
23
|
+
const multimodalAssistants = models.canChat().canSee().canHear();
|
|
24
|
+
const fullStackModels = models.canChat().canCallFunctions().canOutputJSON();
|
|
25
|
+
|
|
26
|
+
// Audio capabilities
|
|
27
|
+
const speechModels = models.canHear().canSpeak();
|
|
28
|
+
|
|
29
|
+
// Text processing
|
|
30
|
+
const textProcessors = models.canRead().canWrite();
|
|
31
|
+
|
|
32
|
+
// Available fluent API methods:
|
|
33
|
+
// - canChat() - models with chat capability
|
|
34
|
+
// - canReason() - models with reasoning capability
|
|
35
|
+
// - canRead() - models that can process text input
|
|
36
|
+
// - canWrite() - models that can output text
|
|
37
|
+
// - canSee() - models that understand images
|
|
38
|
+
// - canGenerateImages() - models that can create images
|
|
39
|
+
// - canHear() - models that understand audio
|
|
40
|
+
// - canSpeak() - models that can generate speech
|
|
41
|
+
// - canOutputJSON() - models that provide structured JSON output
|
|
42
|
+
// - canCallFunctions() - models with function calling capability
|
|
43
|
+
// - canGenerateEmbeddings() - models that output vector embeddings
|
|
19
44
|
|
|
20
45
|
// Find models by provider
|
|
21
46
|
const openaiModels = models.fromProvider('openai');
|
|
@@ -27,7 +52,7 @@ const metaModels = models.fromCreator('meta');
|
|
|
27
52
|
const largeContextModels = models.withMinContext(32768);
|
|
28
53
|
|
|
29
54
|
// Find specific model
|
|
30
|
-
const model = models.id('gpt-
|
|
55
|
+
const model = models.id('gpt-4o');
|
|
31
56
|
console.log(model?.context.total); // Context window size
|
|
32
57
|
console.log(model?.providers); // ['openai']
|
|
33
58
|
```
|
|
@@ -36,7 +61,7 @@ console.log(model?.providers); // ['openai']
|
|
|
36
61
|
|
|
37
62
|
- Comprehensive database of AI models from major providers (OpenAI, Anthropic, Mistral, etc.)
|
|
38
63
|
- Normalized data structure for easy comparison
|
|
39
|
-
-
|
|
64
|
+
- Intuitive fluent API for filtering models by capabilities
|
|
40
65
|
- Context window information
|
|
41
66
|
- Creator and provider associations
|
|
42
67
|
- TypeScript support with full type safety
|
|
@@ -64,22 +89,6 @@ interface Model {
|
|
|
64
89
|
}
|
|
65
90
|
```
|
|
66
91
|
|
|
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
|
|
81
|
-
```
|
|
82
|
-
|
|
83
92
|
For more detailed information, see:
|
|
84
93
|
- [Model Capabilities](/docs/model-capabilities.md)
|
|
85
94
|
- [Model Structure](/docs/model-structure.md)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,32 +1,28 @@
|
|
|
1
|
-
interface TokenBasedPricePerMillionTokens {
|
|
2
|
-
/** Price per million input tokens */
|
|
3
|
-
input: number;
|
|
4
|
-
/** Price per million output tokens */
|
|
5
|
-
output: number;
|
|
6
|
-
/** Price type */
|
|
7
|
-
type: 'token';
|
|
8
|
-
}
|
|
9
|
-
interface ImagePrice {
|
|
10
|
-
/** Price per image */
|
|
11
|
-
price: number;
|
|
12
|
-
/** Image size */
|
|
13
|
-
size: string;
|
|
14
|
-
/** Price type */
|
|
15
|
-
type: 'image';
|
|
16
|
-
/** Price unit */
|
|
17
|
-
unit: 'per_image';
|
|
18
|
-
}
|
|
19
|
-
|
|
20
1
|
/**
|
|
21
2
|
* Defines all possible model capabilities
|
|
22
3
|
*/
|
|
23
|
-
type Capability = "chat" | "reason" | "
|
|
4
|
+
type Capability = "chat" | "reason" | "txt-in" | "txt-out" | "img-in" | "img-out" | "audio-in" | "audio-out" | "json-out" | "fn-out" | "vec-out";
|
|
24
5
|
|
|
25
6
|
declare class ModelCollection extends Array<Model> {
|
|
26
7
|
/** Create a new ModelCollection from an array of models */
|
|
27
8
|
constructor(models?: Model[]);
|
|
28
9
|
/** Filter models by one or more capabilities (all must be present) */
|
|
29
10
|
can(...capabilities: Capability[]): ModelCollection;
|
|
11
|
+
/**
|
|
12
|
+
* Fluent capability filters for better readability
|
|
13
|
+
* Each method filters models by a specific capability
|
|
14
|
+
*/
|
|
15
|
+
canChat(): ModelCollection;
|
|
16
|
+
canReason(): ModelCollection;
|
|
17
|
+
canRead(): ModelCollection;
|
|
18
|
+
canWrite(): ModelCollection;
|
|
19
|
+
canSee(): ModelCollection;
|
|
20
|
+
canGenerateImages(): ModelCollection;
|
|
21
|
+
canHear(): ModelCollection;
|
|
22
|
+
canSpeak(): ModelCollection;
|
|
23
|
+
canOutputJSON(): ModelCollection;
|
|
24
|
+
canCallFunctions(): ModelCollection;
|
|
25
|
+
canGenerateEmbeddings(): ModelCollection;
|
|
30
26
|
/** Filter models by one or more languages (all must be supported) */
|
|
31
27
|
know(...languages: string[]): ModelCollection;
|
|
32
28
|
/** Override array filter to return ModelCollection */
|
|
@@ -43,6 +39,7 @@ declare class ModelCollection extends Array<Model> {
|
|
|
43
39
|
withMinContext(tokens: number): ModelCollection;
|
|
44
40
|
/** Get all providers from all models in the collection deduplicated */
|
|
45
41
|
getProviders(): string[];
|
|
42
|
+
getCreators(): string[];
|
|
46
43
|
}
|
|
47
44
|
interface BaseContext {
|
|
48
45
|
/** The type discriminator */
|
|
@@ -142,6 +139,25 @@ interface Model {
|
|
|
142
139
|
overrides?: Partial<Omit<Model, 'id' | 'extends' | 'overrides'>>;
|
|
143
140
|
}
|
|
144
141
|
|
|
142
|
+
interface TokenBasedPricePerMillionTokens {
|
|
143
|
+
/** Price per million input tokens */
|
|
144
|
+
input: number;
|
|
145
|
+
/** Price per million output tokens */
|
|
146
|
+
output: number;
|
|
147
|
+
/** Price type */
|
|
148
|
+
type: 'token';
|
|
149
|
+
}
|
|
150
|
+
interface ImagePrice {
|
|
151
|
+
/** Price per image */
|
|
152
|
+
price: number;
|
|
153
|
+
/** Image size */
|
|
154
|
+
size: string;
|
|
155
|
+
/** Price type */
|
|
156
|
+
type: 'image';
|
|
157
|
+
/** Price unit */
|
|
158
|
+
unit: 'per_image';
|
|
159
|
+
}
|
|
160
|
+
|
|
145
161
|
interface Provider {
|
|
146
162
|
/** Provider identifier */
|
|
147
163
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,28 @@
|
|
|
1
|
-
interface TokenBasedPricePerMillionTokens {
|
|
2
|
-
/** Price per million input tokens */
|
|
3
|
-
input: number;
|
|
4
|
-
/** Price per million output tokens */
|
|
5
|
-
output: number;
|
|
6
|
-
/** Price type */
|
|
7
|
-
type: 'token';
|
|
8
|
-
}
|
|
9
|
-
interface ImagePrice {
|
|
10
|
-
/** Price per image */
|
|
11
|
-
price: number;
|
|
12
|
-
/** Image size */
|
|
13
|
-
size: string;
|
|
14
|
-
/** Price type */
|
|
15
|
-
type: 'image';
|
|
16
|
-
/** Price unit */
|
|
17
|
-
unit: 'per_image';
|
|
18
|
-
}
|
|
19
|
-
|
|
20
1
|
/**
|
|
21
2
|
* Defines all possible model capabilities
|
|
22
3
|
*/
|
|
23
|
-
type Capability = "chat" | "reason" | "
|
|
4
|
+
type Capability = "chat" | "reason" | "txt-in" | "txt-out" | "img-in" | "img-out" | "audio-in" | "audio-out" | "json-out" | "fn-out" | "vec-out";
|
|
24
5
|
|
|
25
6
|
declare class ModelCollection extends Array<Model> {
|
|
26
7
|
/** Create a new ModelCollection from an array of models */
|
|
27
8
|
constructor(models?: Model[]);
|
|
28
9
|
/** Filter models by one or more capabilities (all must be present) */
|
|
29
10
|
can(...capabilities: Capability[]): ModelCollection;
|
|
11
|
+
/**
|
|
12
|
+
* Fluent capability filters for better readability
|
|
13
|
+
* Each method filters models by a specific capability
|
|
14
|
+
*/
|
|
15
|
+
canChat(): ModelCollection;
|
|
16
|
+
canReason(): ModelCollection;
|
|
17
|
+
canRead(): ModelCollection;
|
|
18
|
+
canWrite(): ModelCollection;
|
|
19
|
+
canSee(): ModelCollection;
|
|
20
|
+
canGenerateImages(): ModelCollection;
|
|
21
|
+
canHear(): ModelCollection;
|
|
22
|
+
canSpeak(): ModelCollection;
|
|
23
|
+
canOutputJSON(): ModelCollection;
|
|
24
|
+
canCallFunctions(): ModelCollection;
|
|
25
|
+
canGenerateEmbeddings(): ModelCollection;
|
|
30
26
|
/** Filter models by one or more languages (all must be supported) */
|
|
31
27
|
know(...languages: string[]): ModelCollection;
|
|
32
28
|
/** Override array filter to return ModelCollection */
|
|
@@ -43,6 +39,7 @@ declare class ModelCollection extends Array<Model> {
|
|
|
43
39
|
withMinContext(tokens: number): ModelCollection;
|
|
44
40
|
/** Get all providers from all models in the collection deduplicated */
|
|
45
41
|
getProviders(): string[];
|
|
42
|
+
getCreators(): string[];
|
|
46
43
|
}
|
|
47
44
|
interface BaseContext {
|
|
48
45
|
/** The type discriminator */
|
|
@@ -142,6 +139,25 @@ interface Model {
|
|
|
142
139
|
overrides?: Partial<Omit<Model, 'id' | 'extends' | 'overrides'>>;
|
|
143
140
|
}
|
|
144
141
|
|
|
142
|
+
interface TokenBasedPricePerMillionTokens {
|
|
143
|
+
/** Price per million input tokens */
|
|
144
|
+
input: number;
|
|
145
|
+
/** Price per million output tokens */
|
|
146
|
+
output: number;
|
|
147
|
+
/** Price type */
|
|
148
|
+
type: 'token';
|
|
149
|
+
}
|
|
150
|
+
interface ImagePrice {
|
|
151
|
+
/** Price per image */
|
|
152
|
+
price: number;
|
|
153
|
+
/** Image size */
|
|
154
|
+
size: string;
|
|
155
|
+
/** Price type */
|
|
156
|
+
type: 'image';
|
|
157
|
+
/** Price unit */
|
|
158
|
+
unit: 'per_image';
|
|
159
|
+
}
|
|
160
|
+
|
|
145
161
|
interface Provider {
|
|
146
162
|
/** Provider identifier */
|
|
147
163
|
id: string;
|