mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-19 14:01:15 +00:00
feat(ai): Add auto-generated TypeScript models with factory function
- Generate models.generated.ts from models.json with proper types - Categorize providers: OpenAI (Responses), OpenAI-compatible, Anthropic, Gemini - Create createLLM() factory with TypeScript overloads for type safety - Auto-detect base URLs and environment variables for providers - Support 353 models across 39 providers with full autocompletion - Exclude generated file from git (rebuilt on npm build)
This commit is contained in:
parent
9b8ea585bd
commit
da66a97ea7
6 changed files with 414 additions and 2 deletions
|
|
@ -12,9 +12,11 @@
|
|||
"scripts": {
|
||||
"clean": "rm -rf dist",
|
||||
"models": "curl -s https://models.dev/api.json -o src/models.json",
|
||||
"build": "tsc -p tsconfig.build.json && cp src/models.json dist/models.json",
|
||||
"generate-models": "npx tsx scripts/generate-models.ts",
|
||||
"build": "npm run generate-models && tsc -p tsconfig.build.json && cp src/models.json dist/models.json",
|
||||
"check": "biome check --write .",
|
||||
"test": "npx tsx --test test/providers.test.ts",
|
||||
"extract-models": "npx tsx scripts/extract-openai-models.ts",
|
||||
"prepublishOnly": "npm run clean && npm run models && npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
@ -41,5 +43,8 @@
|
|||
},
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue