()
| 34 | await Instance.provide({ |
| 35 | directory: process.cwd(), |
| 36 | async fn() { |
| 37 | const providers = await Provider.list() |
| 38 | |
| 39 | function printModels(providerID: string, verbose?: boolean) { |
| 40 | const provider = providers[providerID] |
| 41 | const sortedModels = Object.entries(provider.models).sort(([a], [b]) => a.localeCompare(b)) |
| 42 | for (const [modelID, model] of sortedModels) { |
| 43 | process.stdout.write(`${providerID}/${modelID}`) |
| 44 | process.stdout.write(EOL) |
| 45 | if (verbose) { |
| 46 | process.stdout.write(JSON.stringify(model, null, 2)) |
| 47 | process.stdout.write(EOL) |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | if (args.provider) { |
| 53 | const provider = providers[args.provider] |
| 54 | if (!provider) { |
| 55 | UI.error(`Provider not found: ${args.provider}`) |
| 56 | return |
| 57 | } |
| 58 | |
| 59 | printModels(args.provider, args.verbose) |
| 60 | return |
| 61 | } |
| 62 | |
| 63 | const providerIDs = Object.keys(providers).sort((a, b) => { |
| 64 | const aIsArctic = a.startsWith("arctic") |
| 65 | const bIsArctic = b.startsWith("arctic") |
| 66 | if (aIsArctic && !bIsArctic) return -1 |
| 67 | if (!aIsArctic && bIsArctic) return 1 |
| 68 | return a.localeCompare(b) |
| 69 | }) |
| 70 | |
| 71 | for (const providerID of providerIDs) { |
| 72 | printModels(providerID, args.verbose) |
| 73 | } |
| 74 | }, |
| 75 | }) |
| 76 | }, |
| 77 | }) |
nothing calls this directly
no test coverage detected