Skip to content

Add semantic similarity score to TestEvalLLMs #120

Add semantic similarity score to TestEvalLLMs

Add semantic similarity score to TestEvalLLMs #120

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
schedule:
- cron: "7 0 * * 2"
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
services:
llama32-1b:
image: "maragudk/llama-3.2-1b-instruct-q4_k_m"
ports:
- 8090:8080
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Build
run: go build -v ./...
- name: Test
run: go test -v -coverprofile=cover.out -shuffle on ./...
env:
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
ANTHROPIC_KEY: ${{ secrets.ANTHROPIC_KEY }}
GOOGLE_KEY: ${{ secrets.GOOGLE_KEY }}
evaluate:
name: Evaluate
runs-on: ubuntu-latest
if: ${{ github.triggering_actor != 'dependabot[bot]' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Get dependencies
run: go mod download
- name: Install evals
run: go install maragu.dev/evals
- name: Download evals.db
id: download-artifact
uses: dawidd6/action-download-artifact@v7
with:
name: evals.db
branch: main
if_no_artifact_found: warn
- name: Evaluate
run: |
go test -run TestEval ./...
evals | tee evals.txt >> $GITHUB_STEP_SUMMARY
env:
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
ANTHROPIC_KEY: ${{ secrets.ANTHROPIC_KEY }}
GOOGLE_KEY: ${{ secrets.GOOGLE_KEY }}
- name: Upload evals.db
uses: actions/upload-artifact@v4
id: evalsdb
with:
name: evals.db
path: evals.db
if-no-files-found: error
- name: Add evals comment to PR
uses: actions/github-script@v7
if: ${{ github.event_name == 'pull_request' }}
with:
script: |
const fs = require('fs')
const table = fs.readFileSync('evals.txt', 'utf8')
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `# Evals\n\n${table}\n\n[Download evals.db](${{ steps.evalsdb.outputs.artifact-url }})`
})
lint:
name: Lint
runs-on: ubuntu-latest
if: ${{ github.triggering_actor != 'dependabot[bot]' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
version: latest