Nightly Together.ai Models Update #16
This file contains 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: Nightly Together.ai Models Update | |
on: | |
schedule: | |
# Run at 2:00 AM UTC every day | |
- cron: '0 2 * * *' | |
# Allow manual triggering | |
workflow_dispatch: | |
inputs: | |
forceRegenerate: | |
description: 'Pass --force-regenerate flag to the script' | |
required: false | |
default: 'false' | |
jobs: | |
update-models: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Update Together.ai models and generate changes report | |
id: update-models | |
run: | | |
if [[ "${{ github.event.inputs.forceRegenerate }}" == "true" ]]; then | |
python together_models.py --summary --force-regenerate > model_update_report.txt | |
else | |
python together_models.py --summary > model_update_report.txt | |
fi | |
# Extract specific sections for PR description | |
# Extract new models section (simple list) | |
echo "Extracting new models section..." | |
NEW_MODELS=$(grep -A 100 "Newly added models:" model_update_report.txt | grep -v "^$" | grep -v "Updated models:" | tail -n +2) | |
# Extract updated models section with their detailed changes | |
echo "Extracting updated models section..." | |
UPDATED_MODELS_START=$(grep -n "Updated models:" model_update_report.txt | cut -d':' -f1) | |
if [ ! -z "$UPDATED_MODELS_START" ]; then | |
# Extract the updated models with their changes using awk for multi-line indented blocks | |
UPDATED_MODELS=$(awk -v start="$UPDATED_MODELS_START" 'NR > start && $0 !~ /^$/ && $0 !~ /^[^[:space:]]/{print; next} NR > start && $0 ~ /^ -/{print; next} NR > start && $0 ~ /^$/{exit} NR > start{print}' model_update_report.txt) | |
else | |
UPDATED_MODELS="" | |
fi | |
# Format for GitHub Actions output (preserving indentation) | |
NEW_MODELS_FORMATTED="$(echo "$NEW_MODELS" | sed 's/^/ /')" | |
UPDATED_MODELS_FORMATTED="$(echo "$UPDATED_MODELS" | sed 's/^/ /')" | |
# Save to GitHub outputs with multiline syntax | |
echo "new_models<<EOF" >> $GITHUB_OUTPUT | |
echo "$NEW_MODELS_FORMATTED" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
echo "updated_models<<EOF" >> $GITHUB_OUTPUT | |
echo "$UPDATED_MODELS_FORMATTED" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
# For debugging | |
echo "Contents of model_update_report.txt:" | |
cat model_update_report.txt | |
env: | |
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }} | |
- name: Check for changes | |
id: check-changes | |
run: | | |
git status | |
if [[ -n $(git status -s blocks/) ]]; then | |
echo "has_changes=true" >> $GITHUB_OUTPUT | |
else | |
echo "has_changes=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
if: steps.check-changes.outputs.has_changes == 'true' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: "Update Together.ai model configurations" | |
title: "Nightly update of Together.ai models - ${{ steps.date.outputs.date }}" | |
body: | | |
# Together.ai Model Updates | |
This PR contains automatic updates to Together.ai model configurations based on the latest API data. | |
## 📦 New Models | |
${{ steps.update-models.outputs.new_models || 'No new models were added.' }} | |
## 🔄 Updated Models | |
${{ steps.update-models.outputs.updated_models || 'No existing models were updated.' }} | |
### Change Details | |
- All updated models have their version numbers incremented according to semver (minor version bump) | |
- Role changes are shown for each model (any additions or removals) | |
- Context length changes are shown where applicable | |
Generated by the nightly update workflow. | |
Run ID: ${{ github.run_id }} | |
branch: update-together-models-${{ github.run_id }} | |
delete-branch: true |