aimodels 0.3.11 → 0.4.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/package.json CHANGED
@@ -1,26 +1,30 @@
1
1
  {
2
2
  "name": "aimodels",
3
- "version": "0.3.11",
3
+ "version": "0.4.0",
4
4
  "description": "A collection of AI model specifications across different providers",
5
+ "type": "module",
5
6
  "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
7
+ "module": "dist/index.js",
8
+ "types": "dist/aimodels.d.ts",
8
9
  "exports": {
9
10
  ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.mjs",
12
- "require": "./dist/index.js"
11
+ "types": "./dist/aimodels.d.ts",
12
+ "import": "./dist/index.js"
13
13
  }
14
14
  },
15
15
  "files": [
16
16
  "dist",
17
- "LICENSE"
17
+ "../LICENSE",
18
+ "README.md"
18
19
  ],
19
20
  "scripts": {
20
- "prebuild": "npm run typecheck && npm run lint && npm test",
21
- "build": "tsup src/index.ts --format cjs,esm --dts",
22
- "test": "deno test tests/",
23
- "test:watch": "deno test --watch tests/",
21
+ "gen-data-js-file": "node genDataFile.js",
22
+ "prebuild": "npm run clean && npm run gen-data-js-file",
23
+ "build:ts": "tsup",
24
+ "build": "npm run build:ts && npm test",
25
+ "test": "vitest run",
26
+ "test:watch": "vitest watch",
27
+ "test:coverage": "vitest run --coverage",
24
28
  "typecheck": "tsc --noEmit",
25
29
  "lint": "eslint src --ext .ts",
26
30
  "clean": "rm -rf dist",
@@ -28,7 +32,7 @@
28
32
  "preversion": "npm run typecheck && npm run lint && npm test",
29
33
  "version": "git add -A",
30
34
  "postversion": "git push && git push --tags",
31
- "prepublishOnly": "npm run clean && npm run typecheck && npm test && npm run lint",
35
+ "prepublishOnly": "npm run typecheck && npm run lint && npm run build",
32
36
  "postpublish": "npm run clean",
33
37
  "rules": "airul generate",
34
38
  "rules:comment": "# Generate AI rules from documentation",
@@ -64,9 +68,12 @@
64
68
  "@types/node": "^20.0.0",
65
69
  "@typescript-eslint/eslint-plugin": "^6.0.0",
66
70
  "@typescript-eslint/parser": "^6.0.0",
71
+ "@vitest/coverage-v8": "^1.0.0",
67
72
  "airul": "^0.1.10",
68
73
  "eslint": "^8.0.0",
74
+ "ts-node": "^10.9.2",
69
75
  "tsup": "^8.0.0",
70
- "typescript": "^5.0.0"
76
+ "typescript": "^5.0.0",
77
+ "vitest": "^1.0.0"
71
78
  }
