Skip to content

feat: add update_options to STTs #3234

feat: add update_options to STTs

feat: add update_options to STTs #3234

Workflow file for this run

name: tests
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
workflow_dispatch:
jobs:
tests:
# Don't run tests for PRs on forks
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
strategy:
fail-fast: false
matrix:
os: [macos-14-large, macos-14, windows-2019, ubuntu-20.04, namespace-profile-default-arm64]
python_version: ["3.9", "3.12"]
test_group: ["base"]
include:
# Include llm, stt, and tts tests only on Ubuntu 20.04 with Python 3.9
- os: ubuntu-20.04
python_version: "3.9"
test_group: llm
- os: ubuntu-20.04
python_version: "3.9"
test_group: stt
- os: ubuntu-20.04
python_version: "3.9"
test_group: tts
runs-on: ${{ matrix.os }}
name: ${{ matrix.test_group }} β€” ${{ matrix.os }}) (py${{ matrix.python_version }})
steps:
- uses: actions/checkout@v4
with:
submodules: true
lfs: true
- name: Cache packages
uses: actions/cache@v4
with:
path: |
/var/cache/apt/archives
~/Library/Caches/Homebrew
C:\ProgramData\chocolatey\lib\ffmpeg
key: ${{ runner.os }}-cache
restore-keys: |
${{ runner.os }}-cache
- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- name: Install ffmpeg (Linux)
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'namespace-profile-default-arm64' }}
run: sudo apt-get update && sudo apt-get install -y ffmpeg
# Azure plugin fails with OpenSSL3, and Ubuntu 22.04 does not include libssl1.1 in its repos
- name: Install libssl 1.1 (Linux 22.04)
if: ${{ matrix.os == 'namespace-profile-default-arm64' }}
run: |
wget https://old-releases.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1_arm64.deb
wget https://old-releases.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1_arm64.deb
sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1_arm64.deb
sudo dpkg -i libssl-dev_1.1.1-1ubuntu2.1_arm64.deb
- name: Install ffmpeg (macOS)
if: ${{ startsWith(matrix.os, 'macos') }}
run: brew install ffmpeg
- name: Install ffmpeg (Windows)
if: ${{ matrix.os == 'windows-2019' }}
run: choco install ffmpeg
- name: Install packages
shell: bash
run: |
pip3 install pytest pytest-asyncio pytest-timeout './livekit-agents[codecs]' psutil
pip3 install -r ./tests/test-requirements.txt
pip3 install ./livekit-agents \
./livekit-plugins/livekit-plugins-openai \
./livekit-plugins/livekit-plugins-deepgram \
./livekit-plugins/livekit-plugins-google \
./livekit-plugins/livekit-plugins-nltk \
./livekit-plugins/livekit-plugins-silero \
./livekit-plugins/livekit-plugins-elevenlabs \
./livekit-plugins/livekit-plugins-cartesia \
./livekit-plugins/livekit-plugins-azure \
./livekit-plugins/livekit-plugins-anthropic \
./livekit-plugins/livekit-plugins-assemblyai \
./livekit-plugins/livekit-plugins-fal
- name: Run tests
shell: bash
env:
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
DEEPGRAM_API_KEY: ${{ secrets.DEEPGRAM_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ELEVEN_API_KEY: ${{ secrets.ELEVEN_API_KEY }}
CARTESIA_API_KEY: ${{ secrets.CARTESIA_API_KEY }}
AZURE_SPEECH_KEY: ${{ secrets.AZURE_SPEECH_KEY }}
AZURE_SPEECH_REGION: ${{ secrets.AZURE_SPEECH_REGION }} # nit: doesn't have to be secret
GOOGLE_CREDENTIALS_JSON: ${{ secrets.GOOGLE_CREDENTIALS_JSON }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
ASSEMBLYAI_API_KEY: ${{ secrets.ASSEMBLYAI_API_KEY }}
FAL_KEY: ${{ secrets.FAL_KEY }}
GOOGLE_APPLICATION_CREDENTIALS: google.json
PYTEST_ADDOPTS: "--color=yes"
working-directory: tests
run: |
echo "$GOOGLE_CREDENTIALS_JSON" > google.json
case "${{ matrix.test_group }}" in
base)
test_files="test_aio.py test_tokenizer.py test_vad.py test_ipc.py test_tts_fallback.py test_stt_fallback.py test_message_change.py"
;;
llm)
test_files="test_llm.py"
;;
stt)
test_files="test_stt.py"
;;
tts)
test_files="test_tts.py"
;;
*)
echo "Unknown test group: ${{ matrix.test_group }}"
exit 1
;;
esac
pytest $test_files