docs: generate model alias & multiplier reference tables from JSON data#30256
docs: generate model alias & multiplier reference tables from JSON data#30256
Conversation
… tables Agent-Logs-Url: https://github.com/github/gh-aw/sessions/a0eb7072-8793-4fa1-9d5b-834fccc05e11 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a docs-generation pipeline for publishing the built-in model alias map and Effective Token (ET) multiplier reference tables as a checked-in docs page.
Changes:
- Introduces a Node.js generator (
scripts/generate-model-tables.js) that reads JSON data and emitsdocs/src/content/docs/reference/model-tables.md. - Adds
pkg/cli/data/model_aliases.jsonas a JSON representation of the built-in alias map for doc tooling consumption. - Wires the docs build to regenerate the page on
prebuildand adds a new sidebar entry for the page.
Show a summary per file
| File | Description |
|---|---|
| scripts/generate-model-tables.js | New generator script that reads alias/multiplier JSON and renders markdown tables. |
| pkg/cli/data/model_aliases.json | New JSON source for built-in model aliases to drive docs generation. |
| docs/src/content/docs/reference/model-tables.md | Generated documentation page containing alias + multiplier reference tables. |
| docs/package.json | Runs model table generation during docs prebuild and adds a script entry. |
| docs/astro.config.mjs | Adds sidebar navigation entry for the new reference page. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
scripts/generate-model-tables.js:62
- The generated markdown ordering depends on object insertion order in the JSON files. To keep
model-tables.mddiffs stable across regenerations, consider sorting aliases and multiplier rows (e.g., by alias/model name) before emitting tables.
function classifyAliases(aliasMap) {
const vendor = [];
const meta = [];
for (const [alias, patterns] of Object.entries(aliasMap)) {
const isMetaOnly = patterns.every((p) => !p.includes("/"));
if (isMetaOnly) {
meta.push({ alias, resolves: patterns });
} else {
vendor.push({ alias, patterns });
}
}
return { vendor, meta };
}
- Files reviewed: 5/5 changed files
- Comments generated: 4
| const aliasesData = JSON.parse(fs.readFileSync(ALIASES_PATH, "utf-8")); | ||
| const multipliersData = JSON.parse(fs.readFileSync(MULTIPLIERS_PATH, "utf-8")); | ||
|
|
| // Approximation callout | ||
| lines.push("> [!CAUTION]"); | ||
| lines.push( | ||
| "> The multiplier values shown on this page are **approximations**. They are used solely for the purpose of normalising token usage across models into a single comparable metric (Effective Tokens) and do **not** represent precise cost ratios. Values may be inaccurate for specific model versions and may become out of date as providers update their offerings. Do not use these numbers for billing or financial calculations." |
| { | ||
| "version": "1", | ||
| "description": "Built-in model alias map for GitHub Agentic Workflows. Each key is an alias name; the value is an ordered list of model patterns tried in sequence until one resolves.", | ||
| "aliases": { | ||
| "sonnet": [ | ||
| "copilot/*sonnet*", | ||
| "anthropic/*sonnet*" | ||
| ], |
| "prebuild": "npm run generate-agent-factory && npm run generate-model-tables && npm run build:slides", | ||
| "build": "astro build", | ||
| "build:slides": "mkdir -p public/js && cp node_modules/mermaid/dist/mermaid.min.js public/js/ && npx @marp-team/marp-cli slides/index.md --html --allow-local-files --theme slides/gh-aw-theme.css -o public/slides/index.html && mkdir -p public/slides && cp slides/*.pdf public/slides/", | ||
| "preview": "astro preview", | ||
| "astro": "astro", | ||
| "validate-links": "astro build", | ||
| "generate-agent-factory": "cd .. && node scripts/generate-agent-factory.js", | ||
| "generate-model-tables": "cd .. && node scripts/generate-model-tables.js", | ||
| "test": "playwright test", |
|
@copilot remove the duplication in pkg/workflow/model_aliases.go. Convert that file to json, embed in go and read from JavaScript |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cd9e03cd-0347-42fe-8f84-c628ccc73eeb Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cd9e03cd-0347-42fe-8f84-c628ccc73eeb Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit d46fabe. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot update daily model alias updater agentic workflow work new file location |
…odel_aliases.json Agent-Logs-Url: https://github.com/github/gh-aw/sessions/16c63ed4-91e0-4d2d-a95b-62a4266f7d9b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit 44e20ed. Updated all references in
The lock file has been recompiled. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot merge main and recompile |
…d-script-tables # Conflicts: # .github/workflows/daily-model-inventory.lock.yml Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/1386aa05-7c4a-4298-8d3c-0866e4522102 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit e75a689. Merged main, resolved a Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot merge main, fix conflicts, recompile |
…d-script-tables # Conflicts: # pkg/workflow/compiler_repo_config.go Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit f825bfb. Merged main, resolved the Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
- Add Model Alias entry (from new model-tables reference, PR #30256) - Update Observability entry with gh-aw.detection.conclusion and gh-aw.detection.reason span attributes (from PR #30273) - Fix broken link: parameterising → parameterizing (from PR #30265) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a documentation build script that reads the built-in model alias map and per-model Effective Token multipliers from JSON and renders them as readable reference tables in a new docs page.
New files
pkg/workflow/data/model_aliases.json— single source of truth for the built-in model alias map, embedded in Go via//go:embedand read by the docs generation scriptscripts/generate-model-tables.js— readsmodel_aliases.json+model_multipliers.json, emitsdocs/src/content/docs/reference/model-tables.mdwith:> [!CAUTION]callout that multiplier values are approximations, may be inaccurate, and may be out of datedocs/src/content/docs/reference/model-tables.md— generated output, checked in and regenerated each buildChanges to existing files
pkg/workflow/model_aliases.go— replaced the hardcodedmap[string][]stringliteral inBuiltinModelAliases()with a//go:embed data/model_aliases.jsondirective andjson.Unmarshalcall; the alias data now lives only in the JSON filescripts/generate-model-tables.js— addedreadJSON()helper withtry/catch+process.exit(1)for clear CI diagnostics on missing or malformed JSON files; fixed "normalising" → "normalizing" spelling.github/workflows/daily-model-inventory.md— updated all references frompkg/workflow/model_aliases.gotopkg/workflow/data/model_aliases.json; the Step 5 alias proposal format now uses a JSON snippet targeting the canonical file; recompiled lock fileWiring
docs/package.json— addsgenerate-model-tablesscript, runs it inprebuildalongsidegenerate-agent-factorydocs/astro.config.mjs— adds Cost Management (Model Tables) sidebar entry under/reference/model-tables/