Skip to content

Commit 50d75c5

Browse files
committed
Update models with a PR nightly.
1 parent b3fa36c commit 50d75c5

File tree

4 files changed

+570
-4
lines changed

4 files changed

+570
-4
lines changed

.github/workflows/update-models.yml

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: Nightly Together.ai Models Update
2+
3+
on:
4+
schedule:
5+
# Run at 2:00 AM UTC every day
6+
- cron: '0 2 * * *'
7+
# Allow manual triggering
8+
workflow_dispatch:
9+
10+
jobs:
11+
update-models:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: '3.10'
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -r requirements.txt
30+
31+
- name: Update Together.ai models and generate changes report
32+
id: update-models
33+
run: |
34+
python together_models.py --summary > model_update_report.txt
35+
36+
# Extract specific sections for PR description
37+
38+
# Extract new models section (simple list)
39+
echo "Extracting new models section..."
40+
NEW_MODELS=$(grep -A 100 "Newly added models:" model_update_report.txt | grep -v "^$" | grep -v "Updated models:" | tail -n +2)
41+
42+
# Extract updated models section with their detailed changes
43+
echo "Extracting updated models section..."
44+
UPDATED_MODELS_START=$(grep -n "Updated models:" model_update_report.txt | cut -d':' -f1)
45+
46+
if [ ! -z "$UPDATED_MODELS_START" ]; then
47+
# Extract the updated models with their changes using awk for multi-line indented blocks
48+
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)
49+
else
50+
UPDATED_MODELS=""
51+
fi
52+
53+
# Format for GitHub Actions output (preserving indentation)
54+
NEW_MODELS_FORMATTED="$(echo "$NEW_MODELS" | sed 's/^/ /')"
55+
UPDATED_MODELS_FORMATTED="$(echo "$UPDATED_MODELS" | sed 's/^/ /')"
56+
57+
# Save to GitHub outputs with multiline syntax
58+
echo "new_models<<EOF" >> $GITHUB_OUTPUT
59+
echo "$NEW_MODELS_FORMATTED" >> $GITHUB_OUTPUT
60+
echo "EOF" >> $GITHUB_OUTPUT
61+
62+
echo "updated_models<<EOF" >> $GITHUB_OUTPUT
63+
echo "$UPDATED_MODELS_FORMATTED" >> $GITHUB_OUTPUT
64+
echo "EOF" >> $GITHUB_OUTPUT
65+
66+
# For debugging
67+
echo "Contents of model_update_report.txt:"
68+
cat model_update_report.txt
69+
env:
70+
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }}
71+
72+
- name: Check for changes
73+
id: check-changes
74+
run: |
75+
git status
76+
if [[ -n $(git status -s blocks/) ]]; then
77+
echo "has_changes=true" >> $GITHUB_OUTPUT
78+
else
79+
echo "has_changes=false" >> $GITHUB_OUTPUT
80+
fi
81+
82+
- name: Get current date
83+
id: date
84+
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
85+
86+
- name: Create Pull Request
87+
if: steps.check-changes.outputs.has_changes == 'true'
88+
uses: peter-evans/create-pull-request@v5
89+
with:
90+
commit-message: "Update Together.ai model configurations"
91+
title: "Nightly update of Together.ai models - ${{ steps.date.outputs.date }}"
92+
body: |
93+
# Together.ai Model Updates
94+
95+
This PR contains automatic updates to Together.ai model configurations based on the latest API data.
96+
97+
## 📦 New Models
98+
${{ steps.update-models.outputs.new_models || 'No new models were added.' }}
99+
100+
## 🔄 Updated Models
101+
${{ steps.update-models.outputs.updated_models || 'No existing models were updated.' }}
102+
103+
### Change Details
104+
- All updated models have their version numbers incremented according to semver (minor version bump)
105+
- Role changes are shown for each model (any additions or removals)
106+
- Context length changes are shown where applicable
107+
108+
Generated by the nightly update workflow.
109+
Run ID: ${{ github.run_id }}
110+
branch: update-together-models-${{ github.run_id }}
111+
delete-branch: true

0 commit comments

Comments
 (0)