72
79
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Dmitry Kury
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/dist/index.d.mts DELETED
@@ -1,212 +0,0 @@
1
- /**
2
- * Defines all possible model capabilities
3
- */
4
- type Capability = "chat" | "reason" | "txt-in" | "txt-out" | "img-in" | "img-out" | "audio-in" | "audio-out" | "json-out" | "fn-out" | "vec-out";
5
-
6
- declare class ModelCollection extends Array<Model> {
7
- /** Create a new ModelCollection from an array of models */
8
- constructor(models?: Model[]);
9
- /** Filter models by one or more capabilities (all must be present) */
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;
26
- /** Filter models by one or more languages (all must be supported) */
27
- know(...languages: string[]): ModelCollection;
28
- /** Override array filter to return ModelCollection */
29
- filter(predicate: (value: Model, index: number, array: Model[]) => boolean): ModelCollection;
30
- /** Override array slice to return ModelCollection */
31
- slice(start?: number, end?: number): ModelCollection;
32
- /** Find a model by its ID or alias */
33
- id(modelId: string): Model | undefined;
34
- /** Get models available from a specific provider */
35
- fromProvider(provider: string): ModelCollection;
36
- /** Get models available from a specific creator */
37
- fromCreator(creator: string): ModelCollection;
38
- /** Filter models by minimum context window size */
39
- withMinContext(tokens: number): ModelCollection;
40
- /** Get all providers from all models in the collection deduplicated */
41
- getProviders(): string[];
42
- getCreators(): string[];
43
- }
44
- interface BaseContext {
45
- /** The type discriminator */
46
- type: string;
47
- }
48
- interface TokenContext extends BaseContext {
49
- type: "token";
50
- /** Maximum input tokens the model can accept */
51
- total: number | null;
52
- /** Maximum tokens the model can generate in response */
53
- maxOutput: number | null;
54
- /**
55
- * When set to 1, indicates the model can generate up to maxOutput tokens
56
- * regardless of input size (as long as input is within total limit).
57
- * When not set, available output tokens may be reduced based on input size.
58
- */
59
- outputIsFixed?: 1;
60
- /**
61
- * Extended capabilities beyond the standard model behavior.
62
- * This is a flexible object that can contain any properties or nested objects
63
- * related to model-specific extensions (e.g., reasoning, experimental features).
64
- */
65
- extended?: Record<string, any>;
66
- }
67
- interface CharacterContext extends BaseContext {
68
- type: "character";
69
- /** Maximum input characters the model can accept */
70
- total: number | null;
71
- /** Maximum characters the model can generate in response */
72
- maxOutput: number | null;
73
- }
74
- interface ImageContext extends BaseContext {
75
- type: "image";
76
- /** Maximum outputs per request */
77
- maxOutput: number;
78
- /** Available image sizes (e.g. "1024x1024") */
79
- sizes: string[];
80
- /** Available quality settings (e.g. "standard", "hd") */
81
- qualities: string[];
82
- }
83
- interface AudioInputContext extends BaseContext {
84
- type: "audio-in";
85
- /** Maximum duration in seconds, null if unlimited */
86
- maxDuration?: number | null;
87
- /** Supported input formats */
88
- formats?: string[];
89
- /** Maximum file size in bytes */
90
- maxSize?: number | null;
91
- }
92
- interface AudioOutputContext extends BaseContext {
93
- type: "audio-out";
94
- /** Maximum text length that can be converted to speech */
95
- maxInput?: number | null;
96
- /** Supported output formats */
97
- formats?: string[];
98
- /** Available voices */
99
- voices?: string[];
100
- /** Available quality settings */
101
- qualities?: string[];
102
- }
103
- interface EmbeddingContext extends BaseContext {
104
- type: "embedding";
105
- /** Maximum input size */
106
- total: number;
107
- /** Unit of measurement for input */
108
- unit: "tokens" | "characters";
109
- /** Size of output embedding vectors */
110
- dimensions: number;
111
- /** Type of embeddings produced */
112
- embeddingType?: "text" | "image" | "audio" | "multimodal";
113
- /** Normalization of output vectors */
114
- normalized?: boolean;
115
- }
116
- type ModelContext = TokenContext | CharacterContext | ImageContext | AudioInputContext | AudioOutputContext | EmbeddingContext;
117
- interface Model {
118
- /** Unique identifier */
119
- id: string;
120
- /** Display name */
121
- name: string;
122
- /** Creator of the model */
123
- creator: string;
124
- /** License type (e.g., "proprietary", "apache-2.0", "llama-2-community") */
125
- license: string;
126
- /** List of providers that can serve this model */
127
- providers: string[];
128
- /** Model capabilities */
129
- can: Capability[];
130
- /** Languages the model knows */
131
- languages?: string[];
132
- /** Alternative identifiers for this model */
133
- aliases?: string[];
134
- /** Context window information */
135
- context: ModelContext;
136
- /** Base model ID this model extends */
137
- extends?: string;
138
- /** Properties that override the base model */
139
- overrides?: Partial<Omit<Model, 'id' | 'extends' | 'overrides'>>;
140
- }
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
-
161
- interface Provider {
162
- /** Provider identifier */
163
- id: string;
164
- /** Display name */
165
- name: string;
166
- /** Website URL */
167
- websiteUrl: string;
168
- /** API endpoint */
169
- apiUrl: string;
170
- /** Default model */
171
- defaultModel?: string;
172
- /** Whether this is a local provider */
173
- isLocal?: number;
174
- /** Model pricing */
175
- models: Record<string, TokenBasedPricePerMillionTokens | ImagePrice>;
176
- }
177
-
178
- var creators = {
179
- openai: {
180
- name: "OpenAI",
181
- website: "https://openai.com"
182
- },
183
- anthropic: {
184
- name: "Anthropic",
185
- website: "https://anthropic.com"
186
- },
187
- meta: {
188
- name: "Meta",
189
- website: "https://ai.meta.com"
190
- },
191
- mistral: {
192
- name: "Mistral AI",
193
- website: "https://mistral.ai"
194
- }
195
- };
196
- var creators$1 = {
197
- creators: creators
198
- };
199
-
200
- declare class AIModels extends ModelCollection {
201
- constructor(models?: Model[]);
202
- get creators(): string[];
203
- get providers(): string[];
204
- getPrice(modelId: string, provider: string): TokenBasedPricePerMillionTokens | undefined;
205
- /** Get provider information by ID */
206
- getProvider(providerId: string): Provider | undefined;
207
- /** Get all providers that can serve a specific model */
208
- getProvidersForModel(modelId: string): Provider[];
209
- }
210
- declare const models: AIModels;
211
-
212
- export { AIModels, type Capability, type Model, ModelCollection, type ModelContext, type Provider, type TokenBasedPricePerMillionTokens, creators$1 as creators, models };