Update AI Models #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update AI Models | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| providers: | |
| description: 'Comma-separated list of providers to update (or "all")' | |
| required: false | |
| default: 'all' | |
| type: string | |
| dry_run: | |
| description: 'Dry run — only report changes, do not create a PR' | |
| required: false | |
| default: false | |
| type: boolean | |
| schedule: | |
| - cron: '0 14 * * 1' # Every Monday at 2pm UTC | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| jobs: | |
| update-models: | |
| runs-on: depot-ubuntu-24.04-16 | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Claude Code | |
| run: npm install -g @anthropic-ai/claude-code | |
| - name: Discover and update models | |
| id: update | |
| run: | | |
| PROVIDERS="${{ inputs.providers || 'all' }}" | |
| DRY_RUN="${{ inputs.dry_run || 'false' }}" | |
| PROMPT="$(cat <<'PROMPT_EOF' | |
| You are updating AI model configuration files for the Botpress cognitive service. | |
| ## Context | |
| Provider config files live in: packages/cognitive/src/features/providers/{provider}/{provider}.config.ts | |
| Each file exports a ProviderConfig with a models array. The schema is defined in: | |
| packages/cognitive/src/features/model-selection/schemas.models.ts | |
| The providers to check: PROVIDERS_PLACEHOLDER | |
| ## Instructions | |
| 1. Read every provider config file that matches the requested providers. | |
| 2. For each provider, fetch their latest model information from their official documentation/API pages: | |
| - OpenAI: https://platform.openai.com/docs/models | |
| - Anthropic: https://docs.anthropic.com/en/docs/about-claude/models | |
| - Google AI: https://ai.google.dev/gemini-api/docs/models | |
| - Groq: https://console.groq.com/docs/models | |
| - Cerebras: https://inference-docs.cerebras.ai/introduction | |
| - xAI: https://docs.x.ai/docs/models | |
| - OpenRouter: https://openrouter.ai/models (only top models) | |
| - Fireworks AI: https://fireworks.ai/models | |
| 3. Compare the fetched data against the existing config files and identify: | |
| - NEW models not yet listed (add them) | |
| - PRICING changes on existing models (update cost fields) | |
| - DEPRECATED models upstream that we still list as production (update lifecycle) | |
| - CONTEXT WINDOW or capability changes (update limits/capabilities) | |
| 4. For any new model, follow the EXACT same TypeScript pattern as the existing models in that file. | |
| Use numeric separators for large numbers (e.g., 200_000). Keep models ordered newest first. | |
| 5. Do NOT remove any models. Do NOT rename model IDs. Do NOT change the provider config structure. | |
| 6. Do NOT touch the mock provider. | |
| DRY_RUN_PLACEHOLDER | |
| ## Output | |
| After making changes (or analyzing for dry run), write a markdown summary to /tmp/model-update-summary.md with: | |
| - A section per provider with changes | |
| - For each change: model ID, what changed, old value → new value | |
| - If no changes were found for a provider, say so | |
| - At the top, a one-line summary like "Updated X models across Y providers" | |
| PROMPT_EOF | |
| )" | |
| if [ "$PROVIDERS" = "all" ]; then | |
| PROMPT="${PROMPT//PROVIDERS_PLACEHOLDER/all providers (openai, anthropic, google-ai, groq, cerebras, xai, openrouter, fireworks-ai)}" | |
| else | |
| PROMPT="${PROMPT//PROVIDERS_PLACEHOLDER/$PROVIDERS}" | |
| fi | |
| if [ "$DRY_RUN" = "true" ]; then | |
| PROMPT="${PROMPT//DRY_RUN_PLACEHOLDER/THIS IS A DRY RUN. Do NOT edit any files. Only analyze and write the summary.}" | |
| else | |
| PROMPT="${PROMPT//DRY_RUN_PLACEHOLDER/Apply all changes to the config files.}" | |
| fi | |
| claude --print \ | |
| --model claude-sonnet-4-6 \ | |
| --max-turns 30 \ | |
| --allowedTools "Bash,Read,Write,Edit,Glob,Grep,WebFetch" \ | |
| "$PROMPT" | tee /tmp/claude-output.txt | |
| # Check if any files were actually modified | |
| if git diff --quiet; then | |
| echo "has_changes=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Upload summary | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: model-update-summary | |
| path: /tmp/model-update-summary.md | |
| if-no-files-found: ignore | |
| - name: Create pull request | |
| if: steps.update.outputs.has_changes == 'true' && inputs.dry_run != 'true' | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| branch: chore/update-models-${{ github.run_number }} | |
| commit-message: 'chore(cognitive): update AI model catalog' | |
| title: 'chore(cognitive): update AI model catalog' | |
| body-path: /tmp/model-update-summary.md | |
| labels: models,automated,cognitive | |
| reviewers: ${{ github.actor }} | |
| delete-branch: true | |
| - name: Summary | |
| if: always() | |
| run: | | |
| if [ -f /tmp/model-update-summary.md ]; then | |
| echo "## Model Update Summary" >> "$GITHUB_STEP_SUMMARY" | |
| cat /tmp/model-update-summary.md >> "$GITHUB_STEP_SUMMARY" | |
| else | |
| echo "No summary generated." >> "$GITHUB_STEP_SUMMARY" | |
| fi |