aimodels 0.4.0 → 0.4.1

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/dist/index.d.ts CHANGED
@@ -31,6 +31,12 @@ interface Organization {
31
31
  founded: number;
32
32
  }
33
33
 
34
+ interface ProviderSource {
35
+ id: string;
36
+ apiUrl: string;
37
+ apiDocsUrl: string;
38
+ pricing: Record<string, TokenBasedPricePerMillionTokens | ImagePrice>;
39
+ }
34
40
  /** Provider-specific data */
35
41
  interface Provider extends Organization {
36
42
  /** Provider's API endpoint URL */
@@ -191,7 +197,7 @@ declare class Model {
191
197
  }
192
198
 
193
199
  declare class ModelCollection extends Array<Model> {
194
- static providersData: Record<string, Provider>;
200
+ static providersData: Record<string, ProviderSource>;
195
201
  static orgsData: Record<string, Organization>;
196
202
  static modelSources: Record<string, ModelSource>;
197
203
  /** Create a new ModelCollection from an array of models */
@@ -277,7 +283,7 @@ declare class AIModels extends ModelCollection {
277
283
  */
278
284
  static addStaticData({ models, providers, orgs }: {
279
285
  models?: Record<string, ModelSource>;
280
- providers?: Record<string, Provider>;
286
+ providers?: Record<string, ProviderSource>;
281
287
  orgs?: Record<string, Organization>;
282
288
  }): void;
283
289
  static get instance(): AIModels;
@@ -294,4 +300,4 @@ declare class AIModels extends ModelCollection {
294
300
  }
295
301
  declare const models: AIModels;
296
302
 
297
- export { AIModels, type AudioInputContext, type AudioOutputContext, type BaseContext, type Capability, type CharacterContext, type EmbeddingContext, type ImageContext, Model, ModelCollection, type ModelContext, type ModelSource, type Organization, type Provider, type TokenContext, models };
303
+ export { AIModels, type AudioInputContext, type AudioOutputContext, type BaseContext, type Capability, type CharacterContext, type EmbeddingContext, type ImageContext, Model, ModelCollection, type ModelContext, type ModelSource, type Organization, type Provider, type ProviderSource, type TokenContext, models };
package/dist/index.js CHANGED
@@ -1628,7 +1628,7 @@ var providers = {
1628
1628
  },
1629
1629
  "azure": {
1630
1630
  "id": "azure",
1631
- "name": "Azure OpenAI",
1631
+ "name": "Azure",
1632
1632
  "apiUrl": "",
1633
1633
  "apiDocsUrl": "https://learn.microsoft.com/en-us/azure/ai-services/openai/reference",
1634
1634
  "pricing": {
@@ -1870,6 +1870,10 @@ var providers = {
1870
1870
  }
1871
1871
  }
1872
1872
  },
1873
+ "ollama": {
1874
+ "id": "ollama",
1875
+ "name": "Ollama"
1876
+ },
1873
1877
  "openai": {
1874
1878
  "id": "openai",
1875
1879
  "name": "OpenAI",
@@ -2321,7 +2325,16 @@ var ModelCollection = class _ModelCollection extends Array {
2321
2325
  /** Get all providers from all models in the collection deduplicated */
2322
2326
  get providers() {
2323
2327
  const providerIds = [...new Set(this.flatMap((model) => model.providerIds))];
2324
- return providerIds.map((id) => _ModelCollection.providersData[id]).filter((p) => p !== void 0);
2328
+ const providers2 = [];
2329
+ for (const id of providerIds) {
2330
+ const provider = _ModelCollection.providersData[id];
2331
+ const organization = _ModelCollection.orgsData[id];
2332
+ providers2.push({
2333
+ ...organization,
2334
+ ...provider
2335
+ });
2336
+ }
2337
+ return providers2;
2325
2338
  }
2326
2339
  /** Get all orgs from all models in the collection deduplicated */
2327
2340
  get orgs() {
@@ -2330,7 +2343,12 @@ var ModelCollection = class _ModelCollection extends Array {
2330
2343
  }
2331
2344
  /** Get a specific provider by ID */
2332
2345
  getProvider(id) {
2333
- return _ModelCollection.providersData[id];
2346
+ const provider = _ModelCollection.providersData[id];
2347
+ const organization = _ModelCollection.orgsData[id];
2348
+ return {
2349
+ ...organization,
2350
+ ...provider
2351
+ };
2334
2352
  }
2335
2353
  /** Get a specific creator by ID */
2336
2354
  getCreator(id) {
@@ -2409,7 +2427,16 @@ var Model = class _Model {
2409
2427
  return this.resolveProperty("providerIds") || [];
2410
2428
  }
2411
2429
  get providers() {
2412
- return this.providerIds.map((id) => ModelCollection.providersData[id]).filter(Boolean);
2430
+ const providers2 = [];
2431
+ for (const id of this.providerIds) {
2432
+ const provider = ModelCollection.providersData[id];
2433
+ const organization = ModelCollection.orgsData[id];
2434
+ providers2.push({
2435
+ ...organization,
2436
+ ...provider
2437
+ });
2438
+ }
2439
+ return providers2;
2413
2440
  }
2414
2441
  get creatorId() {
2415
2442
  return this.resolveProperty("creatorId");
@@ -2513,7 +2540,10 @@ var AIModels = class _AIModels extends ModelCollection {
2513
2540
  * We want to return all known providers here.
2514
2541
  */
2515
2542
  get providers() {
2516
- return Object.values(ModelCollection.providersData);
2543
+ return Object.values(ModelCollection.providersData).map((provider) => ({
2544
+ ...ModelCollection.orgsData[provider.id],
2545
+ ...provider
2546
+ }));
2517
2547
  }
2518
2548
  /**
2519
2549
  * Override to return all creators directly without filtering through models.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aimodels",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "A collection of AI model specifications across different providers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",