diff --git a/.github/workflows/notify-models.yaml b/.github/workflows/notify-models.yaml index e684df18b..609b7cf00 100644 --- a/.github/workflows/notify-models.yaml +++ b/.github/workflows/notify-models.yaml @@ -11,18 +11,12 @@ permissions: jobs: notify-discord: if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'area/ai-model')) }} - env: - MODEL_NAME: gemma-3-12b-it-qat runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 with: fetch-depth: 0 # needed to checkout all branches for this Action to work ref: ${{ github.event.pull_request.head.sha }} # Checkout the PR head to get the actual changes - - uses: mudler/localai-github-action@v1 - with: - model: 'gemma-3-12b-it-qat' # Any from models.localai.io, or from huggingface.com with: "huggingface:///file" - # Check the PR diff using the current branch and the base branch of the PR - uses: GrantBirki/git-diff-action@v2.8.1 id: git-diff-action with: @@ -32,16 +26,16 @@ jobs: - name: Summarize env: DIFF: ${{ steps.git-diff-action.outputs.raw-diff-path }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }} + OPENAI_MODEL: "gemma-3-27b-it-qat" id: summarize run: | input="$(cat $DIFF)" - # Define the LocalAI API endpoint - API_URL="http://localhost:8080/chat/completions" - # Create a JSON payload using jq to handle special characters json_payload=$(jq -n --arg input "$input" '{ - model: "'$MODEL_NAME'", + model: "'$OPENAI_MODEL'", messages: [ { role: "system", @@ -54,16 +48,16 @@ jobs: ] }') - # Send the request to LocalAI - response=$(curl -s -X POST $API_URL \ + # Send the request to OpenAI API + response=$(curl -s -X POST $OPENAI_BASE_URL/chat/completions \ -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ -d "$json_payload") # Extract the summary from the response summary="$(echo $response | jq -r '.choices[0].message.content')" # Print the summary - # -H "Authorization: Bearer $API_KEY" \ echo "Summary:" echo "$summary" echo "payload sent" @@ -73,7 +67,6 @@ jobs: echo "$summary" echo EOF } >> "$GITHUB_OUTPUT" - docker logs --tail 10 local-ai - name: Discord notification env: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }} @@ -91,20 +84,12 @@ jobs: limit-access-to-actor: true notify-twitter: if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'area/ai-model')) }} - env: - MODEL_NAME: gemma-3-12b-it-qat runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 with: fetch-depth: 0 # needed to checkout all branches for this Action to work ref: ${{ github.event.pull_request.head.sha }} # Checkout the PR head to get the actual changes - - name: Start LocalAI - run: | - echo "Starting LocalAI..." - docker run -e -ti -d --name local-ai -p 8080:8080 localai/localai:master run --debug $MODEL_NAME - until [ "`docker inspect -f {{.State.Health.Status}} local-ai`" == "healthy" ]; do echo "Waiting for container to be ready"; docker logs --tail 10 local-ai; sleep 2; done - # Check the PR diff using the current branch and the base branch of the PR - uses: GrantBirki/git-diff-action@v2.8.1 id: git-diff-action with: @@ -114,20 +99,20 @@ jobs: - name: Summarize env: DIFF: ${{ steps.git-diff-action.outputs.raw-diff-path }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }} + OPENAI_MODEL: "gemma-3-27b-it-qat" id: summarize run: | input="$(cat $DIFF)" - # Define the LocalAI API endpoint - API_URL="http://localhost:8080/chat/completions" - # Create a JSON payload using jq to handle special characters json_payload=$(jq -n --arg input "$input" '{ - model: "'$MODEL_NAME'", + model: "'$OPENAI_MODEL'", messages: [ { role: "system", - content: "You are LocalAI-bot. Write a twitter message to notify everyone about the new model from the git diff. Make it informal and really short. An example can include: the name, and a brief description of the model if exists. Also add an hint on how to install it in LocalAI. For example: local-ai run model_name_here" + content: "You are LocalAI-bot. Write a short, twitter message to notify everyone about the new model from the git diff. Make it informal and really short, less than 250 characters. An example can include: the name, and a brief description of the model if exists. Also add an hint on how to install it in LocalAI. For example: local-ai run model_name_here" }, { role: "user", @@ -136,16 +121,16 @@ jobs: ] }') - # Send the request to LocalAI - response=$(curl -s -X POST $API_URL \ + # Send the request to OpenAI API + response=$(curl -s -X POST $OPENAI_BASE_URL/chat/completions \ -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ -d "$json_payload") # Extract the summary from the response summary="$(echo $response | jq -r '.choices[0].message.content')" # Print the summary - # -H "Authorization: Bearer $API_KEY" \ echo "Summary:" echo "$summary" echo "payload sent" @@ -155,7 +140,6 @@ jobs: echo "$summary" echo EOF } >> "$GITHUB_OUTPUT" - docker logs --tail 10 local-ai - uses: Eomm/why-don-t-you-tweet@v2 with: tweet-message: ${{ steps.summarize.outputs.message }} diff --git a/.github/workflows/notify-releases.yaml b/.github/workflows/notify-releases.yaml index b7c6bf847..3620996c7 100644 --- a/.github/workflows/notify-releases.yaml +++ b/.github/workflows/notify-releases.yaml @@ -11,22 +11,18 @@ jobs: RELEASE_BODY: ${{ github.event.release.body }} RELEASE_TITLE: ${{ github.event.release.name }} RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} - MODEL_NAME: gemma-3-12b-it-qat + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }} + OPENAI_MODEL: "gemma-3-27b-it-qat" steps: - - uses: mudler/localai-github-action@v1 - with: - model: 'gemma-3-12b-it-qat' # Any from models.localai.io, or from huggingface.com with: "huggingface:///file" - name: Summarize id: summarize run: | input="$RELEASE_TITLE\b$RELEASE_BODY" - # Define the LocalAI API endpoint - API_URL="http://localhost:8080/chat/completions" - # Create a JSON payload using jq to handle special characters json_payload=$(jq -n --arg input "$input" '{ - model: "'$MODEL_NAME'", + model: "'$OPENAI_MODEL'", messages: [ { role: "system", @@ -39,16 +35,16 @@ jobs: ] }') - # Send the request to LocalAI API - response=$(curl -s -X POST $API_URL \ + # Send the request to OpenAI API + response=$(curl -s -X POST $OPENAI_BASE_URL/chat/completions \ -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ -d "$json_payload") # Extract the summary from the response summary=$(echo $response | jq -r '.choices[0].message.content') # Print the summary - # -H "Authorization: Bearer $API_KEY" \ { echo 'message<