aimodels 0.2.2 → 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/dist/index.d.mts +20 -23
- package/dist/index.d.ts +20 -23
- package/dist/index.js +37 -38
- package/dist/index.mjs +36 -38
- 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/dist/index.d.mts
CHANGED
|
@@ -13,11 +13,22 @@ interface ModelPrice {
|
|
|
13
13
|
type Capability = "chat" | "reason" | "text-in" | "text-out" | "img-in" | "img-out" | "sound-in" | "sound-out" | "json-out" | "function-out" | "vectors-out";
|
|
14
14
|
|
|
15
15
|
declare class ModelCollection extends Array<Model> {
|
|
16
|
-
|
|
16
|
+
/** Create a new ModelCollection from an array of models */
|
|
17
|
+
constructor(models?: Model[]);
|
|
18
|
+
/** Filter models by one or more capabilities (all must be present) */
|
|
17
19
|
can(...capabilities: Capability[]): ModelCollection;
|
|
20
|
+
/** Filter models by one or more languages (all must be supported) */
|
|
18
21
|
know(...languages: string[]): ModelCollection;
|
|
22
|
+
/** Override array filter to return ModelCollection */
|
|
19
23
|
filter(predicate: (value: Model, index: number, array: Model[]) => boolean): ModelCollection;
|
|
24
|
+
/** Override array slice to return ModelCollection */
|
|
20
25
|
slice(start?: number, end?: number): ModelCollection;
|
|
26
|
+
/** Find a model by its ID */
|
|
27
|
+
id(modelId: string): Model | undefined;
|
|
28
|
+
/** Get models available from a specific provider */
|
|
29
|
+
fromProvider(provider: string): ModelCollection;
|
|
30
|
+
/** Filter models by minimum context window size */
|
|
31
|
+
withMinContext(tokens: number): ModelCollection;
|
|
21
32
|
}
|
|
22
33
|
interface ModelContext {
|
|
23
34
|
/** Maximum total tokens (input + output) */
|
|
@@ -41,26 +52,6 @@ interface Model {
|
|
|
41
52
|
/** Context window information */
|
|
42
53
|
context: ModelContext;
|
|
43
54
|
}
|
|
44
|
-
interface ModelsAPI {
|
|
45
|
-
/** All available models */
|
|
46
|
-
all: ModelCollection;
|
|
47
|
-
/** List of all creators */
|
|
48
|
-
creators: string[];
|
|
49
|
-
/** List of all providers */
|
|
50
|
-
providers: string[];
|
|
51
|
-
/** Get models from a specific creator */
|
|
52
|
-
fromCreator(creator: string): ModelCollection;
|
|
53
|
-
/** Get models from a specific provider */
|
|
54
|
-
fromProvider(provider: string): ModelCollection;
|
|
55
|
-
/** Find a specific model by ID */
|
|
56
|
-
find(id: string): Model | undefined;
|
|
57
|
-
/** Filter models by one or more capabilities (all must be present) */
|
|
58
|
-
can(...capabilities: string[]): ModelCollection;
|
|
59
|
-
/** Filter models by minimum context window */
|
|
60
|
-
withMinContext(tokens: number): ModelCollection;
|
|
61
|
-
/** Get pricing for a model from a specific provider */
|
|
62
|
-
getPrice(modelId: string, provider: string): ModelPrice | undefined;
|
|
63
|
-
}
|
|
64
55
|
|
|
65
56
|
var creators = {
|
|
66
57
|
openai: {
|
|
@@ -84,6 +75,12 @@ var creators$1 = {
|
|
|
84
75
|
creators: creators
|
|
85
76
|
};
|
|
86
77
|
|
|
87
|
-
declare
|
|
78
|
+
declare class ModelsCollection extends ModelCollection {
|
|
79
|
+
get creators(): string[];
|
|
80
|
+
get providers(): string[];
|
|
81
|
+
fromCreator(creator: string): ModelCollection;
|
|
82
|
+
getPrice(modelId: string, provider: string): ModelPrice | undefined;
|
|
83
|
+
}
|
|
84
|
+
declare const models: ModelsCollection;
|
|
88
85
|
|
|
89
|
-
export { creators$1 as creators, models };
|
|
86
|
+
export { type Capability, type Model, ModelCollection, type ModelContext, type ModelPrice, creators$1 as creators, models };
|
package/dist/index.d.ts
CHANGED
|
@@ -13,11 +13,22 @@ interface ModelPrice {
|
|
|
13
13
|
type Capability = "chat" | "reason" | "text-in" | "text-out" | "img-in" | "img-out" | "sound-in" | "sound-out" | "json-out" | "function-out" | "vectors-out";
|
|
14
14
|
|
|
15
15
|
declare class ModelCollection extends Array<Model> {
|
|
16
|
-
|
|
16
|
+
/** Create a new ModelCollection from an array of models */
|
|
17
|
+
constructor(models?: Model[]);
|
|
18
|
+
/** Filter models by one or more capabilities (all must be present) */
|
|
17
19
|
can(...capabilities: Capability[]): ModelCollection;
|
|
20
|
+
/** Filter models by one or more languages (all must be supported) */
|
|
18
21
|
know(...languages: string[]): ModelCollection;
|
|
22
|
+
/** Override array filter to return ModelCollection */
|
|
19
23
|
filter(predicate: (value: Model, index: number, array: Model[]) => boolean): ModelCollection;
|
|
24
|
+
/** Override array slice to return ModelCollection */
|
|
20
25
|
slice(start?: number, end?: number): ModelCollection;
|
|
26
|
+
/** Find a model by its ID */
|
|
27
|
+
id(modelId: string): Model | undefined;
|
|
28
|
+
/** Get models available from a specific provider */
|
|
29
|
+
fromProvider(provider: string): ModelCollection;
|
|
30
|
+
/** Filter models by minimum context window size */
|
|
31
|
+
withMinContext(tokens: number): ModelCollection;
|
|
21
32
|
}
|
|
22
33
|
interface ModelContext {
|
|
23
34
|
/** Maximum total tokens (input + output) */
|
|
@@ -41,26 +52,6 @@ interface Model {
|
|
|
41
52
|
/** Context window information */
|
|
42
53
|
context: ModelContext;
|
|
43
54
|
}
|
|
44
|
-
interface ModelsAPI {
|
|
45
|
-
/** All available models */
|
|
46
|
-
all: ModelCollection;
|
|
47
|
-
/** List of all creators */
|
|
48
|
-
creators: string[];
|
|
49
|
-
/** List of all providers */
|
|
50
|
-
providers: string[];
|
|
51
|
-
/** Get models from a specific creator */
|
|
52
|
-
fromCreator(creator: string): ModelCollection;
|
|
53
|
-
/** Get models from a specific provider */
|
|
54
|
-
fromProvider(provider: string): ModelCollection;
|
|
55
|
-
/** Find a specific model by ID */
|
|
56
|
-
find(id: string): Model | undefined;
|
|
57
|
-
/** Filter models by one or more capabilities (all must be present) */
|
|
58
|
-
can(...capabilities: string[]): ModelCollection;
|
|
59
|
-
/** Filter models by minimum context window */
|
|
60
|
-
withMinContext(tokens: number): ModelCollection;
|
|
61
|
-
/** Get pricing for a model from a specific provider */
|
|
62
|
-
getPrice(modelId: string, provider: string): ModelPrice | undefined;
|
|
63
|
-
}
|
|
64
55
|
|
|
65
56
|
var creators = {
|
|
66
57
|
openai: {
|
|
@@ -84,6 +75,12 @@ var creators$1 = {
|
|
|
84
75
|
creators: creators
|
|
85
76
|
};
|
|
86
77
|
|
|
87
|
-
declare
|
|
78
|
+
declare class ModelsCollection extends ModelCollection {
|
|
79
|
+
get creators(): string[];
|
|
80
|
+
get providers(): string[];
|
|
81
|
+
fromCreator(creator: string): ModelCollection;
|
|
82
|
+
getPrice(modelId: string, provider: string): ModelPrice | undefined;
|
|
83
|
+
}
|
|
84
|
+
declare const models: ModelsCollection;
|
|
88
85
|
|
|
89
|
-
export { creators$1 as creators, models };
|
|
86
|
+
export { type Capability, type Model, ModelCollection, type ModelContext, type ModelPrice, creators$1 as creators, models };
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
ModelCollection: () => ModelCollection,
|
|
23
24
|
creators: () => creators_default,
|
|
24
25
|
models: () => models
|
|
25
26
|
});
|
|
@@ -27,26 +28,43 @@ module.exports = __toCommonJS(index_exports);
|
|
|
27
28
|
|
|
28
29
|
// src/types/models.ts
|
|
29
30
|
var ModelCollection = class _ModelCollection extends Array {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
/** Create a new ModelCollection from an array of models */
|
|
32
|
+
constructor(models2 = []) {
|
|
33
|
+
super();
|
|
34
|
+
if (models2.length > 0) {
|
|
35
|
+
this.push(...models2);
|
|
36
|
+
}
|
|
32
37
|
Object.setPrototypeOf(this, _ModelCollection.prototype);
|
|
33
38
|
}
|
|
39
|
+
/** Filter models by one or more capabilities (all must be present) */
|
|
34
40
|
can(...capabilities) {
|
|
35
|
-
return
|
|
36
|
-
this.filter((model) => capabilities.every((cap) => model.can.includes(cap)))
|
|
37
|
-
);
|
|
41
|
+
return this.filter((model) => capabilities.every((cap) => model.can.includes(cap)));
|
|
38
42
|
}
|
|
43
|
+
/** Filter models by one or more languages (all must be supported) */
|
|
39
44
|
know(...languages) {
|
|
40
|
-
return
|
|
41
|
-
this.filter((model) => languages.every((lang) => model.languages?.includes(lang)))
|
|
42
|
-
);
|
|
45
|
+
return this.filter((model) => languages.every((lang) => model.languages?.includes(lang)));
|
|
43
46
|
}
|
|
44
|
-
|
|
47
|
+
/** Override array filter to return ModelCollection */
|
|
45
48
|
filter(predicate) {
|
|
46
|
-
|
|
49
|
+
const filtered = Array.from(this).filter(predicate);
|
|
50
|
+
return new _ModelCollection(filtered);
|
|
47
51
|
}
|
|
52
|
+
/** Override array slice to return ModelCollection */
|
|
48
53
|
slice(start, end) {
|
|
49
|
-
|
|
54
|
+
const sliced = Array.from(this).slice(start, end);
|
|
55
|
+
return new _ModelCollection(sliced);
|
|
56
|
+
}
|
|
57
|
+
/** Find a model by its ID */
|
|
58
|
+
id(modelId) {
|
|
59
|
+
return this.find((model) => model.id === modelId);
|
|
60
|
+
}
|
|
61
|
+
/** Get models available from a specific provider */
|
|
62
|
+
fromProvider(provider) {
|
|
63
|
+
return this.filter((model) => model.providers.includes(provider));
|
|
64
|
+
}
|
|
65
|
+
/** Filter models by minimum context window size */
|
|
66
|
+
withMinContext(tokens) {
|
|
67
|
+
return this.filter((model) => model.context.total >= tokens);
|
|
50
68
|
}
|
|
51
69
|
};
|
|
52
70
|
|
|
@@ -762,51 +780,32 @@ var creators_default = {
|
|
|
762
780
|
// src/index.ts
|
|
763
781
|
var allModels = buildAllModels();
|
|
764
782
|
var providersData = buildProvidersData();
|
|
765
|
-
var
|
|
766
|
-
all: new ModelCollection(allModels),
|
|
783
|
+
var ModelsCollection = class extends ModelCollection {
|
|
767
784
|
get creators() {
|
|
768
785
|
return Object.keys(creators_default.creators);
|
|
769
|
-
}
|
|
786
|
+
}
|
|
770
787
|
get providers() {
|
|
771
788
|
return providersData.providers.map((p) => p.id);
|
|
772
|
-
}
|
|
789
|
+
}
|
|
773
790
|
fromCreator(creator) {
|
|
774
791
|
return new ModelCollection(
|
|
775
|
-
|
|
792
|
+
this.filter(
|
|
776
793
|
(model) => model.license.startsWith(creator) || // For open source models
|
|
777
|
-
providersData.providers.find((p) => p.id === creator)?.models[model.id]
|
|
794
|
+
!!providersData.providers.find((p) => p.id === creator)?.models[model.id]
|
|
778
795
|
// For proprietary models
|
|
779
796
|
)
|
|
780
797
|
);
|
|
781
|
-
}
|
|
782
|
-
fromProvider(provider) {
|
|
783
|
-
return new ModelCollection(
|
|
784
|
-
allModels.filter((model) => model.providers.includes(provider))
|
|
785
|
-
);
|
|
786
|
-
},
|
|
787
|
-
find(id) {
|
|
788
|
-
return allModels.find((model) => model.id === id);
|
|
789
|
-
},
|
|
790
|
-
can(...capabilities) {
|
|
791
|
-
return new ModelCollection(
|
|
792
|
-
allModels.filter(
|
|
793
|
-
(model) => capabilities.every((capability) => model.can.includes(capability))
|
|
794
|
-
)
|
|
795
|
-
);
|
|
796
|
-
},
|
|
797
|
-
withMinContext(tokens) {
|
|
798
|
-
return new ModelCollection(
|
|
799
|
-
allModels.filter((model) => model.context.total >= tokens)
|
|
800
|
-
);
|
|
801
|
-
},
|
|
798
|
+
}
|
|
802
799
|
getPrice(modelId, provider) {
|
|
803
800
|
const providerData = providersData.providers.find((p) => p.id === provider);
|
|
804
801
|
const price = providerData?.models[modelId];
|
|
805
802
|
return price?.type === "token" ? price : void 0;
|
|
806
803
|
}
|
|
807
804
|
};
|
|
805
|
+
var models = new ModelsCollection(allModels);
|
|
808
806
|
// Annotate the CommonJS export names for ESM import in node:
|
|
809
807
|
0 && (module.exports = {
|
|
808
|
+
ModelCollection,
|
|
810
809
|
creators,
|
|
811
810
|
models
|
|
812
811
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,42 @@
|
|
|
1
1
|
// src/types/models.ts
|
|
2
2
|
var ModelCollection = class _ModelCollection extends Array {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/** Create a new ModelCollection from an array of models */
|
|
4
|
+
constructor(models2 = []) {
|
|
5
|
+
super();
|
|
6
|
+
if (models2.length > 0) {
|
|
7
|
+
this.push(...models2);
|
|
8
|
+
}
|
|
5
9
|
Object.setPrototypeOf(this, _ModelCollection.prototype);
|
|
6
10
|
}
|
|
11
|
+
/** Filter models by one or more capabilities (all must be present) */
|
|
7
12
|
can(...capabilities) {
|
|
8
|
-
return
|
|
9
|
-
this.filter((model) => capabilities.every((cap) => model.can.includes(cap)))
|
|
10
|
-
);
|
|
13
|
+
return this.filter((model) => capabilities.every((cap) => model.can.includes(cap)));
|
|
11
14
|
}
|
|
15
|
+
/** Filter models by one or more languages (all must be supported) */
|
|
12
16
|
know(...languages) {
|
|
13
|
-
return
|
|
14
|
-
this.filter((model) => languages.every((lang) => model.languages?.includes(lang)))
|
|
15
|
-
);
|
|
17
|
+
return this.filter((model) => languages.every((lang) => model.languages?.includes(lang)));
|
|
16
18
|
}
|
|
17
|
-
|
|
19
|
+
/** Override array filter to return ModelCollection */
|
|
18
20
|
filter(predicate) {
|
|
19
|
-
|
|
21
|
+
const filtered = Array.from(this).filter(predicate);
|
|
22
|
+
return new _ModelCollection(filtered);
|
|
20
23
|
}
|
|
24
|
+
/** Override array slice to return ModelCollection */
|
|
21
25
|
slice(start, end) {
|
|
22
|
-
|
|
26
|
+
const sliced = Array.from(this).slice(start, end);
|
|
27
|
+
return new _ModelCollection(sliced);
|
|
28
|
+
}
|
|
29
|
+
/** Find a model by its ID */
|
|
30
|
+
id(modelId) {
|
|
31
|
+
return this.find((model) => model.id === modelId);
|
|
32
|
+
}
|
|
33
|
+
/** Get models available from a specific provider */
|
|
34
|
+
fromProvider(provider) {
|
|
35
|
+
return this.filter((model) => model.providers.includes(provider));
|
|
36
|
+
}
|
|
37
|
+
/** Filter models by minimum context window size */
|
|
38
|
+
withMinContext(tokens) {
|
|
39
|
+
return this.filter((model) => model.context.total >= tokens);
|
|
23
40
|
}
|
|
24
41
|
};
|
|
25
42
|
|
|
@@ -735,50 +752,31 @@ var creators_default = {
|
|
|
735
752
|
// src/index.ts
|
|
736
753
|
var allModels = buildAllModels();
|
|
737
754
|
var providersData = buildProvidersData();
|
|
738
|
-
var
|
|
739
|
-
all: new ModelCollection(allModels),
|
|
755
|
+
var ModelsCollection = class extends ModelCollection {
|
|
740
756
|
get creators() {
|
|
741
757
|
return Object.keys(creators_default.creators);
|
|
742
|
-
}
|
|
758
|
+
}
|
|
743
759
|
get providers() {
|
|
744
760
|
return providersData.providers.map((p) => p.id);
|
|
745
|
-
}
|
|
761
|
+
}
|
|
746
762
|
fromCreator(creator) {
|
|
747
763
|
return new ModelCollection(
|
|
748
|
-
|
|
764
|
+
this.filter(
|
|
749
765
|
(model) => model.license.startsWith(creator) || // For open source models
|
|
750
|
-
providersData.providers.find((p) => p.id === creator)?.models[model.id]
|
|
766
|
+
!!providersData.providers.find((p) => p.id === creator)?.models[model.id]
|
|
751
767
|
// For proprietary models
|
|
752
768
|
)
|
|
753
769
|
);
|
|
754
|
-
}
|
|
755
|
-
fromProvider(provider) {
|
|
756
|
-
return new ModelCollection(
|
|
757
|
-
allModels.filter((model) => model.providers.includes(provider))
|
|
758
|
-
);
|
|
759
|
-
},
|
|
760
|
-
find(id) {
|
|
761
|
-
return allModels.find((model) => model.id === id);
|
|
762
|
-
},
|
|
763
|
-
can(...capabilities) {
|
|
764
|
-
return new ModelCollection(
|
|
765
|
-
allModels.filter(
|
|
766
|
-
(model) => capabilities.every((capability) => model.can.includes(capability))
|
|
767
|
-
)
|
|
768
|
-
);
|
|
769
|
-
},
|
|
770
|
-
withMinContext(tokens) {
|
|
771
|
-
return new ModelCollection(
|
|
772
|
-
allModels.filter((model) => model.context.total >= tokens)
|
|
773
|
-
);
|
|
774
|
-
},
|
|
770
|
+
}
|
|
775
771
|
getPrice(modelId, provider) {
|
|
776
772
|
const providerData = providersData.providers.find((p) => p.id === provider);
|
|
777
773
|
const price = providerData?.models[modelId];
|
|
778
774
|
return price?.type === "token" ? price : void 0;
|
|
779
775
|
}
|
|
780
776
|
};
|
|
777
|
+
var models = new ModelsCollection(allModels);
|
|
781
778
|
export {
|
|
779
|
+
ModelCollection,
|
|
782
780
|
creators_default as creators,
|
|
783
781
|
models
|
|
784
782
|
};
|
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",
|